RooFit 2D-PDF from TKDTree or 2D RooHistPdf interpolated

Dear experts,

I would like to extract a RooFit unbinned 2D-PDF from a MC simulation.

The first option I considered was to use RooNDKeysPdf but the computation time is way too long.

The second case I considered was to define a RooHistPdf from a TH2F and set an interpolation order. RooFit does not seems to complain but when I plot the PDF it does not look interpolated (it is basically a 2D step fonction). Is this expected?

The third case I considered was to use a TKDTree. I manage to build the tree, but then I do not know how to extra a 2D RooFit PDF from it.

Do you know a solution to my problem?

Thanks for your help
Matthias

Hi,

For the RooHistPdf I think you have an option about the interpolation level to be used when constructing the RooHistPdf.

For building rom a TKDTree you might try to use the TKDTreeBinning class to make 1 2D histograms with binning based on a TKDTree.
See root.cern.ch/root/html/TKDTreeBinning.html
But then you would need to implement your self a wrapper o a RooAbsPdf of that class implementing according the evaluate() function.

Another possibility is to make a new 2-d key based class but using the TKDTree inside. This is more work, we would like to do it in the long term, so if you are interested in contributing to this, we would be grateful and include this contribution in ROOT.

Best Regards

Lorenzo

Hi Lorenzo,

Thank you for your message.

For the RooHistPdf I think you have an option about the interpolation level to be used when constructing the RooHistPdf.

Yes, actually there is one and it works well for 1D histograms, but for some reasons i does not work for multidimensional histograms. RooFit does not complain if I set an interpolation order in the constructor and I end up with a 2D step function. Is this expected or is it a bug?

Unfortunately I need to finish pretty quickly my analysis and will not be able to dedicate too much time to this, but I will have a look at the TKDTreeBinning class and come back to you.

Best regards
Matthias

Hi,
The interpolation should work also for the 2d case. DO you have an example macro reproducing this problem ?

Best Regards

Lorenzo

Dear Lorenzo,

Thank you for your message.

I am sorry I made a mistake, the 2D interpolation is indeed working it is just that I do not have enough statistics to make a smooth template.

It would be nice somehow to take into account the bin error from the TH* when computing the interpolation. It is of course easier to say than to implement.

I will have a try at the TKDTreeBinning and come back to you if necessary.

Thanks for your help
Cheers
Matthias

Dear Lorenzo,

I actually have an extra-question: does TKDE support weighted data?

Cheers
Matthias

Hi,
Currently TKDE does not support weighted data sets as the class RooKeysPdf does. It could probably be added, if needed

Cheers

Lorenzo

Dear Lorenzo,

Thank you very much for your quick answer, that would be a great feature! I am actually at CERN until wednesday so we can meet in you want.

Cheers
Matthias