Get fit status string

so for each fitting we will get something like
FCN=374294 FROM MINOS STATUS=SUCCESSFUL 37 CALLS 503 TOTAL
how do we get the string “SUCCEFFFUL” (or other status) from the fit result?

__
ROOT Version: 6.26
Platform: Not Provided
Compiler: Not Provided


Hi,
from the FitResult in the TH1.

Fit status

The status of the fit is obtained converting the TFitResultPtr to an integer independently if the fit option “S” is used or not:

TFitResultPtr r = h->Fit(myFunc,opt);

Int_t fitStatus = r;

  • status = 0 : the fit has been performed successfully (i.e no error occurred).
  • status < 0 : there is an error not connected with the minimization procedure, for example when a wrong function is used.
  • status > 0 : return status from Minimizer, depends on used Minimizer. For example for TMinuit and Minuit2 we have:
    • status = migradStatus + 10*minosStatus + 100*hesseStatus + 1000*improveStatus. TMinuit returns 0 (for migrad, minos, hesse or improve) in case of success and 4 in case of error (see the documentation of TMinuit::mnexcm). For example, for an error only in Minos but not in Migrad a fitStatus of 40 will be returned. Minuit2 returns 0 in case of success and different values in migrad,minos or hesse depending on the error. See in this case the documentation of Minuit2Minimizer::Minimize for the migrad return status, Minuit2Minimizer::GetMinosError for the minos return status and Minuit2Minimizer::Hesse for the hesse return status. If other minimizers are used see their specific documentation for the status code returned. For example in the case of Fumili, see TFumili::Minimize.

So you can print if the fit is successful or not, according to the value of the TFitPointer.

Best,
Stefano

1 Like

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