9 |
|
from copy import copy |
10 |
|
|
11 |
|
class HistoMaker: |
12 |
< |
def __init__(self, samples, path, config, optionsList): |
12 |
> |
def __init__(self, samples, path, config, optionsList,GroupDict=None): |
13 |
|
self.path = path |
14 |
|
self.config = config |
15 |
|
self.optionsList = optionsList |
22 |
|
self.tc = TreeCache(self.cuts,samples,path,config) |
23 |
|
self._rebin = False |
24 |
|
self.mybinning = None |
25 |
+ |
self.GroupDict=GroupDict |
26 |
|
|
27 |
|
def get_histos_from_tree(self,job): |
28 |
|
if self.lumi == 0: |
41 |
|
# get all Histos at once |
42 |
|
for options in self.optionsList: |
43 |
|
name=job.name |
44 |
< |
group=job.group |
44 |
> |
if self.GroupDict is None: |
45 |
> |
group=job.group |
46 |
> |
else: |
47 |
> |
group=self.GroupDict[job.name] |
48 |
|
treeVar=options['var'] |
49 |
|
name=options['name'] |
50 |
|
nBins=self.nBins |
144 |
|
self.nBins = nBins_start |
145 |
|
i=0 |
146 |
|
#add all together: |
147 |
+ |
print '\n\t...calculating rebinning...' |
148 |
|
for job in bg_list: |
144 |
– |
print job |
149 |
|
htree = self.get_histos_from_tree(job)[0].values()[0] |
150 |
|
if not i: |
151 |
|
totalBG = copy(htree) |
198 |
|
|
199 |
|
self.mybinning = Rebinner(int(self.norebin_nBins),array('d',[-1.0]+[totalBG.GetBinLowEdge(i) for i in binlist]),True) |
200 |
|
self._rebin = True |
201 |
< |
|
201 |
> |
print '\t > rebinning is set <\n' |
202 |
|
|
203 |
|
@staticmethod |
204 |
|
def orderandadd(histo_dicts,setup): |