I’m trying to do a simple fit, and check if Minuit converged properly. The concerned code is the following:
for (int i = 0; i < npix; i++){
TH1* hProjection = profile->ProjectionY(" ", i + 1, i + 1);
hProjection->Fit(fFit, "", "", 200., 400.); //fFit is a predefined function
if (gMinuit->fCstatu != "CONVERGED ") continue;
const double slope = fFit->GetParameter(1);
const unsigned int col = i / 256;
const unsigned int row = i % 256;
hSlope->Fill(col, row, slope);
}
However, ROOT returns the following error, and I don’t know how to fix it:
I see this fixed in the HEAD for simple fits.
Could you post a full reproducer to be sure that your issue as well is fixed?
The next release is expected around mid-September.
In general you should not query the variable gMinuit, but the retuned code of the Fit method, or in case you ant more information, retrieve the FItResult class using the fit option 'S".
gMInuit will not be null only if you are using TMInuit and it won’t work with other minimiser. So, it is not guaranteed that in future versions of ROOT will be still always accessible.