Global bin number for 2D and 3D histograms

Hey All,

There are two different commands to get global bin numbers out of a histogram - “GetBin” and “FindBin”. The first gives the bin number corresponing to binx,y,z the later corresponding to the values x,y,z. What I would like to know is, if these global bin numbers are related to one another, i.e. if these commands give out the same Integer for (binx,biny,binz) and (x,y,z) respectively where bin[i] contains the value [i]?


Suppose a 3-d histogram and values x,y,z

Int_t binx = h3.GetXaxis()->FindBin(x); Int_t biny = h3.GetYaxis()->FindBin(y); Int_t binz = h3.GetZaxis()->FindBin(z); Int_t globalbin1 = h3-GetBin(binx,biny,binz); Int_t globalbin2 = h3.GetBin(x,y,z);
globalbin1 must be equal to globalbin2

see code in TH1::GetBin … TH1:GetBin … H1:FindBin


ok, got it,

thanks a lot,