18x = ROOT.RooRealVar(
"x",
"x", -10, 10)
21sigma = ROOT.RooRealVar(
"sigma",
"sigma", 3, 0.1, 10)
22mean = ROOT.RooRealVar(
"mean",
"mean", -3, -10, 10)
23gauss = ROOT.RooGaussian(
"gauss",
"gauss", x, mean, sigma)
26data = gauss.generate(ROOT.RooArgSet(x), 100)
35frame1 = x.frame(ROOT.RooFit.Name(
"xframe"), ROOT.RooFit.Title(
36 "Red Curve / SumW2 Histo errors"), ROOT.RooFit.Bins(20))
37frame2 = x.frame(ROOT.RooFit.Name(
"xframe"), ROOT.RooFit.Title(
38 "Dashed Curve / No XError bars"), ROOT.RooFit.Bins(20))
39frame3 = x.frame(ROOT.RooFit.Name(
"xframe"), ROOT.RooFit.Title(
40 "Filled Curve / Blue Histo"), ROOT.RooFit.Bins(20))
41frame4 = x.frame(ROOT.RooFit.Name(
"xframe"), ROOT.RooFit.Title(
42 "Partial Range / Filled Bar chart"), ROOT.RooFit.Bins(20))
48data.plotOn(frame1, ROOT.RooFit.DataError(ROOT.RooAbsData.SumW2))
51data.plotOn(frame2, ROOT.RooFit.XErrorSize(0))
54data.plotOn(frame3, ROOT.RooFit.MarkerColor(
55 ROOT.kBlue), ROOT.RooFit.LineColor(ROOT.kBlue))
60 ROOT.RooFit.DrawOption(
"B"),
61 ROOT.RooFit.DataError(
62 ROOT.RooAbsData.ErrorType(2)),
63 ROOT.RooFit.XErrorSize(0),
64 ROOT.RooFit.FillColor(
71gauss.plotOn(frame1, ROOT.RooFit.LineColor(ROOT.kRed))
74gauss.plotOn(frame2, ROOT.RooFit.LineStyle(ROOT.kDashed))
77gauss.plotOn(frame3, ROOT.RooFit.DrawOption(
"F"),
78 ROOT.RooFit.FillColor(ROOT.kOrange), ROOT.RooFit.MoveToBack())
81gauss.plotOn(frame4, ROOT.RooFit.Range(-8, 3),
82 ROOT.RooFit.LineColor(ROOT.kMagenta))
84c = ROOT.TCanvas(
"rf107_plotstyles",
"rf107_plotstyles", 800, 800)
87ROOT.gPad.SetLeftMargin(0.15)
88frame1.GetYaxis().SetTitleOffset(1.6)
91ROOT.gPad.SetLeftMargin(0.15)
92frame2.GetYaxis().SetTitleOffset(1.6)
95ROOT.gPad.SetLeftMargin(0.15)
96frame3.GetYaxis().SetTitleOffset(1.6)
99ROOT.gPad.SetLeftMargin(0.15)
100frame4.GetYaxis().SetTitleOffset(1.6)
103c.SaveAs(
"rf107_plotstyles.png")