21x = ROOT.RooRealVar(
"x",
"x", -10, 10)
24sigma = ROOT.RooRealVar(
"sigma",
"sigma", 3, 0.1, 10)
25mean = ROOT.RooRealVar(
"mean",
"mean", -3, -10, 10)
26gauss = ROOT.RooGaussian(
"gauss",
"gauss", x, mean, sigma)
29data = gauss.generate(ROOT.RooArgSet(x), 100)
38frame1 = x.frame(ROOT.RooFit.Name(
"xframe"), ROOT.RooFit.Title(
39 "Red Curve / SumW2 Histo errors"), ROOT.RooFit.Bins(20))
40frame2 = x.frame(ROOT.RooFit.Name(
"xframe"), ROOT.RooFit.Title(
41 "Dashed Curve / No XError bars"), ROOT.RooFit.Bins(20))
42frame3 = x.frame(ROOT.RooFit.Name(
"xframe"), ROOT.RooFit.Title(
43 "Filled Curve / Blue Histo"), ROOT.RooFit.Bins(20))
44frame4 = x.frame(ROOT.RooFit.Name(
"xframe"), ROOT.RooFit.Title(
45 "Partial Range / Filled Bar chart"), ROOT.RooFit.Bins(20))
51data.plotOn(frame1, ROOT.RooFit.DataError(ROOT.RooAbsData.SumW2))
54data.plotOn(frame2, ROOT.RooFit.XErrorSize(0))
57data.plotOn(frame3, ROOT.RooFit.MarkerColor(
58 ROOT.kBlue), ROOT.RooFit.LineColor(ROOT.kBlue))
61data.plotOn(frame4, ROOT.RooFit.DrawOption(
"B"), ROOT.RooFit.DataError(
62 ROOT.RooAbsData.ErrorType(2)), ROOT.RooFit.XErrorSize(0), ROOT.RooFit.FillColor(ROOT.kGray))
68gauss.plotOn(frame1, ROOT.RooFit.LineColor(ROOT.kRed))
71gauss.plotOn(frame2, ROOT.RooFit.LineStyle(ROOT.kDashed))
74gauss.plotOn(frame3, ROOT.RooFit.DrawOption(
"F"),
75 ROOT.RooFit.FillColor(ROOT.kOrange), ROOT.RooFit.MoveToBack())
78gauss.plotOn(frame4, ROOT.RooFit.Range(-8, 3),
79 ROOT.RooFit.LineColor(ROOT.kMagenta))
81c = ROOT.TCanvas(
"rf107_plotstyles",
"rf107_plotstyles", 800, 800)
84ROOT.gPad.SetLeftMargin(0.15)
85frame1.GetYaxis().SetTitleOffset(1.6)
88ROOT.gPad.SetLeftMargin(0.15)
89frame2.GetYaxis().SetTitleOffset(1.6)
92ROOT.gPad.SetLeftMargin(0.15)
93frame3.GetYaxis().SetTitleOffset(1.6)
96ROOT.gPad.SetLeftMargin(0.15)
97frame4.GetYaxis().SetTitleOffset(1.6)
100c.SaveAs(
"rf107_plotstyles.png")