21x = ROOT.RooRealVar(
"x",
"x", -20, 20)
24mean = ROOT.RooRealVar(
"mean",
"mean of g1 and g2", 0, -1, 1)
25sigma_g1 = ROOT.RooRealVar(
"sigma_g1",
"width of g1", 2)
26g1 = ROOT.RooGaussian(
"g1",
"g1", x, mean, sigma_g1)
28sigma_g2 = ROOT.RooRealVar(
"sigma_g2",
"width of g2", 4, 3.0, 5.0)
29g2 = ROOT.RooGaussian(
"g2",
"g2", x, mean, sigma_g2)
31frac = ROOT.RooRealVar(
"frac",
"frac", 0.5, 0.0, 1.0)
32model = ROOT.RooAddPdf(
"model",
"model", [g1, g2], [frac])
35data = model.generate({x}, 1000)
40r = model.fitTo(data, Save=
True, PrintLevel=-1)
45parabPdf = r.createHessePdf({frac, mean, sigma_g2})
51d = parabPdf.generate({mean, sigma_g2, frac}, 100000)
55hh_3d = parabPdf.createHistogram(
"mean,sigma_g2,frac", 25, 25, 25)
56hh_3d.SetFillColor(ROOT.kBlue)
61pdf_sigmag2_frac = parabPdf.createProjection({mean})
62pdf_mean_frac = parabPdf.createProjection({sigma_g2})
63pdf_mean_sigmag2 = parabPdf.createProjection({frac})
66hh_sigmag2_frac = pdf_sigmag2_frac.createHistogram(
"sigma_g2,frac", 50, 50)
67hh_mean_frac = pdf_mean_frac.createHistogram(
"mean,frac", 50, 50)
68hh_mean_sigmag2 = pdf_mean_sigmag2.createHistogram(
"mean,sigma_g2", 50, 50)
69hh_mean_frac.SetLineColor(ROOT.kBlue)
70hh_sigmag2_frac.SetLineColor(ROOT.kBlue)
71hh_mean_sigmag2.SetLineColor(ROOT.kBlue)
74ROOT.gStyle.SetCanvasPreferGL(
True)
75ROOT.gStyle.SetPalette(1)
76c1 = ROOT.TCanvas(
"rf608_fitresultaspdf_1",
"rf608_fitresultaspdf_1", 600, 600)
79c1.SaveAs(
"rf608_fitresultaspdf_1.png")
82c2 = ROOT.TCanvas(
"rf608_fitresultaspdf_2",
"rf608_fitresultaspdf_2", 900, 600)
85ROOT.gPad.SetLeftMargin(0.15)
86hh_mean_sigmag2.GetZaxis().SetTitleOffset(1.4)
87hh_mean_sigmag2.Draw(
"surf3")
89ROOT.gPad.SetLeftMargin(0.15)
90hh_sigmag2_frac.GetZaxis().SetTitleOffset(1.4)
91hh_sigmag2_frac.Draw(
"surf3")
93ROOT.gPad.SetLeftMargin(0.15)
94hh_mean_frac.GetZaxis().SetTitleOffset(1.4)
95hh_mean_frac.Draw(
"surf3")
98tmp1 = d.createHistogram(mean, sigma_g2, 50, 50)
99tmp2 = d.createHistogram(sigma_g2, frac, 50, 50)
100tmp3 = d.createHistogram(mean, frac, 50, 50)
103ROOT.gPad.SetLeftMargin(0.15)
104tmp1.GetZaxis().SetTitleOffset(1.4)
107ROOT.gPad.SetLeftMargin(0.15)
108tmp2.GetZaxis().SetTitleOffset(1.4)
111ROOT.gPad.SetLeftMargin(0.15)
112tmp3.GetZaxis().SetTitleOffset(1.4)
115c2.SaveAs(
"rf608_fitresultaspdf_2.png")