Hi,
suppose I am plotting a 2d histogram. There are 10 bins in the x-axis and 10 bins in the y-axis, the total no.of bins = 100. Is it possible to find the mean x (or mean y) of the events in a particular bin , say the 2nd xbin and the 3rd ybin ?
Hi debdatta,
no, it’s not - only the number of entries is stored. But this is a good idea for an extension (e.g. to be turned on by a TH1::SetBinAverage()). It’s a bit fundamental, but it would allow fits and “conversions” to a TGraph to be much more precise, at almost no cost (using a floating average). The main drawback: it’s very uncommon.
Axel.
You can get the mean, rms of a sub-range of a 1, 2, or 3-d histogram.
See documentation of TH1::GetRMS or TH1::GetMean.
For example you can specify a range along the Y axis
h->GetYaxis()->SetRange(binmin,binmax);
h->GetRMS(1); //return RMS along X
or specify a sub-range in x and y