21x = ROOT.RooRealVar(
"x",
"x", -10, 10)
23mean = ROOT.RooRealVar(
"mean",
"mean of gaussian", 0, -2.0, 1.8)
24sigma = ROOT.RooRealVar(
"sigma",
"width of gaussian", 5, 1, 10)
27gauss = ROOT.RooGaussian(
"gauss",
"gaussian PDF", x, mean, sigma)
34mcs = ROOT.RooMCStudy(gauss, {x}, ROOT.RooFit.Silence(), ROOT.RooFit.Binned())
37chi2mod = ROOT.RooChi2MCSModule()
41mcs.generateAndFit(2000, 1000)
45hist_chi2 = ROOT.RooAbsData.createHistogram(mcs.fitParDataSet(),
"chi2")
46hist_prob = ROOT.RooAbsData.createHistogram(mcs.fitParDataSet(),
"prob")
52mean2 = ROOT.RooRealVar(
"mean2",
"mean of gaussian 2", 2.0)
53gauss2 = ROOT.RooGaussian(
"gauss2",
"gaussian PDF2", x, mean2, sigma)
58mcs2 = ROOT.RooMCStudy(gauss2, {x}, ROOT.RooFit.FitModel(gauss), ROOT.RooFit.Silence(), ROOT.RooFit.Binned())
61chi2mod2 = ROOT.RooChi2MCSModule()
62mcs2.addModule(chi2mod2)
65mcs2.generateAndFit(2000, 1000)
73pullMeanFrame = mcs2.plotPull(mean)
77hist2_chi2 = ROOT.RooAbsData.createHistogram(mcs2.fitParDataSet(),
"chi2")
78hist2_prob = ROOT.RooAbsData.createHistogram(mcs2.fitParDataSet(),
"prob")
79hist2_chi2.SetLineColor(ROOT.kRed)
80hist2_prob.SetLineColor(ROOT.kRed)
82c = ROOT.TCanvas(
"rf802_mcstudy_addons",
"rf802_mcstudy_addons", 800, 400)
85ROOT.gPad.SetLeftMargin(0.15)
86hist_chi2.GetYaxis().SetTitleOffset(1.4)
88hist2_chi2.Draw(
"esame")
90ROOT.gPad.SetLeftMargin(0.15)
91hist_prob.GetYaxis().SetTitleOffset(1.4)
93hist2_prob.Draw(
"esame")
97c.SaveAs(
"rf802_mcstudy_addons.png")
101ROOT.gDirectory.Add(mcs)