Integral too slow with certain range

Hi,
I got a strange questions. I use createIntegral to compute 2D integral of my PDF, but when I specify some range for one of the two observables, the integral becomes very very slow, why? My code is like this:

  RooNDKeysPdf *pdfTrain = new RooNDKeysPdf(pdfNomTrain.c_str(), pdfNomTrain.c_str(), *varListTrain, *dataTrain, option.c_str());
    RooNDKeysPdf *pdfTest = new RooNDKeysPdf(pdfNomTest.c_str(), pdfNomTest.c_str(), *varListTest, *dataTest, option.c_str());


    // product conditional pdf
    RooRealVar *varConditional = (RooRealVar*)varListTrain->at(0);
    RooProdPdf *pdfConditional = new RooProdPdf("Conditional", "Conditional", *pdfTest, Conditional(*pdfTrain, *varConditional));
    //pdfConditional->Print("v");

 

    varConditional->setRange("inte", 10, 50) ;
    RooArgSet *varSetTrain = new RooArgSet(*varListTrain);
    pdfConditional->forceAnalyticalInt(*varConditional);
    RooAbsReal *predicTest = pdfConditional->createIntegral(*varSetTrain, NormSet(*varSetTrain), Range("inte"));

    If the range "inte" is removed, the integral is very very quick. But adding the range, the integral becomes very very slow, Can anyone tell me the reason and how to fix this? Many thanks!!

Hi,

Can you please post a running example showing this problem, so it can be investigate

Thanks

Lorenzo

Hi,
here is my code, line 295 is very very slow. and also line 315 is very very slow, but line 317 is very fast. Do you know why? Thanks for your help
code.cpp (17.6 KB)

Any one has idea?? Thanks a lot