15 |
|
self.cuts = [] |
16 |
|
for options in optionsList: |
17 |
|
self.cuts.append(options['cut']) |
18 |
< |
self.tc = TreeCache(self.cuts,samples,path) |
19 |
< |
|
18 |
> |
#self.tc = TreeCache(self.cuts,samples,path) |
19 |
> |
self.tc = TreeCache(self.cuts,samples,path,config) |
20 |
|
|
21 |
|
def get_histos_from_tree(self,job): |
22 |
|
if self.lumi == 0: |
23 |
|
raise Exception("You're trying to plot with no lumi") |
24 |
|
|
25 |
|
hTreeList=[] |
26 |
– |
groupList=[] |
26 |
|
|
27 |
|
#get the conversion rate in case of BDT plots |
28 |
|
TrainFlag = eval(self.config.get('Analysis','TrainFlag')) |
59 |
|
else: |
60 |
|
full=False |
61 |
|
elif job.type == 'DATA': |
62 |
< |
if options['blind'] == 'blind': |
64 |
< |
output.cd() |
62 |
> |
if options['blind']: |
63 |
|
if treeVar == 'H.mass': |
64 |
|
CuttedTree.Draw('%s>>%s(%s,%s,%s)' %(treeVar,name,nBins,xMin,xMax),treeVar+'<90. || '+treeVar + '>150.' , "goff,e") |
65 |
|
else: |
96 |
|
hTree.SetBinError(1,uFlowErr) |
97 |
|
hTree.SetBinError(hTree.GetNbinsX(),oFlowErr) |
98 |
|
hTree.SetDirectory(0) |
99 |
< |
hTreeList.append(hTree) |
100 |
< |
groupList.append(group) |
99 |
> |
gDict = {} |
100 |
> |
gDict[group] = hTree |
101 |
> |
hTreeList.append(gDict) |
102 |
|
|
103 |
< |
return hTreeList, groupList |
103 |
> |
return hTreeList |
104 |
|
|
105 |
|
|
106 |
< |
###################### |
107 |
< |
def orderandadd(histos,typs,setup): |
108 |
< |
#ORDER AND ADD TOGETHER |
109 |
< |
ordnung=[] |
110 |
< |
ordnungtyp=[] |
111 |
< |
num=[0]*len(setup) |
112 |
< |
for i in range(0,len(setup)): |
113 |
< |
for j in range(0,len(histos)): |
114 |
< |
if typs[j] in setup[i]: |
115 |
< |
num[i]+=1 |
116 |
< |
ordnung.append(histos[j]) |
117 |
< |
ordnungtyp.append(typs[j]) |
118 |
< |
del histos |
119 |
< |
del typs |
120 |
< |
histos=ordnung |
122 |
< |
typs=ordnungtyp |
123 |
< |
print typs |
124 |
< |
for k in range(0,len(num)): |
125 |
< |
for m in range(0,num[k]): |
126 |
< |
if m > 0: |
127 |
< |
#add |
128 |
< |
histos[k].Add(histos[k+1],1) |
129 |
< |
printc('magenta','','\t--> added %s to %s'%(typs[k],typs[k+1])) |
130 |
< |
del histos[k+1] |
131 |
< |
del typs[k+1] |
132 |
< |
del histos[len(setup):] |
133 |
< |
del typs[len(setup):] |
134 |
< |
return histos, typs |
106 |
> |
@staticmethod |
107 |
> |
def orderandadd(histo_dicts,setup): |
108 |
> |
print histo_dicts |
109 |
> |
ordered_histo_dict = {} |
110 |
> |
for sample in setup: |
111 |
> |
nSample = 0 |
112 |
> |
for histo_dict in histo_dicts: |
113 |
> |
if histo_dict.has_key(sample): |
114 |
> |
if nSample == 0: |
115 |
> |
ordered_histo_dict[sample] = histo_dict[sample] |
116 |
> |
else: |
117 |
> |
printc('magenta','','\t--> added %s to %s'%(sample,sample)) |
118 |
> |
ordered_histo_dict[sample].Add(histo_dict[sample]) |
119 |
> |
nSample += 1 |
120 |
> |
return ordered_histo_dict |