17x = ROOT.RooRealVar(
"x",
"x", 0, 20)
18p = ROOT.RooPolynomial(
"p",
"p", x, ROOT.RooArgList(ROOT.RooFit.RooConst(
19 0.01), ROOT.RooFit.RooConst(-0.01), ROOT.RooFit.RooConst(0.0004)))
26data1 = p.generate(ROOT.RooArgSet(x), 500)
29hist1 = data1.binnedClone()
32histpdf1 = ROOT.RooHistPdf(
"histpdf1",
"histpdf1", ROOT.RooArgSet(x), hist1, 0)
35frame1 = x.frame(ROOT.RooFit.Title(
36 "Low statistics histogram pdf"), ROOT.RooFit.Bins(100))
38histpdf1.plotOn(frame1)
45data2 = p.generate(ROOT.RooArgSet(x), 100000)
48hist2 = data2.binnedClone()
51histpdf2 = ROOT.RooHistPdf(
"histpdf2",
"histpdf2", ROOT.RooArgSet(x), hist2, 2)
54frame2 = x.frame(ROOT.RooFit.Title(
55 "High stats histogram pdf with interpolation"), ROOT.RooFit.Bins(100))
57histpdf2.plotOn(frame2)
59c = ROOT.TCanvas(
"rf706_histpdf",
"rf706_histpdf", 800, 400)
62ROOT.gPad.SetLeftMargin(0.15)
63frame1.GetYaxis().SetTitleOffset(1.4)
66ROOT.gPad.SetLeftMargin(0.15)
67frame2.GetYaxis().SetTitleOffset(1.8)
70c.SaveAs(
"rf706_histpdf.png")