From 04ab0c4bfe1160a78cf3ea21519e4e3e1e856c02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Tich=C3=A1k?= Date: Mon, 30 Sep 2024 15:02:45 +0200 Subject: [PATCH] switch MOs in MonitorObjectCollection when run number is higher on new --- Framework/src/MonitorObjectCollection.cxx | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Framework/src/MonitorObjectCollection.cxx b/Framework/src/MonitorObjectCollection.cxx index 31b021289f..f1ce3800a6 100644 --- a/Framework/src/MonitorObjectCollection.cxx +++ b/Framework/src/MonitorObjectCollection.cxx @@ -33,7 +33,6 @@ void MonitorObjectCollection::merge(mergers::MergeInterface* const other) throw std::runtime_error("The other object is not a MonitorObjectCollection"); } - bool reportedMismatchingRunNumbers = false; auto otherIterator = otherCollection->MakeIterator(); while (auto otherObject = otherIterator->Next()) { auto otherObjectName = otherObject->GetName(); @@ -46,16 +45,19 @@ void MonitorObjectCollection::merge(mergers::MergeInterface* const other) if (!otherMO || !targetMO) { throw std::runtime_error("The target object or the other object could not be casted to MonitorObject."); } - if (!reportedMismatchingRunNumbers && targetMO->getActivity().mId != otherMO->getActivity().mId) { + + if (otherMO->getActivity().mId > targetMO->getActivity().mId) { ILOG(Error, Ops) << "The run number of the input object '" << otherMO->GetName() << "' (" << otherMO->getActivity().mId << ") " - << "does not match the run number of the target object '" + << "is higher than the one of the target object '" << targetMO->GetName() << "' (" << targetMO->getActivity().mId - << "). Trying to continue, but THIS SHOULD BE IMMEDIATELY ADDRESSED IN PRODUCTION. " - << "QC objects from other setups are reaching this one. Will not report more mismatches in this collection." + << "). I am switching these objects, but THIS SHOULD BE IMMEDIATELY ADDRESSED IN PRODUCTION. " + << "QC objects from other setups are reaching this one." << ENDM; - reportedMismatchingRunNumbers = true; + otherMO->Copy(*targetMO); + continue; } + // That might be another collection or a concrete object to be merged, we walk on the collection recursively. algorithm::merge(targetMO->getObject(), otherMO->getObject()); if (otherMO->getValidity().isValid()) {