20x = ROOT.RooRealVar(
"x",
"x", -10, 10)
23sigma = ROOT.RooRealVar(
"sigma",
"sigma", 3, 0.1, 10)
24mean = ROOT.RooRealVar(
"mean",
"mean", -3, -10, 10)
25gauss = ROOT.RooGaussian(
"gauss",
"gauss", x, mean, sigma)
28data = gauss.generate({x}, 100)
31gauss.fitTo(data, PrintLevel=-1)
37frame1 = x.frame(Name=
"xframe", Title=
"Red Curve / SumW2 Histo errors", Bins=20)
38frame2 = x.frame(Name=
"xframe", Title=
"Dashed Curve / No XError bars", Bins=20)
39frame3 = x.frame(Name=
"xframe", Title=
"Filled Curve / Blue Histo", Bins=20)
40frame4 = x.frame(Name=
"xframe", Title=
"Partial Range / Filled Bar chart", Bins=20)
46data.plotOn(frame1, DataError=
"SumW2")
49data.plotOn(frame2, XErrorSize=0)
52data.plotOn(frame3, MarkerColor=
"b", LineColor=
"b")
55data.plotOn(frame4, DrawOption=
"B", DataError=
None, XErrorSize=0, FillColor=
"kGray")
61gauss.plotOn(frame1, LineColor=
"r")
64gauss.plotOn(frame2, LineStyle=
"--")
67gauss.plotOn(frame3, MoveToBack=
True, DrawOption=
"F", FillColor=
"kOrange")
70gauss.plotOn(frame4, Range=(-8, 3), LineColor=
"m")
72c = ROOT.TCanvas(
"rf107_plotstyles",
"rf107_plotstyles", 800, 800)
75ROOT.gPad.SetLeftMargin(0.15)
76frame1.GetYaxis().SetTitleOffset(1.6)
79ROOT.gPad.SetLeftMargin(0.15)
80frame2.GetYaxis().SetTitleOffset(1.6)
83ROOT.gPad.SetLeftMargin(0.15)
84frame3.GetYaxis().SetTitleOffset(1.6)
87ROOT.gPad.SetLeftMargin(0.15)
88frame4.GetYaxis().SetTitleOffset(1.6)
91c.SaveAs(
"rf107_plotstyles.png")