when I use GetBinContent on weighted histograms, it returns integers for many bins. I am not sure why this happens and if there is a way to get the actual number of entires.
I am using 5.18/00.
For an histogram GetBinContent() returns the sum of the weights and the number of entries/bin is not stored internally. You would need to use the TProfile class via the method TProfile::GetBinEntries
Thanks Lorenzo. But I just have a 1 dimensional histogram, how can I convert that to a profile histogram ?
Is it ok to use GetBinContent for unweighted hostogram then ?
You can’t convert from 1D histogram to the profile, but the opposite is true, since the profile stores more information.
If you have unweighted histograms (i.e. all weights = 1), you can use GetBinContent() to get the number of entries.
you say that the GetBinContent returns the “sum of the weights” , probably that is what i want. GetBinEntries will return “the number of entries in that bin w/o the weights” ? I dont want this number.
My question was that in many cases I see that GetBinContent returns an integer. If it is returning the sum of weights(which are non-integers) how can the sum be an integer ?