18x = ROOT.RooRealVar(
"x",
"x", -5, 5)
19y = ROOT.RooRealVar(
"y",
"y", -5, 5)
20z = ROOT.RooRealVar(
"z",
"z", -5, 5)
24 "gx",
"gx", x, ROOT.RooFit.RooConst(0), ROOT.RooFit.RooConst(1))
26 "gy",
"gy", y, ROOT.RooFit.RooConst(0), ROOT.RooFit.RooConst(1))
28 "gz",
"gz", z, ROOT.RooFit.RooConst(0), ROOT.RooFit.RooConst(1))
29sig = ROOT.RooProdPdf(
"sig",
"sig", ROOT.RooArgList(gx, gy, gz))
32px = ROOT.RooPolynomial(
"px",
"px", x, ROOT.RooArgList(
33 ROOT.RooFit.RooConst(-0.1), ROOT.RooFit.RooConst(0.004)))
34py = ROOT.RooPolynomial(
"py",
"py", y, ROOT.RooArgList(
35 ROOT.RooFit.RooConst(0.1), ROOT.RooFit.RooConst(-0.004)))
36pz = ROOT.RooPolynomial(
"pz",
"pz", z)
37bkg = ROOT.RooProdPdf(
"bkg",
"bkg", ROOT.RooArgList(px, py, pz))
40fsig = ROOT.RooRealVar(
"fsig",
"signal fraction", 0.1, 0., 1.)
41model = ROOT.RooAddPdf(
42 "model",
"model", ROOT.RooArgList(
43 sig, bkg), ROOT.RooArgList(fsig))
45data = model.generate(ROOT.RooArgSet(x, y, z), 20000)
51frame = x.frame(ROOT.RooFit.Title(
52 "Projection of 3D data and pdf on X"), ROOT.RooFit.Bins(40))
60y.setRange(
"sigRegion", -1, 1)
61z.setRange(
"sigRegion", -1, 1)
64frame2 = x.frame(ROOT.RooFit.Title(
65 "Same projection on X in signal range of (Y,Z)"), ROOT.RooFit.Bins(40))
71data.plotOn(frame2, ROOT.RooFit.CutRange(
"sigRegion"))
74model.plotOn(frame2, ROOT.RooFit.ProjectionRange(
"sigRegion"))
76c = ROOT.TCanvas(
"rf311_rangeplot",
"rf310_rangeplot", 800, 400)
79ROOT.gPad.SetLeftMargin(0.15)
80frame.GetYaxis().SetTitleOffset(1.4)
83ROOT.gPad.SetLeftMargin(0.15)
84frame2.GetYaxis().SetTitleOffset(1.4)
87c.SaveAs(
"rf311_rangeplot.png")