Hi all,
I would like to perform extended fits over a particular range, called fitRange
. Even when I specify the range, however, I still get warnings about the PDF being evaluated outside of the range. My question is: how do I make sure the normalization/evaluation of the PDF is constrained to the range I provide?
As a demonstration, I have the following:
- A PDF = 1/x, so it’s undefined at x=0
- x[0,3], so 0 is within the range of the variable
x
- I call PDF->expectedEvents() to trigger this warning, however I also see the warning come up inside fits
The standalone code to reproduce this:
from __future__ import division
import sys
sys.path = ["/home/prime/Downloads/buildRoot/lib/"] + sys.path
from ROOT import *
from ROOT.RooStats import *
# This is the range I want to operate over:
fitMin=1
fitMax = 3
# Set up workspace
w = RooWorkspace("w","w")
w.factory("x[0,3]")
w.factory("EXPR::pdf('1/x',x)")
w.var("x").setRange("fitRange",fitMin,fitMax)
# make PDF
pdfNorm = RooRealVar("pdfNorm","pdfNorm",1);
pdfExpr = w.pdf("pdf")
pdfExtExpr = RooExtendPdf("pdfExt","pdfExt",pdfExpr,pdfNorm,"fitRange")
print pdfExtExpr.expectedEvents(RooArgSet(w.var("x")))
# This does not work:
# pdfExtExpr.expectedEvents(RooArgSet(w.var("x")),RooFit.Range("fitRange"))
The warning I am concerned about:
[#0] WARNING:Integration -- RooIntegrator1D::integral: integral of pdf over range (0,3) did not converge after 20 steps
[1] h = 1 , s = 0.5
[2] h = 0.25 , s = 1.25
[3] h = 0.0625 , s = 1.95833
[4] h = 0.015625 , s = 2.65536
[5] h = 0.00390625 , s = 3.34948
[6] h = 0.000976562 , s = 4.04287
[7] h = 0.000244141 , s = 4.73608