TH2F max entries using Fill()

Hi rooters,
I found a weird behaviour of TH2F when it is filled more than ~1e8 times.
The number of entries is right but the bins reach a limit.

Long_t NMAX = 1e8;
TRandom3 r;
TH2F *h2f = new TH2F("h2f","test",2,-0.1,1.1,2,-0.1,1.1);
for (long k =0;k<NMAX;k++){h2f->Fill(r.Uniform(),r.Uniform());}

The Printout gives:
TH1.Print Name = h2f, Entries= 100000000, Total sum= 6.71089e+07
which means not all the Fill() worked, summing the bin contents gives actually the total sum.

spiting the Filling in two rounds gives the correct result.

NMAX = 5e7;
TH2F *h2f1 = new TH2F("h2f1","test",2,-0.1,1.1,2,-0.1,1.1);
for (long k =0;k<NMAX;k++){h2f1->Fill(r.Uniform(),r.Uniform());}

TH2F *h2f2 = new TH2F("h2f2","test",2,-0.1,1.1,2,-0.1,1.1);
for (long k =0;k<NMAX;k++){h2f2->Fill(r.Uniform(),r.Uniform());}


TH1.Print Name = h2f1, Entries= 100000000, Total sum= 1e+08
It is not the float limit.

I found this problem first filling a TH2F with a TChain, then I ended up with this concise example.
TH2D doesn’t has this problem.

_ROOT Version: 6.12/06 and 6.14/04
_Platform: Debian GNU/Linux 9 4.9.0-8-amd64 and Linux_CentOS7.2.1511-x86_64-gcc4.8.5
_Compiler: g++ (Debian 6.3.0-18+deb9u1) and g++ (GCC) 4.8.5 20150623 (Red Hat 4.8.5-4)

You need to use TH2D.

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