# Useless check/bug in TH1::Smooth

**URL:** <https://root-forum.cern.ch/t/useless-check-bug-in-th1-smooth/63183>\
**Category:** Newbie\
**Tags:** hist, root\
**Created:** [March 21, 2025, 9:52pm UTC](https://root-forum.cern.ch/t/useless-check-bug-in-th1-smooth/63183 "2025-03-21T21:52:06Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Evander137](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/e/3da27b/32.png) [@Evander137](https://root-forum.cern.ch/u/Evander137)\
**Post date:** [March 21, 2025, 9:52pm UTC](https://root-forum.cern.ch/t/useless-check-bug-in-th1-smooth/63183/1 "2025-03-21T21:52:06Z")

</div>

Hi, I’ve been looking at the [TH1::Smooth](https://github.com/root-project/root/blob/master/hist/hist/src/TH1.cxx#L6884) function (and the associated [TH1::SmoothArray](https://github.com/root-project/root/blob/master/hist/hist/src/TH1.cxx#L6773) for smoothing some of my histograms. In [this line](https://github.com/root-project/root/blob/master/hist/hist/src/TH1.cxx#L6840) of the smoothing procedure in the source code, I noticed there seems to be a useless check of the absolute value of the same variable, `tmp0`, compared to itself. I’ve taken a look at the associated references [here](https://cds.cern.ch/record/186223) and [here](https://www.slac.stanford.edu/pubs/slacreports/reports16/slac-r-176.pdf) but I can’t find exactly where this routine is referenced. I would guess it should be comparing `tmp0` with `tmp1`, but I’m not sure.

---

<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:** [March 21, 2025, 11:13pm UTC](https://root-forum.cern.ch/t/useless-check-bug-in-th1-smooth/63183/2 "2025-03-21T23:13:28Z")

</div>

Maybe @moneta can comment on this

---

<div class="post-metadata">

**Author:** ![ferhue](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/ferhue/32/29462_2.png) [@ferhue](https://root-forum.cern.ch/u/ferhue)\
**Post date:** [March 22, 2025, 9:58am UTC](https://root-forum.cern.ch/t/useless-check-bug-in-th1-smooth/63183/3 "2025-03-22T09:58:43Z")

</div>

Thanks for spotting that !!  
This was a bug introduced here: [[hist] Code improvements to `TH1::SmoothArray()` · root-project/root@9ef86d5 · GitHub](https://github.com/root-project/root/commit/9ef86d578954406440504aec31edcd1ea701671d#diff-f9554db4e8f6e87a454392c3387c28fb198444cea915e6365fac55317f9ea5f2R23-R6823)

A PR to fix this is underway: [[hist] fix smootharray bug by ferdymercury · Pull Request #18099 · root-project/root · GitHub](https://github.com/root-project/root/pull/18099)

---

<div class="post-metadata">

**Author:** ![Evander137](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/e/3da27b/32.png) [@Evander137](https://root-forum.cern.ch/u/Evander137)\
**Post date:** [March 22, 2025, 8:00pm UTC](https://root-forum.cern.ch/t/useless-check-bug-in-th1-smooth/63183/4 "2025-03-22T20:00:53Z")

</div>

Thank you!
