How to use IntegralError?

Hi, everyone

I have a question about using IntegralError.

I refered to next URL. https://root.cern.ch/doc/master/classTF1.html#af785051fd4b259fd13601023f2adb5f9

I used this example for my code.

``````TFitResultPtr r = histo->Fit(func, "S");
func->IntegralError(x1,x2,r->GetParams(), r->GetCovarianceMatrix()->GetMatrixArray() );
``````

I used this function after fitting histogram.
But, my code doesn’t work.

Error is next:

``````error: member reference type 'TMatrixDSym' (aka 'TMatrixTSym<double>') is not a pointer; did you mean to use '.'?
``````

I refered to next examplehttps://root.cern/doc/master/ErrorIntegral_8C_source.html

Maybe, this code is corresponding code

``````  auto covMatrix = fitResult->GetCovarianceMatrix();
double sigma_integral = fitFunc->IntegralError(0,1, fitResult->GetParams() , covMatrix.GetMatrixArray());
``````

But I don’t know how different my code is.

Could you tell me how to solve this error?

I’m sure @moneta will give you some hints

Hi,

`TFitResult` returns a covariance matrix by value and not its pointer. See ROOT: TFitResult Class Reference

So use `.` instead of `->`:

``````TFitResultPtr r = histo->Fit(func, "S");
func->IntegralError(x1,x2,r->GetParams(), r->GetCovarianceMatrix().GetMatrixArray() );
``````

Lorenzo

2 Likes

Sorry, I overlooked this one…

Hi, Lorenzo.

Thanks for your reply!
My code worked well after your modification.

Thanks!