Basic functionality: examples on normalization and integration of pdfs, construction of cumulative distribution functions from monodimensional pdfs
from __future__ import print_function
import ROOT
x = ROOT.RooRealVar("x", "x", -10, 10)
gx = ROOT.RooGaussian("gx", "gx", x, ROOT.RooFit.RooConst(-2), ROOT.RooFit.RooConst(3))
print("gx = ", gx.getVal())
nset = {x}
print("gx_Norm[x] = ", gx.getVal(nset))
igx = gx.createIntegral({x})
print("gx_Int[x] = ", igx.getVal())
x.setRange("signal", -5, 5)
xset = {x}
igx_sig = gx.createIntegral(xset, NormSet=xset, Range="signal")
print("gx_Int[x|signal]_Norm[x] = ", igx_sig.getVal())
gx_cdf = gx.createCdf({x})
frame = x.frame(Title="cdf of Gaussian pdf")
gx_cdf.plotOn(frame)
c = ROOT.TCanvas("rf110_normintegration", "rf110_normintegration", 600, 600)
ROOT.gPad.SetLeftMargin(0.15)
frame.GetYaxis().SetTitleOffset(1.6)
frame.Draw()
c.SaveAs("rf110_normintegration.png")
- Date
- February 2018
- Authors
- Clemens Lange, Wouter Verkerke (C++ version)
Definition in file rf110_normintegration.py.