I am new to Roofit and am fitting a function to some data.
Plotting the RooDataHist and (fitted) RooGenericPdf make it look like the fit has worked. However if I obtain the fit parameters and plot an equivalent TH1 and TF1, the RooGenericPdf and TF1 do not agree.
I suspect I am misunderstanding something. Would someone be able to explain what I am doing incorrectly please?
The attached macro recreates the issue.
Thanks in advance,
example.C (2.8 KB)
The difference is that in RooFit the PDF is normalised to 1, while the TF1 function is not. When you are plotting the PDF in RooFit is scaled to get the correct normalisation on the data. So you would need to scale the TF1 accordingly.
Also your fit does not work correctly because you are fitting both shape and normalisation. Either you build an extended PDF where you add the normalisation or you need to just fit the function shape (setting the parameter C in your macro to a constant value).
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.