9 |
|
import sys |
10 |
|
|
11 |
|
|
12 |
< |
#load config |
13 |
< |
config = BetterConfigParser() |
14 |
< |
config.read('./config7TeV_ZZ') |
15 |
< |
|
16 |
< |
#get locations: |
17 |
< |
Wdir=config.get('Directories','Wdir') |
18 |
< |
anaTag=config.get('Analysis','tag') |
19 |
< |
|
20 |
< |
|
21 |
< |
|
22 |
< |
def getScale(job,path,rescale,subsample=-1): |
12 |
> |
def getScale(job,path,config,rescale,subsample=-1): |
13 |
> |
anaTag=config.get('Analysis','tag') |
14 |
|
input = TFile.Open(path+'/'+job.getpath()) |
15 |
|
CountWithPU = input.Get("CountWithPU") |
16 |
|
CountWithPU2011B = input.Get("CountWithPU2011B") |
31 |
|
theScale = float(job.lumi)*xsec*sf/(CountWithPU.GetBinContent(1))*rescale/float(job.split) |
32 |
|
return theScale |
33 |
|
|
34 |
< |
def getHistoFromTree(job,path,options,rescale=1,subsample=-1): |
34 |
> |
def getHistoFromTree(job,path,config,options,rescale=1,subsample=-1,which_weightF='weightF'): |
35 |
|
|
36 |
|
#print job.getpath() |
37 |
|
#print options |
67 |
|
#Tree.SetDirectory(0) |
68 |
|
|
69 |
|
#Tree=tmpTree.Clone() |
70 |
< |
weightF=config.get('Weights','weightF') |
70 |
> |
weightF=config.get('Weights',which_weightF) |
71 |
|
#hTree = ROOT.TH1F('%s'%name,'%s'%title,nBins,xMin,xMax) |
72 |
|
#hTree.SetDirectory(0) |
73 |
|
#hTree.Sumw2() |
97 |
|
#print job.name + ' Sumw2', hTree.GetEntries() |
98 |
|
|
99 |
|
if job.type != 'DATA': |
100 |
< |
ScaleFactor = getScale(job,path,rescale,subsample) |
100 |
> |
ScaleFactor = getScale(job,path,config,rescale,subsample) |
101 |
|
if ScaleFactor != 0: |
102 |
|
hTree.Scale(ScaleFactor) |
103 |
|
|