20x = ROOT.RooRealVar(
"x",
"x", 0, 10)
25mean = ROOT.RooRealVar(
"mean",
"mean of gaussians", 5, 0, 10)
26sigma1 = ROOT.RooRealVar(
"sigma1",
"width of gaussians", 0.5)
27sigma2 = ROOT.RooRealVar(
"sigma2",
"width of gaussians", 1)
29sig1 = ROOT.RooGaussian(
"sig1",
"Signal component 1", x, mean, sigma1)
30sig2 = ROOT.RooGaussian(
"sig2",
"Signal component 2", x, mean, sigma2)
33a0 = ROOT.RooRealVar(
"a0",
"a0", 0.5, 0.0, 1.0)
34a1 = ROOT.RooRealVar(
"a1",
"a1", -0.2, -1, 1.0)
35bkg = ROOT.RooChebychev(
"bkg",
"Background", x, [a0, a1])
38sig1frac = ROOT.RooRealVar(
"sig1frac",
"fraction of component 1 in signal", 0.8, 0.0, 1.0)
39sig = ROOT.RooAddPdf(
"sig",
"Signal", [sig1, sig2], [sig1frac])
42nbkg = ROOT.RooRealVar(
"nbkg",
"number of background events, ", 150, 0, 1000)
43nsig = ROOT.RooRealVar(
"nsig",
"number of signal events", 150, 0, 1000)
44model = ROOT.RooAddPdf(
"model",
"g1+g2+a", [bkg, sig], [nbkg, nsig])
64mcstudy = ROOT.RooMCStudy(
70 FitOptions=dict(Save=
True, PrintEvalErrors=0),
77mcstudy.generateAndFit(1000)
84frame1 = mcstudy.plotParam(mean, Bins=40)
85frame2 = mcstudy.plotError(mean, Bins=40)
86frame3 = mcstudy.plotPull(mean, Bins=40, FitGauss=
True)
89frame4 = mcstudy.plotNLL(Bins=40)
92hh_cor_a0_s1f = mcstudy.fitParDataSet().createHistogram(
"hh", a1, YVar=sig1frac)
93hh_cor_a0_a1 = mcstudy.fitParDataSet().createHistogram(
"hh", a0, YVar=a1)
96corrHist000 = mcstudy.fitResult(0).correlationHist(
"c000")
97corrHist127 = mcstudy.fitResult(127).correlationHist(
"c127")
98corrHist953 = mcstudy.fitResult(953).correlationHist(
"c953")
101ROOT.gStyle.SetPalette(1)
102ROOT.gStyle.SetOptStat(0)
103c = ROOT.TCanvas(
"rf801_mcstudy",
"rf801_mcstudy", 900, 900)
106ROOT.gPad.SetLeftMargin(0.15)
107frame1.GetYaxis().SetTitleOffset(1.4)
110ROOT.gPad.SetLeftMargin(0.15)
111frame2.GetYaxis().SetTitleOffset(1.4)
114ROOT.gPad.SetLeftMargin(0.15)
115frame3.GetYaxis().SetTitleOffset(1.4)
118ROOT.gPad.SetLeftMargin(0.15)
119frame4.GetYaxis().SetTitleOffset(1.4)
122ROOT.gPad.SetLeftMargin(0.15)
123hh_cor_a0_s1f.GetYaxis().SetTitleOffset(1.4)
124hh_cor_a0_s1f.Draw(
"box")
126ROOT.gPad.SetLeftMargin(0.15)
127hh_cor_a0_a1.GetYaxis().SetTitleOffset(1.4)
128hh_cor_a0_a1.Draw(
"box")
130ROOT.gPad.SetLeftMargin(0.15)
131corrHist000.GetYaxis().SetTitleOffset(1.4)
132corrHist000.Draw(
"colz")
134ROOT.gPad.SetLeftMargin(0.15)
135corrHist127.GetYaxis().SetTitleOffset(1.4)
136corrHist127.Draw(
"colz")
138ROOT.gPad.SetLeftMargin(0.15)
139corrHist953.GetYaxis().SetTitleOffset(1.4)
140corrHist953.Draw(
"colz")
142c.SaveAs(
"rf801_mcstudy.png")
146ROOT.gDirectory.Add(mcstudy)