21ROOT.RooAbsPdf.defaultIntegratorConfig().setEpsRel(1e-8)
22ROOT.RooAbsPdf.defaultIntegratorConfig().setEpsAbs(1e-8)
25x = ROOT.RooRealVar(
"x",
"x", -5, 5)
26y = ROOT.RooRealVar(
"y",
"y", -2, 2)
29a0 = ROOT.RooRealVar(
"a0",
"a0", 0)
30a1 = ROOT.RooRealVar(
"a1",
"a1", -1.5, -3, 1)
31fy = ROOT.RooPolyVar(
"fy",
"fy", y, [a0, a1])
34sigmax = ROOT.RooRealVar(
"sigmax",
"width of gaussian", 0.5)
35gaussx = ROOT.RooGaussian(
"gaussx",
"Gaussian in x with shifting mean in y", x, fy, sigmax)
38gaussy = ROOT.RooGaussian(
"gaussy",
"Gaussian in y", y, ROOT.RooFit.RooConst(0), ROOT.RooFit.RooConst(2))
41model = ROOT.RooProdPdf(
43 "gaussx(x|y)*gaussy(y)",
45 Conditional=({gaussx}, {x}),
52modelx = model.createProjection({y})
58data = modelx.generateBinned({x}, 1000)
61modelx.fitTo(data, Verbose=
True, PrintLevel=-1)
69hh = model.createHistogram(
"x,y")
70hh.SetLineColor(ROOT.kBlue)
72c = ROOT.TCanvas(
"rf315_projectpdf",
"rf315_projectpdf", 800, 400)
75ROOT.gPad.SetLeftMargin(0.15)
76frame.GetYaxis().SetTitleOffset(1.4)
79ROOT.gPad.SetLeftMargin(0.20)
80hh.GetZaxis().SetTitleOffset(2.5)
82c.SaveAs(
"rf315_projectpdf.png")