24x = ROOT.RooRealVar(
"x",
"x", -20, 20)
27mean = ROOT.RooRealVar(
"mean",
"mean of g1 and g2", 0, -10, 10)
28sigma_g1 = ROOT.RooRealVar(
"sigma_g1",
"width of g1", 3)
29g1 = ROOT.RooGaussian(
"g1",
"g1", x, mean, sigma_g1)
31sigma_g2 = ROOT.RooRealVar(
"sigma_g2",
"width of g2", 4, 3.0, 6.0)
32g2 = ROOT.RooGaussian(
"g2",
"g2", x, mean, sigma_g2)
34frac = ROOT.RooRealVar(
"frac",
"frac", 0.5, 0.0, 1.0)
35model = ROOT.RooAddPdf(
"model",
"model", [g1, g2], [frac])
38data = model.generate({x}, 1000)
44nll = model.createNLL(data, NumCPU=2)
47ROOT.RooMinimizer(nll).migrad()
50frame1 = frac.frame(Bins=10, Range=(0.01, 0.95), Title=
"LL and profileLL in frac")
51nll.plotOn(frame1, ShiftToZero=
True)
54frame2 = sigma_g2.frame(Bins=10, Range=(3.3, 5.0), Title=
"LL and profileLL in sigma_g2")
55nll.plotOn(frame2, ShiftToZero=
True)
63pll_frac = nll.createProfile({frac})
66pll_frac.plotOn(frame1, LineColor=
"r")
77pll_sigmag2 = nll.createProfile({sigma_g2})
80pll_sigmag2.plotOn(frame2, LineColor=
"r")
87c = ROOT.TCanvas(
"rf605_profilell",
"rf605_profilell", 800, 400)
90ROOT.gPad.SetLeftMargin(0.15)
91frame1.GetYaxis().SetTitleOffset(1.4)
94ROOT.gPad.SetLeftMargin(0.15)
95frame2.GetYaxis().SetTitleOffset(1.4)
98c.SaveAs(
"rf605_profilell.png")