-
Notifications
You must be signed in to change notification settings - Fork 1
/
plotBkgFitErrs2.py
88 lines (75 loc) · 2.59 KB
/
plotBkgFitErrs2.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
from ROOT import *
from math import sqrt
from tcanvasTDR import TDRify
tfile=[]
tfile.append(TFile("/Users/johakala/dec11/forErrs/rebinnedPdfs_antibtag.root"))
tfile.append(TFile("/Users/johakala/dec11/forErrs/rebinnedPdfs_btag.root"))
anti = tfile[0].Get("masterCan_antibtag")
antiFit = anti.GetPrimitive("dataFit_antibtag")
antiHist = antiFit.GetPrimitive("rebinned_fit")
antiHist.SetTitle("antibtag category")
antiCurve = antiFit.GetPrimitive("bkg_dijetsimple2_Norm[x]")
antiCurve.SetTitle("dijet2 fit")
btag = tfile[1].Get("masterCan_btag")
btagFit = btag.GetPrimitive("dataFit_btag")
btagHist = btagFit.GetPrimitive("rebinned_fit")
btagHist.SetTitle("btag category")
btagCurve = btagFit.GetPrimitive("bkg_dijetsimple2_Norm[x]")
btagCurve.SetTitle("dijet2 fit")
antiErrFile = TFile("fitRes_antibtag.root")
btagErrFile = TFile("fitRes_btag.root")
btagErrCan = btagErrFile.Get("c1")
btagErrorCurves = []
for prim in btagErrCan.GetListOfPrimitives():
print prim.GetName()
if "errorband" in prim.GetName():
btagErrorCurves.append(prim)
for btagErrorCurve in btagErrorCurves:
for i in range(0, btagErrorCurve.GetN()):
btagErrorCurve.GetY()[i] *= 50 # the rebin factor
btagCan = TCanvas()
btagCan.cd()
btag.Draw()
btagFit.cd()
btagErrorCurves[0].SetFillColor(kOrange)
btagErrorCurves[0].Draw("f")
btagErrorCurves[1].SetFillColor(kGreen+2)
btagErrorCurves[1].Draw("f")
TDRify(btagFit, False, "btagFit")
btagRatio = btag.GetPrimitive("ratioPad_btag")
btagRatio.cd()
TDRify(btagRatio, True, "btagRatio")
antiErrCan = antiErrFile.Get("c1")
antiErrorCurves = []
for prim in antiErrCan.GetListOfPrimitives():
if "errorband" in prim.GetName():
antiErrorCurves.append(prim)
for antiErrorCurve in antiErrorCurves:
for i in range(0, antiErrorCurve.GetN()):
antiErrorCurve.GetY()[i] *= 50 # the rebin factor
antiCan = TCanvas()
antiCan.cd()
anti.Draw()
antiFit.cd()
antiErrorCurves[0].SetFillColor(kOrange)
antiErrorCurves[0].Draw("f")
antiErrorCurves[1].SetFillColor(kGreen+2)
antiErrorCurves[1].Draw("f")
TDRify(antiFit, False, "antiFit")
antiRatio = anti.GetPrimitive("ratioPad_antibtag")
antiRatio.cd()
TDRify(antiRatio, True, "antiRatio")
antiFit.cd()
antiFit.GetPrimitive("bkg_dijetsimple2_Norm[x]").Draw("SAME")
antiFit.GetPrimitive("rebinned_fit").Draw("SAME PE")
for prim in antiFit.GetListOfPrimitives():
print prim.GetName()
print prim.IsA().GetName()
print "-------"
btagFit.cd()
btagFit.GetPrimitive("bkg_dijetsimple2_Norm[x]").Draw("SAME")
btagFit.GetPrimitive("rebinned_fit").Draw("SAME PE")
for prim in btagFit.GetListOfPrimitives():
print prim.GetName()
print prim.IsA().GetName()
print "-------"