In the manual (article TH1, function fit), I read:
[quote] 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->Parameter(0); // retrieve the value for the parameter 0 Double_t err0 = r->ParError(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
However, this is not working:
- r is an object, rather than a pointer to an object so I think the usage of -> is already incorrect in the manual
- When I try to overcome this problem by using “r.” to access the functions of r, I get the error:
This is indeed correct when I watch the manual of the class TFitResultPtr.
Can someone please explain me how I should be using this? I want to know the values of the fit and if the fit succeeded.