12 |
|
from optparse import OptionParser |
13 |
|
import pickle |
14 |
|
|
15 |
+ |
|
16 |
|
#CONFIGURE |
17 |
|
ROOT.gROOT.SetBatch(True) |
18 |
|
print('hello') |
88 |
|
#eval |
89 |
|
|
90 |
|
samples = info.get_samples(namelist) |
91 |
+ |
print(samples) |
92 |
|
for job in samples: |
93 |
|
#get trees: |
94 |
|
print(INpath+'/'+job.prefix+job.identifier+'.root') |
107 |
|
#print key.GetName() |
108 |
|
obj.Write(key.GetName()) |
109 |
|
tree = input.Get(job.tree) |
108 |
– |
nEntries = tree.GetEntries() |
110 |
|
outfile.cd() |
111 |
< |
newtree = tree.CloneTree(0) |
111 |
> |
newtree = tree.CopyTree('V.pt > 100') #hard skim to get faster |
112 |
> |
nEntries = newtree.GetEntries() |
113 |
> |
input.Close() |
114 |
|
|
115 |
|
#Set branch adress for all vars |
116 |
|
for i in range(0,len(theMVAs)): |
117 |
< |
theMVAs[i].setVariables(tree,job) |
117 |
> |
theMVAs[i].setVariables(newtree,job) |
118 |
|
outfile.cd() |
119 |
|
#Setup Branches |
120 |
|
mvaVals=[] |
127 |
|
newtree.Branch(theMVAs[i].MVAname,mvaVals[i],'nominal:JER_up:JER_down:JES_up:JES_down:beff_up:beff_down:bmis_up:bmis_down:beff1_up:beff1_down/F') |
128 |
|
MVA_formulas_Nominal = [] |
129 |
|
print('\n--> ' + job.name +':') |
127 |
– |
#progbar setup |
128 |
– |
if nEntries >= longe: |
129 |
– |
step=long(nEntries/longe) |
130 |
– |
long=longe |
131 |
– |
else: |
132 |
– |
long=nEntries |
133 |
– |
step = 1 |
134 |
– |
bar=progbar(long) |
130 |
|
#Fill event by event: |
131 |
|
for entry in range(0,nEntries): |
132 |
< |
if entry % step == 0: |
138 |
< |
bar.move() |
139 |
< |
#load entry |
140 |
< |
tree.GetEntry(entry) |
132 |
> |
newtree.GetEntry(entry) |
133 |
|
|
134 |
|
for i in range(0,len(theMVAs)): |
135 |
|
theMVAs[i].evaluate(mvaVals[i],job) |