From 9ba8cca72cd11503a0f0069ae724812742527f9d Mon Sep 17 00:00:00 2001 From: Piotr Konopka Date: Wed, 18 Mar 2026 13:36:14 +0100 Subject: [PATCH] Correctly handle errors in merging histograms with kAverage 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. --- Utilities/Mergers/src/MergerAlgorithm.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Utilities/Mergers/src/MergerAlgorithm.cxx b/Utilities/Mergers/src/MergerAlgorithm.cxx index 9395dd0a2b3f7..2cd09712e4a81 100644 --- a/Utilities/Mergers/src/MergerAlgorithm.cxx +++ b/Utilities/Mergers/src/MergerAlgorithm.cxx @@ -111,7 +111,7 @@ Long64_t mergeDefault(TObject* const target, TObject* const other) // Merge() does not support averages, we have to use Add() // this will break if collection.size != 1 if (auto otherTH1 = dynamic_cast(otherCollection.First())) { - errorCode = targetTH1->Add(otherTH1); + errorCode = targetTH1->Add(otherTH1) == kFALSE ? -1 : 0; } } else { // Add() does not support histograms with labels, thus we resort to Merge() by default