17 |
|
#print lumi*xsecs[i]/hist.GetBinContent(1) |
18 |
|
|
19 |
|
if subsample>-1: |
20 |
< |
xsec=float(job.xsec[subsample]) |
20 |
> |
if type(job.xsec[subsample]) == str: xsec=float(eval(job.xsec[subsample])) |
21 |
> |
else: xsec=float(job.xsec[subsample]) |
22 |
|
sf=float(job.sf[subsample]) |
23 |
|
else: |
24 |
< |
xsec=float(job.xsec) |
24 |
> |
if type(job.xsec) == str: xsec=float(eval(job.xsec)) |
25 |
> |
else: xsec=float(job.xsec) |
26 |
|
sf=float(job.sf) |
27 |
|
|
28 |
|
|
31 |
|
theScale = float(job.lumi)*xsec*sf/(0.46502*CountWithPU.GetBinContent(1)+0.53498*CountWithPU2011B.GetBinContent(1))*rescale/float(job.split) |
32 |
|
elif anaTag == '8TeV': |
33 |
|
theScale = float(job.lumi)*xsec*sf/(CountWithPU.GetBinContent(1))*rescale/float(job.split) |
34 |
+ |
input.Close() |
35 |
|
return theScale |
36 |
|
|
37 |
|
def getHistoFromTree(job,path,config,options,rescale=1,subsample=-1,which_weightF='weightF'): |
50 |
|
nBins=int(options[3]) |
51 |
|
xMin=float(options[4]) |
52 |
|
xMax=float(options[5]) |
53 |
+ |
#addOverFlow=eval(config.get('Plot_general','addOverFlow')) |
54 |
+ |
addOverFlow = False |
55 |
+ |
|
56 |
+ |
TrainFlag = eval(config.get('Analysis','TrainFlag')) |
57 |
+ |
if TrainFlag: traincut = " & EventForTraining == 0" |
58 |
+ |
if not TrainFlag: traincut="" |
59 |
|
|
60 |
|
if job.type != 'DATA': |
61 |
|
|
66 |
|
cutcut=cutcut.replace(options[7][1],options[7][2]) |
67 |
|
#print cutcut |
68 |
|
if subsample>-1: |
69 |
< |
treeCut='%s & %s & EventForTraining == 0'%(cutcut,job.subcuts[subsample]) |
69 |
> |
treeCut='%s & %s%s'%(cutcut,job.subcuts[subsample],traincut) |
70 |
|
else: |
71 |
< |
treeCut='%s & EventForTraining == 0'%(cutcut) |
71 |
> |
treeCut='%s%s'%(cutcut,traincut) |
72 |
|
|
73 |
|
elif job.type == 'DATA': |
74 |
|
cutcut=config.get('Cuts',options[8]) |
115 |
|
ScaleFactor = getScale(job,path,config,rescale,subsample) |
116 |
|
if ScaleFactor != 0: |
117 |
|
hTree.Scale(ScaleFactor) |
118 |
+ |
|
119 |
+ |
if addOverFlow: |
120 |
+ |
print 'Adding overflow' |
121 |
+ |
uFlow = hTree.GetBinContent(0)+hTree.GetBinContent(1) |
122 |
+ |
oFlow = hTree.GetBinContent(hTree.GetNbinsX()+1)+hTree.GetBinContent(hTree.GetNbinsX()) |
123 |
+ |
uFlowErr = ROOT.TMath.Sqrt(ROOT.TMath.Power(hTree.GetBinError(0),2)+ROOT.TMath.Power(hTree.GetBinError(1),2)) |
124 |
+ |
oFlowErr = ROOT.TMath.Sqrt(ROOT.TMath.Power(hTree.GetBinError(hTree.GetNbinsX()),2)+ROOT.TMath.Power(hTree.GetBinError(hTree.GetNbinsX()+1),2)) |
125 |
+ |
hTree.SetBinContent(1,uFlow) |
126 |
+ |
hTree.SetBinContent(hTree.GetNbinsX(),oFlow) |
127 |
+ |
hTree.SetBinError(1,uFlowErr) |
128 |
+ |
hTree.SetBinError(hTree.GetNbinsX(),oFlowErr) |
129 |
+ |
|
130 |
|
|
131 |
|
print '\t-->import %s\t Integral: %s'%(job.name,hTree.Integral()) |
132 |
|
|
133 |
|
hTree.SetDirectory(0) |
134 |
|
input.Close() |
135 |
|
|
115 |
– |
|
116 |
– |
|
136 |
|
return hTree, group |
137 |
|
|
138 |
|
|
148 |
|
num=[0]*len(setup) |
149 |
|
for i in range(0,len(setup)): |
150 |
|
for j in range(0,len(histos)): |
151 |
< |
if typs[j] in setup[i]: |
151 |
> |
if typs[j] == setup[i]: |
152 |
|
num[i]+=1 |
153 |
|
ordnung.append(histos[j]) |
154 |
|
ordnungtyp.append(typs[j]) |