If I understand correctly then setting the range of an axis to 1->nbins causes the range to reset so that underflow and overflow bins are included. Calling TAxis::SetBit(TAxis::kAxisRange) after doing this is then supposed to exclude the underflow and overflow bins (as described in this post: TAxis::SetRange and TH2::Projection). When I run the following
{
TH3D *h3 = new TH3D("h3",";x;y;z", 10, 0, 10, 10, 0, 10, 10, 0, 10);
h3->Fill(.1, 3, 3);
h3->Fill(.1, 4.5, 3);
h3->Fill(.1, 5.5, 3);
h3->Fill(.1, 24, 3);
h3->GetYaxis()->SetRange(1, 10);
h3->GetYaxis()->SetBit(TAxis::kAxisRange);
TH1 *h = h3->Project3D("x");
h->Draw();
}
the drawn histogram is empty but I would expect it to have 3 entries in the first bin. Removing the SetBit line results in 4 entries so the underflow and overflow are being included in that case. This is in ROOT 5.22/00. Do I have to do something differently to exclude the overflow and underflow bins?
PS - In the documentation for TH3::Project3D it says
and then stops. Is the example here is supposed to include another line demonstrating how to set the axis bit?