17x = ROOT.RooRealVar(
"x",
"x", -20, 20)
25alpha = ROOT.RooRealVar(
"alpha",
"alpha", 5, 0.1, 10)
26genpdf = ROOT.RooGenericPdf(
29 "(1+0.1*abs(x)+sin(sqrt(abs(x*alpha+0.1))))",
38data = genpdf.generate(ROOT.RooArgSet(x), 10000)
44xframe = x.frame(ROOT.RooFit.Title(
"Interpreted expression pdf"))
56mean2 = ROOT.RooRealVar(
"mean2",
"mean^2", 10, 0, 200)
57sigma = ROOT.RooRealVar(
"sigma",
"sigma", 3, 0.1, 10)
60mean = ROOT.RooFormulaVar(
61 "mean",
"mean",
"sqrt(mean2)", ROOT.RooArgList(mean2))
64g2 = ROOT.RooGaussian(
"g2",
"h2", x, mean, sigma)
71g1 = ROOT.RooGaussian(
"g1",
"g1", x, ROOT.RooFit.RooConst(
72 10), ROOT.RooFit.RooConst(3))
73data2 = g1.generate(ROOT.RooArgSet(x), 1000)
79r = g2.fitTo(data2, ROOT.RooFit.Save())
83xframe2 = x.frame(ROOT.RooFit.Title(
"Tailored Gaussian pdf"))
88c = ROOT.TCanvas(
"rf103_interprfuncs",
"rf103_interprfuncs", 800, 400)
91ROOT.gPad.SetLeftMargin(0.15)
92xframe.GetYaxis().SetTitleOffset(1.4)
95ROOT.gPad.SetLeftMargin(0.15)
96xframe2.GetYaxis().SetTitleOffset(1.4)
99c.SaveAs(
"rf103_interprfuncs.png")