21x = ROOT.RooRealVar(
"x",
"x", 0, 10)
25mean = ROOT.RooRealVar(
"mean",
"mean of gaussians", 5)
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., 1.)
34a1 = ROOT.RooRealVar(
"a1",
"a1", -0.2, 0., 1.)
35bkg = ROOT.RooChebychev(
"bkg",
"Background", x, ROOT.RooArgList(a0, a1))
43sig1frac = ROOT.RooRealVar(
44 "sig1frac",
"fraction of component 1 in signal", 0.8, 0., 1.)
45sig = ROOT.RooAddPdf(
"sig",
"Signal", ROOT.RooArgList(
46 sig1, sig2), ROOT.RooArgList(sig1frac))
52bkgfrac = ROOT.RooRealVar(
"bkgfrac",
"fraction of background", 0.5, 0., 1.)
53model = ROOT.RooAddPdf(
54 "model",
"g1+g2+a", ROOT.RooArgList(bkg, sig), ROOT.RooArgList(bkgfrac))
60data = model.generate(ROOT.RooArgSet(x), 1000)
66xframe = x.frame(ROOT.RooFit.Title(
67 "Example of composite pdf=(sig1+sig2)+bkg"))
72ras_bkg = ROOT.RooArgSet(bkg)
73model.plotOn(xframe, ROOT.RooFit.Components(ras_bkg),
74 ROOT.RooFit.LineStyle(ROOT.kDashed))
77ras_bkg_sig2 = ROOT.RooArgSet(bkg, sig2)
78model.plotOn(xframe, ROOT.RooFit.Components(ras_bkg_sig2),
79 ROOT.RooFit.LineStyle(ROOT.kDotted))
91model2 = ROOT.RooAddPdf(
112model2.plotOn(xframe, ROOT.RooFit.LineColor(ROOT.kRed),
113 ROOT.RooFit.LineStyle(ROOT.kDashed))
116 ROOT.RooFit.Components(ras_bkg_sig2),
117 ROOT.RooFit.LineColor(
119 ROOT.RooFit.LineStyle(
124c = ROOT.TCanvas(
"rf201_composite",
"rf201_composite", 600, 600)
125ROOT.gPad.SetLeftMargin(0.15)
126xframe.GetYaxis().SetTitleOffset(1.4)
129c.SaveAs(
"rf201_composite.png")