On my computer I need 51 seconds to build a kde from 50k event and 3 minutes for 100k events. I have dataset of ~1M events (should be 5 hours). I was trying to solve this issue first making a very fine histogram (10k bins) and then to create a kde from this. Is there an easy way in RooFit? I see that RooKeysPdf accepts only RooDataSet and not RooDataHist.

Hi,

You should use the TKDE class of ROOT, it should be much faster. Then you can get the result as an histogram and transform the resulting histograms as RooDataHist that can be used in a RooFIt model

Best Regards

Lorenzo

Thank you Lorenzo. I donâ€™t know if it works. My model is

`pdf(x|delta) = KDE(x + delta)`

where x is the observable and I have to find delta, so I need a continous pdf (as a sum of gaussians in the KDE), while an histogram is not.

Hi,

It should work, because you can use the interpolation capabilities of the RooHistPdf and you can make a RooHIstPdf(x) where x is a function of some other variables.

Best,

Lorenzo