19x = ROOT.RooRealVar(
"x",
"x", 0, 10)
24mean = ROOT.RooRealVar(
"mean",
"mean of gaussians", 5, 0, 10)
25sigma1 = ROOT.RooRealVar(
"sigma1",
"width of gaussians", 0.5)
26sigma2 = ROOT.RooRealVar(
"sigma2",
"width of gaussians", 1)
28sig1 = ROOT.RooGaussian(
"sig1",
"Signal component 1", x, mean, sigma1)
29sig2 = ROOT.RooGaussian(
"sig2",
"Signal component 2", x, mean, sigma2)
32a0 = ROOT.RooRealVar(
"a0",
"a0", 0.5, 0., 1.)
33a1 = ROOT.RooRealVar(
"a1",
"a1", -0.2, -1, 1.)
34bkg = ROOT.RooChebychev(
"bkg",
"Background", x, ROOT.RooArgList(a0, a1))
37sig1frac = ROOT.RooRealVar(
38 "sig1frac",
"fraction of component 1 in signal", 0.8, 0., 1.)
40 "sig",
"Signal", ROOT.RooArgList(sig1, sig2), ROOT.RooArgList(sig1frac))
43nbkg = ROOT.RooRealVar(
44 "nbkg",
"number of background events, ", 150, 0, 1000)
45nsig = ROOT.RooRealVar(
"nsig",
"number of signal events", 150, 0, 1000)
46model = ROOT.RooAddPdf(
47 "model",
"g1+g2+a", ROOT.RooArgList(bkg, sig), ROOT.RooArgList(nbkg, nsig))
67mcstudy = ROOT.RooMCStudy(
72 ROOT.RooFit.Silence(),
73 ROOT.RooFit.Extended(),
74 ROOT.RooFit.FitOptions(
77 ROOT.RooFit.PrintEvalErrors(0)))
83mcstudy.generateAndFit(1000)
90frame1 = mcstudy.plotParam(mean, ROOT.RooFit.Bins(40))
91frame2 = mcstudy.plotError(mean, ROOT.RooFit.Bins(40))
92frame3 = mcstudy.plotPull(mean, ROOT.RooFit.Bins(
93 40), ROOT.RooFit.FitGauss(ROOT.kTRUE))
96frame4 = mcstudy.plotNLL(ROOT.RooFit.Bins(40))
99hh_cor_a0_s1f = ROOT.RooAbsData.createHistogram(
100 mcstudy.fitParDataSet(),
"hh", a1, ROOT.RooFit.YVar(sig1frac))
101hh_cor_a0_a1 = ROOT.RooAbsData.createHistogram(mcstudy.fitParDataSet(),
102 "hh", a0, ROOT.RooFit.YVar(a1))
105corrHist000 = mcstudy.fitResult(0).correlationHist(
"c000")
106corrHist127 = mcstudy.fitResult(127).correlationHist(
"c127")
107corrHist953 = mcstudy.fitResult(953).correlationHist(
"c953")
110ROOT.gStyle.SetPalette(1)
111ROOT.gStyle.SetOptStat(0)
112c = ROOT.TCanvas(
"rf801_mcstudy",
"rf801_mcstudy", 900, 900)
115ROOT.gPad.SetLeftMargin(0.15)
116frame1.GetYaxis().SetTitleOffset(1.4)
119ROOT.gPad.SetLeftMargin(0.15)
120frame2.GetYaxis().SetTitleOffset(1.4)
123ROOT.gPad.SetLeftMargin(0.15)
124frame3.GetYaxis().SetTitleOffset(1.4)
127ROOT.gPad.SetLeftMargin(0.15)
128frame4.GetYaxis().SetTitleOffset(1.4)
131ROOT.gPad.SetLeftMargin(0.15)
132hh_cor_a0_s1f.GetYaxis().SetTitleOffset(1.4)
133hh_cor_a0_s1f.Draw(
"box")
135ROOT.gPad.SetLeftMargin(0.15)
136hh_cor_a0_a1.GetYaxis().SetTitleOffset(1.4)
137hh_cor_a0_a1.Draw(
"box")
139ROOT.gPad.SetLeftMargin(0.15)
140corrHist000.GetYaxis().SetTitleOffset(1.4)
141corrHist000.Draw(
"colz")
143ROOT.gPad.SetLeftMargin(0.15)
144corrHist127.GetYaxis().SetTitleOffset(1.4)
145corrHist127.Draw(
"colz")
147ROOT.gPad.SetLeftMargin(0.15)
148corrHist953.GetYaxis().SetTitleOffset(1.4)
149corrHist953.Draw(
"colz")
151c.SaveAs(
"rf801_mcstudy.png")
155ROOT.gDirectory.Add(mcstudy)