98 |
|
## else: |
99 |
|
## os.system("mergeTFileServiceHistograms -i %s -o %s -w %g" % (dataset_file, dataset_file + "_tmp", 1.0)) |
100 |
|
|
101 |
+ |
|
102 |
|
for channel in channels: # loop over final states, which each have their own directory |
103 |
|
|
104 |
|
testFile.cd(rootDirectory+"/"+channel) |
235 |
|
Stack.Add(bgMCHist) |
236 |
|
|
237 |
|
|
237 |
– |
finalMax = 0 |
238 |
– |
if not arguments.noStack: |
239 |
– |
finalMax = Stack.GetMaximum() |
240 |
– |
else: |
241 |
– |
for bgMCHist in BgMCHistograms: |
242 |
– |
if(bgMCHist.GetMaximum() > finalMax): |
243 |
– |
finalMax = bgMCHist.GetMaximum() |
244 |
– |
for signalMCHist in SignalMCHistograms: |
245 |
– |
if(signalMCHist.GetMaximum() > finalMax): |
246 |
– |
finalMax = signalMCHist.GetMaximum() |
247 |
– |
for dataHist in DataHistograms: |
248 |
– |
if(dataHist.GetMaximum() > finalMax): |
249 |
– |
finalMax = dataHist.GetMaximum() |
250 |
– |
|
251 |
– |
|
238 |
|
|
253 |
– |
if len(DataHistograms) is 1: |
254 |
– |
dataIntegral += DataHistograms[0].Integral() |
239 |
|
|
240 |
|
|
241 |
|
### formatting data histograms and adding to legend |
246 |
|
|
247 |
|
|
248 |
|
### creating the histogram to represent the statistical errors on the stack |
249 |
< |
if numBgMCSamples is not 0: |
249 |
> |
if numBgMCSamples is not 0 and not arguments.noStack: |
250 |
|
ErrorHisto = BgMCHistograms[0].Clone("errors") |
251 |
|
ErrorHisto.SetFillStyle(3001) |
252 |
|
ErrorHisto.SetFillColor(13) |
274 |
|
|
275 |
|
|
276 |
|
|
277 |
+ |
### finding the maximum value of anything going on the canvas, and know how to set the y-axis |
278 |
+ |
finalMax = 0 |
279 |
+ |
if numBgMCSamples is not 0 and not arguments.noStack: |
280 |
+ |
finalMax = ErrorHisto.GetMaximum() + ErrorHisto.GetBinError(ErrorHisto.GetMaximumBin()) |
281 |
+ |
else: |
282 |
+ |
for bgMCHist in BgMCHistograms: |
283 |
+ |
if(bgMCHist.GetMaximum() > finalMax): |
284 |
+ |
finalMax = bgMCHist.GetMaximum() |
285 |
+ |
for signalMCHist in SignalMCHistograms: |
286 |
+ |
if(signalMCHist.GetMaximum() > finalMax): |
287 |
+ |
finalMax = signalMCHist.GetMaximum() |
288 |
+ |
for dataHist in DataHistograms: |
289 |
+ |
if(dataHist.GetMaximum() > finalMax): |
290 |
+ |
finalMax = dataHist.GetMaximum() + dataHist.GetBinError(dataHist.GetMaximumBin()) |
291 |
+ |
finalMax = 1.1*finalMax |
292 |
+ |
|
293 |
+ |
|
294 |
|
### Drawing histograms to canvas |
295 |
|
|
296 |
|
|
328 |
|
Stack.SetTitle(histoTitle) |
329 |
|
Stack.Draw("HIST") |
330 |
|
Stack.GetXaxis().SetTitle(xAxisLabel) |
331 |
< |
Stack.SetMaximum(1.1*finalMax) |
331 |
> |
Stack.SetMaximum(finalMax) |
332 |
|
Stack.SetMinimum(0.0001) |
333 |
|
if makeRatioPlots or makeDiffPlots: |
334 |
|
Stack.GetHistogram().GetXaxis().SetLabelSize(0) |
340 |
|
BgMCHistograms[0].SetTitle(histoTitle) |
341 |
|
BgMCHistograms[0].Draw("HIST") |
342 |
|
BgMCHistograms[0].GetXaxis().SetTitle(xAxisLabel) |
343 |
< |
BgMCHistograms[0].SetMaximum(1.1*finalMax) |
343 |
> |
BgMCHistograms[0].SetMaximum(finalMax) |
344 |
|
BgMCHistograms[0].SetMinimum(0.0001) |
345 |
|
for bgMCHist in BgMCHistograms: |
346 |
|
bgMCHist.Draw("A HIST SAME") |
353 |
|
SignalMCHistograms[0].SetTitle(histoTitle) |
354 |
|
SignalMCHistograms[0].Draw("HIST") |
355 |
|
SignalMCHistograms[0].GetXaxis().SetTitle(xAxisLabel) |
356 |
< |
SignalMCHistograms[0].SetMaximum(1.1*finalMax) |
356 |
> |
SignalMCHistograms[0].SetMaximum(finalMax) |
357 |
|
SignalMCHistograms[0].SetMinimum(0.0001) |
358 |
|
for signalMCHist in SignalMCHistograms: |
359 |
|
if(signalMCHist is not SignalMCHistograms[0]): |
365 |
|
DataHistograms[0].SetTitle(histoTitle) |
366 |
|
DataHistograms[0].Draw("E") |
367 |
|
DataHistograms[0].GetXaxis().SetTitle(xAxisLabel) |
368 |
< |
DataHistograms[0].SetMaximum(1.1*finalMax) |
368 |
> |
DataHistograms[0].SetMaximum(finalMax) |
369 |
|
DataHistograms[0].SetMinimum(0.0001) |
370 |
|
for dataHist in DataHistograms: |
371 |
|
if(dataHist is not DataHistograms[0]): |
436 |
|
Comparison.GetYaxis().SetLabelSize(0.1) |
437 |
|
Comparison.GetXaxis().SetLabelSize(0.15) |
438 |
|
if makeRatioPlots: |
439 |
< |
Comparison.GetYaxis().SetRangeUser(-1,1) |
439 |
> |
Comparison.GetYaxis().SetRangeUser(-1.15,1.15) |
440 |
|
elif makeDiffPlots: |
441 |
|
YMax = Comparison.GetMaximum() |
442 |
|
YMin = Comparison.GetMinimum() |
573 |
|
Canvas.Write() |
574 |
|
|
575 |
|
|
575 |
– |
|
576 |
|
#for dataset in processed_datasets: |
577 |
|
# dataset_file = "%s/%s.root_tmp" % (condor_dir,dataset) |
578 |
|
# os.remove(dataset_file) |