# Bug in TH1F when working with lots of events

**URL:** <https://root-forum.cern.ch/t/bug-in-th1f-when-working-with-lots-of-events/48663>\
**Category:** ROOT\
**Created:** [February 5, 2022, 2:08am UTC](https://root-forum.cern.ch/t/bug-in-th1f-when-working-with-lots-of-events/48663 "2022-02-05T02:08:33Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![fsili](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/f/6de8d8/32.png) [@fsili](https://root-forum.cern.ch/u/fsili)\
**Post date:** [February 5, 2022, 2:08am UTC](https://root-forum.cern.ch/t/bug-in-th1f-when-working-with-lots-of-events/48663/1 "2022-02-05T02:08:33Z")

</div>

Dear ROOT experts,

I have been working with ntuples with lots of events (\>10^8) evts and doing a skimming over them. During the skimming I fill a cutflow histogram indicating how many events pass certain selections.

The problem is that when working with so many events, the cutflow histogram stops working after 16777216 events, meaning that the bins are not filled past that value.

I leave attached a minimal working example, in which I loop over 100000000 (1x10^7) events and check if the number is divisible by an integer. The result I got is the same one I got when working with the ntuple:

```auto
Processing test.cxx...
                    All events = 16777216
                Divisible by 2 = 16777216
          Divisible by 3 and 2 = 16666667
       Divisible by 4, 3 and 2 = 8333334

```

I repeated the test with less events 10000000 (10^6) and worked fine:

```auto
Processing test.cxx...
                    All events = 10000000
                Divisible by 2 = 5000000
          Divisible by 3 and 2 = 1666667
       Divisible by 4, 3 and 2 = 833334

```

It would be very much appreciated if you could tell me how to solve this issue.

Thanks in advance,

Cheers,  
Francisco

[test.cxx](https://root-forum.cern.ch/uploads/short-url/lninJPXJSF0XjTKOkdfTCKx3pPO.cxx) (1.5 KB)  
[test.root](https://root-forum.cern.ch/uploads/short-url/mXHh8p3T5CuGp5SPQydLFs2iGJZ.root) (3.8 KB)

* * *

_ROOT Version:_ 6.24/06  
_Platform:_ MacOS and lxplus

* * *

---

<div class="post-metadata">

**Author:** ![dastudillo](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/dastudillo/32/17280_2.png) [@dastudillo](https://root-forum.cern.ch/u/dastudillo)\
**Post date:** [February 5, 2022, 6:23am UTC](https://root-forum.cern.ch/t/bug-in-th1f-when-working-with-lots-of-events/48663/2 "2022-02-05T06:23:09Z")

</div>

> [@TH1F : overflow in bin content?](https://root-forum.cern.ch/t/th1f-overflow-in-bin-content/33252):
>
> Hi rooter, I fill a TH1F by the Fill(x) function. I know how many counts I should have in a given bin, but when drawing the histogram (and doing h-\>GetBinContent(i)) the number of counts in that bin are 1.677e7, while they should be ~6e7. Is 1.677e7 the maximum content of a bin in TH1F? I’m using ROOT 6.15 Thank you for your help Cheers Paola

---

<div class="post-metadata">

**Author:** ![fsili](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/f/6de8d8/32.png) [@fsili](https://root-forum.cern.ch/u/fsili)\
**Post date:** [February 5, 2022, 2:26pm UTC](https://root-forum.cern.ch/t/bug-in-th1f-when-working-with-lots-of-events/48663/3 "2022-02-05T14:26:39Z")

</div>

Thank you very much!!.. and sorry for asking this naive question…

---

<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:** [February 19, 2022, 2:27pm UTC](https://root-forum.cern.ch/t/bug-in-th1f-when-working-with-lots-of-events/48663/4 "2022-02-19T14:27:31Z")

</div>

Closed on February 19, 2022, 2:27pm UTC

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