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): |
31 |
> |
def get_histos_from_tree(self,job,cutOverWrite=None): |
32 |
|
if self.lumi == 0: |
33 |
|
raise Exception("You're trying to plot with no lumi") |
34 |
|
|
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: |
59 |
|
xMin=float(options['xMin']) |
60 |
|
xMax=float(options['xMax']) |
61 |
|
weightF=options['weight'] |
62 |
< |
treeCut='%s'%(options['cut']) |
63 |
< |
CuttedTree = self.tc.get_tree(job,treeCut) |
62 |
> |
if cutOverWrite: |
63 |
> |
treeCut=cutOverWrite |
64 |
> |
else: |
65 |
> |
treeCut='%s'%(options['cut']) |
66 |
|
|
67 |
|
#options |
68 |
|
|
69 |
|
if job.type != 'DATA': |
70 |
|
if CuttedTree.GetEntries(): |
71 |
|
if 'RTight' in treeVar or 'RMed' in treeVar: |
72 |
< |
drawoption = '(%s)*(%s)'%(weightF,BDT_add_cut) |
72 |
> |
drawoption = '(%s)*(%s & %s)'%(weightF,treeCut,BDT_add_cut) |
73 |
> |
#print drawoption |
74 |
|
else: |
75 |
< |
drawoption = '%s'%(weightF) |
75 |
> |
drawoption = '(%s)*(%s)'%(weightF,treeCut) |
76 |
|
CuttedTree.Draw('%s>>%s(%s,%s,%s)' %(treeVar,name,nBins,xMin,xMax), drawoption, "goff,e") |
77 |
|
full=True |
78 |
|
else: |
79 |
|
full=False |
80 |
|
elif job.type == 'DATA': |
81 |
< |
if eval(options['blind']): |
81 |
> |
if options['blind']: |
82 |
|
if treeVar == 'H.mass': |
83 |
< |
CuttedTree.Draw('%s>>%s(%s,%s,%s)' %(treeVar,name,nBins,xMin,xMax),treeVar+'<90. || '+treeVar + '>150.' , "goff,e") |
83 |
> |
CuttedTree.Draw('%s>>%s(%s,%s,%s)' %(treeVar,name,nBins,xMin,xMax),' (%(var)s <90. || %(var)s > 150.) & %(cut)s' %options, "goff,e") |
84 |
|
else: |
85 |
< |
CuttedTree.Draw('%s>>%s(%s,%s,%s)' %(treeVar,name,nBins,xMin,xMax),treeVar+'<0', "goff,e") |
85 |
> |
CuttedTree.Draw('%s>>%s(%s,%s,%s)' %(treeVar,name,nBins,xMin,xMax),'%(var)s < 0. & %(cut)s'%options, "goff,e") |
86 |
|
|
87 |
|
else: |
88 |
< |
CuttedTree.Draw('%s>>%s(%s,%s,%s)' %(treeVar,name,nBins,xMin,xMax),'1', "goff,e") |
88 |
> |
CuttedTree.Draw('%s>>%s(%s,%s,%s)' %(treeVar,name,nBins,xMin,xMax),'%s' %treeCut, "goff,e") |
89 |
|
full = True |
90 |
|
if full: |
91 |
|
hTree = ROOT.gDirectory.Get(name) |
123 |
|
#print 'not rebinning %s'%job.name |
124 |
|
gDict[group] = hTree |
125 |
|
hTreeList.append(gDict) |
126 |
< |
CuttedTree.IsA().Destructor(CuttedTree) |
127 |
< |
del CuttedTree |
126 |
> |
CuttedTree.IsA().Destructor(CuttedTree) |
127 |
> |
del CuttedTree |
128 |
|
return hTreeList |
129 |
|
|
130 |
|
@property |
148 |
|
elif not self._rebin and not self.value: |
149 |
|
return False |
150 |
|
|
151 |
< |
def calc_rebin(self, bg_list, nBins_start=1000, tolerance=0.35): |
151 |
> |
def calc_rebin(self, bg_list, nBins_start=1000, tolerance=0.25): |
152 |
|
self.calc_rebin_flag = True |
153 |
|
self.norebin_nBins = copy(self.nBins) |
154 |
|
self.rebin_nBins = nBins_start |