Operations limited to a histogram subset

I have a huge 2D histogram storing the power density distribution over a large component of a collider.
I have to read out and average the power density but also find the maximum value, from a small slab of the component, namely all points (x,y) such that 5.3 < x < 7.025
and -0.2 <y < 0.2
Since the pixel size is 0.2x0.2 the slab is only 2 bins wide.
What is the best way to proceed ? Scanning all bins and process only those whose center point satisfies the above unequality ?
Or are there “cut” parameters that allow for restricting the operation range ?

A silly question … what is thepurpose of rebinning ? Maybe it is necessary if some properties of a histogram are changed ?

Thank you,

Instead of a TH2, use a TTree or TNtuple and the function TTree::Draw
to specify your selections. TTree::Draw creates a histogram that you can query to find out its mean, rms, etc


Thank you. I have not explored either TTree or TNtuple yet.
This is a good chance to familiarize with these features as well.
Will I be able to read out the data from the histogram created by TTree::Draw ? I mean does this special histogram support all the operations that are commonly applicable to a TH2 data structure ?
For instance get the contents of each bin ?