19x = ROOT.RooRealVar(
"x",
"x", -20, 20)
27alpha = ROOT.RooRealVar(
"alpha",
"alpha", 5, 0.1, 10)
28genpdf = ROOT.RooGenericPdf(
29 "genpdf",
"genpdf",
"(1+0.1*abs(x)+sin(sqrt(abs(x*alpha+0.1))))", ROOT.RooArgList(x, alpha))
35data = genpdf.generate(ROOT.RooArgSet(x), 10000)
41xframe = x.frame(ROOT.RooFit.Title(
"Interpreted expression pdf"))
53mean2 = ROOT.RooRealVar(
"mean2",
"mean^2", 10, 0, 200)
54sigma = ROOT.RooRealVar(
"sigma",
"sigma", 3, 0.1, 10)
57mean = ROOT.RooFormulaVar(
58 "mean",
"mean",
"sqrt(mean2)", ROOT.RooArgList(mean2))
61g2 = ROOT.RooGaussian(
"g2",
"h2", x, mean, sigma)
68g1 = ROOT.RooGaussian(
"g1",
"g1", x, ROOT.RooFit.RooConst(
69 10), ROOT.RooFit.RooConst(3))
70data2 = g1.generate(ROOT.RooArgSet(x), 1000)
76r = g2.fitTo(data2, ROOT.RooFit.Save())
80xframe2 = x.frame(ROOT.RooFit.Title(
"Tailored Gaussian pdf"))
85c = ROOT.TCanvas(
"rf103_interprfuncs",
"rf103_interprfuncs", 800, 400)
88ROOT.gPad.SetLeftMargin(0.15)
89xframe.GetYaxis().SetTitleOffset(1.4)
92ROOT.gPad.SetLeftMargin(0.15)
93xframe2.GetYaxis().SetTitleOffset(1.4)
96c.SaveAs(
"rf103_interprfuncs.png")