From 2762d606d4878896cb46d1e00d10d0aaef28a9d0 Mon Sep 17 00:00:00 2001
From: Jean Yves Beaucamp <jean.yves.beaucamp@cern.ch>
Date: Mon, 17 Feb 2025 16:54:25 +0000
Subject: [PATCH] Implement Dev menu-specific TauID inferences for the HLT Tau
 reconstruction

Implement Dev menu-specific TauID inferences for the HLT Tau reconstruction
---
 .../TrigTauHypo/python/TrigTauHypoTool.py          |  2 +-
 .../python/HLT/Tau/TauConfigurationTools.py        | 14 +++++++++++---
 .../python/HLT/Tau/TauMenuSequences.py             |  4 ++--
 3 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/Trigger/TrigHypothesis/TrigTauHypo/python/TrigTauHypoTool.py b/Trigger/TrigHypothesis/TrigTauHypo/python/TrigTauHypoTool.py
index 2cde35cd3edf..752bdca72713 100644
--- a/Trigger/TrigHypothesis/TrigTauHypo/python/TrigTauHypoTool.py
+++ b/Trigger/TrigHypothesis/TrigTauHypo/python/TrigTauHypoTool.py
@@ -81,7 +81,7 @@ def TrigTauPrecisionIDHypoToolFromDict(flags, chainDict):
 
         # Monitor all the included algorithms
         used_builtin_rnnscore = False
-        for tau_id in getPrecisionSequenceTauIDs(precision_seq_name):
+        for tau_id in getPrecisionSequenceTauIDs(flags, precision_seq_name):
             # Skip algs without inference scores
             if tau_id in ['MesonCuts']: continue
 
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLT/Tau/TauConfigurationTools.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLT/Tau/TauConfigurationTools.py
index 114a60438e4c..456fc950ca95 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLT/Tau/TauConfigurationTools.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLT/Tau/TauConfigurationTools.py
@@ -12,15 +12,23 @@ log = logging.getLogger(__name__)
 # we split the reconstruction according to the primary ID algorithm to be used, to avoid running unnecesary long inferences
 # The configuration for each TauID algorithm is contained in the flags.Trigger.Offline.Tau.<TauID> subdirectory
 
-def getPrecisionSequenceTauIDs(precision_sequence: str) -> list[str]:
+def getPrecisionSequenceTauIDs(flags, precision_sequence: str) -> list[str]:
     '''Get the list of TauIDs for each HLT tau trigger sequence'''
     tau_ids = {
-        'MVA': ['GNTau', 'DeepSet', 'MesonCuts'],
+        'MVA': ['DeepSet', 'MesonCuts'],
         'LLP': ['RNNLLP'],
         'LRT': ['RNNLLP'],
     }
 
-    return tau_ids[precision_sequence]
+    # Additional Tau ID algorithms to run ONLY if we're using the Dev menu
+    dev_tau_ids = {
+        'MVA': ['GNTau'],
+    }
+
+    ret = tau_ids[precision_sequence]
+    if 'Dev_' in flags.Trigger.triggerMenuSetup and precision_sequence in dev_tau_ids: ret += dev_tau_ids[precision_sequence]
+    return ret
+
 
 #####################################################################
 # This file contains helper functions for the Tau Trigger signature
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLT/Tau/TauMenuSequences.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLT/Tau/TauMenuSequences.py
index 4b77208aa5f5..6ca8196c9ace 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLT/Tau/TauMenuSequences.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLT/Tau/TauMenuSequences.py
@@ -477,7 +477,7 @@ def tauPrecisionSequenceGenCfg(flags, seq_name, output_name=None, is_probe_leg=F
 
     from TriggerMenuMT.HLT.Tau.TauConfigurationTools import getPrecisionSequenceTauIDs
 
-    return _tauPrecisionSeq(newflags, seq_name, tau_ids=getPrecisionSequenceTauIDs(seq_name), output_name=output_name, is_probe_leg=is_probe_leg)
+    return _tauPrecisionSeq(newflags, seq_name, tau_ids=getPrecisionSequenceTauIDs(flags, seq_name), output_name=output_name, is_probe_leg=is_probe_leg)
 
 
 @AccumulatorCache
@@ -487,4 +487,4 @@ def tauPrecisionLRTSequenceGenCfg(flags, seq_name, output_name=None, is_probe_le
 
     from TriggerMenuMT.HLT.Tau.TauConfigurationTools import getPrecisionSequenceTauIDs
 
-    return _tauPrecisionSeq(newflags, seq_name, tau_ids=getPrecisionSequenceTauIDs(seq_name), output_name=output_name, is_probe_leg=is_probe_leg)
+    return _tauPrecisionSeq(newflags, seq_name, tau_ids=getPrecisionSequenceTauIDs(flags, seq_name), output_name=output_name, is_probe_leg=is_probe_leg)
-- 
GitLab