# Avoiding accumulation out-of-range entries in the histogram's first and last bins

**URL:** <https://root-forum.cern.ch/t/avoiding-accumulation-out-of-range-entries-in-the-histograms-first-and-last-bins/39325>\
**Category:** ROOT\
**Created:** [May 8, 2020, 4:14pm UTC](https://root-forum.cern.ch/t/avoiding-accumulation-out-of-range-entries-in-the-histograms-first-and-last-bins/39325 "2020-05-08T16:14:11Z")\
**Posts on this page:** 1\
**Showing post:** 2

<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 11, 2020, 7:49am UTC](https://root-forum.cern.ch/t/avoiding-accumulation-out-of-range-entries-in-the-histograms-first-and-last-bins/39325/2 "2020-05-11T07:49:26Z")

</div>

HI,

Can you please post a running script so we can understand where the problem is coming from ?  
I already answer in this related post

> [@Sum of TF1 in a loop](https://root-forum.cern.ch/t/sum-of-tf1-in-a-loop/39276/7):
>
> Hi Lorenzo, This solution looks promising (and efficient), do you need to pass a variable here? i.e. “par” in the definition I didn’t manage to run it In the meantime I figured out a way by basically converting TF1’s to TH1’s then add the histograms: for iev in chain1: Gaus\_i.Clear() Gaus\_i = ROOT.TF1(“Gaus\_i”,“gaus”,100, 200) Gaus\_i.SetParameters(1., iev.mean, iev.sigma) Hist\_i = Gaus\_i.GetHistogram() Hist\_tot.Add(Hist\_i, iev.weight) And this works, however on the edges of the histo…

---

_[View the full topic](https://root-forum.cern.ch/t/avoiding-accumulation-out-of-range-entries-in-the-histograms-first-and-last-bins/39325)._
