25 |
|
self.mybinning = None |
26 |
|
self.GroupDict=GroupDict |
27 |
|
self.calc_rebin_flag = False |
28 |
+ |
VHbbNameSpace=config.get('VHbbNameSpace','library') |
29 |
+ |
ROOT.gSystem.Load(VHbbNameSpace) |
30 |
|
|
31 |
|
def get_histos_from_tree(self,job): |
32 |
|
if self.lumi == 0: |
43 |
|
addOverFlow=eval(self.config.get('Plot_general','addOverFlow')) |
44 |
|
|
45 |
|
# get all Histos at once |
46 |
+ |
CuttedTree = self.tc.get_tree(job,'1') |
47 |
|
for options in self.optionsList: |
48 |
|
name=job.name |
49 |
|
if self.GroupDict is None: |
60 |
|
xMax=float(options['xMax']) |
61 |
|
weightF=options['weight'] |
62 |
|
treeCut='%s'%(options['cut']) |
60 |
– |
CuttedTree = self.tc.get_tree(job,treeCut) |
63 |
|
|
64 |
|
#options |
65 |
|
|
66 |
|
if job.type != 'DATA': |
67 |
|
if CuttedTree.GetEntries(): |
68 |
|
if 'RTight' in treeVar or 'RMed' in treeVar: |
69 |
< |
drawoption = '(%s)*(%s)'%(weightF,BDT_add_cut) |
69 |
> |
drawoption = '(%s)*(%s & %s)'%(weightF,treeCut,BDT_add_cut) |
70 |
|
else: |
71 |
< |
drawoption = '%s'%(weightF) |
71 |
> |
drawoption = '(%s)*(%s)'%(weightF,treeCut) |
72 |
|
CuttedTree.Draw('%s>>%s(%s,%s,%s)' %(treeVar,name,nBins,xMin,xMax), drawoption, "goff,e") |
73 |
|
full=True |
74 |
|
else: |
75 |
|
full=False |
76 |
|
elif job.type == 'DATA': |
77 |
< |
if eval(options['blind']): |
77 |
> |
if options['blind']: |
78 |
|
if treeVar == 'H.mass': |
79 |
< |
CuttedTree.Draw('%s>>%s(%s,%s,%s)' %(treeVar,name,nBins,xMin,xMax),treeVar+'<90. || '+treeVar + '>150.' , "goff,e") |
79 |
> |
CuttedTree.Draw('%s>>%s(%s,%s,%s)' %(treeVar,name,nBins,xMin,xMax),' (%(var)s <90. || %(var)s > 150.) & %(cut)s' %options, "goff,e") |
80 |
|
else: |
81 |
< |
CuttedTree.Draw('%s>>%s(%s,%s,%s)' %(treeVar,name,nBins,xMin,xMax),treeVar+'<0', "goff,e") |
81 |
> |
CuttedTree.Draw('%s>>%s(%s,%s,%s)' %(treeVar,name,nBins,xMin,xMax),'%(var)s < 0. & %(cut)s'%options, "goff,e") |
82 |
|
|
83 |
|
else: |
84 |
< |
CuttedTree.Draw('%s>>%s(%s,%s,%s)' %(treeVar,name,nBins,xMin,xMax),'1', "goff,e") |
84 |
> |
CuttedTree.Draw('%s>>%s(%s,%s,%s)' %(treeVar,name,nBins,xMin,xMax),'%s' %treeCut, "goff,e") |
85 |
|
full = True |
86 |
|
if full: |
87 |
|
hTree = ROOT.gDirectory.Get(name) |
119 |
|
#print 'not rebinning %s'%job.name |
120 |
|
gDict[group] = hTree |
121 |
|
hTreeList.append(gDict) |
122 |
< |
CuttedTree.IsA().Destructor(CuttedTree) |
123 |
< |
del CuttedTree |
122 |
> |
CuttedTree.IsA().Destructor(CuttedTree) |
123 |
> |
del CuttedTree |
124 |
|
return hTreeList |
125 |
|
|
126 |
|
@property |
144 |
|
elif not self._rebin and not self.value: |
145 |
|
return False |
146 |
|
|
147 |
< |
def calc_rebin(self, bg_list, nBins_start=1000, tolerance=0.35): |
147 |
> |
def calc_rebin(self, bg_list, nBins_start=1000, tolerance=0.25): |
148 |
|
self.calc_rebin_flag = True |
149 |
|
self.norebin_nBins = copy(self.nBins) |
150 |
|
self.rebin_nBins = nBins_start |