17x = ROOT.RooRealVar(
"x",
"x", -5, 5)
18y = ROOT.RooRealVar(
"y",
"y", -5, 5)
19z = ROOT.RooRealVar(
"z",
"z", -5, 5)
23 "gx",
"gx", x, ROOT.RooFit.RooConst(0), ROOT.RooFit.RooConst(1))
25 "gy",
"gy", y, ROOT.RooFit.RooConst(0), ROOT.RooFit.RooConst(1))
27 "gz",
"gz", z, ROOT.RooFit.RooConst(0), ROOT.RooFit.RooConst(1))
28sig = ROOT.RooProdPdf(
"sig",
"sig", ROOT.RooArgList(gx, gy, gz))
31px = ROOT.RooPolynomial(
"px",
"px", x, ROOT.RooArgList(
32 ROOT.RooFit.RooConst(-0.1), ROOT.RooFit.RooConst(0.004)))
33py = ROOT.RooPolynomial(
"py",
"py", y, ROOT.RooArgList(
34 ROOT.RooFit.RooConst(0.1), ROOT.RooFit.RooConst(-0.004)))
35pz = ROOT.RooPolynomial(
"pz",
"pz", z)
36bkg = ROOT.RooProdPdf(
"bkg",
"bkg", ROOT.RooArgList(px, py, pz))
39fsig = ROOT.RooRealVar(
"fsig",
"signal fraction", 0.1, 0., 1.)
40model = ROOT.RooAddPdf(
41 "model",
"model", ROOT.RooArgList(
42 sig, bkg), ROOT.RooArgList(fsig))
44data = model.generate(ROOT.RooArgSet(x, y, z), 20000)
50frame = x.frame(ROOT.RooFit.Title(
51 "Projection of 3D data and pdf on X"), ROOT.RooFit.Bins(40))
59y.setRange(
"sigRegion", -1, 1)
60z.setRange(
"sigRegion", -1, 1)
63frame2 = x.frame(ROOT.RooFit.Title(
64 "Same projection on X in signal range of (Y,Z)"), ROOT.RooFit.Bins(40))
70data.plotOn(frame2, ROOT.RooFit.CutRange(
"sigRegion"))
73model.plotOn(frame2, ROOT.RooFit.ProjectionRange(
"sigRegion"))
75c = ROOT.TCanvas(
"rf311_rangeplot",
"rf310_rangeplot", 800, 400)
78ROOT.gPad.SetLeftMargin(0.15)
79frame.GetYaxis().SetTitleOffset(1.4)
82ROOT.gPad.SetLeftMargin(0.15)
83frame2.GetYaxis().SetTitleOffset(1.4)
86c.SaveAs(
"rf311_rangeplot.png")