ROOT Version: 6.06
I have a TH1F filled with integer numbers. With this two options I enforce Poisson errors in plotting:
Everything works fine except for one bin.
For one bin I set the bin content to 2.
If I call GetBinContent for that bin I get: 2
If I call GetBinErrorUp for that bin I get: 1.29953
If I call GetBinErrorLow for that bin I get: 1.82725
But it should be 2.63786 and 1.29181 respectively.
For a bin content of 1 it would be 2.29953 and 0.827246 respectively.
So, what causes the problem is the double to int conversion in the GetBinErrorLow/high function: https://root.cern.ch/doc/master/TH1_8cxx_source.html#l08413
In my case the 2 is internally a 1.9999999 and it gets rounded to 1.
If I fill the histogramm with 2.00001 everything is fine.
Is it a option to change the line 8413 and 8443 from
Int_t n = int(c);
Int_t n = int(c+0.5); if (c<-0.5) n = int(c-0.5);
or would this cause other problems?
As temporary workaround I add 0.00001 to each bin before plotting. Is there a better solution to avoid this?