# How to find the raw numbers stored in a specific bin in a histogram?

**URL:** <https://root-forum.cern.ch/t/how-to-find-the-raw-numbers-stored-in-a-specific-bin-in-a-histogram/56880>\
**Category:** Newbie\
**Tags:** hist, root\
**Created:** [October 26, 2023, 6:58pm UTC](https://root-forum.cern.ch/t/how-to-find-the-raw-numbers-stored-in-a-specific-bin-in-a-histogram/56880 "2023-10-26T18:58:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Quantic](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/q/ee7513/32.png) [@Quantic](https://root-forum.cern.ch/u/Quantic)\
**Post date:** [October 26, 2023, 6:58pm UTC](https://root-forum.cern.ch/t/how-to-find-the-raw-numbers-stored-in-a-specific-bin-in-a-histogram/56880/1 "2023-10-26T18:58:09Z")

</div>

Hello,

I need to produce a list of data values that I stored in a histogram, which each got placed into the same bin. I would like to be able to do this for each bin.

For example, let’s say I put nine numbers into one histogram. The nine numbers are simply:

1, 2, 3, 4, 5, 6, 7, 8, 9

Then I tell ROOT that the histogram has three bins. The nine numbers are now split up something like:

Bin 1: 1, 2, 3  
Bin 2: 4, 5, 6  
Bin 3: 7, 8, 9

Now I want to retrieve a list of data values stored in a specific bin. So if I perform this function and give the argument “bin 1”, I will get a vector or something containing the numbers “1, 2, 3”. If I perform this function and give the argument “bin 2”, I will get a vector or something containing the numbers “4, 5, 6”. If I perform this function and give the argument “bin 3”, I will get a vector or something containing the numbers “7, 8, 9”.

Is there a pre-existing, built-in function in ROOT that performs this operation? Something like “GetBinContent()”, but instead of giving the number of entries in a bin, it spits out the raw data values stored in the bin?

Edit: This question is specifically for C++ ROOT, in case that is important. I do not know the exact version number I am using, but I expect that that should not change the answer to this question.

---

<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:** [October 27, 2023, 6:13am UTC](https://root-forum.cern.ch/t/how-to-find-the-raw-numbers-stored-in-a-specific-bin-in-a-histogram/56880/2 "2023-10-27T06:13:43Z")

</div>

> [@Quantic](#):
>
> spits out the raw data values stored in the bin?

No, those values are not stored in histos.
