19x = ROOT.RooRealVar(
"x",
"x", -20, 20)
27alpha = ROOT.RooRealVar(
"alpha",
"alpha", 5, 0.1, 10)
28genpdf = ROOT.RooGenericPdf(
"genpdf",
"genpdf",
"(1+0.1*abs(x)+sin(sqrt(abs(x*alpha+0.1))))", [x, alpha])
34data = genpdf.generate({x}, 10000)
37genpdf.fitTo(data, PrintLevel=-1)
40xframe = x.frame(Title=
"Interpreted expression pdf")
52mean2 = ROOT.RooRealVar(
"mean2",
"mean^2", 10, 0, 200)
53sigma = ROOT.RooRealVar(
"sigma",
"sigma", 3, 0.1, 10)
56mean = ROOT.RooFormulaVar(
"mean",
"mean",
"sqrt(mean2)", [mean2])
59g2 = ROOT.RooGaussian(
"g2",
"h2", x, mean, sigma)
66g1 = ROOT.RooGaussian(
"g1",
"g1", x, 10, 3)
67data2 = g1.generate({x}, 1000)
73r = g2.fitTo(data2, Save=
True, PrintLevel=-1)
77xframe2 = x.frame(Title=
"Tailored Gaussian pdf")
82c = ROOT.TCanvas(
"rf103_interprfuncs",
"rf103_interprfuncs", 800, 400)
85ROOT.gPad.SetLeftMargin(0.15)
86xframe.GetYaxis().SetTitleOffset(1.4)
89ROOT.gPad.SetLeftMargin(0.15)
90xframe2.GetYaxis().SetTitleOffset(1.4)
93c.SaveAs(
"rf103_interprfuncs.png")