19x = ROOT.RooRealVar(
"x",
"x", -10, 10)
21m = ROOT.RooRealVar(
"m",
"m", 0, -10, 10)
22s = ROOT.RooRealVar(
"s",
"s", 2, 1, 50)
23sig = ROOT.RooGaussian(
"sig",
"sig", x, m, s)
25m2 = ROOT.RooRealVar(
"m2",
"m2", -1, -10, 10)
26s2 = ROOT.RooRealVar(
"s2",
"s2", 6, 1, 50)
27bkg = ROOT.RooGaussian(
"bkg",
"bkg", x, m2, s2)
29fsig = ROOT.RooRealVar(
"fsig",
"fsig", 0.33, 0, 1)
30model = ROOT.RooAddPdf(
"model",
"model", ROOT.RooArgList(
31 sig, bkg), ROOT.RooArgList(fsig))
35d = model.generateBinned(ROOT.RooArgSet(x), 1000)
38r = model.fitTo(d, ROOT.RooFit.Save())
44frame = x.frame(ROOT.RooFit.Bins(40), ROOT.RooFit.Title(
45 "P.d.f with visualized 1-sigma error band"))
65model.plotOn(frame, ROOT.RooFit.VisualizeError(
66 r, 1), ROOT.RooFit.FillColor(ROOT.kOrange))
80 ROOT.RooFit.VisualizeError(
84 ROOT.RooFit.DrawOption(
"L"),
85 ROOT.RooFit.LineWidth(2),
86 ROOT.RooFit.LineColor(
93 frame, ROOT.RooFit.VisualizeError(
94 r, 1), ROOT.RooFit.FillColor(
95 ROOT.kOrange), ROOT.RooFit.Components(
"bkg"))
98 ROOT.RooFit.VisualizeError(
102 ROOT.RooFit.DrawOption(
"L"),
103 ROOT.RooFit.LineWidth(2),
104 ROOT.RooFit.LineColor(
106 ROOT.RooFit.Components(
"bkg"),
107 ROOT.RooFit.LineStyle(
112model.plotOn(frame, ROOT.RooFit.Components(
"bkg"),
113 ROOT.RooFit.LineStyle(ROOT.kDashed))
121frame2 = x.frame(ROOT.RooFit.Bins(40), ROOT.RooFit.Title(
122 "Visualization of 2-sigma partial error from (m,m2)"))
136model.plotOn(frame2, ROOT.RooFit.VisualizeError(
137 r, ROOT.RooArgSet(m, m2), 2), ROOT.RooFit.FillColor(ROOT.kCyan))
138model.plotOn(frame2, ROOT.RooFit.Components(
"bkg"), ROOT.RooFit.VisualizeError(
139 r, ROOT.RooArgSet(m, m2), 2), ROOT.RooFit.FillColor(ROOT.kCyan))
142model.plotOn(frame2, ROOT.RooFit.Components(
"bkg"),
143 ROOT.RooFit.LineStyle(ROOT.kDashed))
147frame3 = x.frame(ROOT.RooFit.Bins(40), ROOT.RooFit.Title(
148 "Visualization of 2-sigma partial error from (s,s2)"))
152model.plotOn(frame3, ROOT.RooFit.VisualizeError(
153 r, ROOT.RooArgSet(s, s2), 2), ROOT.RooFit.FillColor(ROOT.kGreen))
154model.plotOn(frame3, ROOT.RooFit.Components(
"bkg"), ROOT.RooFit.VisualizeError(
155 r, ROOT.RooArgSet(s, s2), 2), ROOT.RooFit.FillColor(ROOT.kGreen))
158model.plotOn(frame3, ROOT.RooFit.Components(
"bkg"),
159 ROOT.RooFit.LineStyle(ROOT.kDashed))
163frame4 = x.frame(ROOT.RooFit.Bins(40), ROOT.RooFit.Title(
164 "Visualization of 2-sigma partial error from fsig"))
168model.plotOn(frame4, ROOT.RooFit.VisualizeError(
169 r, ROOT.RooArgSet(fsig), 2), ROOT.RooFit.FillColor(ROOT.kMagenta))
170model.plotOn(frame4, ROOT.RooFit.Components(
"bkg"), ROOT.RooFit.VisualizeError(
171 r, ROOT.RooArgSet(fsig), 2), ROOT.RooFit.FillColor(ROOT.kMagenta))
174model.plotOn(frame4, ROOT.RooFit.Components(
"bkg"),
175 ROOT.RooFit.LineStyle(ROOT.kDashed))
178c = ROOT.TCanvas(
"rf610_visualerror",
"rf610_visualerror", 800, 800)
181ROOT.gPad.SetLeftMargin(0.15)
182frame.GetYaxis().SetTitleOffset(1.4)
185ROOT.gPad.SetLeftMargin(0.15)
186frame2.GetYaxis().SetTitleOffset(1.6)
189ROOT.gPad.SetLeftMargin(0.15)
190frame3.GetYaxis().SetTitleOffset(1.6)
193ROOT.gPad.SetLeftMargin(0.15)
194frame4.GetYaxis().SetTitleOffset(1.6)
197c.SaveAs(
"rf610_visualerror.png")