23t = ROOT.RooRealVar(
"t",
"t", 0, 5)
26tau = ROOT.RooRealVar(
"tau",
"tau", -1.54, -4, -0.1)
27model = ROOT.RooExponential(
"model",
"model", t, tau)
33eff = ROOT.RooFormulaVar(
"eff",
"0.5*(TMath::Erf((t-1)/0.5)+1)", ROOT.RooArgList(t))
39modelEff = ROOT.RooEffProd(
"modelEff",
"model with efficiency", model, eff)
44frame1 = t.frame(ROOT.RooFit.Title(
"Efficiency"))
45eff.plotOn(frame1, ROOT.RooFit.LineColor(ROOT.kRed))
47frame2 = t.frame(ROOT.RooFit.Title(
"Pdf with and without efficiency"))
49model.plotOn(frame2, ROOT.RooFit.LineStyle(ROOT.kDashed))
50modelEff.plotOn(frame2)
57data = modelEff.generate(ROOT.RooArgSet(t), 10000)
63frame3 = t.frame(ROOT.RooFit.Title(
"Fitted pdf with efficiency"))
65modelEff.plotOn(frame3)
67c = ROOT.TCanvas(
"rf703_effpdfprod",
"rf703_effpdfprod", 1200, 400)
70ROOT.gPad.SetLeftMargin(0.15)
71frame1.GetYaxis().SetTitleOffset(1.4)
74ROOT.gPad.SetLeftMargin(0.15)
75frame2.GetYaxis().SetTitleOffset(1.6)
78ROOT.gPad.SetLeftMargin(0.15)
79frame3.GetYaxis().SetTitleOffset(1.6)
82c.SaveAs(
"rf703_effpdfprod.png")