Hello,
I spent about an hour battling with a strange crash in my code which was somehow caused by retrieving the parameters from a fit of a TGraph via a TFitResultPtr. It turns out that there is a known clash with the Error function, but the example shown in the documentation ignores the workaround, namely to use ParError instead.
The offending section plus link is posted below:
root.cern.ch/root/html/TGraph.html#TGraph:Fit
If the option "S" is instead used, TFitResultPtr contains the TFitResult and behaves
as a smart pointer to it. For example one can do:
TFitResultPtr r = h->Fit(myFunc,"S");
TMatrixDSym cov = r->GetCovarianceMatrix(); // to access the covariance matrix
Double_t chi2 = r->Chi2(); // to retrieve the fit chi2
Double_t par0 = r->Value(0); // retrieve the value for the parameter 0
Double_t err0 = r->Error(0); // retrieve the error for the parameter 0
r->Print("V"); // print full information of fit including covariance matrix
r->Write(); // store the result in a file
Cheers,
Liam
P.S. The hyperlink in this section also clearly points to TObject::Error and not Fit::FitResult::Error (root.cern.ch/root/html/ROOT__Fit … sult:Error)