Stat box for TH2

What does the overflow grid for TH2 exactly say?

E.g. my first example, the field in the middle shows the number of entries, but in my second example, it is a negative number (that hist goes from -150 to 150 on both axes). How should this be interpreted?

Thanks,

Andrea

53


ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided


Hi Andrea,
could you specify the type of your TH2:
TH2C, TH2I, TH2F or TH2D
You obviously have huge numbers.
Otto

Negative number for the number of entries is weird. Do you have a reproducer ?

Actually, negative numbers in the “underflows and overflows table” are possible if, for example, one uses negative “weights” when filling the histogram (but then I would also expect a negative “Integral”).
But this number is quite suspicious … 2147483648LL = 0x80000000 = -1L and so -2147483648LL = 0xffffffff80000000

Well it depends. see for instance the following lines:

root [0] TH1D *h = new TH1D("h","h",100,-1.,1)
root [1] h->Fill(0.,1.)
root [2] h->GetEntries()
(double) 1.0000000
root [3] h->Fill(0.,-1.)
root [4] h->GetEntries()
(double) 2.0000000

We are talking about the “number of overflows and underflows” table.

The histogram is TH2F. The weights are positive. I attached a file with the histogram.

Can you explain what does this mean?

histogram.root (18.9 KB)

Numerology

Your histogram has 9670702 entries and it then triggers a bug in the THistPainter::PaintStat2 method:

      if (h2->GetEntries() < 1e7)
         snprintf(t, 100," %7d|%7d|%7d\n", (Int_t)unov[3], (Int_t)unov[4], (Int_t)unov[5]);
      else
         snprintf(t, 100," %7d|%14.7g|%7d\n", (Int_t)unov[3], (Float_t)unov[4], (Int_t)unov[5]);

@couet The simplest fix would be to use:

      if (TMath::Abs(unov[4]) < 1.e7)

This bug is present in ROOT 5 and 6.

Note that this bug will also appear for another fields, as soon as they exceed the maximum value 2147483647 possible for an “(Int_t)”.

1 Like

@Wile_E_Coyote yes I was looking at that too.

@Wile_E_Coyote the fix you suggested is correct. I just pushed it in master.
Thanks !

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