23x = ROOT.RooRealVar(
"x",
"x", -10, 10)
24mean = ROOT.RooRealVar(
"mean",
"mean", -3, 3)
25sigma = ROOT.RooRealVar(
"sigma",
"sigma", 0.5, 0.1, 10)
26modelx = ROOT.RooGaussian(
"gx",
"gx", x, mean, sigma)
29a = ROOT.RooRealVar(
"a",
"a", 2, 1, 10)
30model_mean = ROOT.RooGenericPdf(
"model_mean",
"abs(mean)<a", [mean, a])
33x.setBins(1000,
"cache")
34mean.setBins(50,
"cache")
35model = ROOT.RooFFTConvPdf(
"model",
"model", mean, modelx, model_mean)
40model.setCacheObservables({x})
41model.setBufferFraction(1.0)
44projModel = model.createProjection({mean})
47d = projModel.generateBinned({x}, 1000)
50projModel.fitTo(d, Verbose=
True, PrintLevel=-1)
53frame = x.frame(Bins=25)
55projModel.plotOn(frame)
58hh = model.createHistogram(
62 YVar=dict(var=mean, Binning=50),
63 ConditionalObservables={mean},
65hh.SetTitle(
"histogram of model(x|mean)")
66hh.SetLineColor(ROOT.kBlue)
69c = ROOT.TCanvas(
"rf211_paramconv",
"rf211_paramconv", 800, 400)
72ROOT.gPad.SetLeftMargin(0.15)
73frame.GetYaxis().SetTitleOffset(1.4)
76ROOT.gPad.SetLeftMargin(0.20)
77hh.GetZaxis().SetTitleOffset(2.5)
80c.SaveAs(
"rf211_paramconv.png")