Bind TF1 into RooFit pdf using bindPdf()

Dear all,

I have been trying to bind a python function to a TF1 and then bind this TF1 to a RooFit pdf using bindPdf(). Following the example I found online I managed to do this and I can plot said pdf without issues.
My idea was then to use this pdf for fitting. That’s where the problems start as it seems there is no way to pass a RooArgList of floating parameters to bindPdf() (none of the overloaded fucntion seem to allow this at least). I see it is possible with bindFunction() though.

I would like to know whether there would be a work around? I tried importing the python function using bindFunction() and then use RooRealSumPdf() with a fixed weight of 1 to convert the function into a pdf. It is fitting something but it seems numerically really unstable.

Thanks a lot in advance.


I understand your problem. There is a missing API in bindPdf taking the RooArgList as parameters in the RooTfnPdfBinding class. We should extend this API.
A possible alternative solution is to create a C++ functor, or better a class of type ROOT::Math::IBaseFunctionMultiDim class where in the evaluation you combine observables and parameters. For RooFit a pdf has no a-priori distinction between observables and parameters.
If you need I can send an example for this.

What you are doing should be also fine, it could be that the numerically instability are caused by the computation of the normalisation.

Best Regards


Dear Lorenzo,

Thank you for reply. If it is not too much extra efforts for you I would for sure appreciate having an example.



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