# TPaveStats is showing weird fit numbers

**URL:** <https://root-forum.cern.ch/t/tpavestats-is-showing-weird-fit-numbers/63908>\
**Category:** ROOT\
**Tags:** hist, root\
**Created:** [July 17, 2025, 10:27pm UTC](https://root-forum.cern.ch/t/tpavestats-is-showing-weird-fit-numbers/63908 "2025-07-17T22:27:06Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![OtaviusDecius](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/otaviusdecius/32/31051_2.png) [@OtaviusDecius](https://root-forum.cern.ch/u/OtaviusDecius)\
**Post date:** [July 17, 2025, 10:27pm UTC](https://root-forum.cern.ch/t/tpavestats-is-showing-weird-fit-numbers/63908/1 "2025-07-17T22:27:07Z")

</div>

Hi there,

Fitting a histogram with one Breit-Wigner signal and a non-resonant background I noticed the fit parameters shown on TPaveStats are completely different, non-physical, than those ones shown in the ROOT command line. I am using version 6.36.00.  
The histogram was created with a weight as in:

histosTH1D[“hm4rec2OSpipitt05acc”]-\>Fill(mrecpi1pi2,1/totemcor);

Would you please advise?  
I am attaching the code and pictures.

Many thanks,  
Luiz Regis

* * *

_ROOT Version:_ 6.36.00  
_Platform:_ Fedora Linux 42  
_Compiler:_ gcc 15.1.1

* * *

 ![c1](https://root-forum.cern.ch/uploads/default/original/3X/d/6/d6deb09ed63a40670e2e2ef0c40abcd67a181c6d.png)  
 ![Screenshot From 2025-07-17 15-31-51](https://root-forum.cern.ch/uploads/default/original/3X/5/7/578cc25a9a60dbdf72771c4fc7d3b70076181750.png)

[mykshort.txt](https://root-forum.cern.ch/uploads/short-url/anubZjcEYffGjJo5kcADwMOdKcW.txt) (5.3 KB)

---

<div class="post-metadata">

**Author:** ![siliataider](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/siliataider/32/35694_2.png) [@siliataider](https://root-forum.cern.ch/u/siliataider)\
**Post date:** [July 18, 2025, 8:03am UTC](https://root-forum.cern.ch/t/tpavestats-is-showing-weird-fit-numbers/63908/2 "2025-07-18T08:03:08Z")

</div>

@jonas or @StephanH might have an idea?

---

<div class="post-metadata">

**Author:** ![yus](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/y/9fc348/32.png) [@yus](https://root-forum.cern.ch/u/yus)\
**Post date:** [July 18, 2025, 9:36am UTC](https://root-forum.cern.ch/t/tpavestats-is-showing-weird-fit-numbers/63908/3 "2025-07-18T09:36:34Z")

</div>

Hi Luiz,

in your code, you do `hm4rec2OSpipitt05acc->Fit(...)` twice. Are you sure the parameters in the statbox and in the terminal come from the same iteration?

---

<div class="post-metadata">

**Author:** ![OtaviusDecius](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/otaviusdecius/32/31051_2.png) [@OtaviusDecius](https://root-forum.cern.ch/u/OtaviusDecius)\
**Post date:** [July 18, 2025, 8:15pm UTC](https://root-forum.cern.ch/t/tpavestats-is-showing-weird-fit-numbers/63908/4 "2025-07-18T20:15:28Z")

</div>

Hi Yus,

No, I run once the attached code mykshort.txt (cut and paste in ROOT command line).  
As far as I know the information from statbox comes from the last iteration, isn’t it?

---

<div class="post-metadata">

**Author:** ![OtaviusDecius](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/otaviusdecius/32/31051_2.png) [@OtaviusDecius](https://root-forum.cern.ch/u/OtaviusDecius)\
**Post date:** [July 18, 2025, 8:18pm UTC](https://root-forum.cern.ch/t/tpavestats-is-showing-weird-fit-numbers/63908/5 "2025-07-18T20:18:07Z")

</div>

hm4rec2OSpipitt05acc is a weighted histogram.

---

<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:** [July 18, 2025, 8:42pm UTC](https://root-forum.cern.ch/t/tpavestats-is-showing-weird-fit-numbers/63908/6 "2025-07-18T20:42:53Z")

</div>

Use `"V"` instead of `"V+"`.

---

<div class="post-metadata">

**Author:** ![OtaviusDecius](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/otaviusdecius/32/31051_2.png) [@OtaviusDecius](https://root-forum.cern.ch/u/OtaviusDecius)\
**Post date:** [July 18, 2025, 9:02pm UTC](https://root-forum.cern.ch/t/tpavestats-is-showing-weird-fit-numbers/63908/7 "2025-07-18T21:02:22Z")

</div>

Hi Wile,

It works! Thanks a lot.

Best,  
Luiz

 ![itworks](https://root-forum.cern.ch/uploads/default/original/3X/e/f/efab46adec48bb435d00cee410b6cd76e2af7bb7.png)

---

<div class="post-metadata">

**Author:** ![system](https://root-forum.cern.ch/uploads/default/original/3X/e/f/efe4f24398fd8ffeb76bccb6ecc46d9d9c003376.png) [@system](https://root-forum.cern.ch/u/system)\
**Post date:** [August 1, 2025, 9:03pm UTC](https://root-forum.cern.ch/t/tpavestats-is-showing-weird-fit-numbers/63908/8 "2025-08-01T21:03:02Z")

</div>

Closed on August 1, 2025, 9:03pm UTC

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
