21x = ROOT.RooRealVar(
"x",
"x", 0, 20)
22p = ROOT.RooPolynomial(
"p",
"p", x, ROOT.RooArgList(ROOT.RooFit.RooConst(
23 0.01), ROOT.RooFit.RooConst(-0.01), ROOT.RooFit.RooConst(0.0004)))
30data1 = p.generate(ROOT.RooArgSet(x), 500)
33hist1 = data1.binnedClone()
36histpdf1 = ROOT.RooHistPdf(
"histpdf1",
"histpdf1", ROOT.RooArgSet(x), hist1, 0)
39frame1 = x.frame(ROOT.RooFit.Title(
40 "Low statistics histogram pdf"), ROOT.RooFit.Bins(100))
42histpdf1.plotOn(frame1)
49data2 = p.generate(ROOT.RooArgSet(x), 100000)
52hist2 = data2.binnedClone()
55histpdf2 = ROOT.RooHistPdf(
"histpdf2",
"histpdf2", ROOT.RooArgSet(x), hist2, 2)
58frame2 = x.frame(ROOT.RooFit.Title(
59 "High stats histogram pdf with interpolation"), ROOT.RooFit.Bins(100))
61histpdf2.plotOn(frame2)
63c = ROOT.TCanvas(
"rf706_histpdf",
"rf706_histpdf", 800, 400)
66ROOT.gPad.SetLeftMargin(0.15)
67frame1.GetYaxis().SetTitleOffset(1.4)
70ROOT.gPad.SetLeftMargin(0.15)
71frame2.GetYaxis().SetTitleOffset(1.8)
74c.SaveAs(
"rf706_histpdf.png")