Show Overflow (?) in last bin of histogram?

Hello,

When I make my histograms, I set the length of the x-Axis. So I’m “cutting” away a little bit of my entries and I want to fill everything that comes after my “cut” in the last bin I have in my histogram. I thought this would be called overflow bin but I’m not so sure about that, after reading something about that in the class references of root.

I you can understand what I mean and that you can help me :slight_smile:

Best regards

What is unclear e.g. in the TH1::Fill method description?

BTW. @couet There is a small mistake in all these descriptions. It should be “… if x is equal to or greater than the upper edge of last bin, the Overflow bin is incremented” (same mistake in all TH2::Fill methods’ descriptions).

After you are done filling up you histogram called histo, you should do something like

histo->SetBinContent(histo->GetNbinsX(), histo->GetBinContent(histo->GetNbinsX()) + histo->GetBinContent(histo->GetNbinsX() + 1));

I see you propose to add “is equal or”. I would prefer @moneta double check this to be sure the mistake is in the help and not is the implementation. If it is in the help I can of course change it.

Hi,

Yes it is correct. The overflow bin is incremented if x is equal to or greater than the upper edge.
I agree the documentation should be updated

Thank you

Lorenzo

I have updated the doc.
Thanks to have seen it.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.