Fit to RooDataSet incorrect but finished with no errors

I’ve written a script that generates a RooDataSet from a product of 2 PDFs, a RooGenericPdf and a RooExponential. Then I fit the DataSet with the product of 2 pdfs that were used to generate the data, the parameters in the generic pdf are fixed and slope of the exponential can vary.

When I run the fit it finishes with no errors but the slope of the exponential is not the same as the slope used to generate the dataset and it clearly incorrect when plotted with the dataset. There are no errors to indicate what is going wrong here but the answer is incorrect. I’ve attached the script and the output I get when I run it.

Any help about what I’m doing wrong you be greatly appreciated.

Thanks,
Hannah
generate_and_fit_decay_time.cxx (3.44 KB)
plots_forgenerate_and_fit_decay_time.root (18 KB)
output.txt (3.93 KB)

Hi,

Your model is not correctly defined. You should not use the RooProdPdf in your case because your are in reality multiplying a pdf (an exponential) with an acceptance function, which is not a pdf.
The right class to use in this case is the RooEffProd, which compute correctly the normalisation.

Attached you find your modified working script

Best Regards

Lorenzo
generate_and_fit_decay_time.cxx (3.72 KB)