Skip to content

Commit 2e6b872

Browse files
authored
Correctly handle errors in merging histograms with kAverage (#15189)
As pointed out by Felix Schlepper, TH1::Add reports errors differently than Merge, see https://root.cern.ch/doc/master/classTH1.html#a6e3008f571628f0c9d17d754c8b88730 Fixes QC-1341.
1 parent 866b9a2 commit 2e6b872

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Utilities/Mergers/src/MergerAlgorithm.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ Long64_t mergeDefault(TObject* const target, TObject* const other)
111111
// Merge() does not support averages, we have to use Add()
112112
// this will break if collection.size != 1
113113
if (auto otherTH1 = dynamic_cast<TH1*>(otherCollection.First())) {
114-
errorCode = targetTH1->Add(otherTH1);
114+
errorCode = targetTH1->Add(otherTH1) == kFALSE ? -1 : 0;
115115
}
116116
} else {
117117
// Add() does not support histograms with labels, thus we resort to Merge() by default

0 commit comments

Comments
 (0)