21x = ROOT.RooRealVar(
"x",
"x", -5, 5)
22y = ROOT.RooRealVar(
"y",
"y", -5, 5)
23z = ROOT.RooRealVar(
"z",
"z", -5, 5)
26gx = ROOT.RooGaussian(
"gx",
"gx", x, 0.0, 1.0)
27gy = ROOT.RooGaussian(
"gy",
"gy", y, 0.0, 1.0)
28gz = ROOT.RooGaussian(
"gz",
"gz", z, 0.0, 1.0)
29sig = ROOT.RooProdPdf(
"sig",
"sig", [gx, gy, gz])
32px = ROOT.RooPolynomial(
"px",
"px", x, [-0.1, 0.004])
33py = ROOT.RooPolynomial(
"py",
"py", y, [0.1, -0.004])
34pz = ROOT.RooPolynomial(
"pz",
"pz", z)
35bkg = ROOT.RooProdPdf(
"bkg",
"bkg", [px, py, pz])
38fsig = ROOT.RooRealVar(
"fsig",
"signal fraction", 0.1, 0.0, 1.0)
39model = ROOT.RooAddPdf(
"model",
"model", [sig, bkg], [fsig])
41data = model.generate({x, y, z}, 20000)
47frame = x.frame(Title=
"Projection of 3D data and pdf on X", Bins=40)
56sigyz = sig.createProjection({x})
57totyz = model.createProjection({x})
60llratio_func = ROOT.RooFormulaVar(
"llratio",
"log10(@0)-log10(@1)", [sigyz, totyz])
66data.addColumn(llratio_func)
69dataSel = data.reduce(Cut=
"llratio>0.7")
72frame2 = x.frame(Title=
"Same projection on X with LLratio(y,z)>0.7", Bins=40)
81mcprojData = model.generate({x, y, z}, 10000)
85mcprojData.addColumn(llratio_func)
86mcprojDataSel = mcprojData.reduce(Cut=
"llratio>0.7")
90model.plotOn(frame2, ProjWData=mcprojDataSel)
92c = ROOT.TCanvas(
"rf316_llratioplot",
"rf316_llratioplot", 800, 400)
95ROOT.gPad.SetLeftMargin(0.15)
96frame.GetYaxis().SetTitleOffset(1.4)
99ROOT.gPad.SetLeftMargin(0.15)
100frame2.GetYaxis().SetTitleOffset(1.4)
102c.SaveAs(
"rf316_llratioplot.png")