Suppressing warning from histogram fitting

Dear all.

I had a problem with warning when fitting histograms.
Following warning, which was not shown with v5.20, is shown during fitting with v5.22 (or SVN-version rev.27508).


I asked if there is a way to suppress the warning in support forum.
Thanks to a help, the problem was solved for me by modifying source code of ROOT locally by hand.
But I wonder if some modification could be done for ROOT distribution.

I had look into code, and it seems to me that the warning is shown when ranges and initial values of fitting parameters are set. So, the warning is independent of implementation of fitting function.
I confirmed that the warning is shown before fitting function is called.
So, it seems that the condition of warning simply depends on range and initial value of a parameter.

For example, following fitting shows the warning.
When I change “offset” to smaller value like 10, the warning disappear.
(This fitting is just an example to reproduce the problem.)

   Double_t offset = 1000;
   TH1F hist("hist", "hist", 100, -50 + offset, 50 + offset);
   Int_t i;
   for (i = 0; i < 10000; i++) {
      hist.Fill(gRandom->Gaus(offset, 3));
   TF1 f1("f1", "gaus", -50 + offset, 50 + offset);
   f1.SetParameters(1300, offset, 3);
   f1.SetParLimits(1, -50 + offset, 50 + offset);
   f1.SetParError(1, 1);
   hist.Fit("f1", "Q", "", -50 + offset, 50 + offset);

As far as I understand the code, during setting parameters, a fitter sets initial step size based on the initial value (maybe proportional to the initial value). A minimizer shows the warning if “initial” + “step” is outside of parameter limits.
So, it seems to me that the warning is not under control of users.

It would be nice if some modification is done for the ROOT distribution.
A possible modification could be one of followings.

  • Suppress the warning when ‘Q’ option is used.
  • Allow users to set step size for the check.
  • Set step size more intelligently with taking into account parameter range.

I personally want the modification to be included in the next patch release of v5.22, if possible, because our collaboration is going to use the version as a standard for the next one year.

Best regards.



thank you for raising this issue.
I can suppress easily the warning when setting the parameter values, but I agree that the optimal approach is allow also the user to control the step size.
I will use as step size the parameter errors when they are not zero, because they are a reasonable estimate of the step sizes.
Also in case of limited parameter, I will use a more clever approach to set the step sizes.

I will apply the changes in the patch as you requested. I’ll let you know when they are committed in SVN

Best Regards


Hi ,

I have fixed this in the trunk revision of SVN,

If it fine with you, I will also commit the fix in the patch branch

Thank you for reporting this,



I tried the SVN version, and it works fine for me.

Thank you for the modification, and for including it in the next patch release.