GetBinContent() in profile histograms

I have a profile histogram .When I use GetBinContent() method, I get most of the bins empty although they are not.What I am hoping to get after using this method is the mean values of y for each bin.

Could you send the shortest possible RUNNING script reproducing this problem?


I run my code using some other files and a testbeam file which consumes a lot of disk space. So it is not possible to send it or post it.However, I cut the part of the program which causes problem and made the histograms as gif files. I hope you can understand what is going on by looking at the relevant code and the output histograms.
So briefly,
s7 pointer is my profile histogram and its shape is in “test_histo.gif”
I am making a graph using the bin content of this profile histogram.
x values are 1,2,…25.
y values are s7->GetBincontent() (for each bin)
The graps is in the file called "test_graph.gif "
As you will see, most of the entries are zero which should not be.
Sorry for presenting the problem in such a incoenient way.
If this helps you to understand the problem, great.
If the problem is not clear under these conditions, nothing to do.
Thank you.
test2.tar (20 KB)


There must be more than 25 bins in your profile histogram.
Hence many of them are empty.
You might have to use h->GetXaxis()->FindBin(x+i) as the argument to GetBinContent.