19x = ROOT.RooRealVar(
"x",
"x", -5, 5)
20y = ROOT.RooRealVar(
"y",
"y", -5, 5)
21z = ROOT.RooRealVar(
"z",
"z", -5, 5)
25 "gx",
"gx", x, ROOT.RooFit.RooConst(0), ROOT.RooFit.RooConst(1))
27 "gy",
"gy", y, ROOT.RooFit.RooConst(0), ROOT.RooFit.RooConst(1))
29 "gz",
"gz", z, ROOT.RooFit.RooConst(0), ROOT.RooFit.RooConst(1))
30sig = ROOT.RooProdPdf(
"sig",
"sig", ROOT.RooArgList(gx, gy, gz))
33px = ROOT.RooPolynomial(
"px",
"px", x, ROOT.RooArgList(
34 ROOT.RooFit.RooConst(-0.1), ROOT.RooFit.RooConst(0.004)))
35py = ROOT.RooPolynomial(
"py",
"py", y, ROOT.RooArgList(
36 ROOT.RooFit.RooConst(0.1), ROOT.RooFit.RooConst(-0.004)))
37pz = ROOT.RooPolynomial(
"pz",
"pz", z)
38bkg = ROOT.RooProdPdf(
"bkg",
"bkg", ROOT.RooArgList(px, py, pz))
41fsig = ROOT.RooRealVar(
"fsig",
"signal fraction", 0.1, 0., 1.)
42model = ROOT.RooAddPdf(
43 "model",
"model", ROOT.RooArgList(
44 sig, bkg), ROOT.RooArgList(fsig))
46data = model.generate(ROOT.RooArgSet(x, y, z), 20000)
52frame = x.frame(ROOT.RooFit.Title(
53 "Projection of 3D data and pdf on X"), ROOT.RooFit.Bins(40))
62sigyz = sig.createProjection(ROOT.RooArgSet(x))
63totyz = model.createProjection(ROOT.RooArgSet(x))
66llratio_func = ROOT.RooFormulaVar(
67 "llratio",
"log10(@0)-log10(@1)", ROOT.RooArgList(sigyz, totyz))
73data.addColumn(llratio_func)
76dataSel = data.reduce(ROOT.RooFit.Cut(
"llratio>0.7"))
79frame2 = x.frame(ROOT.RooFit.Title(
80 "Same projection on X with LLratio(y,z)>0.7"), ROOT.RooFit.Bins(40))
89mcprojData = model.generate(ROOT.RooArgSet(x, y, z), 10000)
93mcprojData.addColumn(llratio_func)
94mcprojDataSel = mcprojData.reduce(ROOT.RooFit.Cut(
"llratio>0.7"))
98model.plotOn(frame2, ROOT.RooFit.ProjWData(mcprojDataSel))
100c = ROOT.TCanvas(
"rf316_llratioplot",
"rf316_llratioplot", 800, 400)
103ROOT.gPad.SetLeftMargin(0.15)
104frame.GetYaxis().SetTitleOffset(1.4)
107ROOT.gPad.SetLeftMargin(0.15)
108frame2.GetYaxis().SetTitleOffset(1.4)
110c.SaveAs(
"rf316_llratioplot.png")