# TH1 Overflow bins: GetSumOfAllWeights(true) and GetBinContent/Print("all") disagree

**URL:** <https://root-forum.cern.ch/t/th1-overflow-bins-getsumofallweights-true-and-getbincontent-print-all-disagree/65064>\
**Category:** ROOT\
**Created:** [November 24, 2026, 12:51pm UTC](https://root-forum.cern.ch/t/th1-overflow-bins-getsumofallweights-true-and-getbincontent-print-all-disagree/65064 "2026-11-24T12:51:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rmcgover](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/rmcgover/32/26948_2.png) [@rmcgover](https://root-forum.cern.ch/u/rmcgover)\
**Post date:** [November 24, 2026, 12:51pm UTC](https://root-forum.cern.ch/t/th1-overflow-bins-getsumofallweights-true-and-getbincontent-print-all-disagree/65064/1 "2026-11-24T12:51:29Z")

</div>

* * *

_Please read [tips for efficient and successful posting](https://root-forum.cern.ch/t/tips-for-efficient-and-successful-posting/28292) and [posting code](https://root-forum.cern.ch/t/posting-code-read-this-first/28293)_

_ROOT Version:_ 6.38.04 From tags/6-38-04@6-38-04  
_Platform:_ linuxx8664gcc  
_Compiler:_ g++ (GCC) 15.2.0 std202302

* * *

I have several histograms (generated by `EL::AnaAlgorithm`) whose overflow bins are empty, _e.g._

```auto
$ h_Z_pdgId->GetBinContent(0)
(double) 0.0000000
$ h_Z_pdgId->GetBinContent(h_Z_pdgId->GetNbinsX() + 1)
(double) 0.0000000

```

The histogram printout agrees:

```auto
$ h_Z_pdgId->Print("all")
TH1.Print Name = h_Z_pdgId, Entries= 9856, Total sum= 1.291e+12
 fSumw[0]=0, x=-25.5, error=0
 fSumw[1]=0, x=-24.5, error=0
 ...
 fSumw[48]=0, x=22.5, error=0
 fSumw[49]=1.291e+12, x=23.5, error=1.53674e+10
 fSumw[50]=0, x=24.5, error=0
 fSumw[51]=0, x=25.5, error=0

```

but the values of `GetSumOfWeights()` and `GetSumOfAllWeights(true)` differ significantly:

```auto
$ h_Z_pdgId->GetSumOfWeights()
(double) 1.2909971e+12
$ h_Z_pdgId->GetSumOfAllWeights(true)
(double) 1.1618974e+13

```

What on earth is happening here?

I’ve attached a file containing these histograms:  
[hist-run.root](https://root-forum.cern.ch/uploads/short-url/2zMRPi7bT8tUMIVn7ZLKN6cqHSY.root) (47.3 KB)

---

<div class="post-metadata">

**Author:** ![Wile\_E\_Coyote](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/wile_e_coyote/32/12417_2.png) [@Wile\_E\_Coyote](https://root-forum.cern.ch/u/Wile_E_Coyote)\
**Post date:** [November 24, 2026, 1:26pm UTC](https://root-forum.cern.ch/t/th1-overflow-bins-getsumofallweights-true-and-getbincontent-print-all-disagree/65064/2 "2026-11-24T13:26:43Z")

</div>

It’s a bug in ROOT 6.36(.14 and older) and 6.38(.06 and older), fixed in 6.40.
