TH1::GetCumulative changes errors

I am filling and then scaling a TH1D, and the errors behave as expected (sqrt(n) before scaling, multiplied by scaling factor after), but then I use the GetCumulative() method, and the errors of the original histogram get recalculated, I’m not sure how and why.
The errors do not change if the histogram wasn’t rescaled.
Maybe there is a good statistical reason not to use GetCumulative for a rescaled histogram, but even if there is, it seems wrong to me that the histogram itself should be affected.

ROOT Version: 6.24
Platform: CentOS 7
Compiler: Not Provided

Hi @Lars_Martin,

Welcome to the ROOT forum! Maybe @couet knows.


It looks like GetCumulative recomputes the errors. I am not sure to fully understand the internal logic of this code. I let @moneta give his input on that.


There is a bug in the computation of the errors for weighted (or scaled histograms)in GetCumulative.
See [hist] TH1::GetCumulative doesn't set the bin error for the generated histogram, but change that of the original hist instead · Issue #11947 · root-project/root · GitHub

The bug is fixed in current master and it will be fixed also in the coming 6.28 version



Great news, thanks!

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