# GetParError for exponential fit

**URL:** <https://root-forum.cern.ch/t/getparerror-for-exponential-fit/33072>\
**Category:** Newbie\
**Created:** [March 8, 2019, 4:27am UTC](https://root-forum.cern.ch/t/getparerror-for-exponential-fit/33072 "2019-03-08T04:27:48Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Prya13](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/p/ea666f/32.png) [@Prya13](https://root-forum.cern.ch/u/Prya13)\
**Post date:** [March 8, 2019, 4:27am UTC](https://root-forum.cern.ch/t/getparerror-for-exponential-fit/33072/1 "2019-03-08T04:27:48Z")

</div>

Hi All,

I trying fi find the +1 sigma and -1sigma in EXPONENTIAL background fit. But getting error wid the value of the amplitude of the background along with its error. They come out same value can’t be correct.

Attached is code and refer to the mass plot from before with gaussian and exponential fit from 2.6 - 4 [fitGausandexponentfunc.cpp](https://root-forum.cern.ch/uploads/default/original/3X/d/7/d7334ffb723641f5294416edc558c6b1aeb10d79.cpp) (4.7 KB)

[https://root-forum.cern.ch/uploads/default/original/3X/8/9/899e78fb43168c9014cc6e07401a8faf93857643.png](https://root-forum.cern.ch/uploads/default/original/3X/8/9/899e78fb43168c9014cc6e07401a8faf93857643.png)

Caio

Ps: exponential function maybe wrong

---

<div class="post-metadata">

**Author:** ![Wile\_E\_Coyote](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/wile_e_coyote/32/12417_2.png) [@Wile\_E\_Coyote](https://root-forum.cern.ch/u/Wile_E_Coyote)\
**Post date:** [March 8, 2019, 7:55am UTC](https://root-forum.cern.ch/t/getparerror-for-exponential-fit/33072/2 "2019-03-08T07:55:05Z")

</div>

Try:

```auto
    Double_t bkg = fit->GetParameter(3);
    Double_t bkg_err = fit->GetParError(3);
    bkg *= hsub->GetBinWidth(1); bkg_err *= hsub->GetBinWidth(1); // same scaling
    std::cout << "bkg = " << bkg << " \t" << "bkg_err = " << bkg_err << std::endl;

```

---

<div class="post-metadata">

**Author:** ![Prya13](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/p/ea666f/32.png) [@Prya13](https://root-forum.cern.ch/u/Prya13)\
**Post date:** [March 8, 2019, 2:22pm UTC](https://root-forum.cern.ch/t/getparerror-for-exponential-fit/33072/3 "2019-03-08T14:22:13Z")

</div>

Hi Wile\_E,

Thank you so much, I tried but the result is : bkg = 798.114 bkg\_err = 2833.18

Also why the \* sign after bkg and bkg\_err  
My bkg also doesnt fit on the function anymore.

---

<div class="post-metadata">

**Author:** ![Prya13](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/p/ea666f/32.png) [@Prya13](https://root-forum.cern.ch/u/Prya13)\
**Post date:** [March 8, 2019, 2:52pm UTC](https://root-forum.cern.ch/t/getparerror-for-exponential-fit/33072/5 "2019-03-08T14:52:51Z")

</div>

This is what plot looks like:

[canvas fit.pdf](https://root-forum.cern.ch/uploads/default/original/3X/2/8/28cd59ffb5099daa233d263cf96e915359d970e4.pdf) (23.6 KB)
