19x = ROOT.RooRealVar(
"x",
"x", -5, 5)
20y = ROOT.RooRealVar(
"y",
"y", -5, 5)
23a0 = ROOT.RooRealVar(
"a0",
"a0", -3.5, -5, 5)
24a1 = ROOT.RooRealVar(
"a1",
"a1", -1.5, -1, 1)
25sigma = ROOT.RooRealVar(
"sigma",
"width of gaussian", 1.5)
28fy = ROOT.RooFormulaVar(
"fy",
"a0-a1*sqrt(10*abs(y))", [y, a0, a1])
31model = ROOT.RooGaussian(
"model",
"Gaussian with shifting mean", x, fy, sigma)
34data = model.generate({x, y}, 10000)
40hh_data = data.createHistogram(
"x,y", x, Binning=20, YVar=dict(var=y, Binning=20))
44hh_pdf = model.createHistogram(
"x,y", 50, 50)
45hh_pdf.SetLineColor(ROOT.kBlue)
51z = ROOT.RooRealVar(
"z",
"z", -5, 5)
53gz = ROOT.RooGaussian(
"gz",
"gz", z, 0.0, 2.0)
54model3 = ROOT.RooProdPdf(
"model3",
"model3", [model, gz])
56data3 = model3.generate({x, y, z}, 10000)
63hh_data3 = data3.createHistogram(
67 YVar=dict(var=y, Binning=8),
68 ZVar=dict(var=z, Binning=8),
72hh_pdf3 = model3.createHistogram(
76 YVar=dict(var=y, Binning=20),
77 ZVar=dict(var=z, Binning=20),
79hh_pdf3.SetFillColor(ROOT.kBlue)
81c1 = ROOT.TCanvas(
"rf309_2dimplot",
"rf309_2dimplot", 800, 800)
84ROOT.gPad.SetLeftMargin(0.15)
85hh_data.GetZaxis().SetTitleOffset(1.4)
88ROOT.gPad.SetLeftMargin(0.20)
89hh_pdf.GetZaxis().SetTitleOffset(2.5)
92ROOT.gPad.SetLeftMargin(0.15)
93hh_data.GetZaxis().SetTitleOffset(1.4)
96ROOT.gPad.SetLeftMargin(0.15)
97hh_pdf.GetZaxis().SetTitleOffset(2.5)
99c1.SaveAs(
"rf309_2dimplot.png")
101c2 = ROOT.TCanvas(
"rf309_3dimplot",
"rf309_3dimplot", 800, 400)
104ROOT.gPad.SetLeftMargin(0.15)
105hh_data3.GetZaxis().SetTitleOffset(1.4)
108ROOT.gPad.SetLeftMargin(0.15)
109hh_pdf3.GetZaxis().SetTitleOffset(1.4)
111c2.SaveAs(
"rf309_3dimplot.png")