RooFit: setRange doesn't works with createIntegral

Hi all,

I’m using the PyRoot implementation of RooFit and it works great. IHowever, 'm running into an issue tonight though trying to get the integral of a PDF.

I’ve rewritten the rf308_normintegration2d.C tutorial and I attach it to this post. The tutorial shows how you can define a sub-range and integrate the PDF only over that sub-range.

[code]# Define a range named “signal” in x from -5,5
x.setRange(“signal”,-5,5)
y.setRange(“signal”,-3,3)

Create an integral of gxy_Norm[x,y] over x and y in range “signal”

This is the fraction of of p.d.f. gxy_Norm[x,y] which is in the

range named “signal”

igxy_sig = gxy.createIntegral(RooArgSet(x,y),RooFit.NormSet(RooArgSet(x,y)),RooFit.Range(“signal”))
print “gx_Int[x,y|signal]_Norm[x,y] = %f” % ( igxy_sig.getVal() )[/code]

When I run the C version, I get

gx_Int[x,y|signal]_Norm[x,y] = 0.572035

The python version gives me

gx_Int[x,y|signal]_Norm[x,y] = 1.000000

The rest of the output is the same. It seems to not like the RooFit.Range(XXX).

Any thoughts?

Matt
rf308_normintegration2d.py (3.17 KB)

Matt,

looks like a standard RooFit problem where references are taken to temporaries (which are collected earlier in python, due to ref-counting, then in C++ where their lifetime is the statement). Change:

argset = RooArgSet(x,y) igxy_sig = gxy.createIntegral(argset,RooFit.NormSet(argset),RooFit.Range("signal"))
HTH,
Wim

Awesome. Works like a charm. Thanks as always, Wim.
Matt