18x = ROOT.RooRealVar(
"x",
"x", -5, 5)
19y = ROOT.RooRealVar(
"y",
"y", -5, 5)
22a0 = ROOT.RooRealVar(
"a0",
"a0", -1.5, -5, 5)
23a1 = ROOT.RooRealVar(
"a1",
"a1", -0.5, -1, 1)
24sigma = ROOT.RooRealVar(
"sigma",
"width of gaussian", 0.5)
30fy_1 = ROOT.RooFormulaVar(
"fy_1",
"a0-a1*sqrt(10*abs(y))", [y, a0, a1])
33model_1 = ROOT.RooGaussian(
"model_1",
"Gaussian with shifting mean", x, fy_1, sigma)
39fy_2 = ROOT.RooPolyVar(
"fy_2",
"fy_2", y, [a0, a1])
42model_2 = ROOT.RooGaussian(
"model_2",
"Gaussian with shifting mean", x, fy_2, sigma)
48fy_3 = ROOT.RooAddition(
"fy_3",
"a0+y", [a0, y])
51model_3 = ROOT.RooGaussian(
"model_3",
"Gaussian with shifting mean", x, fy_3, sigma)
57fy_4 = ROOT.RooProduct(
"fy_4",
"a1*y", [a1, y])
60model_4 = ROOT.RooGaussian(
"model_4",
"Gaussian with shifting mean", x, fy_4, sigma)
66hh_model_1 = model_1.createHistogram(
"hh_model_1", x, Binning=50, YVar=dict(var=y, Binning=50))
67hh_model_2 = model_2.createHistogram(
"hh_model_2", x, Binning=50, YVar=dict(var=y, Binning=50))
68hh_model_3 = model_3.createHistogram(
"hh_model_3", x, Binning=50, YVar=dict(var=y, Binning=50))
69hh_model_4 = model_4.createHistogram(
"hh_model_4", x, Binning=50, YVar=dict(var=y, Binning=50))
70hh_model_1.SetLineColor(ROOT.kBlue)
71hh_model_2.SetLineColor(ROOT.kBlue)
72hh_model_3.SetLineColor(ROOT.kBlue)
73hh_model_4.SetLineColor(ROOT.kBlue)
76c = ROOT.TCanvas(
"rf302_utilfuncs",
"rf302_utilfuncs", 800, 800)
79ROOT.gPad.SetLeftMargin(0.20)
80hh_model_1.GetZaxis().SetTitleOffset(2.5)
81hh_model_1.Draw(
"surf")
83ROOT.gPad.SetLeftMargin(0.20)
84hh_model_2.GetZaxis().SetTitleOffset(2.5)
85hh_model_2.Draw(
"surf")
87ROOT.gPad.SetLeftMargin(0.20)
88hh_model_3.GetZaxis().SetTitleOffset(2.5)
89hh_model_3.Draw(
"surf")
91ROOT.gPad.SetLeftMargin(0.20)
92hh_model_4.GetZaxis().SetTitleOffset(2.5)
93hh_model_4.Draw(
"surf")
95c.SaveAs(
"rf302_utilfuncs.png")