TH2 / TH3 and under-/over-flow bins and global bin number

Hi,

how are actually overflows and underflows handled for TH2 or TH3 histograms?

Since for TH1 bin 0 and bin n+1 contain the underflow and overflow, I wonder if I have to act with caution when using the global bin numbering in more-dimensional histograms? I.e. is for TH2/TH3 over- and under-flow (bins) defined for each bin projection of particular dimension?
At least in a saved 2D histogram (as *.C) the over- and under-flow values are hard coded into the statistics panel or I did not identified the correct bins.

To cut a long story short: can I iterate over the global bin number without encountering any under-/overflow-bins (I guess so :wink: )

Another thing: Is there a way to get a histograms bin number directly without making a detour via GetNbinsX()GetNbinsY()?

Cheers & Thanks,
Thomas

1 Like

Hi,
you can loop on the global bin number and then use the functions
TH1::IsBinUnderflow() and TH1::IsBinOverflow()

Lorenzo

1 Like

OK – many thanks! :slight_smile: