How to get Chi squared values for a fit

I am fitting a gaussian to the data, then in order to see that if mt fit is good or bad, what code I should use to get Chi squared value?
roomodel.cpp (1.4 KB)

you might not be able to execute it as you do not have that root file, but can you please tell me the code which I should use to get Chi squared value.

Hi,

In RoFit, you can use RooPlot::chiSquare

Lorenzo

Is it the code I should add to my macro?
Ans where will it print the value of the ChiSquare?

Hi,
You can see the example from this tutorial, ROOT: tutorials/roofit/rf109_chi2residpull.C File Reference, but you need after the fit to provide the number of fit parameters. In your case it is enough you add this line after fitting:

double chiSquare = frame->chiSquare(2);

Lorenzo

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