23x = ROOT.RooRealVar(
"x",
"x", -20, 20)
26g1mean = ROOT.RooRealVar(
"g1mean",
"g1mean", -10)
27g1 = ROOT.RooGaussian(
"g1",
"g1", x, g1mean, 2.0)
30g2 = ROOT.RooPolynomial(
"g2",
"g2", x, [-0.03, -0.001])
36alpha = ROOT.RooRealVar(
"alpha",
"alpha", 0, 1.0)
39x.setBins(1000,
"cache")
40alpha.setBins(50,
"cache")
44lmorph = ROOT.RooIntegralMorph(
"lmorph",
"lmorph", g1, g2, x, alpha)
56lmorph.plotOn(frame1, LineColor=
"r")
58lmorph.plotOn(frame1, LineColor=
"r")
60lmorph.plotOn(frame1, LineColor=
"r")
62lmorph.plotOn(frame1, LineColor=
"r")
64lmorph.plotOn(frame1, LineColor=
"r")
66lmorph.plotOn(frame1, LineColor=
"r")
68lmorph.plotOn(frame1, LineColor=
"r")
70lmorph.plotOn(frame1, LineColor=
"r")
76hh = lmorph.createHistogram(
"hh", x, Binning=40, YVar=dict(var=alpha, Binning=40))
77hh.SetLineColor(ROOT.kBlue)
84data = lmorph.generate({x}, 1000)
87lmorph.setCacheAlpha(
True)
88lmorph.fitTo(data, Verbose=
True, PrintLevel=-1)
91frame2 = x.frame(Bins=100)
99frame3 = alpha.frame(Bins=100, Range=(0.1, 0.9))
102nll = lmorph.createNLL(data)
103nll.plotOn(frame3, ShiftToZero=
True)
105lmorph.setCacheAlpha(
False)
107c = ROOT.TCanvas(
"rf705_linearmorph",
"rf705_linearmorph", 800, 800)
110ROOT.gPad.SetLeftMargin(0.15)
111frame1.GetYaxis().SetTitleOffset(1.6)
114ROOT.gPad.SetLeftMargin(0.20)
115hh.GetZaxis().SetTitleOffset(2.5)
118ROOT.gPad.SetLeftMargin(0.15)
119frame3.GetYaxis().SetTitleOffset(1.4)
122ROOT.gPad.SetLeftMargin(0.15)
123frame2.GetYaxis().SetTitleOffset(1.4)
126c.SaveAs(
"rf705_linearmorph.png")