RooNDKeysPdf calculate integration problem

Hi experts,
I got a question on calculate integration for one RooProdPdf including RooNKeysPdf

First I create two RooNDKeysPdf, one is 1D the other is 2D, like this,
2D RooNDKeysPdf *pdfTrain = new RooNDKeysPdf(pdfNomTrain.c_str(), pdfNomTrain.c_str(), *varListTrain, *dataTrain, option.c_str());
1D RooNDKeysPdf *pdfTest = new RooNDKeysPdf(pdfNomTest.c_str(), pdfNomTest.c_str(), *varListTest, *dataTest, option.c_str());

  Then I use RooProdPdf to create a conditional product which has form like this  "f(x|y)g(y)"
        RooProdPdf *pdfConditional = new RooProdPdf("Conditional", "Conditional", *pdfTest, Conditional(*pdfTrain, *varConditional));

  Finally, I want to use createIntegral or createCdf on this pdfConditional, how to use this two methods in order to get a correct results?  My goal is to calculate the integration when specify some ranges for certain observable in the Pdf.


Can you post the example showing the problem ? I remind you you can also use the RooAbsReal::asTF method to get the corresponding TF1 (or TF2 object) and then use TF1::Integral to compute the integral in the way you want.

Best Regards


Thanks so much for your answers. Actually, I want to do an integral over “x, y” in the function “f(x|y)g(y)”, here f(x|y) is an conditional pdf. so I use the method below
RooProdPdf *pdfConditional = new RooProdPdf(“Conditional”, “Conditional”, *pdfTest, Conditional(*pdfTrain, *varConditional));
to construct the “f(x|y)g(y)”. pdfTest is like g(y), and pdfTrain is like f(x|y) . Is this correct???

Then I use 

RooAbsReal *predicTest = pdfConditional->createIntegral(*varISetTest, *varNSetTest) ;
to do integration. the first RooArgset varISetTest is the “y” in the “f(x|y)g(y)” , and second varNSetTest is the “x” in the “f(x|y)g(y)” .
Then I use predicTest->getValV(), find this is 1, is this normal?

However, my goal is to integrate over x and y, not only y above. but if I put x and y in one RooArgSet and use it as the first argument in createIntegral, the getValV() will give value like 1.14395e+20, why is it like this??
Finally, in the integration, I want to specify certain range only for x, and y will integrate over its whole range, how can I do this??
Thanks so much.