# ProfileX error calculation after scaling 2d histogram

**URL:** <https://root-forum.cern.ch/t/profilex-error-calculation-after-scaling-2d-histogram/51603>\
**Category:** Newbie\
**Created:** [September 18, 2022, 4:44pm UTC](https://root-forum.cern.ch/t/profilex-error-calculation-after-scaling-2d-histogram/51603 "2022-09-18T16:44:08Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![haha123](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/h/e19adc/32.png) [@haha123](https://root-forum.cern.ch/u/haha123)\
**Post date:** [September 18, 2022, 4:44pm UTC](https://root-forum.cern.ch/t/profilex-error-calculation-after-scaling-2d-histogram/51603/1 "2022-09-18T16:44:08Z")

</div>

I have a question about the error bar calculation when calling TProfileX from a TH2D. The problem occurs when I first scale the TH2D by a value (e.g. Scale(1./10000)). ProfileX() gives the correct the error. However, directly using the formula of std err of mean will give an extra factor sqrt(10000). I wonder how profileX knows to correct for this scale. Attached is the code to illustrate this. Thanks.  
[test.C](https://root-forum.cern.ch/uploads/short-url/2yAiBhfwoWmaNXotTzVK9IMI8PZ.C) (1.3 KB)

---

<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:** [September 18, 2022, 4:55pm UTC](https://root-forum.cern.ch/t/profilex-error-calculation-after-scaling-2d-histogram/51603/2 "2022-09-18T16:55:56Z")

</div>

[`TH2::ProfileX`](https://root.cern/doc/master/classTH2.html#a19eb4ae4f4d399b0f4ad820d838de75e)  
[`TProfile::BuildOptions`](https://root.cern/doc/master/classTProfile.html#a1ff9340284c73ce8762ab6e7dc0e6725)  
[`TProfile` Class Reference](https://root.cern/doc/master/classTProfile.html)
