Breit Wigner Fitting Problem--Large (chi2/ndf) value

Hello All,

I have been trying to fit my histogram with linear background+breitwigner peak function. As you can see the attached histograms the fit looks nice, but if I try to subtract fit function from the data histogram, result is not straight line and this makes me confused.

Also, there are big difference between both background constant and error and background slope and the error like,
22.06±10.03 for the constant,
-45.12±19.57 for the slope.

Moreover chi2/ndf ratio is about 17.2 (as far as I know if this value smaller than 3, this fit is reasonable)

I think I have a big mistake somewhere, but I couldn’t find it. So, could you please help me to find where is the problem on this macro.

In the attached files, you might find result histograms, macro and the root file.

Thank you very much,

Best regards,


Dear Rooters,

I have also one more question about SetParameters function.
I think users should define arbitrary parameters, but set all the parameters to 1, I get following warning ,

Warning in : Abnormal termination of minimization.

So, my question is why I’m getting this error and is there a simple way to guess fit parameters at the beginning, especially for linear background .

Thank you very much,

With my best regards,



first of all your function does not model very well the data. If you for example use a Gaussian instead of a Breit-Wigner your fit will be better (you’ll get a lower chi square).

Concerning your second question, before performing a fit you must set the initial values of your parameters to some reasonable values, otherwise the minimization program (Minuit) may fail to converge to the minimum.
It is unfortunately impossible to predict automatically these values in a generic way (valid for all user defined functions). Only when fitting with some simple functions (like gaussian or exponential) we can pre-compute these values.
You can try interactively the best parameters by using the fit panel GUI.
See … g-fitpanel


Dear Lorenzo,

Thank you very much for the reply. I have already fitted the histogram with gaussian. You are right, chi2/ndf value now about 2.83. So, because of this is smaller than 3 can we say this fit is acceptable?

Also, there is still the peak at difference histogram. Should I add another function to the fit?

Also, I have one more technical question, what is the meaning of following line,


specifically why I’m using 3 for this.

Because of I’m a beginner, I could miss many many things. I would be grateful if you could help me to understand.

Kind regards,