Multidimensional models: working with parameterized ranges in a fit. ROOT.This an example of a fit with an acceptance that changes per-event
pdf = exp(-t/tau) with t[tmin,5]
where t and tmin are both observables in the dataset
import ROOT
t = ROOT.RooRealVar("t", "t", 0, 5)
tmin = ROOT.RooRealVar("tmin", "tmin", 0, 0, 5)
t.setRange(tmin, ROOT.RooFit.RooConst(t.getMax()))
tau = ROOT.RooRealVar("tau", "tau", -1.54, -10, -0.1)
model = ROOT.RooExponential("model", "model", t, tau)
dall = model.generate(ROOT.RooArgSet(t), 10000)
tmp = ROOT.RooGaussian("gmin", "gmin", tmin, ROOT.RooFit.RooConst(
0), ROOT.RooFit.RooConst(0.5)).generate(ROOT.RooArgSet(tmin), 5000)
dacc = model.generate(ROOT.RooArgSet(t), ROOT.RooFit.ProtoData(tmp))
r = model.fitTo(dacc, ROOT.RooFit.Save())
frame = t.frame(ROOT.RooFit.Title("Fit to data with per-event acceptance"))
dall.plotOn(frame, ROOT.RooFit.MarkerColor(ROOT.kRed),
ROOT.RooFit.LineColor(ROOT.kRed))
model.plotOn(frame)
dacc.plotOn(frame)
r.Print("v")
c = ROOT.TCanvas("rf314_paramranges", "rf314_paramranges", 600, 600)
ROOT.gPad.SetLeftMargin(0.15)
frame.GetYaxis().SetTitleOffset(1.6)
frame.Draw()
c.SaveAs("rf314_paramranges.png")
- Date
- February 2018
- Author
- Clemens Lange, Wouter Verkerke (C++ version)
Definition in file rf314_paramfitrange.py.