Chi square in roofit

Dear Experts,

I am fitting a variable Bmass with double gaussian+exponential. I want to check the fit quality. Could you please tell me how to print the chi square/dof in the fitted plot? I also want to plot pull distributions for the fit plot. How to plot pull distribution?


Hi Deepak, could you post some minimal working code? These things depend on how you are doing your fit.

Dear Vcroft,

I am attaching the fitting code. Please have a look on it.

Thanks, (5.3 KB)

Okey dokey a scan of your tutorials folder should find this macro:

frame->chiSquare() ;
frame->makePullHist() ;
frame->makeResidHist() ;

That should fit in with your code quite easily

Dear Vcroft,

frame->chiSquare() ; prints only chisquare value. But I need chisquare/dof value.


Hello Deepak,

it actually prints chi2/nBins. See e.g. here:

However, it doesn’t know how many parameters the fitted function had. That’s why you have to give this as a hint for the internal calculation.
I updated the documentation, so it will show up much more clearly on the webpages in a couple of days.

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