18x = ROOT.RooRealVar(
"x",
"x", 0, 20)
19p = ROOT.RooPolynomial(
"p",
"p", x, ROOT.RooArgList(ROOT.RooFit.RooConst(
20 0.01), ROOT.RooFit.RooConst(-0.01), ROOT.RooFit.RooConst(0.0004)))
27data1 = p.generate(ROOT.RooArgSet(x), 500)
30hist1 = data1.binnedClone()
33histpdf1 = ROOT.RooHistPdf(
"histpdf1",
"histpdf1", ROOT.RooArgSet(x), hist1, 0)
36frame1 = x.frame(ROOT.RooFit.Title(
37 "Low statistics histogram pdf"), ROOT.RooFit.Bins(100))
39histpdf1.plotOn(frame1)
46data2 = p.generate(ROOT.RooArgSet(x), 100000)
49hist2 = data2.binnedClone()
52histpdf2 = ROOT.RooHistPdf(
"histpdf2",
"histpdf2", ROOT.RooArgSet(x), hist2, 2)
55frame2 = x.frame(ROOT.RooFit.Title(
56 "High stats histogram pdf with interpolation"), ROOT.RooFit.Bins(100))
58histpdf2.plotOn(frame2)
60c = ROOT.TCanvas(
"rf706_histpdf",
"rf706_histpdf", 800, 400)
63ROOT.gPad.SetLeftMargin(0.15)
64frame1.GetYaxis().SetTitleOffset(1.4)
67ROOT.gPad.SetLeftMargin(0.15)
68frame2.GetYaxis().SetTitleOffset(1.8)
71c.SaveAs(
"rf706_histpdf.png")