23x = ROOT.RooRealVar(
"x",
"x", -20, 20)
26mean = ROOT.RooRealVar(
"mean",
"mean of g1 and g2", 0, -10, 10)
27sigma_g1 = ROOT.RooRealVar(
"sigma_g1",
"width of g1", 3)
28g1 = ROOT.RooGaussian(
"g1",
"g1", x, mean, sigma_g1)
30sigma_g2 = ROOT.RooRealVar(
"sigma_g2",
"width of g2", 4, 3.0, 6.0)
31g2 = ROOT.RooGaussian(
"g2",
"g2", x, mean, sigma_g2)
33frac = ROOT.RooRealVar(
"frac",
"frac", 0.5, 0.0, 1.0)
34model = ROOT.RooAddPdf(
"model",
"model", [g1, g2], [frac])
37data = model.generate({x}, 1000)
43nll = model.createNLL(data, NumCPU=2)
46ROOT.RooMinimizer(nll).migrad()
49frame1 = frac.frame(Bins=10, Range=(0.01, 0.95), Title=
"LL and profileLL in frac")
50nll.plotOn(frame1, ShiftToZero=
True)
53frame2 = sigma_g2.frame(Bins=10, Range=(3.3, 5.0), Title=
"LL and profileLL in sigma_g2")
54nll.plotOn(frame2, ShiftToZero=
True)
62pll_frac = nll.createProfile({frac})
65pll_frac.plotOn(frame1, LineColor=
"r")
76pll_sigmag2 = nll.createProfile({sigma_g2})
79pll_sigmag2.plotOn(frame2, LineColor=
"r")
86c = ROOT.TCanvas(
"rf605_profilell",
"rf605_profilell", 800, 400)
89ROOT.gPad.SetLeftMargin(0.15)
90frame1.GetYaxis().SetTitleOffset(1.4)
93ROOT.gPad.SetLeftMargin(0.15)
94frame2.GetYaxis().SetTitleOffset(1.4)
97c.SaveAs(
"rf605_profilell.png")