RooNDKeysPdf is very slow for Print()

I am trying to print a RooKeysPdf of 2 dimensions. The process takes at least 20 minutes, with the CPU at 100%. I have not tested yet if it ever finishes, but I expected this to be almost instantaneous.

Fitting with this PDF works fine.

For analytical PDFs such as RooCrystalBall, RooGaussian, or user-defined RooAbsPdf, printing is instantaneous.

Relevant code

bkg = ROOT.RooNDKeysPdf('bkg', 'Background PDF', bkg_argset, bkg_data)

ROOT 6.24/06

The Keys pdf requires to process all the input data to evaluate. The time will depend on the size of the input data set and it has not a linear scaling. How big is your data set ? I think dataset with sizes of order of 100k, 1M are too large for this class and you should use a binned pdf in that case


Thank you for the answer Lorenzo.
Indeed I have more than 100k.
Fitting with keys pdf I also observed that it takes around 35’ before starting the parallelization. I guess it has to do a similar procedure to prepare the fit.


If is reallly needed to use the keys pdf with large multi-dimensional data, we can try to provide a better and more efficient implementation, but it will take some time to have it. If you post your example, it will be great to have it as a benchmark to test the new implementation



I am sure others have a similar situation. I am working on an angular fit (2D only) where the angular distribution of the combinatorial background events is parametrized by the RooNDKeysPdf of the mass sideband events

My data isn’t public but I will try to reproduce the fit with toy data (generated in the same script) and post it here.

This will be great .Thank you very much!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.