Projecting underflow/overflow bins from TH3

Usually the underflow/overflow bins are of no interest, but now I find myself wanting to project only them from a TH3. If I do the obvious thing and SetRange(0, 0) or SetRange(nbin+1, nbin+1) to get the underflow/overflow bin, this resets the axis range (as per the documentation).

So how can I do it without writing my own projection function?

Thanks in advance,

  • Peter

Hi,

This is a known limitation of Taxis::SetRange. You should do:

axis->SetRange(0,0);
axis->SetBit(TAxis::kAxisRange);

See Note 4 in root.cern.ch/root/htmldoc/TH3.html#TH3:Project3D

Regards

Lorenzo

I don’t want to exclude the overflow/underflow bins, I want to include them? Just as I can project any bin of a histogram out with SetRange(bin, bin), I want to project the underflow or overflow bin.

Hi,

yes you are right, for selecting ONLY underflow/oveflow it will not work !
We will need to fix Taxis::SetRange. In the meantime, you can Project using all range (including underflow and/or overflow) and then subtract the histogram projected excluding them.
This is still better than writing your own projection function

Lorenzo

Hi,

just wanted to comment that this issue is ATM fixed at least in the trunk version (e.g. will probably be available in root-6.X).