Hadd inconsistency for >350 files


I am encountering an inconsistency with hadd when merging more than 350 files together.
I have a histogram with just one bin containing an integer number, i.e. just counting entries.

I have 367 input files containing this histogram. If I merge them together and check the number of entries in histogram in the merged *.root file and compare it with the sum of the entries in the histograms of the single files, they do not match.

We are talking about only 1 event inconsistency within O(10M) events, but still this seems strange.

If I limit the hadd to 350 files, the comparison is fine, but not for the full amount.

I extracted the event numbers out ouf my large *.root files and created a minimum working example which reproduces the problem, see attached script.

I am using root version
mwe.py (1.95 KB)
nentries.txt (2.15 KB)

This version 5.34.10, seems quite old. Can you please try with a newer version ? The latest of ATLAS or version 6 ?
We had some bug fixed in TH1::Merge in the past

Best Regards


Hello moneta!

I see the same inconsistency for the latest default version 5.34.25-x86_64-slc6-gcc48-opt and also for the most recent available 6.02.10-x86_64-slc6-gcc48-opt

INFO :: 367 part files INFO :: 18756241 summed events in part files INFO :: 18756240 events in merged file INFO :: -1 diff (merged-parts)

The René Brun’s post disappeared due to the forum server problem. Basically, it said that your problem comes from the rounding approximation. If you use TH1D instead of TH1F, your problem should disappear.