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