10 |
|
import warnings |
11 |
|
warnings.filterwarnings( action='ignore', category=RuntimeWarning, message='creating converter.*' ) |
12 |
|
from ConfigParser import SafeConfigParser |
13 |
< |
from samplesinfo import sample |
13 |
> |
from samplesclass import sample |
14 |
|
from mvainfos import mvainfo |
15 |
|
import pickle |
16 |
|
from progbar import progbar |
89 |
|
|
90 |
|
#define variables and specatators |
91 |
|
MVA_var_buffer = [] |
92 |
+ |
MVA_var_buffer4 = [] |
93 |
|
for i in range(len( MVA_Vars['Nominal'])): |
94 |
|
MVA_var_buffer.append(array( 'f', [ 0 ] )) |
95 |
|
for reader in readers: |
135 |
|
#MCs: |
136 |
|
if job.type != 'DATA': |
137 |
|
MVA_formulas={} |
138 |
+ |
MVA_formulas4={} |
139 |
|
for systematic in systematics: |
140 |
|
#print '\t\t - ' + systematic |
141 |
|
MVA_formulas[systematic]=[] |
142 |
+ |
MVA_formulas4[systematic]=[] |
143 |
|
#create TTreeFormulas |
144 |
|
for j in range(len( MVA_Vars['Nominal'])): |
145 |
|
MVA_formulas[systematic].append(ROOT.TTreeFormula("MVA_formula%s_%s"%(j,systematic),MVA_Vars[systematic][j],tree)) |
146 |
+ |
MVA_formulas4[systematic].append(ROOT.TTreeFormula("MVA_formula4%s_%s"%(j,systematic),MVA_Vars['Nominal'][j]+'+('+MVA_Vars[systematic][j]+'-'+MVA_Vars['Nominal'][j]+')*4',tree))#HERE change |
147 |
|
outfile.cd() |
148 |
|
#Setup Branches |
149 |
|
MVAbranches=[] |
150 |
+ |
MVAbranches4=[] |
151 |
|
for i in range(0,len(readers)): |
152 |
|
MVAbranches.append(array('f',[0]*9)) |
153 |
+ |
MVAbranches4.append(array('f',[0]*9)) |
154 |
|
newtree.Branch(MVAinfos[i].MVAname,MVAbranches[i],'nominal:JER_up:JER_down:JES_up:JES_down:beff_up:beff_down:bmis_up:bmis_down/F') |
155 |
+ |
newtree.Branch(MVAinfos[i].MVAname+'_4',MVAbranches4[i],'nominal:JER_up:JER_down:JES_up:JES_down:beff_up:beff_down:bmis_up:bmis_down/F') |
156 |
|
print '\n--> ' + job.name +':' |
157 |
|
#progbar setup |
158 |
|
if nEntries >= longe: |
174 |
|
|
175 |
|
for j in range(0,len(readers)): |
176 |
|
MVAbranches[j][systematics.index(systematic)] = readers[j].EvaluateMVA(MVAinfos[j].MVAname) |
177 |
+ |
|
178 |
+ |
for j in range(len( MVA_Vars['Nominal'])): |
179 |
+ |
MVA_var_buffer[j][0] = MVA_formulas4[systematic][j].EvalInstance() |
180 |
+ |
|
181 |
+ |
for j in range(0,len(readers)): |
182 |
+ |
MVAbranches4[j][systematics.index(systematic)] = readers[j].EvaluateMVA(MVAinfos[j].MVAname) |
183 |
|
#Fill: |
184 |
|
newtree.Fill() |
185 |
|
newtree.AutoSave() |
197 |
|
for i in range(0,len(readers)): |
198 |
|
MVAbranches.append(array('f',[0])) |
199 |
|
newtree.Branch(MVAinfos[i].MVAname,MVAbranches[i],'nominal/F') |
200 |
+ |
newtree.Branch(MVAinfos[i].MVAname+'_4',MVAbranches[i],'nominal/F') |
201 |
|
#progbar |
202 |
|
print '\n--> ' + job.name +':' |
203 |
|
if nEntries >= longe: |