17x = ROOT.RooRealVar(
"x",
"x", -5, 5)
18y = ROOT.RooRealVar(
"y",
"y", -5, 5)
21a0 = ROOT.RooRealVar(
"a0",
"a0", -3.5, -5, 5)
22a1 = ROOT.RooRealVar(
"a1",
"a1", -1.5, -1, 1)
23sigma = ROOT.RooRealVar(
"sigma",
"width of gaussian", 1.5)
26fy = ROOT.RooFormulaVar(
"fy",
"a0-a1*sqrt(10*abs(y))", [y, a0, a1])
29model = ROOT.RooGaussian(
"model",
"Gaussian with shifting mean", x, fy, sigma)
32data = model.generate({x, y}, 10000)
41hh_data = ROOT.RooAbsData.createHistogram(data,
"x,y", x, Binning=20, YVar=dict(var=y, Binning=20))
45hh_pdf = model.createHistogram(
"x,y", 50, 50)
46hh_pdf.SetLineColor(ROOT.kBlue)
52z = ROOT.RooRealVar(
"z",
"z", -5, 5)
54gz = ROOT.RooGaussian(
"gz",
"gz", z, ROOT.RooFit.RooConst(0), ROOT.RooFit.RooConst(2))
55model3 = ROOT.RooProdPdf(
"model3",
"model3", [model, gz])
57data3 = model3.generate({x, y, z}, 10000)
64hh_data3 = ROOT.RooAbsData.createHistogram(
69 YVar=dict(var=y, Binning=8),
70 ZVar=dict(var=z, Binning=8),
74hh_pdf3 = model3.createHistogram(
78 YVar=dict(var=y, Binning=20),
79 ZVar=dict(var=z, Binning=20),
81hh_pdf3.SetFillColor(ROOT.kBlue)
83c1 = ROOT.TCanvas(
"rf309_2dimplot",
"rf309_2dimplot", 800, 800)
86ROOT.gPad.SetLeftMargin(0.15)
87hh_data.GetZaxis().SetTitleOffset(1.4)
90ROOT.gPad.SetLeftMargin(0.20)
91hh_pdf.GetZaxis().SetTitleOffset(2.5)
94ROOT.gPad.SetLeftMargin(0.15)
95hh_data.GetZaxis().SetTitleOffset(1.4)
98ROOT.gPad.SetLeftMargin(0.15)
99hh_pdf.GetZaxis().SetTitleOffset(2.5)
101c1.SaveAs(
"rf309_2dimplot.png")
103c2 = ROOT.TCanvas(
"rf309_3dimplot",
"rf309_3dimplot", 800, 400)
106ROOT.gPad.SetLeftMargin(0.15)
107hh_data3.GetZaxis().SetTitleOffset(1.4)
110ROOT.gPad.SetLeftMargin(0.15)
111hh_pdf3.GetZaxis().SetTitleOffset(1.4)
113c2.SaveAs(
"rf309_3dimplot.png")