2 |
|
import sys |
3 |
|
import os |
4 |
|
import re |
5 |
+ |
from math import * |
6 |
|
from array import * |
7 |
|
from decimal import * |
8 |
|
from optparse import OptionParser |
85 |
|
channels.append(key2.GetName()) |
86 |
|
|
87 |
|
|
88 |
< |
#weight = intLumi / 10000.0 |
89 |
< |
#for dataset in processed_datasets: |
90 |
< |
# dataset_file = "%s/%s.root" % (condor_dir,dataset) |
91 |
< |
# fin = TFile (dataset_file) |
92 |
< |
# flags = fin.Get ("flags") |
93 |
< |
# noWeights = flags and flags.GetBinContent (1) |
94 |
< |
# fin.Close () |
95 |
< |
# |
96 |
< |
# if types[dataset] != "data" and not noWeights: |
97 |
< |
# os.system("mergeTFileServiceHistograms -i %s -o %s -w %g" % (dataset_file, dataset_file + "_tmp", weight)) |
98 |
< |
# else: |
99 |
< |
# os.system("mergeTFileServiceHistograms -i %s -o %s -w %g" % (dataset_file, dataset_file + "_tmp", 1.0)) |
88 |
> |
## weight = intLumi / 10000.0 |
89 |
> |
## for dataset in processed_datasets: |
90 |
> |
## dataset_file = "%s/%s.root" % (condor_dir,dataset) |
91 |
> |
## fin = TFile (dataset_file) |
92 |
> |
## flags = fin.Get ("flags") |
93 |
> |
## noWeights = flags and flags.GetBinContent (1) |
94 |
> |
## fin.Close () |
95 |
> |
|
96 |
> |
## if types[dataset] != "data" and not noWeights: |
97 |
> |
## os.system("mergeTFileServiceHistograms -i %s -o %s -w %g" % (dataset_file, dataset_file + "_tmp", weight)) |
98 |
> |
## else: |
99 |
> |
## os.system("mergeTFileServiceHistograms -i %s -o %s -w %g" % (dataset_file, dataset_file + "_tmp", 1.0)) |
100 |
|
|
101 |
|
for channel in channels: # loop over final states, which each have their own directory |
102 |
|
|
125 |
|
LumiLabel.SetFillColor(0) |
126 |
|
LumiLabel.SetFillStyle(0) |
127 |
|
|
128 |
+ |
|
129 |
|
BgMCLegend = TLegend(0.70,0.65,0.94,0.89) |
130 |
|
BgMCLegend.AddEntry (0, "Data & Bkgd. MC", "H").SetTextFont (62) |
131 |
|
BgMCLegend.SetBorderSize(0) |
180 |
|
Histogram.SetLineColor(1) |
181 |
|
Histogram.SetLineWidth(1) |
182 |
|
BgMCLegend.AddEntry(Histogram,legLabel,"F").SetTextFont (42) |
183 |
+ |
|
184 |
|
Histogram.SetLineStyle(1) |
185 |
|
|
186 |
|
backgroundIntegral += Histogram.Integral() |
187 |
|
|
188 |
|
BgMCHistograms.append(Histogram) |
189 |
+ |
|
190 |
|
|
191 |
|
elif( types[sample] == "signalMC"): |
192 |
|
|
251 |
|
|
252 |
|
|
253 |
|
### Drawing histograms to canvas |
254 |
< |
|
255 |
< |
|
254 |
> |
|
255 |
> |
if numBgMCSamples is not 0: |
256 |
> |
ErrorHisto = BgMCHistograms[0].Clone("errors") |
257 |
> |
ErrorHisto.SetFillStyle(3001) |
258 |
> |
ErrorHisto.SetFillColor(13) |
259 |
> |
ErrorHisto.SetLineWidth(0) |
260 |
> |
for Histogram in BgMCHistograms: |
261 |
> |
if Histogram is not BgMCHistograms[0]: |
262 |
> |
ErrorHisto.Add(Histogram) |
263 |
> |
|
264 |
|
outputFile.cd(rootDirectory+"/"+channel) |
265 |
|
|
266 |
|
makeRatioPlots = arguments.makeRatioPlots |
289 |
|
|
290 |
|
Canvas.cd(1) |
291 |
|
|
292 |
< |
if(numBgMCSamples is not 0): |
292 |
> |
if numBgMCSamples is not 0: |
293 |
|
|
294 |
|
if not arguments.noStack: |
295 |
|
Stack.SetTitle(histoTitle) |
299 |
|
Stack.SetMinimum(0.0001) |
300 |
|
if makeRatioPlots or makeDiffPlots: |
301 |
|
Stack.GetHistogram().GetXaxis().SetLabelSize(0) |
302 |
+ |
#draw shaded error bands |
303 |
+ |
ErrorHisto.Draw("E2 SAME") |
304 |
+ |
|
305 |
+ |
|
306 |
|
else: |
307 |
|
BgMCHistograms[0].SetTitle(histoTitle) |
308 |
|
BgMCHistograms[0].Draw("HIST") |
316 |
|
for dataHist in DataHistograms: |
317 |
|
dataHist.Draw("E SAME") |
318 |
|
|
319 |
< |
elif(numSignalSamples is not 0): |
319 |
> |
elif numSignalSamples is not 0: |
320 |
|
SignalMCHistograms[0].SetTitle(histoTitle) |
321 |
|
SignalMCHistograms[0].Draw("HIST") |
322 |
|
SignalMCHistograms[0].GetXaxis().SetTitle(xAxisLabel) |