Error in TGraph page, section TFitResultPtr Fit


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:

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


P.S. The hyperlink in this section also clearly points to TObject::Error and not Fit::FitResult::Error ( … sult:Error)


Actually is not only a documentation problem. It is true that calling TFitResult::Error can cause a crash in CINT or a failed compilation if C++/AClic is used.
I will apply now in ROOT a patch for this and also update the documentation to use ParError which does not have this problem

Thank you for reporting this problem