20 using namespace RooFit;
27 RooRealVar x(
"x",
"x", 0, 20);
28 RooPolynomial p(
"p",
"p", x, RooArgList(RooConst(0.01), RooConst(-0.01), RooConst(0.0004)));
35 RooDataSet *data1 = p.generate(x, 500);
38 RooDataHist *hist1 = data1->binnedClone();
41 RooHistPdf histpdf1(
"histpdf1",
"histpdf1", x, *hist1, 0);
44 RooPlot *frame1 = x.frame(Title(
"Low statistics histogram pdf"), Bins(100));
45 data1->plotOn(frame1);
46 histpdf1.plotOn(frame1);
53 RooDataSet *data2 = p.generate(x, 100000);
56 RooDataHist *hist2 = data2->binnedClone();
59 RooHistPdf histpdf2(
"histpdf2",
"histpdf2", x, *hist2, 2);
62 RooPlot *frame2 = x.frame(Title(
"High stats histogram pdf with interpolation"), Bins(100));
63 data2->plotOn(frame2);
64 histpdf2.plotOn(frame2);
66 TCanvas *c =
new TCanvas(
"rf706_histpdf",
"rf706_histpdf", 800, 400);
69 gPad->SetLeftMargin(0.15);
70 frame1->GetYaxis()->SetTitleOffset(1.4);
73 gPad->SetLeftMargin(0.15);
74 frame2->GetYaxis()->SetTitleOffset(1.8);