25ROOT.RooClassFactory.makePdf(
"MyPdfV1",
"x,A,B")
34ROOT.RooClassFactory.makePdf(
35 "MyPdfV2",
"x,A,B",
"",
"A*fabs(x)+pow(x-B,2)")
45ROOT.RooClassFactory.makePdf(
49 "A*fabs(x)+pow(x-B,2)",
52 "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))")
58ROOT.gROOT.ProcessLineSync(
".x MyPdfV3.cxx+")
61a = ROOT.RooRealVar(
"a",
"a", 1)
62b = ROOT.RooRealVar(
"b",
"b", 2, -10, 10)
63y = ROOT.RooRealVar(
"y",
"y", -10, 10)
64pdf = ROOT.MyPdfV3(
"pdf",
"pdf", y, a, b)
67frame1 = y.frame(ROOT.RooFit.Title(
"Compiled class MyPdfV3"))
68data = pdf.generate(ROOT.RooArgSet(y), 1000)
78x = ROOT.RooRealVar(
"x",
"x", -20, 20)
84alpha = ROOT.RooRealVar(
"alpha",
"alpha", 5, 0.1, 10)
85genpdf = ROOT.RooClassFactory.makePdfInstance(
87 "(1+0.1*fabs(x)+sin(sqrt(fabs(x*alpha+0.1))))",
93data2 = genpdf.generate(ROOT.RooArgSet(x), 50000)
99frame2 = x.frame(ROOT.RooFit.Title(
"Compiled version of pdf of rf103"))
104c = ROOT.TCanvas(
"rf104_classfactory",
"rf104_classfactory", 800, 400)
107ROOT.gPad.SetLeftMargin(0.15)
108frame1.GetYaxis().SetTitleOffset(1.4)
111ROOT.gPad.SetLeftMargin(0.15)
112frame2.GetYaxis().SetTitleOffset(1.4)
115c.SaveAs(
"rf104_classfactory.png")