27ROOT.RooClassFactory.makePdf(
"MyPdfV1",
"x,A,B")
36ROOT.RooClassFactory.makePdf(
37 "MyPdfV2",
"x,A,B",
"",
"A*fabs(x)+pow(x-B,2)")
47ROOT.RooClassFactory.makePdf(
"MyPdfV3",
"x,A,B",
"",
"A*fabs(x)+pow(x-B,2)", ROOT.kTRUE, ROOT.kFALSE,
48 "x:(A/2)*(pow(x.max(rangeName),2)+pow(x.min(rangeName),2))+(1./3)*(pow(x.max(rangeName)-B,3)-pow(x.min(rangeName)-B,3))")
54ROOT.gROOT.ProcessLineSync(
".x MyPdfV3.cxx+")
57a = ROOT.RooRealVar(
"a",
"a", 1)
58b = ROOT.RooRealVar(
"b",
"b", 2, -10, 10)
59y = ROOT.RooRealVar(
"y",
"y", -10, 10)
60pdf = ROOT.MyPdfV3(
"pdf",
"pdf", y, a, b)
63frame1 = y.frame(ROOT.RooFit.Title(
"Compiled class MyPdfV3"))
64data = pdf.generate(ROOT.RooArgSet(y), 1000)
74x = ROOT.RooRealVar(
"x",
"x", -20, 20)
80alpha = ROOT.RooRealVar(
"alpha",
"alpha", 5, 0.1, 10)
81genpdf = ROOT.RooClassFactory.makePdfInstance(
82 "GenPdf",
"(1+0.1*fabs(x)+sin(sqrt(fabs(x*alpha+0.1))))", ROOT.RooArgList(x, alpha))
85data2 = genpdf.generate(ROOT.RooArgSet(x), 50000)
91frame2 = x.frame(ROOT.RooFit.Title(
"Compiled version of pdf of rf103"))
96c = ROOT.TCanvas(
"rf104_classfactory",
"rf104_classfactory", 800, 400)
99ROOT.gPad.SetLeftMargin(0.15)
100frame1.GetYaxis().SetTitleOffset(1.4)
103ROOT.gPad.SetLeftMargin(0.15)
104frame2.GetYaxis().SetTitleOffset(1.4)
107c.SaveAs(
"rf104_classfactory.png")