18x = ROOT.RooRealVar(
"x",
"x", -20, 20)
26alpha = ROOT.RooRealVar(
"alpha",
"alpha", 5, 0.1, 10)
27genpdf = ROOT.RooGenericPdf(
30 "(1+0.1*abs(x)+sin(sqrt(abs(x*alpha+0.1))))",
39data = genpdf.generate(ROOT.RooArgSet(x), 10000)
45xframe = x.frame(ROOT.RooFit.Title(
"Interpreted expression pdf"))
57mean2 = ROOT.RooRealVar(
"mean2",
"mean^2", 10, 0, 200)
58sigma = ROOT.RooRealVar(
"sigma",
"sigma", 3, 0.1, 10)
61mean = ROOT.RooFormulaVar(
62 "mean",
"mean",
"sqrt(mean2)", ROOT.RooArgList(mean2))
65g2 = ROOT.RooGaussian(
"g2",
"h2", x, mean, sigma)
72g1 = ROOT.RooGaussian(
"g1",
"g1", x, ROOT.RooFit.RooConst(
73 10), ROOT.RooFit.RooConst(3))
74data2 = g1.generate(ROOT.RooArgSet(x), 1000)
80r = g2.fitTo(data2, ROOT.RooFit.Save())
84xframe2 = x.frame(ROOT.RooFit.Title(
"Tailored Gaussian pdf"))
89c = ROOT.TCanvas(
"rf103_interprfuncs",
"rf103_interprfuncs", 800, 400)
92ROOT.gPad.SetLeftMargin(0.15)
93xframe.GetYaxis().SetTitleOffset(1.4)
96ROOT.gPad.SetLeftMargin(0.15)
97xframe2.GetYaxis().SetTitleOffset(1.4)
100c.SaveAs(
"rf103_interprfuncs.png")