24x = ROOT.RooRealVar(
"x",
"x", -20, 20)
27g1mean = ROOT.RooRealVar(
"g1mean",
"g1mean", -10)
28g1 = ROOT.RooGaussian(
"g1",
"g1", x, g1mean, 2.0)
31g2 = ROOT.RooPolynomial(
"g2",
"g2", x, [-0.03, -0.001])
37alpha = ROOT.RooRealVar(
"alpha",
"alpha", 0, 1.0)
40x.setBins(1000,
"cache")
41alpha.setBins(50,
"cache")
45lmorph = ROOT.RooIntegralMorph(
"lmorph",
"lmorph", g1, g2, x, alpha)
57lmorph.plotOn(frame1, LineColor=
"r")
59lmorph.plotOn(frame1, LineColor=
"r")
61lmorph.plotOn(frame1, LineColor=
"r")
63lmorph.plotOn(frame1, LineColor=
"r")
65lmorph.plotOn(frame1, LineColor=
"r")
67lmorph.plotOn(frame1, LineColor=
"r")
69lmorph.plotOn(frame1, LineColor=
"r")
71lmorph.plotOn(frame1, LineColor=
"r")
77hh = lmorph.createHistogram(
"hh", x, Binning=40, YVar=dict(var=alpha, Binning=40))
78hh.SetLineColor(ROOT.kBlue)
85data = lmorph.generate({x}, 1000)
88lmorph.setCacheAlpha(
True)
89lmorph.fitTo(data, Verbose=
True, PrintLevel=-1)
92frame2 = x.frame(Bins=100)
100frame3 = alpha.frame(Bins=100, Range=(0.1, 0.9))
103nll = lmorph.createNLL(data)
104nll.plotOn(frame3, ShiftToZero=
True)
106lmorph.setCacheAlpha(
False)
108c = ROOT.TCanvas(
"rf705_linearmorph",
"rf705_linearmorph", 800, 800)
111ROOT.gPad.SetLeftMargin(0.15)
112frame1.GetYaxis().SetTitleOffset(1.6)
115ROOT.gPad.SetLeftMargin(0.20)
116hh.GetZaxis().SetTitleOffset(2.5)
119ROOT.gPad.SetLeftMargin(0.15)
120frame3.GetYaxis().SetTitleOffset(1.4)
123ROOT.gPad.SetLeftMargin(0.15)
124frame2.GetYaxis().SetTitleOffset(1.4)
127c.SaveAs(
"rf705_linearmorph.png")