# When we use GetEntries()

**URL:** <https://root-forum.cern.ch/t/when-we-use-getentries/45248>\
**Category:** Newbie\
**Created:** [June 4, 2021, 12:10pm UTC](https://root-forum.cern.ch/t/when-we-use-getentries/45248 "2021-06-04T12:10:53Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![IKoro](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/i/3e96dc/32.png) [@IKoro](https://root-forum.cern.ch/u/IKoro)\
**Post date:** [June 4, 2021, 12:10pm UTC](https://root-forum.cern.ch/t/when-we-use-getentries/45248/1 "2021-06-04T12:10:53Z")

</div>

Hello,

I would like to know how much input there is for a charge\_tree \> 1000, but I have no idea where to start.  
Currently I am using the GetEntry function to know the entry number for the entire histogram.

 ![2611](https://root-forum.cern.ch/uploads/default/original/3X/6/5/657a9f0abc58312e08f25197c3905d6753d290ce.png)

* * *

---

<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:** [June 4, 2021, 12:22pm UTC](https://root-forum.cern.ch/t/when-we-use-getentries/45248/2 "2021-06-04T12:22:24Z")

</div>

Hi,

try something like

```auto
printf("Sum of contents of bins with charge > 1000 is %f\n", charge_tree->Integral(charge_tree->FindFixBin(1000), charge_tree->GetNbinsX()+1)); // includes the overflow bin

```

---

<div class="post-metadata">

**Author:** ![IKoro](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/i/3e96dc/32.png) [@IKoro](https://root-forum.cern.ch/u/IKoro)\
**Post date:** [June 4, 2021, 12:41pm UTC](https://root-forum.cern.ch/t/when-we-use-getentries/45248/3 "2021-06-04T12:41:34Z")

</div>

What is the purpose of this order?  
Because my charge\_tree is a double.

---

<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:** [June 4, 2021, 12:46pm UTC](https://root-forum.cern.ch/t/when-we-use-getentries/45248/5 "2021-06-04T12:46:20Z")

</div>

Right. What’s the name of the histogram then? Suppose it’s `hist`, then

```auto
hist->Integral(hist->FindFixBin(1000), hist->GetNbinsX()+1)

```

gives you the the sum of contents of bins with charge \> 1000.

---

<div class="post-metadata">

**Author:** ![IKoro](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/i/3e96dc/32.png) [@IKoro](https://root-forum.cern.ch/u/IKoro)\
**Post date:** [June 4, 2021, 12:48pm UTC](https://root-forum.cern.ch/t/when-we-use-getentries/45248/6 "2021-06-04T12:48:04Z")

</div>

Thank you so much.  
I made the change it works, but I would like to save this value.  
So I would like to know in the command where exactly this value is.

---

<div class="post-metadata">

**Author:** ![IKoro](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/i/3e96dc/32.png) [@IKoro](https://root-forum.cern.ch/u/IKoro)\
**Post date:** [June 4, 2021, 12:49pm UTC](https://root-forum.cern.ch/t/when-we-use-getentries/45248/7 "2021-06-04T12:49:08Z")

</div>

Sorry, I can just write:

```auto
value = hist->Integral(hist->FindFixBin(1000), hist->GetNbinsX()+1);

```
