20x = ROOT.RooRealVar(
"x",
"x", -5, 5)
21y = ROOT.RooRealVar(
"y",
"y", -5, 5)
22z = ROOT.RooRealVar(
"z",
"z", -5, 5)
26 "gx",
"gx", x, ROOT.RooFit.RooConst(0), ROOT.RooFit.RooConst(1))
28 "gy",
"gy", y, ROOT.RooFit.RooConst(0), ROOT.RooFit.RooConst(1))
30 "gz",
"gz", z, ROOT.RooFit.RooConst(0), ROOT.RooFit.RooConst(1))
31sig = ROOT.RooProdPdf(
"sig",
"sig", ROOT.RooArgList(gx, gy, gz))
34px = ROOT.RooPolynomial(
"px",
"px", x, ROOT.RooArgList(
35 ROOT.RooFit.RooConst(-0.1), ROOT.RooFit.RooConst(0.004)))
36py = ROOT.RooPolynomial(
"py",
"py", y, ROOT.RooArgList(
37 ROOT.RooFit.RooConst(0.1), ROOT.RooFit.RooConst(-0.004)))
38pz = ROOT.RooPolynomial(
"pz",
"pz", z)
39bkg = ROOT.RooProdPdf(
"bkg",
"bkg", ROOT.RooArgList(px, py, pz))
42fsig = ROOT.RooRealVar(
"fsig",
"signal fraction", 0.1, 0., 1.)
43model = ROOT.RooAddPdf(
44 "model",
"model", ROOT.RooArgList(
45 sig, bkg), ROOT.RooArgList(fsig))
47data = model.generate(ROOT.RooArgSet(x, y, z), 20000)
53frame = x.frame(ROOT.RooFit.Title(
54 "Projection of 3D data and pdf on X"), ROOT.RooFit.Bins(40))
63sigyz = sig.createProjection(ROOT.RooArgSet(x))
64totyz = model.createProjection(ROOT.RooArgSet(x))
67llratio_func = ROOT.RooFormulaVar(
68 "llratio",
"log10(@0)-log10(@1)", ROOT.RooArgList(sigyz, totyz))
74data.addColumn(llratio_func)
77dataSel = data.reduce(ROOT.RooFit.Cut(
"llratio>0.7"))
80frame2 = x.frame(ROOT.RooFit.Title(
81 "Same projection on X with LLratio(y,z)>0.7"), ROOT.RooFit.Bins(40))
90mcprojData = model.generate(ROOT.RooArgSet(x, y, z), 10000)
94mcprojData.addColumn(llratio_func)
95mcprojDataSel = mcprojData.reduce(ROOT.RooFit.Cut(
"llratio>0.7"))
99model.plotOn(frame2, ROOT.RooFit.ProjWData(mcprojDataSel))
101c = ROOT.TCanvas(
"rf316_llratioplot",
"rf316_llratioplot", 800, 400)
104ROOT.gPad.SetLeftMargin(0.15)
105frame.GetYaxis().SetTitleOffset(1.4)
108ROOT.gPad.SetLeftMargin(0.15)
109frame2.GetYaxis().SetTitleOffset(1.4)
111c.SaveAs(
"rf316_llratioplot.png")