Integration of RooProdPdf

I have been working with some code that uses the product of three functions to generate a data set. I have implemented the product of these functions both as a RooProdPdf of three functions RooGenericPdf’s, and as one long and messy RooGenericPdf. When I create integrals of these two pdfs, there is a discrepancy between the results.

Is this result due to the intended performance of integrating a RooProdPdf, or a bug? I have attached a piece of code which illustrates the differing results.

integTest.C (1.4 KB)

I’ve been using a work-around for this problem for the past few months, but now things are getting difficult.

Are there any comments on this?


Sorry about not answering your post earlier! I realized that I had already started to work on an answer (as I found that I downloaded your example already last year), but then I forgot the post the result

The reason you get a different answer is that an integration over a pdf for which the normalization is not specified is undefined. A pdf has only a well-defined value when
the set of normalization observables is defined (in getVal() one does this by passing
the set of normalization observables as argument). RooProdPdf has a different
strategy for dividing what is in the ‘numerator’ and ‘denominator’ of the normalized
PDF expression than RooGenericPdf, hence the raw integral over E will give you a different answer.

One can quickly verify that the numeric calculation in both cases in 2 ways:

  1. If you change RooGenericPdf in RooFormulaVar and RooProdPdf in RooProduct
    you simply integrate functions, rather than pdfs and you’ll see you get the
    same answer for both integrals

  2. If you stay with pdfs, and you evaluate clean.getVal(RooArgSet(E)) and
    messy.getVal(RooArgSet(E)) you see that both normalized pdfs also
    return the same value.