From b57d4dedc2b07b72d2574be53350e54f234c9266 Mon Sep 17 00:00:00 2001
From: Daniele Zanzi <daniele.zanzi@cern.ch>
Date: Sun, 7 Mar 2021 20:53:36 +0100
Subject: [PATCH] 2tau+met chain (ATR-22966)

---
 .../share/ref_RDOtoRDOTrig_v1Dev_build.ref    |  9 +++++++++
 .../share/ref_data_v1Dev_build.ref            |  4 ++++
 .../python/HLTMenuConfig/Menu/ChainMerging.py | 20 +++++++++++--------
 .../python/HLTMenuConfig/Menu/LS2_v1.py       |  2 +-
 4 files changed, 26 insertions(+), 9 deletions(-)

diff --git a/Trigger/TrigValidation/TrigAnalysisTest/share/ref_RDOtoRDOTrig_v1Dev_build.ref b/Trigger/TrigValidation/TrigAnalysisTest/share/ref_RDOtoRDOTrig_v1Dev_build.ref
index 5d9861fed903..20189abeb63d 100644
--- a/Trigger/TrigValidation/TrigAnalysisTest/share/ref_RDOtoRDOTrig_v1Dev_build.ref
+++ b/Trigger/TrigValidation/TrigAnalysisTest/share/ref_RDOtoRDOTrig_v1Dev_build.ref
@@ -4320,6 +4320,15 @@ HLT_tau35_tightRNN_tracktwo_L1TAU12IM:
     0: 19
     1: 12
     2: 7
+HLT_tau60_mediumRNN_tracktwoMVA_tau25_mediumRNN_tracktwoMVA_xe50_cell_L1TAU40_2TAU12IM_XE40:
+  eventCount: 0
+  stepCounts:
+    0: 3
+    1: 1
+  stepFeatures:
+    0: 12
+    1: 7
+    2: 2
 HLT_tau80_mediumRNN_tracktwoMVA_tau35_mediumRNN_tracktwoMVA_L1TAU60_DR-TAU20ITAU12I:
   eventCount: 0
   stepCounts:
diff --git a/Trigger/TrigValidation/TriggerTest/share/ref_data_v1Dev_build.ref b/Trigger/TrigValidation/TriggerTest/share/ref_data_v1Dev_build.ref
index bc8ae7130f3d..fa75b050fe5f 100644
--- a/Trigger/TrigValidation/TriggerTest/share/ref_data_v1Dev_build.ref
+++ b/Trigger/TrigValidation/TriggerTest/share/ref_data_v1Dev_build.ref
@@ -2843,6 +2843,10 @@ HLT_tau35_tightRNN_tracktwo_L1TAU12IM:
     0: 4
     1: 3
     2: 2
+HLT_tau60_mediumRNN_tracktwoMVA_tau25_mediumRNN_tracktwoMVA_xe50_cell_L1TAU40_2TAU12IM_XE40:
+  eventCount: 0
+  stepFeatures:
+    0: 4
 HLT_tau80_mediumRNN_tracktwoMVA_tau35_mediumRNN_tracktwoMVA_L1TAU60_DR-TAU20ITAU12I:
   eventCount: 0
   stepFeatures:
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/ChainMerging.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/ChainMerging.py
index d776e172c460..cdadd25a7d9a 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/ChainMerging.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/ChainMerging.py
@@ -382,16 +382,20 @@ def makeCombinedStep(parallel_steps, stepNumber, chainDefList, allSteps = [], cu
         for chain_index, step in enumerate(parallel_steps): 
             # every step is empty but some might have empty sequences and some might not
             if len(step.sequences) == 0:
-                new_stepDict = deepcopy(chainDefList[chain_index].steps[-1].stepDicts[-1])
-                currentStepName = 'Empty' + chainDefList[chain_index].alignmentGroups[0]+'Align'+str(stepNumber)+'_'+new_stepDict['chainParts'][0]['multiplicity']+new_stepDict['signature']
+                new_stepDicts = deepcopy(chainDefList[chain_index].steps[-1].stepDicts)
+                currentStepName = 'Empty' + chainDefList[chain_index].alignmentGroups[0]+'Align'+str(stepNumber)+'_'+new_stepDicts[0]['chainParts'][0]['multiplicity']+new_stepDicts[0]['signature']
+                log.debug('[makeCombinedStep] step has no sequences, making empty step %s', currentStepName)
 
                 # we need a chain dict here, use the one corresponding to this leg of the chain
-                oldLegName = new_stepDict['chainName']
-                if re.search('^leg[0-9]{3}_',oldLegName):
-                    oldLegName = oldLegName[7:]
-                new_stepDict['chainName'] = legName(oldLegName,leg_counter)
-                stepDicts.append(new_stepDict)
-                leg_counter += 1
+                for new_stepDict in new_stepDicts:
+                    oldLegName = new_stepDict['chainName']
+                    if re.search('^leg[0-9]{3}_',oldLegName):
+                        oldLegName = oldLegName[7:]
+                    new_stepDict['chainName'] = legName(oldLegName,leg_counter)
+                    log.debug("[makeCombinedStep] stepDict naming old: %s, new: %s", oldLegName, new_stepDict['chainName'])
+                    stepDicts.append(new_stepDict)
+                    leg_counter += 1
+
             else:
                 # Standard step with empty sequence(s)
                 currentStepName = step.name
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/LS2_v1.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/LS2_v1.py
index 670de7241dac..757d6606b2dc 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/LS2_v1.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/LS2_v1.py
@@ -622,7 +622,7 @@ def setupMenu():
 
 
         #ATR-22108: combined tau+X chains: TODO: add dRtt, need T&P-like merging
-        #ChainProp(name='HLT_tau60_mediumRNN_tracktwoMVA_tau25_mediumRNN_tracktwoMVA_xe50_cell_L1TAU40_2TAU12IM_XE40', l1SeedThresholds=['TAU40','TAU12IM','XE40'], stream=[PhysicsStream], groups=TauMETGroup),
+        ChainProp(name='HLT_tau60_mediumRNN_tracktwoMVA_tau25_mediumRNN_tracktwoMVA_xe50_cell_L1TAU40_2TAU12IM_XE40', l1SeedThresholds=['TAU40','TAU12IM','XE40'], stream=[PhysicsStream], groups=TauMETGroup),  # ATR-22966
         ChainProp(name='HLT_e17_lhmedium_tau25_mediumRNN_tracktwoMVA_xe50_cell_L1EM15VHI_2TAU12IM_XE35', l1SeedThresholds=['EM15VHI','TAU12IM','XE35'], stream=[PhysicsStream], groups=TauMETGroup),
         ChainProp(name='HLT_mu14_tau25_mediumRNN_tracktwoMVA_xe50_cell_L1MU10_TAU12IM_XE35', l1SeedThresholds=['MU10','TAU12IM','XE35'], stream=[PhysicsStream], groups=TauMETGroup),
         ChainProp(name='HLT_e17_lhmedium_ivarloose_tau25_mediumRNN_tracktwoMVA_03dRtt_L1EM15VHI_2TAU12IM_4J12', l1SeedThresholds=['EM15VHI','TAU12IM'], stream=[PhysicsStream], groups=EgammaTauGroup),
-- 
GitLab