From 9be2680e651c566a0bf8d20df9def0995ce3cc08 Mon Sep 17 00:00:00 2001
From: Rafal Bielski <rafal.bielski@cern.ch>
Date: Wed, 10 Feb 2021 20:14:26 +0100
Subject: [PATCH 1/2] Prevent events from being accepted into a stream with 
 type

---
 .../src/HLTResultMTByteStreamCnv.cxx          | 33 ++++++++++++++++---
 1 file changed, 28 insertions(+), 5 deletions(-)

diff --git a/Trigger/TrigSteer/TrigHLTResultByteStream/src/HLTResultMTByteStreamCnv.cxx b/Trigger/TrigSteer/TrigHLTResultByteStream/src/HLTResultMTByteStreamCnv.cxx
index 87d6e42e300a..c2b04f788e92 100644
--- a/Trigger/TrigSteer/TrigHLTResultByteStream/src/HLTResultMTByteStreamCnv.cxx
+++ b/Trigger/TrigSteer/TrigHLTResultByteStream/src/HLTResultMTByteStreamCnv.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
 */
 
 // Trigger includes
@@ -20,7 +20,7 @@
 #include "eformat/Issue.h"
 #include "eformat/SourceIdentifier.h"
 
-// Local definitions
+// Local constants
 namespace {
   /**
    * ROBFragment module ID of the HLT result which contains all Trigger EDM collections. Can be considered to be made
@@ -34,6 +34,22 @@ namespace {
   constexpr uint16_t hltRodMinorVersion = 0x0100;
 }
 
+// Local helper methods
+namespace {
+  /// Check if a stream tag has the given type
+  bool isStreamTagType(const eformat::helper::StreamTag& st, const eformat::TagType type) {
+    return eformat::helper::string_to_tagtype(st.type) == type;
+  }
+  /// Check if a stream tag has the debug type
+  bool isDebugStreamTag(const eformat::helper::StreamTag& st) {
+    return isStreamTagType(st, eformat::TagType::DEBUG_TAG);
+  }
+  /// Check if a stream tag has the unknown type
+  bool isUnknownStreamTag(const eformat::helper::StreamTag& st) {
+    return isStreamTagType(st, eformat::TagType::UNKNOWN_TAG);
+  }
+}
+
 // =============================================================================
 // Standard constructor
 // =============================================================================
@@ -109,10 +125,12 @@ StatusCode HLT::HLTResultMTByteStreamCnv::createRep(DataObject* pObj, IOpaqueAdd
   // Read the stream tags to check for debug stream tag and decide which HLT ROBFragments to write out
   std::set<eformat::helper::SourceIdentifier> resultIdsToWrite;
   bool debugEvent=false;
-  auto isDebugStreamTag = [](const eformat::helper::StreamTag& st){
-    return eformat::helper::string_to_tagtype(st.type) == eformat::TagType::DEBUG_TAG;
-  };
+  std::string unknownTypeStreams;
   for (const eformat::helper::StreamTag& st : hltResult->getStreamTags()) {
+    // Flag events with unknown stream type
+    if (isUnknownStreamTag(st)) {
+      unknownTypeStreams += st.type + "_" + st.name + " ";
+    }
     // Flag debug stream events
     if (isDebugStreamTag(st)) debugEvent=true;
     // In case of full event building, add the full result ID
@@ -127,6 +145,11 @@ StatusCode HLT::HLTResultMTByteStreamCnv::createRep(DataObject* pObj, IOpaqueAdd
         resultIdsToWrite.insert(sid);
     }
   }
+  // Fail if the event is not already failed (debug stream) and unknown stream type was found
+  if (!debugEvent && !unknownTypeStreams.empty()) {
+    ATH_MSG_ERROR("Found stream tag(s) with unknown type: " << unknownTypeStreams);
+    return StatusCode::FAILURE;
+  }
 
   // If the event goes to the debug stream, remove all non-debug stream tags
   // and force full event building in all debug streams
-- 
GitLab


From 6aa9360da7225f88841575faec7f79781f8e6f28 Mon Sep 17 00:00:00 2001
From: Rafal Bielski <rafal.bielski@cern.ch>
Date: Wed, 10 Feb 2021 21:16:09 +0100
Subject: [PATCH 2/2] Fix the TimeBurner chain

---
 Trigger/TrigAlgorithms/TrigGenericAlgs/src/TimeBurner.cxx   | 6 ++++--
 .../TriggerTest/share/ref_data_v1Dev_build.ref              | 2 +-
 .../CalibCosmicMon/MonitorChainConfiguration.py             | 4 ++--
 3 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/Trigger/TrigAlgorithms/TrigGenericAlgs/src/TimeBurner.cxx b/Trigger/TrigAlgorithms/TrigGenericAlgs/src/TimeBurner.cxx
index d051622c4327..36a838a74f30 100644
--- a/Trigger/TrigAlgorithms/TrigGenericAlgs/src/TimeBurner.cxx
+++ b/Trigger/TrigAlgorithms/TrigGenericAlgs/src/TimeBurner.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
 */
 
 #include "TimeBurner.h"
@@ -10,7 +10,9 @@
 TimeBurner::TimeBurner(const std::string& name, ISvcLocator* pSvcLocator)
 : ::HypoBase(name, pSvcLocator) {}
 
-StatusCode TimeBurner::execute(const EventContext& /*eventContext*/) const {
+StatusCode TimeBurner::execute(const EventContext& eventContext) const {
+  // Create a reject decision
+  TrigCompositeUtils::createAndStore(decisionOutput(), eventContext);
 
   std::this_thread::sleep_for(std::chrono::milliseconds(m_sleepTimeMillisec.value()));
 
diff --git a/Trigger/TrigValidation/TriggerTest/share/ref_data_v1Dev_build.ref b/Trigger/TrigValidation/TriggerTest/share/ref_data_v1Dev_build.ref
index 002086587895..a671130a4777 100644
--- a/Trigger/TrigValidation/TriggerTest/share/ref_data_v1Dev_build.ref
+++ b/Trigger/TrigValidation/TriggerTest/share/ref_data_v1Dev_build.ref
@@ -2744,7 +2744,7 @@ HLT_tilecalib_laser_TilePEB_L1CALREQ2:
   stepFeatures:
     0: 20
 HLT_timeburner_L1All:
-  eventCount: 20
+  eventCount: 0
 HLT_unconvtrk120_isohpttrack_iaggrmedium_L1XE50:
   eventCount: 0
 HLT_unconvtrk120_isohpttrack_imedium_L1XE50:
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/CalibCosmicMon/MonitorChainConfiguration.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/CalibCosmicMon/MonitorChainConfiguration.py
index 6ce48aba69fb..080de18c9a26 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/CalibCosmicMon/MonitorChainConfiguration.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/CalibCosmicMon/MonitorChainConfiguration.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
 
 from AthenaCommon.Logging import logging
 logging.getLogger().info("Importing %s",__name__)
@@ -64,4 +64,4 @@ class MonitorChainConfiguration(ChainConfigurationBase):
     # TimeBurner configuration
     # --------------------
     def getTimeBurnerStep(self):      
-        return self.getStep(1,'TimeBurner',[TimeBurnerSequenceCfg], comboHypoCfg=None)
+        return self.getStep(1,'TimeBurner',[TimeBurnerSequenceCfg])
-- 
GitLab