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

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

couet
November 22, 2018, 7:35am
#3
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

couet
November 22, 2018, 9:58am
#5
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)

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

couet
November 22, 2018, 3:19pm
#11
@Wile_E_Coyote yes I was looking at that too.

couet
November 22, 2018, 4:21pm
#12
@Wile_E_Coyote the fix you suggested is correct. I just pushed it in master.
Thanks !

system
closed
December 6, 2018, 4:21pm
#13
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.