23x = ROOT.RooRealVar(
"x",
"x", -10, 10)
25mean = ROOT.RooRealVar(
"mean",
"mean of gaussian", 0, -2.0, 1.8)
26sigma = ROOT.RooRealVar(
"sigma",
"width of gaussian", 5, 1, 10)
29gauss = ROOT.RooGaussian(
"gauss",
"gaussian PDF", x, mean, sigma)
36mcs = ROOT.RooMCStudy(gauss, {x}, Silence=
True, Binned=
True)
39chi2mod = ROOT.RooChi2MCSModule()
43mcs.generateAndFit(2000, 1000)
50hist_chi2 = mcs.fitParDataSet().createHistogram(
"chi2", AutoBinning=nBins)
51hist_prob = mcs.fitParDataSet().createHistogram(
"prob", AutoBinning=nBins)
57mean2 = ROOT.RooRealVar(
"mean2",
"mean of gaussian 2", 2.0)
58gauss2 = ROOT.RooGaussian(
"gauss2",
"gaussian PDF2", x, mean2, sigma)
63mcs2 = ROOT.RooMCStudy(gauss2, {x}, FitModel=gauss, Silence=
True, Binned=
True)
66chi2mod2 = ROOT.RooChi2MCSModule()
67mcs2.addModule(chi2mod2)
70mcs2.generateAndFit(2000, 1000)
78pullMeanFrame = mcs2.plotPull(mean)
82hist2_chi2 = mcs2.fitParDataSet().createHistogram(
"chi2", AutoBinning=nBins)
83hist2_prob = mcs2.fitParDataSet().createHistogram(
"prob", AutoBinning=nBins)
84hist2_chi2.SetLineColor(ROOT.kRed)
85hist2_prob.SetLineColor(ROOT.kRed)
87c = ROOT.TCanvas(
"rf802_mcstudy_addons",
"rf802_mcstudy_addons", 800, 400)
90ROOT.gPad.SetLeftMargin(0.15)
91hist_chi2.GetYaxis().SetTitleOffset(1.4)
93hist2_chi2.Draw(
"esame")
95ROOT.gPad.SetLeftMargin(0.15)
96hist_prob.GetYaxis().SetTitleOffset(1.4)
98hist2_prob.Draw(
"esame")
102c.SaveAs(
"rf802_mcstudy_addons.png")
106ROOT.gDirectory.Add(mcs)