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

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.

No, those values are not stored in histos.