Taking profile of TH2 doesn't use overflow bins

Hi everyone,

I am trying to take a ProfileX() of a TH2 histogram. However, when I take the profile, it seems like the error and mean on the bin is calculated without considering overflow bins.

Looking at the documentation, it says on the TH2 website under ProfileX():
“Profiles take the bin center into account, so here the under- and overflow bins are ignored by default.”

Is there anyway to enable the underflow and overflow bins in the calculation of the mean and error on each point?

Thanks for your help!

_ROOT Version: 6.14/00

Hi Ann,

Hmm, good point - I don’t find it convincing that the profile must ignore under-/overflow. @moneta what do you think, could this be enabled as an option (to not break backward compatibility)?

Cheers, Axel.


We cannot include underflow/overflow in the calculation of mean and error because we don’t know their original value. But if you absolutely want to include them you can just do it, by passing 0, and NBin+1 as parameters. For example :

auto px = h2.ProfileX("px",0,h2.GetNbinsY()+1);


Ouch indeed - projections need to calculate the mean and thus need the bin centers! So we must not include the overflow bins, and you, Ann, should not do this either - you’ll probably have to re-think your approach here.

Thanks, Lorenzo!

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