# How to use IntegralError?

**URL:** <https://root-forum.cern.ch/t/how-to-use-integralerror/44724>\
**Category:** Newbie\
**Created:** [May 6, 2021, 2:05am UTC](https://root-forum.cern.ch/t/how-to-use-integralerror/44724 "2021-05-06T02:05:35Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![meu](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/meu/32/20557_2.png) [@meu](https://root-forum.cern.ch/u/meu)\
**Post date:** [May 6, 2021, 2:05am UTC](https://root-forum.cern.ch/t/how-to-use-integralerror/44724/1 "2021-05-06T02:05:35Z")

</div>

Hi, everyone

I have a question about using IntegralError.

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

I used this example for my code.

```auto
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:

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

```

I refered to next example[https://root.cern/doc/master/ErrorIntegral\_8C\_source.html](https://root.cern/doc/master/ErrorIntegral_8C_source.html)

Maybe, this code is corresponding code

```auto
  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?

---

<div class="post-metadata">

**Author:** ![bellenot](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/bellenot/32/29217_2.png) [@bellenot](https://root-forum.cern.ch/u/bellenot)\
**Post date:** [May 6, 2021, 6:26am UTC](https://root-forum.cern.ch/t/how-to-use-integralerror/44724/2 "2021-05-06T06:26:10Z")

</div>

I’m sure @moneta will give you some hints

---

<div class="post-metadata">

**Author:** ![moneta](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/moneta/32/19423_2.png) [@moneta](https://root-forum.cern.ch/u/moneta)\
**Post date:** [May 6, 2021, 6:50am UTC](https://root-forum.cern.ch/t/how-to-use-integralerror/44724/3 "2021-05-06T06:50:42Z")

</div>

Hi,

`TFitResult` returns a covariance matrix by value and not its pointer. See [ROOT: TFitResult Class Reference](https://root.cern.ch/doc/master/classTFitResult.html#a65564f9e3398c7d1f590ddd493e65fb5)…

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

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

```

Lorenzo

---

<div class="post-metadata">

**Author:** ![bellenot](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/bellenot/32/29217_2.png) [@bellenot](https://root-forum.cern.ch/u/bellenot)\
**Post date:** [May 7, 2021, 7:09am UTC](https://root-forum.cern.ch/t/how-to-use-integralerror/44724/4 "2021-05-07T07:09:15Z")

</div>

Sorry, I overlooked this one…

---

<div class="post-metadata">

**Author:** ![meu](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/meu/32/20557_2.png) [@meu](https://root-forum.cern.ch/u/meu)\
**Post date:** [May 7, 2021, 7:24am UTC](https://root-forum.cern.ch/t/how-to-use-integralerror/44724/5 "2021-05-07T07:24:05Z")

</div>

Hi, Lorenzo.

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

Thanks!
