18x = ROOT.RooRealVar(
"x",
"x", 0, 10)
23mean = ROOT.RooRealVar(
"mean",
"mean of gaussians", 5, 0, 10)
24sigma1 = ROOT.RooRealVar(
"sigma1",
"width of gaussians", 0.5)
25sigma2 = ROOT.RooRealVar(
"sigma2",
"width of gaussians", 1)
27sig1 = ROOT.RooGaussian(
"sig1",
"Signal component 1", x, mean, sigma1)
28sig2 = ROOT.RooGaussian(
"sig2",
"Signal component 2", x, mean, sigma2)
31a0 = ROOT.RooRealVar(
"a0",
"a0", 0.5, 0., 1.)
32a1 = ROOT.RooRealVar(
"a1",
"a1", -0.2, -1, 1.)
33bkg = ROOT.RooChebychev(
"bkg",
"Background", x, ROOT.RooArgList(a0, a1))
36sig1frac = ROOT.RooRealVar(
37 "sig1frac",
"fraction of component 1 in signal", 0.8, 0., 1.)
39 "sig",
"Signal", ROOT.RooArgList(sig1, sig2), ROOT.RooArgList(sig1frac))
42nbkg = ROOT.RooRealVar(
43 "nbkg",
"number of background events, ", 150, 0, 1000)
44nsig = ROOT.RooRealVar(
"nsig",
"number of signal events", 150, 0, 1000)
45model = ROOT.RooAddPdf(
46 "model",
"g1+g2+a", ROOT.RooArgList(bkg, sig), ROOT.RooArgList(nbkg, nsig))
66mcstudy = ROOT.RooMCStudy(
71 ROOT.RooFit.Silence(),
72 ROOT.RooFit.Extended(),
73 ROOT.RooFit.FitOptions(
76 ROOT.RooFit.PrintEvalErrors(0)))
82mcstudy.generateAndFit(1000)
89frame1 = mcstudy.plotParam(mean, ROOT.RooFit.Bins(40))
90frame2 = mcstudy.plotError(mean, ROOT.RooFit.Bins(40))
91frame3 = mcstudy.plotPull(mean, ROOT.RooFit.Bins(
92 40), ROOT.RooFit.FitGauss(ROOT.kTRUE))
95frame4 = mcstudy.plotNLL(ROOT.RooFit.Bins(40))
98hh_cor_a0_s1f = ROOT.RooAbsData.createHistogram(
99 mcstudy.fitParDataSet(),
"hh", a1, ROOT.RooFit.YVar(sig1frac))
100hh_cor_a0_a1 = ROOT.RooAbsData.createHistogram(mcstudy.fitParDataSet(),
101 "hh", a0, ROOT.RooFit.YVar(a1))
104corrHist000 = mcstudy.fitResult(0).correlationHist(
"c000")
105corrHist127 = mcstudy.fitResult(127).correlationHist(
"c127")
106corrHist953 = mcstudy.fitResult(953).correlationHist(
"c953")
109ROOT.gStyle.SetPalette(1)
110ROOT.gStyle.SetOptStat(0)
111c = ROOT.TCanvas(
"rf801_mcstudy",
"rf801_mcstudy", 900, 900)
114ROOT.gPad.SetLeftMargin(0.15)
115frame1.GetYaxis().SetTitleOffset(1.4)
118ROOT.gPad.SetLeftMargin(0.15)
119frame2.GetYaxis().SetTitleOffset(1.4)
122ROOT.gPad.SetLeftMargin(0.15)
123frame3.GetYaxis().SetTitleOffset(1.4)
126ROOT.gPad.SetLeftMargin(0.15)
127frame4.GetYaxis().SetTitleOffset(1.4)
130ROOT.gPad.SetLeftMargin(0.15)
131hh_cor_a0_s1f.GetYaxis().SetTitleOffset(1.4)
132hh_cor_a0_s1f.Draw(
"box")
134ROOT.gPad.SetLeftMargin(0.15)
135hh_cor_a0_a1.GetYaxis().SetTitleOffset(1.4)
136hh_cor_a0_a1.Draw(
"box")
138ROOT.gPad.SetLeftMargin(0.15)
139corrHist000.GetYaxis().SetTitleOffset(1.4)
140corrHist000.Draw(
"colz")
142ROOT.gPad.SetLeftMargin(0.15)
143corrHist127.GetYaxis().SetTitleOffset(1.4)
144corrHist127.Draw(
"colz")
146ROOT.gPad.SetLeftMargin(0.15)
147corrHist953.GetYaxis().SetTitleOffset(1.4)
148corrHist953.Draw(
"colz")
150c.SaveAs(
"rf801_mcstudy.png")
154ROOT.gDirectory.Add(mcstudy)