20t = ROOT.RooRealVar(
"t",
"t", 0, 5)
23tau = ROOT.RooRealVar(
"tau",
"tau", -1.54, -4, -0.1)
24model = ROOT.RooExponential(
"model",
"model", t, tau)
30eff = ROOT.RooFormulaVar(
"eff",
"0.5*(TMath::Erf((t-1)/0.5)+1)", [t])
36modelEff = ROOT.RooEffProd(
"modelEff",
"model with efficiency", model, eff)
41frame1 = t.frame(Title=
"Efficiency")
42eff.plotOn(frame1, LineColor=
"r")
44frame2 = t.frame(Title=
"Pdf with and without efficiency")
46model.plotOn(frame2, LineStyle=
"--")
47modelEff.plotOn(frame2)
54data = modelEff.generate({t}, 10000)
57modelEff.fitTo(data, PrintLevel=-1)
60frame3 = t.frame(Title=
"Fitted pdf with efficiency")
62modelEff.plotOn(frame3)
64c = ROOT.TCanvas(
"rf703_effpdfprod",
"rf703_effpdfprod", 1200, 400)
67ROOT.gPad.SetLeftMargin(0.15)
68frame1.GetYaxis().SetTitleOffset(1.4)
71ROOT.gPad.SetLeftMargin(0.15)
72frame2.GetYaxis().SetTitleOffset(1.6)
75ROOT.gPad.SetLeftMargin(0.15)
76frame3.GetYaxis().SetTitleOffset(1.6)
79c.SaveAs(
"rf703_effpdfprod.png")