From 976ef1e30a7c43bd4778f8d3cfcd5a6f531d65b2 Mon Sep 17 00:00:00 2001
From: vcroft <vincent.croft@cern.ch>
Date: Mon, 13 Jan 2020 12:00:18 +0100
Subject: [PATCH 01/36] Moving sequence interactions to internal

---
 .../python/HLTMenuConfig/Menu/HLTCFConfig.py  | 18 +---
 .../HLTMenuConfig/Menu/MenuComponents.py      | 87 +++++++++++++------
 2 files changed, 63 insertions(+), 42 deletions(-)

diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTCFConfig.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTCFConfig.py
index bdf7fc4cce89..e5ae93af9a03 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTCFConfig.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTCFConfig.py
@@ -94,19 +94,10 @@ def createCFTree(CFseq):
 
     already_connected = []
     for menuseq in CFseq.step.sequences:
-        ath_sequence = menuseq.sequence.Alg
-        name = ath_sequence.name()
-        if name in already_connected:
-            log.debug("AthSequencer %s already in the Tree, not added again",name)
-            continue
-        else:
-            already_connected.append(name)
-            stepReco += ath_sequence
-        if type(menuseq.hypo) is list:
-           for hp in menuseq.hypo:
-              seqAndView += hp.Alg
-        else:
-           seqAndView += menuseq.hypo.Alg
+        stepReco, seqAndView, already_connected = menuseq.addToSequencer(
+            stepReco,
+            seqAndView,
+            already_connected)
 
     if CFseq.step.isCombo:
         seqAndView += CFseq.step.combo.Alg
@@ -114,7 +105,6 @@ def createCFTree(CFseq):
     return seqAndWithFilter
 
 
-
 #######################################
 ## CORE of Decision Handling
 #######################################
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py
index 0a539a44eeb4..960c9df1fdde 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py
@@ -297,27 +297,41 @@ class MenuSequence(object):
         
 
     @property
-    def maker(self):
+    def __maker(self):
         if self.ca is not None:
             makerAlg = self.ca.getEventAlgo(self._maker.Alg.name())
             self._maker.Alg = makerAlg
         return self._maker
 
+
     @property
-    def hypo(self):
+    def __hypo(self):
         if self.ca is not None:
             hypoAlg = self.ca.getEventAlgo(self._hypo.Alg.name())
             self._hypo.Alg = hypoAlg
         return self._hypo
 
+
+    def getOutputList(self):
+        outputlist = []
+        if type(self.__hypo) is list:
+
+            for hypo in self.__hypo:
+                outputlist.append(hypo.readOutputList()[0])
+        else:
+            outputlist.append(self.__hypo.readOutputList()[0])
+
+        return outputlist
+
+
     def connectToFilter(self, outfilter):
         """ Connect filter to the InputMaker"""
-        self.maker.addInput(outfilter)
+        self.__maker.addInput(outfilter)
       
 
     def connect(self, Hypo, HypoToolGen):
         """ Sets the input and output of the hypo, and links to the input maker """
-        input_maker_output= self.maker.readOutputList()[0] # only one since it's merged
+        input_maker_output= self.__maker.readOutputList()[0] # only one since it's merged
 
          #### Add input/output Decision to Hypo
         if type(Hypo) is list:
@@ -354,7 +368,7 @@ class MenuSequence(object):
 
         log.debug("MenuSequence.connect: connecting InputMaker and HypoAlg and OverlapRemoverAlg, adding: \n\
         InputMaker::%s.output=%s",\
-                        self.maker.Alg.name(), input_maker_output)
+                        self.__maker.Alg.name(), input_maker_output)
         if type(self._hypo) is list:
            for hp, hp_in, hp_out in zip( self._hypo, hypo_input_total, hypo_output_total):
               log.debug("HypoAlg::%s.previousDecision=%s, \n\
@@ -363,7 +377,35 @@ class MenuSequence(object):
         else:
            log.debug("HypoAlg::%s.previousDecision=%s, \n\
                       HypoAlg::%s.output=%s",\
-                           self.hypo.Alg.name(), input_maker_output, self.hypo.Alg.name(), self.hypo.readOutputList()[0])
+                           self.__hypo.Alg.name(), input_maker_output, self.__hypo.Alg.name(), self.__hypo.readOutputList()[0])
+
+
+    def configureHypoTool(self, chainDict):
+        if type(self.hypoToolConf) is list:
+            log.warning ("This sequence %s has %d multiple HypoTools ",seq.sequence.name, len(seq.hypoToolConf))
+            for hypo, hypoToolConf in zip(self._hypo, self.hypoToolConf):
+                hypoToolConf.setConf( chainDict )
+                hypo.addHypoTool(self.hypoToolConf)
+        else:
+            self.hypoToolConf.setConf( chainDict )
+            self._hypo.addHypoTool(self.hypoToolConf) #this creates the HypoTools  
+
+
+    def addToSequencer(self, already_connected, stepReco, seqAndView):
+        ath_sequence = self.sequence.Alg
+        name = ath_sequence.name()
+        if name in already_connected:
+            log.debug("AthSequencer %s already in the Tree, not added again",name)
+            return stepReco, seqAndView, already_connected        
+        else:
+            already_connected.append(name)
+            stepReco += ath_sequence
+        if type(self._hypo) is list:
+           for hp in self._hypo:
+              seqAndView += hp.Alg
+        else:
+           seqAndView += self.hypo.Alg
+        return stepReco, seqAndView, already_connected        
 
 
     def __repr__(self):
@@ -374,12 +416,12 @@ class MenuSequence(object):
               hyponame.append( hp.Alg.name() )
               hypotool.append( hptool.name )
            return "MenuSequence::%s \n Hypo::%s \n Maker::%s \n Sequence::%s \n HypoTool::%s"\
-           %(self.name, hyponame, self.maker.Alg.name(), self.sequence.Alg.name(), hypotool)
+           %(self.name, hyponame, self.__maker.Alg.name(), self.sequence.Alg.name(), hypotool)
         else:
            hyponame = self._hypo.Alg.name()
            hypotool = self.hypoToolConf.name
            return "MenuSequence::%s \n Hypo::%s \n Maker::%s \n Sequence::%s \n HypoTool::%s\n"\
-           %(self.name, hyponame, self.maker.Alg.name(), self.sequence.Alg.name(), hypotool)
+           %(self.name, hyponame, self.__maker.Alg.name(), self.sequence.Alg.name(), hypotool)
 
 
 
@@ -472,23 +514,15 @@ class Chain(object):
                 chainDict = listOfChainDictsLegs[0]
                 chainDict['chainName']= self.name # rename the chaindict to remove the leg name
                 for seq in step.sequences:
-                    seq.hypoToolConf.setConf( chainDict )
-                    seq.hypo.addHypoTool(seq.hypoToolConf) #this creates the HypoTools                    
+                    seq.configureHypoTool( chainDict ) #this creates the HypoTools                    
                 continue
 
             # add one hypotool per sequence and chain part
             for seq, onePartChainDict in zip(step.sequences, listOfChainDictsLegs):
                 if seq.ca is not None: # The CA merging took care of everything
                     continue
-                if type(seq.hypoToolConf) is list:
-                    log.warning ("This sequence %s has %d multiple HypoTools ",seq.sequence.name, len(seq.hypoToolConf))
-                    for hp, hptoolConf in zip( seq.hypo, seq.hypoToolConf ):
-                        hptoolConf.setConf( onePartChainDict )
-                        hp.addHypoTool(hptoolConf) #this creates the HypoTools
-                else:
-                    seq.hypoToolConf.setConf( onePartChainDict )
-                    seq.hypo.addHypoTool(seq.hypoToolConf) #this creates the HypoTools
-                    
+                seq.configureHypoTool( onePartChainDict )#this creates the HypoTools
+
 
     def __repr__(self):
         return "--- Chain %s --- \n + Seeds: %s \n + Steps: \n %s \n"%(\
@@ -519,12 +553,9 @@ class CFSequence(object):
                 self.decisions.extend(self.step.combo.getOutputList())
             else:
                 for sequence in self.step.sequences:
-                    hp=sequence.hypo
-                    if type(hp) is list:
-                        for hypo in hp:
-                            self.decisions.append(hypo.readOutputList()[0])
-                    else:
-                        self.decisions.append(hp.readOutputList()[0])
+                    sequence_outputs=sequence.getOutputList()
+                    for output in sequence_outputs:
+                        self.decisions.append(output)
 
         log.debug("CFSequence: set out decisions: %s", self.decisions)
 
@@ -558,10 +589,10 @@ class CFSequence(object):
     def connectCombo(self):
         """ connect Combo to Hypos"""
         for seq in self.step.sequences:
-            if type(seq.hypo) is list:
-               combo_input=seq.hypo[-1].readOutputList()[0] # last one?
+            if type(seq.getOutputList()) is list:
+               combo_input=seq.getOutputList()[-1] # last one?
             else:
-               combo_input=seq.hypo.readOutputList()[0]
+               combo_input=seq.getOutputList()[0]
             self.step.combo.addInput(combo_input)
             log.debug("CFSequence.connectCombo: adding input to  %s: %s",  self.step.combo.Alg.name(), combo_input)
             # inputs are the output decisions of the hypos of the sequences
-- 
GitLab


From 6a186be775905770ce9499d26fc6a2aa821c3f5e Mon Sep 17 00:00:00 2001
From: vcroft <vincent.croft@cern.ch>
Date: Mon, 13 Jan 2020 15:51:03 +0100
Subject: [PATCH 02/36] rebased + add menu sequence dot functionality

---
 .../python/HLTMenuConfig/Menu/HLTCFConfig.py  |  8 +--
 .../python/HLTMenuConfig/Menu/HLTCFDot.py     | 53 +++++--------------
 .../HLTMenuConfig/Menu/MenuComponents.py      | 47 +++++++++++++++-
 3 files changed, 61 insertions(+), 47 deletions(-)

diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTCFConfig.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTCFConfig.py
index 4370da8d308c..d129bd95cf9e 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTCFConfig.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTCFConfig.py
@@ -231,18 +231,14 @@ def matrixDisplayOld( allCFSeq ):
 
     
 def matrixDisplay( allCFSeq ):
- 
+
     def __getHyposOfStep( step ):
         if len(step.sequences):
             if len(step.sequences)==1:
-                if type(step.sequences[0].hypo) is list:
-                    return step.sequences[0].hypo[0].tools
-                else:
-                    return step.sequences[0].hypo.tools
+                return step.sequences[0].getTools()
             else:
                 return step.combo.getChains().keys()
         return []
- 
    
     # fill dictionary to cumulate chains on same sequences, in steps (dict with composite keys)
     from collections import defaultdict
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTCFDot.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTCFDot.py
index a6a06d888992..3a63c9886a12 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTCFDot.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTCFDot.py
@@ -139,28 +139,14 @@ def all_DataFlow_to_dot(name, step_list):
                     last_step_hypoNodes.append(cfseq.filter)
 
                 for menuseq in cfseq.step.sequences:
-                    cfseq_algs.append(menuseq.maker)
-                    cfseq_algs.append(menuseq.sequence )
-                    if menuseq.reuse is False:
-                        file.write("    %s[fillcolor=%s]\n"%(menuseq.maker.Alg.name(), algColor(menuseq.maker.Alg)))
-                        file.write("    %s[fillcolor=%s]\n"%(menuseq.sequence.Alg.name(), algColor(menuseq.sequence.Alg)))
-                        menuseq.reuse=True
-                    if type(menuseq.hypo) is list:
-                       for hp in menuseq.hypo:
-                          cfseq_algs.append(hp)
-                          file.write("    %s[color=%s]\n"%(hp.Alg.name(), algColor(hp.Alg)))
-                          all_hypos.append(hp)
-                    else:
-                       cfseq_algs.append(menuseq.hypo)
-                       file.write("    %s[color=%s]\n"%(menuseq.hypo.Alg.name(), algColor(menuseq.hypo.Alg)))
-                       all_hypos.append(menuseq.hypo)
-                       if not cfseq.step.isCombo:
-                        if type(menuseq.hypo) is list:
-                           last_step_hypoNodes.append(menuseq.hypo[-1])
-                        else:
-                           last_step_hypoNodes.append(menuseq.hypo)
-
-                    #combo
+                    cfseq_algs, all_hypos, last_step_hypoNodes = menuseq.buildCFDot(cfseq_algs,
+                                                                                    all_hypos,
+                                                                                    cfseq.step.isCombo,
+                                                                                    last_step_hypoNodes,
+                                                                                    file)
+
+                                                                                     
+                #combo
                 if cfseq.step.isCombo:
                     if cfseq.step.combo is not None:
                         file.write("    %s[color=%s]\n"%(cfseq.step.combo.Alg.name(), algColor(cfseq.step.combo.Alg)))
@@ -212,23 +198,12 @@ def stepCF_DataFlow_to_dot(name, cfseq_list):
                 ##     menuseq.reuse=False
                     
             for menuseq in cfseq.step.sequences:
-                cfseq_algs.append(menuseq.maker)
-                cfseq_algs.append(menuseq.sequence )
-                if menuseq.reuse is False:
-                    file.write("    %s[fillcolor=%s]\n"%(menuseq.maker.Alg.name(), algColor(menuseq.maker.Alg)))
-                    file.write("    %s[fillcolor=%s]\n"%(menuseq.sequence.Alg.name(), algColor(menuseq.sequence.Alg)))
-                    menuseq.reuse=True
-                if type(menuseq.hypo) is list:
-                   for hp in menuseq.hypo:
-                      cfseq_algs.append(hp)
-                      file.write("    %s[color=%s]\n"%(hp.Alg.name(), algColor(hp.Alg)))
-                      all_hypos.append(hp)
-                else:
-                   cfseq_algs.append(menuseq.hypo)
-                   file.write("    %s[color=%s]\n"%(menuseq.hypo.Alg.name(), algColor(menuseq.hypo.Alg)))
-                   all_hypos.append(menuseq.hypo)
-
-                #combo
+                    cfseq_algs, all_hypos, _ = menuseq.buildCFDot(cfseq_algs,
+                                                                  all_hypos,
+                                                                  True,
+                                                                  None,
+                                                                  file)
+            #combo
             if cfseq.step.isCombo:
                 if cfseq.step.combo is not None:
                     file.write("    %s[color=%s]\n"%(cfseq.step.combo.Alg.name(), algColor(cfseq.step.combo.Alg)))
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py
index 8a62cf89f07d..602af4c8e389 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py
@@ -123,6 +123,17 @@ class AlgNode(Node):
         return "Alg::%s  [%s] -> [%s]"%(self.Alg.name(), ' '.join(map(str, self.getInputList())), ' '.join(map(str, self.getOutputList())))
 
 
+def algColor(alg):
+    """ Set given color to Alg type"""
+    if isHypoBase(alg):
+        return "darkorchid1"
+    if isInputMakerBase(alg):
+        return "cyan3"
+    if isFilterAlg(alg):
+        return "chartreuse3"
+    return "cadetblue1"
+
+
 class HypoToolConf(object):
     """ Class to group info on hypotools for ChainDict"""
     def __init__(self, hypoToolGen):
@@ -391,7 +402,7 @@ class MenuSequence(object):
             self._hypo.addHypoTool(self.hypoToolConf) #this creates the HypoTools  
 
 
-    def addToSequencer(self, already_connected, stepReco, seqAndView):
+    def addToSequencer(self, stepReco, seqAndView, already_connected):
         ath_sequence = self.sequence.Alg
         name = ath_sequence.name()
         if name in already_connected:
@@ -404,10 +415,42 @@ class MenuSequence(object):
            for hp in self._hypo:
               seqAndView += hp.Alg
         else:
-           seqAndView += self.hypo.Alg
+           seqAndView += self._hypo.Alg
         return stepReco, seqAndView, already_connected        
 
 
+    def buildCFDot(self, cfseq_algs, all_hypos, isCombo, last_step_hypo_nodes, file):
+        cfseq_algs.append(self._maker)
+        cfseq_algs.append(self.sequence )
+        if self.reuse is False:
+            file.write("    %s[fillcolor=%s]\n"%(self._maker.Alg.name(), algColor(self._maker.Alg)))
+            file.write("    %s[fillcolor=%s]\n"%(self.sequence.Alg.name(), algColor(self.sequence.Alg)))
+            self.reuse=True
+        if type(self._hypo) is list:
+            for hp in self._hypo:
+                cfseq_algs.append(hp)
+                file.write("    %s[color=%s]\n"%(hp.Alg.name(), algColor(hp.Alg)))
+                all_hypos.append(hp)
+        else:
+            cfseq_algs.append(self._hypo)
+            file.write("    %s[color=%s]\n"%(self._hypo.Alg.name(), algColor(self._hypo.Alg)))
+            all_hypos.append(self._hypo)
+            if not isCombo:
+                if type(self._hypo) is list:
+                    last_step_hypo_nodes.append(self._hypo[-1])
+                else:
+                    last_step_hypo_nodes.append(self._hypo)
+
+        return cfseq_algs, all_hypos, last_step_hypo_nodes
+
+
+    def getTools(self):
+        if type(self._hypo) is list:
+            return self._hypo[0].tools
+        else:
+            return self._hypo.tools
+
+
     def __repr__(self):
         if type(self._hypo) is list:
            hyponame=[]
-- 
GitLab


From 3ad3b0cbdce3ee2d6af88e5489f507b3ac517248 Mon Sep 17 00:00:00 2001
From: vcroft <vincent.croft@cern.ch>
Date: Mon, 27 Jan 2020 10:13:47 +0100
Subject: [PATCH 03/36] fixed rogue seq on l 396

---
 .../TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py
index 602af4c8e389..fafaa90fd7e7 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py
@@ -393,7 +393,7 @@ class MenuSequence(object):
 
     def configureHypoTool(self, chainDict):
         if type(self.hypoToolConf) is list:
-            log.warning ("This sequence %s has %d multiple HypoTools ",seq.sequence.name, len(seq.hypoToolConf))
+            log.warning ("This sequence %s has %d multiple HypoTools ",self.sequence.name, len(seq.hypoToolConf))
             for hypo, hypoToolConf in zip(self._hypo, self.hypoToolConf):
                 hypoToolConf.setConf( chainDict )
                 hypo.addHypoTool(self.hypoToolConf)
-- 
GitLab


From fd384baedfae2c6d03b5bafbdea06bbfba9e0395 Mon Sep 17 00:00:00 2001
From: vcroft <vincent.croft@cern.ch>
Date: Mon, 27 Jan 2020 11:15:46 +0100
Subject: [PATCH 04/36] Added Empty menu sequence

---
 .../HLTMenuConfig/Menu/MenuComponents.py      | 47 ++++++++++++++++++-
 1 file changed, 46 insertions(+), 1 deletion(-)

diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py
index fafaa90fd7e7..dd7f8a152ef3 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py
@@ -131,6 +131,8 @@ def algColor(alg):
         return "cyan3"
     if isFilterAlg(alg):
         return "chartreuse3"
+    if isEmptyAlg(alg):
+        return "peachpuff3"
     return "cadetblue1"
 
 
@@ -287,12 +289,55 @@ def isInputMakerBase(alg):
 def isFilterAlg(alg):
     return isinstance(alg, RoRSeqFilter)
 
+def isEmptyAlg(alg):
+    return if alg is None
+
 
 
 ##########################################################
 # NOW sequences and chains
 ##########################################################
 
+
+class EmptyMenuSequence(object):
+    """ Class to emulate reco sequences with no Hypo"""
+    """ By construction it has no Hypo;"""
+    
+    def __init__(self, inputDecision=[]):
+        self.reuse = False # flag to draw dot diagrmas
+        self._inputDecision = inputDecision
+
+    def getOutputList(self):
+        return self._inputDecision
+
+    def connectToFilter(self, outfilter):
+        """ Connect filter to the inputs"""
+        self._inputDecision = outfilter
+
+    def configureHypoTool(self, chainDict):
+        log.debug("This sequence is empty. No Hypo to conficure")
+
+    def addToSequencer(self, stepReco, seqAndView, already_connected):
+        # menu sequence empty do not add to athena sequencer
+        log.debug("This sequence is empty. Not added to athena sequencer")
+        return stepReco, seqAndView, already_connected        
+
+    def buildCFDot(self, cfseq_algs, all_hypos, isCombo, last_step_hypo_nodes, file):
+        if self.reuse is False:
+            file.write("    %s[fillcolor=%s]\n"%("none", algColor(None)))
+            self.reuse=True
+
+        return cfseq_algs, all_hypos, last_step_hypo_nodes
+
+    def getTools(self):
+        # No tools for empty sequences - needs to return empty list?
+        log.debug("No tools for empty menu sequences")
+
+    def __repr__(self):
+        return "MenuSequence::%s \n Hypo::%s \n Maker::%s \n Sequence::%s \n HypoTool::%s\n"\
+            %("Empty", "Empty", "Empty", "Empty", None)
+
+
 class MenuSequence(object):
     """ Class to group reco sequences with the Hypo"""
     """ By construction it has one Hypo Only; behaviour changed to support muFastOvlpRmSequence() which has two, but this will change"""
@@ -306,7 +351,6 @@ class MenuSequence(object):
         self.ca = CA
         self.connect(Hypo, HypoToolGen)
         
-
     @property
     def __maker(self):
         if self.ca is not None:
@@ -469,6 +513,7 @@ class MenuSequence(object):
 
 
 
+
 #################################################
 
 #from TriggerMenuMT.HLTMenuConfig.Menu.DictFromChainName import getAllThresholdsFromItem, getUniqueThresholdsFromItem
-- 
GitLab


From 82f6d4aacd890d28ef7179596ec8160260fabc04 Mon Sep 17 00:00:00 2001
From: vcroft <vincent.croft@cern.ch>
Date: Mon, 27 Jan 2020 14:06:46 +0100
Subject: [PATCH 05/36] fixing dot colour function

---
 .../python/HLTMenuConfig/Menu/MenuComponents.py              | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py
index dd7f8a152ef3..34b2fd071a8a 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py
@@ -290,7 +290,10 @@ def isFilterAlg(alg):
     return isinstance(alg, RoRSeqFilter)
 
 def isEmptyAlg(alg):
-    return if alg is None
+    if alg is None:
+        return True
+    else:
+        return False
 
 
 
-- 
GitLab


From 58e1e88c63af2858031fa427d181a847f6b73975 Mon Sep 17 00:00:00 2001
From: vcroft <vincent.croft@cern.ch>
Date: Mon, 27 Jan 2020 15:30:18 +0100
Subject: [PATCH 06/36] more log warning bugs

---
 .../TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py
index fafaa90fd7e7..eb0407ed7438 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py
@@ -393,7 +393,7 @@ class MenuSequence(object):
 
     def configureHypoTool(self, chainDict):
         if type(self.hypoToolConf) is list:
-            log.warning ("This sequence %s has %d multiple HypoTools ",self.sequence.name, len(seq.hypoToolConf))
+            log.warning ("This sequence %s has %d multiple HypoTools ",self.sequence.name, len(self.hypoToolConf))
             for hypo, hypoToolConf in zip(self._hypo, self.hypoToolConf):
                 hypoToolConf.setConf( chainDict )
                 hypo.addHypoTool(self.hypoToolConf)
-- 
GitLab


From deca68e5ce1b7df53dcebd5dfd82af49d9363f0c Mon Sep 17 00:00:00 2001
From: vcroft <vincent.croft@cern.ch>
Date: Fri, 31 Jan 2020 11:17:50 +0100
Subject: [PATCH 07/36] adding EmustepProcessing test for empty steps

---
 .../TrigUpgradeTest/python/EmuStepProcessingConfig.py       | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/Trigger/TrigValidation/TrigUpgradeTest/python/EmuStepProcessingConfig.py b/Trigger/TrigValidation/TrigUpgradeTest/python/EmuStepProcessingConfig.py
index 0bfc5a72b671..e603ce2cc37e 100644
--- a/Trigger/TrigValidation/TrigUpgradeTest/python/EmuStepProcessingConfig.py
+++ b/Trigger/TrigValidation/TrigUpgradeTest/python/EmuStepProcessingConfig.py
@@ -5,7 +5,7 @@ from AthenaCommon.AlgScheduler import AlgScheduler
 from AthenaCommon.CFElements import parOR
 from AthenaCommon.Logging import logging
 from L1Decoder.L1DecoderConf import CTPUnpackingEmulationTool, RoIsUnpackingEmulationTool, L1Decoder
-
+from TriggerMenuMT.HLTMenuConfig.Menu.MenuComponents import EmptyMenuSequence
 log = logging.getLogger('EmuStepProcessingConfig')
 
 def thresholdToChains( chains ):
@@ -167,6 +167,7 @@ def generateL1DecoderAndChains():
 
     # combined chain
     if doCombo:
+        emptySeq = EmptyMenuSequence()
         if not doElectron:
             from TrigUpgradeTest.HLTSignatureConfig import elMenuSequence        
             el11 = elMenuSequence(step="1",reconame="v1", hyponame="v1")    
@@ -185,7 +186,6 @@ def generateL1DecoderAndChains():
             mu32 = muMenuSequence(step="3",reconame="v2", hyponame="v2")
             #step4
             mu41 = muMenuSequence(step="4",reconame="v1", hyponame="v1")
-
            
            
            
@@ -200,7 +200,7 @@ def generateL1DecoderAndChains():
      
         CombChains =[
 
-            makeChain(name='HLT_mu6_e8_L1MU6_EM5',  L1Thresholds=["MU6","EM5"], ChainSteps=[ ChainStep("Step1_mu_em", [mu11, el11], multiplicity=[1,1]),
+            makeChain(name='HLT_mu6_e8_L1MU6_EM5',  L1Thresholds=["MU6","EM5"], ChainSteps=[ ChainStep("Step1_mu_em", [emptySeq, el11], multiplicity=[1,1]),
                                                                                              ChainStep("Step2_mu_em", [mu21, el21], multiplicity=[1,1])] ),
 
             makeChain(name='HLT_mu6Comb_e8_L1MU6_EM5', L1Thresholds=["MU6","EM5"], ChainSteps=[ ChainStep("Step1_mu2_em", [mu12, el11], multiplicity=[1,1]),
-- 
GitLab


From b5bf11427c6e45e74e94c5d450bb481adb8c2838 Mon Sep 17 00:00:00 2001
From: vcroft <vincent.croft@cern.ch>
Date: Fri, 31 Jan 2020 12:37:10 +0100
Subject: [PATCH 08/36] Adding Maker Node to Empty Sequence

---
 .../HLTMenuConfig/Menu/MenuComponents.py      | 22 +++++++++++++------
 1 file changed, 15 insertions(+), 7 deletions(-)

diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py
index 34b2fd071a8a..40b696ac43fd 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py
@@ -1,5 +1,4 @@
-
-# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 from AthenaCommon.Logging import logging
 log = logging.getLogger( __name__ )
@@ -300,22 +299,31 @@ def isEmptyAlg(alg):
 ##########################################################
 # NOW sequences and chains
 ##########################################################
-
+from AthenaConfiguration.ComponentFactory import CompFactory # for the default maker alg?
 
 class EmptyMenuSequence(object):
     """ Class to emulate reco sequences with no Hypo"""
     """ By construction it has no Hypo;"""
     
-    def __init__(self, inputDecision=[]):
+    def __init__(self):
+        Maker = CompFactory.HLTTest__TestInputMaker("Empty", RoIsLink="initialRoI", LinkName="initialRoI")
         self.reuse = False # flag to draw dot diagrmas
+        self._maker       = InputMakerNode( Alg = Maker )
         self._inputDecision = inputDecision
 
+    @property
+    def __maker(self):
+        if self.ca is not None:
+            makerAlg = self.ca.getEventAlgo(self._maker.Alg.name())
+            self._maker.Alg = makerAlg
+        return self._maker
+
     def getOutputList(self):
-        return self._inputDecision
+        return self.__maker.readOutputList()[0] # Only one since it's merged
 
     def connectToFilter(self, outfilter):
-        """ Connect filter to the inputs"""
-        self._inputDecision = outfilter
+        """ Connect filter to the InputMaker"""
+        self.__maker.addInput(outfilter)
 
     def configureHypoTool(self, chainDict):
         log.debug("This sequence is empty. No Hypo to conficure")
-- 
GitLab


From 09a203390d74fbe83ccba591b23b432ba4694216 Mon Sep 17 00:00:00 2001
From: vcroft <vincent.croft@cern.ch>
Date: Fri, 31 Jan 2020 13:20:07 +0100
Subject: [PATCH 09/36] adding single empty control in matrixDisplay

---
 .../python/HLTMenuConfig/Menu/HLTCFConfig.py           |  6 ++++--
 .../python/HLTMenuConfig/Menu/MenuComponents.py        | 10 +++++++---
 2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTCFConfig.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTCFConfig.py
index d129bd95cf9e..e43cc0a6fc0a 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTCFConfig.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTCFConfig.py
@@ -248,8 +248,10 @@ def matrixDisplay( allCFSeq ):
         for cfseq in cfseq_list:
             chains = __getHyposOfStep(cfseq.step)
             for seq in cfseq.step.sequences:
-                mx[stepNumber, seq.sequence.Alg.name()].extend(chains)
-
+                if seq.name is "Empty":
+                    mx[stepNumber, "Empty"].extend(chains)
+                else:
+                    mx[stepNumber, seq.sequence.Alg.name()].extend(chains)
 
     # sort dictionary by fist key=step
     from collections import  OrderedDict
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py
index 40b696ac43fd..91c1b8fd0231 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py
@@ -280,7 +280,10 @@ def isHypoBase(alg):
     if  'HypoInputDecisions'  in alg.__class__.__dict__:
         return True
     prop = alg.__class__.__dict__.get('_properties')
-    return  ('HypoInputDecisions'  in prop)
+    if type(prop) is dict:
+        return  ('HypoInputDecisions'  in prop)
+    else:
+        return False
 
 def isInputMakerBase(alg):
     return  ('InputMakerInputDecisions'  in alg.__class__.__dict__)
@@ -305,11 +308,12 @@ class EmptyMenuSequence(object):
     """ Class to emulate reco sequences with no Hypo"""
     """ By construction it has no Hypo;"""
     
-    def __init__(self):
+    def __init__(self, CA=None):
         Maker = CompFactory.HLTTest__TestInputMaker("Empty", RoIsLink="initialRoI", LinkName="initialRoI")
+        self.name = "Empty"
         self.reuse = False # flag to draw dot diagrmas
         self._maker       = InputMakerNode( Alg = Maker )
-        self._inputDecision = inputDecision
+        self.ca = CA
 
     @property
     def __maker(self):
-- 
GitLab


From 432088506c72870c76463e8e5bf8bf6747874a15 Mon Sep 17 00:00:00 2001
From: vcroft <vincent.croft@cern.ch>
Date: Wed, 26 Feb 2020 11:08:43 +0100
Subject: [PATCH 10/36] ChainMerging typos/fixes

---
 .../python/HLTMenuConfig/Menu/ChainMerging.py | 53 +++++++++++++++++--
 1 file changed, 49 insertions(+), 4 deletions(-)

diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/ChainMerging.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/ChainMerging.py
index 6aa90b3a97f8..ab229bd11a86 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/ChainMerging.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/ChainMerging.py
@@ -4,7 +4,7 @@ from AthenaCommon.Logging import logging
 log = logging.getLogger( __name__ )
 
 
-from TriggerMenuMT.HLTMenuConfig.Menu.MenuComponents import Chain, ChainStep
+from TriggerMenuMT.HLTMenuConfig.Menu.MenuComponents import Chain, ChainStep, EmptyMenuSequence
 from copy import deepcopy
 
 
@@ -15,9 +15,7 @@ def mergeChainDefs(listOfChainDefs, chainDict, strategy="parallel", offset=-1):
     if strategy=="parallel":
         return mergeParallel(listOfChainDefs,  offset)
     elif strategy=="serial":
-        #return mergeSerial(listOfChainDefs,offset)
-        log.error("Serial mergin not yet implemented.")
-        return -1
+        return mergeSerial(listOfChainDefs)
     else:
         log.error("Merging failed for %s. Merging strategy '%s' not known.", (listOfChainDefs, strategy))
         return -1
@@ -74,7 +72,54 @@ def mergeParallel(chainDefList, offset):
 
     return combinedChainDef
 
+def serial_zip(*allSteps):
+    n_chains = len(allSteps)
+    for chain_index, chainsteps in enumerate(allSteps):
+        for sequence in chainsteps:
+            step = [EmptyMenuSequence() for _x in range(n_chains)]
+            step[i] = sequence
+            yield row
+
+def mergeSerial(chainDefList):
+    allSteps = []
+    nSteps = []
+    chainName = ''
+    l1Thresholds = []
+
 
+    for cConfig in chainDefList:
+        if chainName == '':
+            chainName = cConfig.name
+        elif chainName != cConfig.name:
+            log.error("Something is wrong with the combined chain name: cConfig.name = %s while chainName = %s", cConfig.name, chainName)
+            
+        allSteps.append(cConfig.steps)
+        nSteps.append(len(cConfig.steps))
+        l1Thresholds.extend(cConfig.vseeds)
+
+    serialSteps = serial_zip(allSteps)
+    mySerialSteps = deepcopy(serialSteps)
+
+    combChainSteps =[]
+    for steps in mySerialSteps:
+        mySteps = list(steps)
+        combStep = makeChainSteps(mySteps)
+        combChainSteps.append(combStep)
+
+    # check if all chain parts have the same number of steps
+    sameNSteps = all(x==nSteps[0] for x in nSteps) 
+    if sameNSteps is True:
+        log.debug("All chain parts have the same number of steps")
+    else:
+        log.debug("Have to deal with uneven number of chain steps, there might be none's appearing in sequence list => to be fixed")
+                                  
+    combinedChainDef = Chain(chainName, ChainSteps=combChainSteps, L1Thresholds=l1Thresholds)
+
+    log.debug("Merged chain %s with these steps:", chainName)
+    for step in combinedChainDef.steps:
+        log.debug('   %s', step)
+
+    return combinedChainDef
 
 
 def makeChainSteps(steps):
-- 
GitLab


From fd548597a1e023582dd15cdd989f0fbe81e56d35 Mon Sep 17 00:00:00 2001
From: vcroft <vincent.croft@cern.ch>
Date: Thu, 27 Feb 2020 17:03:47 +0100
Subject: [PATCH 11/36] Fixing errors related to CA migration - Unresolved

---
 .../python/HLTMenuConfig/Menu/HLTCFDot.py     |  4 ---
 .../HLTMenuConfig/Menu/MenuComponents.py      | 28 +++++++++----------
 2 files changed, 13 insertions(+), 19 deletions(-)

diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTCFDot.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTCFDot.py
index 89e18bf85d85..55578c7346f7 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTCFDot.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTCFDot.py
@@ -129,8 +129,6 @@ def all_DataFlow_to_dot(name, step_list):
                 cfseq_algs = []
                 cfseq_algs.append(cfseq.filter)
 
-                alreadydrawn = set()
-
                 if len(cfseq.step.sequences)==0:
                     last_step_hypoNodes.append(cfseq.filter)
 
@@ -187,8 +185,6 @@ def stepCF_DataFlow_to_dot(name, cfseq_list):
             cfseq_algs = []
             cfseq_algs.append(cfseq.filter)
 
-            alreadydrawn = set()
-                    
             for menuseq in cfseq.step.sequences:
                     cfseq_algs, all_hypos, _ = menuseq.buildCFDot(cfseq_algs,
                                                                   all_hypos,
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py
index eb38e48c977d..442a9ef54121 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py
@@ -373,24 +373,24 @@ class MenuSequence(object):
 
     def getOutputList(self):
         outputlist = []
-        if type(self.__hypo) is list:
+        if type(self._hypo) is list:
 
-            for hypo in self.__hypo:
+            for hypo in self._hypo:
                 outputlist.append(hypo.readOutputList()[0])
         else:
-            outputlist.append(self.__hypo.readOutputList()[0])
+            outputlist.append(self._hypo.readOutputList()[0])
 
         return outputlist
 
 
     def connectToFilter(self, outfilter):
         """ Connect filter to the InputMaker"""
-        self.__maker.addInput(outfilter)
+        self._maker.addInput(outfilter)
       
 
     def connect(self, Hypo, HypoToolGen):
         """ Sets the input and output of the hypo, and links to the input maker """
-        input_maker_output= self.__maker.readOutputList()[0] # only one since it's merged
+        input_maker_output= self._maker.readOutputList()[0] # only one since it's merged
 
          #### Add input/output Decision to Hypo
         if type(Hypo) is list:
@@ -426,7 +426,7 @@ class MenuSequence(object):
 
         log.debug("MenuSequence.connect: connecting InputMaker and HypoAlg and OverlapRemoverAlg, adding: \n\
         InputMaker::%s.output=%s",\
-                        self.__maker.Alg.name(), input_maker_output)
+                        self._maker.Alg.name(), input_maker_output)
         if type(self._hypo) is list:
            for hp, hp_in, hp_out in zip( self._hypo, hypo_input_total, hypo_output_total):
               log.debug("HypoAlg::%s.previousDecision=%s, \n\
@@ -435,7 +435,7 @@ class MenuSequence(object):
         else:
            log.debug("HypoAlg::%s.previousDecision=%s, \n\
                       HypoAlg::%s.output=%s",\
-                           self.__hypo.Alg.name(), input_maker_output, self.__hypo.Alg.name(), self.__hypo.readOutputList()[0])
+                           self._hypo.Alg.name(), input_maker_output, self._hypo.Alg.name(), self._hypo.readOutputList()[0])
 
 
     def configureHypoTool(self, chainDict):
@@ -469,10 +469,10 @@ class MenuSequence(object):
     def buildCFDot(self, cfseq_algs, all_hypos, isCombo, last_step_hypo_nodes, file):
         cfseq_algs.append(self._maker)
         cfseq_algs.append(self.sequence )
-        if self.reuse is False:
-            file.write("    %s[fillcolor=%s]\n"%(self._maker.Alg.name(), algColor(self._maker.Alg)))
-            file.write("    %s[fillcolor=%s]\n"%(self.sequence.Alg.name(), algColor(self.sequence.Alg)))
-            self.reuse=True
+
+        file.write("    %s[fillcolor=%s]\n"%(self._maker.Alg.name(), algColor(self._maker.Alg)))
+        file.write("    %s[fillcolor=%s]\n"%(self.sequence.Alg.name(), algColor(self.sequence.Alg)))
+        
         if type(self._hypo) is list:
             for hp in self._hypo:
                 cfseq_algs.append(hp)
@@ -508,12 +508,12 @@ class MenuSequence(object):
               hyponame.append( hp.Alg.name() )
               hypotool.append( hptool.name )
            return "MenuSequence::%s \n Hypo::%s \n Maker::%s \n Sequence::%s \n HypoTool::%s"\
-           %(self.name, hyponame, self.__maker.Alg.name(), self.sequence.Alg.name(), hypotool)
+           %(self.name, hyponame, self._maker.Alg.name(), self.sequence.Alg.name(), hypotool)
         else:
            hyponame = self._hypo.Alg.name()
            hypotool = self.hypoToolConf.name
            return "MenuSequence::%s \n Hypo::%s \n Maker::%s \n Sequence::%s \n HypoTool::%s\n"\
-           %(self.name, hyponame, self.__maker.Alg.name(), self.sequence.Alg.name(), hypotool)
+           %(self.name, hyponame, self._maker.Alg.name(), self.sequence.Alg.name(), hypotool)
 
 
 class CAMenuSequence(MenuSequence):
@@ -635,8 +635,6 @@ class Chain(object):
 
             # add one hypotool per sequence and chain part
             for seq, onePartChainDict in zip(step.sequences, listOfChainDictsLegs):
-                if seq.ca is not None: # The CA merging took care of everything
-                    continue
                 seq.configureHypoTool( onePartChainDict )#this creates the HypoTools
 
 
-- 
GitLab


From 355b8540729679ee52245f7f9614446ec5eb054b Mon Sep 17 00:00:00 2001
From: vcroft <vincent.croft@cern.ch>
Date: Thu, 27 Feb 2020 17:19:10 +0100
Subject: [PATCH 12/36] Fixing errors related to CA migration - Resolved

---
 .../python/HLTMenuConfig/Menu/MenuComponents.py        | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py
index 442a9ef54121..eded577ab5e3 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py
@@ -439,14 +439,14 @@ class MenuSequence(object):
 
 
     def configureHypoTool(self, chainDict):
-        if type(self.hypoToolConf) is list:
+        if type(self._hypoToolConf) is list:
             log.warning ("This sequence %s has %d multiple HypoTools ",self.sequence.name, len(self.hypoToolConf))
-            for hypo, hypoToolConf in zip(self._hypo, self.hypoToolConf):
+            for hypo, hypoToolConf in zip(self._hypo, self._hypoToolConf):
                 hypoToolConf.setConf( chainDict )
-                hypo.addHypoTool(self.hypoToolConf)
+                hypo.addHypoTool(self._hypoToolConf)
         else:
-            self.hypoToolConf.setConf( chainDict )
-            self._hypo.addHypoTool(self.hypoToolConf) #this creates the HypoTools  
+            self._hypoToolConf.setConf( chainDict )
+            self._hypo.addHypoTool(self._hypoToolConf) #this creates the HypoTools  
 
 
     def addToSequencer(self, stepReco, seqAndView, already_connected):
-- 
GitLab


From eaa55d3d0e6f194d8e24e2ae50fa11d71dbc9738 Mon Sep 17 00:00:00 2001
From: vcroft <vincent.croft@cern.ch>
Date: Fri, 28 Feb 2020 15:31:34 +0100
Subject: [PATCH 13/36] configureHypoTool->createHypoTools

---
 .../python/HLTMenuConfig/Menu/MenuComponents.py             | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py
index eded577ab5e3..6dc9cca670d0 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py
@@ -438,7 +438,7 @@ class MenuSequence(object):
                            self._hypo.Alg.name(), input_maker_output, self._hypo.Alg.name(), self._hypo.readOutputList()[0])
 
 
-    def configureHypoTool(self, chainDict):
+    def createHypoTools(self, chainDict):
         if type(self._hypoToolConf) is list:
             log.warning ("This sequence %s has %d multiple HypoTools ",self.sequence.name, len(self.hypoToolConf))
             for hypo, hypoToolConf in zip(self._hypo, self._hypoToolConf):
@@ -630,12 +630,12 @@ class Chain(object):
                 chainDict = listOfChainDictsLegs[0]
                 chainDict['chainName']= self.name # rename the chaindict to remove the leg name
                 for seq in step.sequences:
-                    seq.configureHypoTool( chainDict ) #this creates the HypoTools                    
+                    seq.createHypoTools( chainDict ) #this creates the HypoTools                    
                 continue
 
             # add one hypotool per sequence and chain part
             for seq, onePartChainDict in zip(step.sequences, listOfChainDictsLegs):
-                seq.configureHypoTool( onePartChainDict )#this creates the HypoTools
+                seq.createHypoTools( onePartChainDict )#this creates the HypoTools
 
 
     def __repr__(self):
-- 
GitLab


From 7220c8a8d646316428ab723d2004c3cb5c624abe Mon Sep 17 00:00:00 2001
From: vcroft <vincent.croft@cern.ch>
Date: Mon, 2 Mar 2020 12:02:20 +0100
Subject: [PATCH 14/36] tidy up - empty seq with new CA seq

---
 .../python/HLTMenuConfig/Menu/ChainMerging.py      |  4 ++--
 .../python/HLTMenuConfig/Menu/HLTCFConfig.py       |  2 +-
 .../python/HLTMenuConfig/Menu/MenuComponents.py    | 14 +++-----------
 3 files changed, 6 insertions(+), 14 deletions(-)

diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/ChainMerging.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/ChainMerging.py
index ab229bd11a86..8b8f3a4b517c 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/ChainMerging.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/ChainMerging.py
@@ -77,8 +77,8 @@ def serial_zip(*allSteps):
     for chain_index, chainsteps in enumerate(allSteps):
         for sequence in chainsteps:
             step = [EmptyMenuSequence() for _x in range(n_chains)]
-            step[i] = sequence
-            yield row
+            step[chain_index] = sequence
+            yield step
 
 def mergeSerial(chainDefList):
     allSteps = []
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTCFConfig.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTCFConfig.py
index b6e33f1a6c09..fc872d88855b 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTCFConfig.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTCFConfig.py
@@ -253,7 +253,7 @@ def matrixDisplay( allCFSeq ):
         for cfseq in cfseq_list:
             chains = __getHyposOfStep(cfseq.step)
             for seq in cfseq.step.sequences:
-                if seq.name is "Empty":
+                if seq.name == "Empty":
                     mx[stepNumber, "Empty"].extend(chains)
                 else:
                     mx[stepNumber, seq.sequence.Alg.name()].extend(chains)
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py
index 549e949a6652..654b3cf5c707 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py
@@ -308,18 +308,13 @@ class EmptyMenuSequence(object):
     """ Class to emulate reco sequences with no Hypo"""
     """ By construction it has no Hypo;"""
     
-    def __init__(self, CA=None):
+    def __init__(self):
         Maker = CompFactory.HLTTest__TestInputMaker("Empty", RoIsLink="initialRoI", LinkName="initialRoI")
         self.name = "Empty"
-        self.reuse = False # flag to draw dot diagrmas
         self._maker       = InputMakerNode( Alg = Maker )
-        self.ca = CA
 
     @property
     def __maker(self):
-        if self.ca is not None:
-            makerAlg = self.ca.getEventAlgo(self._maker.Alg.name())
-            self._maker.Alg = makerAlg
         return self._maker
 
     def getOutputList(self):
@@ -329,7 +324,7 @@ class EmptyMenuSequence(object):
         """ Connect filter to the InputMaker"""
         self.__maker.addInput(outfilter)
 
-    def configureHypoTool(self, chainDict):
+    def createHypoTools(self, chainDict):
         log.debug("This sequence is empty. No Hypo to conficure")
 
     def addToSequencer(self, stepReco, seqAndView, already_connected):
@@ -338,10 +333,7 @@ class EmptyMenuSequence(object):
         return stepReco, seqAndView, already_connected        
 
     def buildCFDot(self, cfseq_algs, all_hypos, isCombo, last_step_hypo_nodes, file):
-        if self.reuse is False:
-            file.write("    %s[fillcolor=%s]\n"%("none", algColor(None)))
-            self.reuse=True
-
+        file.write("    %s[fillcolor=%s]\n"%("none", algColor(None)))
         return cfseq_algs, all_hypos, last_step_hypo_nodes
 
     def getTools(self):
-- 
GitLab


From 231b0357d75bea076482ac416bfca67c04d0d494 Mon Sep 17 00:00:00 2001
From: vcroft <vincent.croft@cern.ch>
Date: Tue, 3 Mar 2020 09:34:36 +0100
Subject: [PATCH 15/36] Adding functionality for uneven parallel chains

---
 .../TriggerMenuMT/python/HLTMenuConfig/Menu/ChainMerging.py     | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/ChainMerging.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/ChainMerging.py
index 8b8f3a4b517c..0660070e5463 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/ChainMerging.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/ChainMerging.py
@@ -48,7 +48,7 @@ def mergeParallel(chainDefList, offset):
         from itertools import zip_longest
     else:
         from itertools import izip_longest as zip_longest
-    orderedSteps = list(zip_longest(*allSteps))
+    orderedSteps = list(zip_longest(*allSteps,fillvalue=EmptyMenuSequence()))
     myOrderedSteps = deepcopy(orderedSteps)
 
     combChainSteps =[]
-- 
GitLab


From 538f7edece1d99cdb75a60205c4afa10cb1035ef Mon Sep 17 00:00:00 2001
From: vcroft <vincent.croft@cern.ch>
Date: Tue, 3 Mar 2020 09:50:36 +0100
Subject: [PATCH 16/36] Adding serial muon combined chain into LS2 menu test

---
 .../TriggerMenuMT/python/HLTMenuConfig/Menu/LS2_v1.py           | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/LS2_v1.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/LS2_v1.py
index 537cefda0660..4eef46ef4f32 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/LS2_v1.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/LS2_v1.py
@@ -43,7 +43,7 @@ def setupMenu():
         ChainProp(name='HLT_mu20_ivar_L1MU6',      groups=SingleMuonGroup),
         ChainProp(name='HLT_mu6_ivarmedium_L1MU6', groups=SingleMuonGroup),
         ChainProp(name='HLT_mu6noL1_L1MU6', l1SeedThresholds=['FSNOSEED'], groups=SingleMuonGroup),
-#        ChainProp(name='HLT_mu6_mu6noL1_L1MU6', l1SeedThresholds=['MU6','FSNOSEED'], groups=MultiMuonGroup),
+        ChainProp(name='HLT_mu6_mu6noL1_L1MU6', l1SeedThresholds=['MU6','FSNOSEED'], mergingStrategy='Serial', groups=MultiMuonGroup),
         ChainProp(name='HLT_mu6_msonly_L1MU6',     groups=SingleMuonGroup),
 
         ChainProp(name='HLT_2mu6_10invm70_L1MU6', groups=SingleMuonGroup),
-- 
GitLab


From 88224ab3e6791f02c6d461f28b29856248e47fde Mon Sep 17 00:00:00 2001
From: vcroft <vincent.croft@cern.ch>
Date: Tue, 3 Mar 2020 11:09:48 +0100
Subject: [PATCH 17/36] Seed functionality set

---
 .../HLTMenuConfig/Menu/MenuComponents.py      | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py
index 654b3cf5c707..f5b2f5ef3112 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py
@@ -310,8 +310,19 @@ class EmptyMenuSequence(object):
     
     def __init__(self):
         Maker = CompFactory.HLTTest__TestInputMaker("Empty", RoIsLink="initialRoI", LinkName="initialRoI")
-        self.name = "Empty"
+        self._name = "Empty"
         self._maker       = InputMakerNode( Alg = Maker )
+        self._seed=''
+        self.multiplicity = 0
+
+
+    @property
+    def seed(self):
+        return self._seed
+
+    @property
+    def name(self):
+        return self._name
 
     @property
     def __maker(self):
@@ -340,11 +351,15 @@ class EmptyMenuSequence(object):
         # No tools for empty sequences - needs to return empty list?
         log.debug("No tools for empty menu sequences")
 
+    def setSeed( self, seed ):
+        self._seed = seed
+
     def __repr__(self):
         return "MenuSequence::%s \n Hypo::%s \n Maker::%s \n Sequence::%s \n HypoTool::%s\n"\
             %("Empty", "Empty", "Empty", "Empty", None)
 
 
+
 class MenuSequence(object):
     """ Class to group reco sequences with the Hypo"""
     """ By construction it has one Hypo Only; behaviour changed to support muFastOvlpRmSequence() which has two, but this will change"""
@@ -780,7 +795,7 @@ class CFSequence(object):
 
 
 class StepComp(object):
-    """ Class to build hte ChainStep, for including empty sequences"""
+    """ Class to build the ChainStep, for including empty sequences"""
     def __init__(self, sequence, multiplicity,empty):
         self.sequence=sequence
         self.multiplicity=multiplicity
-- 
GitLab


From 7825b05c369b8231204a7641859dc3a4bb136b6d Mon Sep 17 00:00:00 2001
From: vcroft <vincent.croft@cern.ch>
Date: Tue, 3 Mar 2020 12:31:21 +0100
Subject: [PATCH 18/36] Roll back parallel Merging change - Serial works

---
 .../python/EmuStepProcessingConfig.py         |  6 ++++--
 .../python/HLTMenuConfig/Menu/ChainMerging.py | 20 +++++++++++--------
 2 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/Trigger/TrigValidation/TrigUpgradeTest/python/EmuStepProcessingConfig.py b/Trigger/TrigValidation/TrigUpgradeTest/python/EmuStepProcessingConfig.py
index 0af39c74de4c..086ae2b9d2d9 100644
--- a/Trigger/TrigValidation/TrigUpgradeTest/python/EmuStepProcessingConfig.py
+++ b/Trigger/TrigValidation/TrigUpgradeTest/python/EmuStepProcessingConfig.py
@@ -200,8 +200,10 @@ def generateL1DecoderAndChains():
      
         CombChains =[
 
-            makeChain(name='HLT_mu6_e8_L1MU6_EM5',  L1Thresholds=["MU6","EM5"], ChainSteps=[ ChainStep("Step1_mu_em", [emptySeq, el11], multiplicity=[1,1]),
-                                                                                             ChainStep("Step2_mu_em", [mu21, el21], multiplicity=[1,1])] ),
+            makeChain(name='HLT_mu6_e8_L1MU6_EM5',  L1Thresholds=["MU6","EM5"], ChainSteps=[ ChainStep("Step1_mu_em", [el11, emptySeq], multiplicity=[1,1]),
+                                                                                             ChainStep("Step2_mu_em", [el21, emptySeq], multiplicity=[1,1]),
+                                                                                             ChainStep("Step3_mu_em", [emptySeq, mu11], multiplicity=[1,1]),
+                                                                                             ChainStep("Step4_mu_em", [emptySeq, mu21], multiplicity=[1,1])] ),
 
             makeChain(name='HLT_mu6Comb_e8_L1MU6_EM5', L1Thresholds=["MU6","EM5"], ChainSteps=[ ChainStep("Step1_mu2_em", [mu12, el11], multiplicity=[1,1]),
                                                                                                 ChainStep("Step2_mu_em", [mu21, el21], multiplicity=[1,1])] ),
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/ChainMerging.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/ChainMerging.py
index 0660070e5463..d7d8154ccc77 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/ChainMerging.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/ChainMerging.py
@@ -48,7 +48,7 @@ def mergeParallel(chainDefList, offset):
         from itertools import zip_longest
     else:
         from itertools import izip_longest as zip_longest
-    orderedSteps = list(zip_longest(*allSteps,fillvalue=EmptyMenuSequence()))
+    orderedSteps = list(zip_longest(*allSteps))
     myOrderedSteps = deepcopy(orderedSteps)
 
     combChainSteps =[]
@@ -72,13 +72,16 @@ def mergeParallel(chainDefList, offset):
 
     return combinedChainDef
 
-def serial_zip(*allSteps):
+def serial_zip(allSteps):
     n_chains = len(allSteps)
-    for chain_index, chainsteps in enumerate(allSteps):
-        for sequence in chainsteps:
-            step = [EmptyMenuSequence() for _x in range(n_chains)]
-            step[chain_index] = sequence
-            yield step
+    if n_chains < 2:
+        log.error("serial zipping needs multiple chains to zip. I've only got %i",n_chains)
+    else:
+        for chain_index, chainsteps in enumerate(allSteps):
+            for sequence in chainsteps:
+                step = [EmptyMenuSequence() for _x in range(n_chains)]
+                step[chain_index] = sequence
+                yield step
 
 def mergeSerial(chainDefList):
     allSteps = []
@@ -99,7 +102,8 @@ def mergeSerial(chainDefList):
 
     serialSteps = serial_zip(allSteps)
     mySerialSteps = deepcopy(serialSteps)
-
+    for step in serialSteps:
+        log.error("hey listen! %i, of %i",len(step),len(serialSteps))
     combChainSteps =[]
     for steps in mySerialSteps:
         mySteps = list(steps)
-- 
GitLab


From 3c7ee7e499e7cc8aa27e3e0e99060ca1aa2ea47d Mon Sep 17 00:00:00 2001
From: vcroft <vincent.croft@cern.ch>
Date: Tue, 3 Mar 2020 12:58:06 +0100
Subject: [PATCH 19/36] Serial Merging testing

---
 .../python/HLTMenuConfig/Menu/ChainMerging.py       | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/ChainMerging.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/ChainMerging.py
index d7d8154ccc77..bfd8ca20f404 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/ChainMerging.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/ChainMerging.py
@@ -74,14 +74,11 @@ def mergeParallel(chainDefList, offset):
 
 def serial_zip(allSteps):
     n_chains = len(allSteps)
-    if n_chains < 2:
-        log.error("serial zipping needs multiple chains to zip. I've only got %i",n_chains)
-    else:
-        for chain_index, chainsteps in enumerate(allSteps):
-            for sequence in chainsteps:
-                step = [EmptyMenuSequence() for _x in range(n_chains)]
-                step[chain_index] = sequence
-                yield step
+    for chain_index, chainsteps in enumerate(allSteps):
+        for sequence in chainsteps:
+            step = [EmptyMenuSequence() for _x in range(n_chains)]
+            step[chain_index] = sequence
+            yield step
 
 def mergeSerial(chainDefList):
     allSteps = []
-- 
GitLab


From 7d35c31900db0b9268d20f65f89d06e45eb79acc Mon Sep 17 00:00:00 2001
From: vcroft <vincent.croft@cern.ch>
Date: Wed, 4 Mar 2020 13:11:46 +0100
Subject: [PATCH 20/36] rebase to upstream master for TrigConf::HLTPrescalesSet
 bug in Emu test

---
 .../python/HLTMenuConfig/Menu/LS2_v1.py       | 34 +++++++++----------
 .../HLTMenuConfig/Menu/MenuComponents.py      |  2 --
 2 files changed, 17 insertions(+), 19 deletions(-)

diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/LS2_v1.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/LS2_v1.py
index 4eef46ef4f32..752ddba9187e 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/LS2_v1.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/LS2_v1.py
@@ -31,32 +31,32 @@ def setupMenu():
 
     TriggerFlags.MuonSlice.signatures = TriggerFlags.MuonSlice.signatures() + [
         #ART-19985
-        ChainProp(name='HLT_mu6_idperf_L1MU6', groups=SingleMuonGroup),
-        ChainProp(name='HLT_mu24_idperf_L1MU20', groups=SingleMuonGroup),
+#        ChainProp(name='HLT_mu6_idperf_L1MU6', groups=SingleMuonGroup),
+#        ChainProp(name='HLT_mu24_idperf_L1MU20', groups=SingleMuonGroup),
 
         #ATR-20049
-
-        ChainProp(name='HLT_mu6fast_L1MU6', groups=SingleMuonGroup),
-        ChainProp(name='HLT_mu6Comb_L1MU6', groups=SingleMuonGroup),
+        ChainProp(name='HLT_mu6_mu6noL1_L1MU6', l1SeedThresholds=['MU6','FSNOSEED'], mergingStrategy='Serial', groups=MultiMuonGroup),
+#        ChainProp(name='HLT_mu6fast_L1MU6', groups=SingleMuonGroup),
+#        ChainProp(name='HLT_mu6Comb_L1MU6', groups=SingleMuonGroup),
         ChainProp(name='HLT_mu6_L1MU6',     groups=SingleMuonGroup),
 
-        ChainProp(name='HLT_mu20_ivar_L1MU6',      groups=SingleMuonGroup),
-        ChainProp(name='HLT_mu6_ivarmedium_L1MU6', groups=SingleMuonGroup),
-        ChainProp(name='HLT_mu6noL1_L1MU6', l1SeedThresholds=['FSNOSEED'], groups=SingleMuonGroup),
-        ChainProp(name='HLT_mu6_mu6noL1_L1MU6', l1SeedThresholds=['MU6','FSNOSEED'], mergingStrategy='Serial', groups=MultiMuonGroup),
-        ChainProp(name='HLT_mu6_msonly_L1MU6',     groups=SingleMuonGroup),
+#        ChainProp(name='HLT_mu20_ivar_L1MU6',      groups=SingleMuonGroup),
+#        ChainProp(name='HLT_mu6_ivarmedium_L1MU6', groups=SingleMuonGroup),
+#        ChainProp(name='HLT_mu6noL1_L1MU6', l1SeedThresholds=['FSNOSEED'], groups=SingleMuonGroup),
+
+#        ChainProp(name='HLT_mu6_msonly_L1MU6',     groups=SingleMuonGroup),
 
-        ChainProp(name='HLT_2mu6_10invm70_L1MU6', groups=SingleMuonGroup),
-        ChainProp(name='HLT_mu10_lateMu_L1MU10', l1SeedThresholds=['FSNOSEED'], groups=SingleMuonGroup),
+#        ChainProp(name='HLT_2mu6_10invm70_L1MU6', groups=SingleMuonGroup),
+#        ChainProp(name='HLT_mu10_lateMu_L1MU10', l1SeedThresholds=['FSNOSEED'], groups=SingleMuonGroup),
 
         # ATR-20049
-        ChainProp(name='HLT_mu6_mu4_L12MU4',  l1SeedThresholds=['MU4']*2, groups=MultiMuonGroup),
+#        ChainProp(name='HLT_mu6_mu4_L12MU4',  l1SeedThresholds=['MU4']*2, groups=MultiMuonGroup),
 
         # Additional intermediate thresholds for validation comparisons
-        ChainProp(name='HLT_mu28_ivarmedium_L1MU20', groups=SingleMuonGroup),
-        ChainProp(name='HLT_mu35_ivarmedium_L1MU20', groups=SingleMuonGroup),
-        ChainProp(name='HLT_2mu15_L12MU10', groups=SingleMuonGroup),
-        ChainProp(name='HLT_3mu8_msonly_L13MU6', groups=SingleMuonGroup),
+#        ChainProp(name='HLT_mu28_ivarmedium_L1MU20', groups=SingleMuonGroup),
+#        ChainProp(name='HLT_mu35_ivarmedium_L1MU20', groups=SingleMuonGroup),
+#        ChainProp(name='HLT_2mu15_L12MU10', groups=SingleMuonGroup),
+#        ChainProp(name='HLT_3mu8_msonly_L13MU6', groups=SingleMuonGroup),
 
      ]
 
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py
index f5b2f5ef3112..43b46c7167c4 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py
@@ -313,8 +313,6 @@ class EmptyMenuSequence(object):
         self._name = "Empty"
         self._maker       = InputMakerNode( Alg = Maker )
         self._seed=''
-        self.multiplicity = 0
-
 
     @property
     def seed(self):
-- 
GitLab


From e08496d80a22438a5fd99abfaf78d419b36ab3fa Mon Sep 17 00:00:00 2001
From: vcroft <vincent.croft@cern.ch>
Date: Wed, 4 Mar 2020 14:43:26 +0100
Subject: [PATCH 21/36] Debugging InputMaker stringy outputs

---
 .../python/EmuStepProcessingConfig.py               | 13 ++++++++-----
 .../python/HLTMenuConfig/Menu/MenuComponents.py     |  3 ++-
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/Trigger/TrigValidation/TrigUpgradeTest/python/EmuStepProcessingConfig.py b/Trigger/TrigValidation/TrigUpgradeTest/python/EmuStepProcessingConfig.py
index 086ae2b9d2d9..ce1b037ca530 100644
--- a/Trigger/TrigValidation/TrigUpgradeTest/python/EmuStepProcessingConfig.py
+++ b/Trigger/TrigValidation/TrigUpgradeTest/python/EmuStepProcessingConfig.py
@@ -4,10 +4,11 @@
 from AthenaCommon.AlgScheduler import AlgScheduler
 from AthenaCommon.CFElements import parOR
 from AthenaCommon.Logging import logging
-from L1Decoder.L1DecoderConf import CTPUnpackingEmulationTool, RoIsUnpackingEmulationTool, L1Decoder
+from L1Decoder.L1DecoderConf import CTPUnpackingEmulationTool, RoIsUnpackingEmulationTool, L1Decoder, PrescalingEmulationTool
 from TriggerMenuMT.HLTMenuConfig.Menu.MenuComponents import EmptyMenuSequence
 log = logging.getLogger('EmuStepProcessingConfig')
 
+
 def thresholdToChains( chains ):
     """
     Produces list "threshod : chain" for all chains passed. Uses the L1Thresholds/vseeds Chain property
@@ -200,10 +201,10 @@ def generateL1DecoderAndChains():
      
         CombChains =[
 
-            makeChain(name='HLT_mu6_e8_L1MU6_EM5',  L1Thresholds=["MU6","EM5"], ChainSteps=[ ChainStep("Step1_mu_em", [el11, emptySeq], multiplicity=[1,1]),
-                                                                                             ChainStep("Step2_mu_em", [el21, emptySeq], multiplicity=[1,1]),
-                                                                                             ChainStep("Step3_mu_em", [emptySeq, mu11], multiplicity=[1,1]),
-                                                                                             ChainStep("Step4_mu_em", [emptySeq, mu21], multiplicity=[1,1])] ),
+            makeChain(name='HLT_mu6_e8_L1MU6_EM5',  L1Thresholds=["MU6","EM5"], ChainSteps=[ ChainStep("Step1_em_empty", [el11, emptySeq], multiplicity=[1,1])] ),
+#                                                                                             ChainStep("Step2_em_empty", [el21, emptySeq], multiplicity=[1,1]),
+#                                                                                             ChainStep("Step3_mu_empty", [emptySeq, mu11], multiplicity=[1,1]),
+#                                                                                             ChainStep("Step4_mu_empty", [emptySeq, mu21], multiplicity=[1,1])] ),
 
             makeChain(name='HLT_mu6Comb_e8_L1MU6_EM5', L1Thresholds=["MU6","EM5"], ChainSteps=[ ChainStep("Step1_mu2_em", [mu12, el11], multiplicity=[1,1]),
                                                                                                 ChainStep("Step2_mu_em", [mu21, el21], multiplicity=[1,1])] ),
@@ -240,6 +241,8 @@ def generateL1DecoderAndChains():
 
     l1Decoder = L1Decoder( RoIBResult="", L1TriggerResult="" )
     l1Decoder.L1DecoderSummaryKey = "L1DecoderSummary"
+    psEmulation = PrescalingEmulationTool()
+    l1Decoder.prescaler = psEmulation
 
     ctpUnpacker = CTPUnpackingEmulationTool( ForceEnableAllChains=False , InputFilename="ctp.dat" )
     l1Decoder.ctpUnpacker = ctpUnpacker
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py
index aeda62fe1ab4..f547b63d9c9f 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py
@@ -299,8 +299,9 @@ def isEmptyAlg(alg):
 
 
 
+
 ##########################################################
-# NOW sequences and chains
+# Now sequences and chains
 ##########################################################
 from AthenaConfiguration.ComponentFactory import CompFactory # for the default maker alg?
 
-- 
GitLab


From 3222355ddb12d43697acb20b3f39f006caf9ebf5 Mon Sep 17 00:00:00 2001
From: vcroft <vincent.croft@cern.ch>
Date: Wed, 4 Mar 2020 17:55:13 +0100
Subject: [PATCH 22/36] Adding EmptyMakerNode to athena Sequencer

---
 .../python/EmuStepProcessingConfig.py         | 13 ++++++----
 .../python/HLTSignatureConfig.py              |  1 +
 .../HLTMenuConfig/Menu/MenuComponents.py      | 25 ++++++++++++++-----
 3 files changed, 28 insertions(+), 11 deletions(-)

diff --git a/Trigger/TrigValidation/TrigUpgradeTest/python/EmuStepProcessingConfig.py b/Trigger/TrigValidation/TrigUpgradeTest/python/EmuStepProcessingConfig.py
index ce1b037ca530..b76ca0c5801b 100644
--- a/Trigger/TrigValidation/TrigUpgradeTest/python/EmuStepProcessingConfig.py
+++ b/Trigger/TrigValidation/TrigUpgradeTest/python/EmuStepProcessingConfig.py
@@ -168,7 +168,10 @@ def generateL1DecoderAndChains():
 
     # combined chain
     if doCombo:
-        emptySeq = EmptyMenuSequence()
+        emptySeq1 = EmptyMenuSequence("step1EmptySeqence")
+        emptySeq2 = EmptyMenuSequence("step2EmptySeqence")
+        emptySeq3 = EmptyMenuSequence("step3EmptySeqence")
+        emptySeq4 = EmptyMenuSequence("step4EmptySeqence")
         if not doElectron:
             from TrigUpgradeTest.HLTSignatureConfig import elMenuSequence        
             el11 = elMenuSequence(step="1",reconame="v1", hyponame="v1")    
@@ -201,10 +204,10 @@ def generateL1DecoderAndChains():
      
         CombChains =[
 
-            makeChain(name='HLT_mu6_e8_L1MU6_EM5',  L1Thresholds=["MU6","EM5"], ChainSteps=[ ChainStep("Step1_em_empty", [el11, emptySeq], multiplicity=[1,1])] ),
-#                                                                                             ChainStep("Step2_em_empty", [el21, emptySeq], multiplicity=[1,1]),
-#                                                                                             ChainStep("Step3_mu_empty", [emptySeq, mu11], multiplicity=[1,1]),
-#                                                                                             ChainStep("Step4_mu_empty", [emptySeq, mu21], multiplicity=[1,1])] ),
+            makeChain(name='HLT_mu6_e8_L1MU6_EM5',  L1Thresholds=["MU6","EM5"], ChainSteps=[ ChainStep("Step1_em_empty", [emptySeq1, el12], multiplicity=[1,1])] ),
+            #                                                                                             ChainStep("Step2_em_empty", [emptySeq2, el22], multiplicity=[1,1]),
+            #                                                                                             ChainStep("Step3_mu_empty", [mu31, emptySeq3], multiplicity=[1,1]),
+            #                                                                                             ChainStep("Step4_mu_empty", [mu21, emptySeq4], multiplicity=[1,1])] ),
 
             makeChain(name='HLT_mu6Comb_e8_L1MU6_EM5', L1Thresholds=["MU6","EM5"], ChainSteps=[ ChainStep("Step1_mu2_em", [mu12, el11], multiplicity=[1,1]),
                                                                                                 ChainStep("Step2_mu_em", [mu21, el21], multiplicity=[1,1])] ),
diff --git a/Trigger/TrigValidation/TrigUpgradeTest/python/HLTSignatureConfig.py b/Trigger/TrigValidation/TrigUpgradeTest/python/HLTSignatureConfig.py
index 5845fed428eb..ebc5b6ef3f4d 100644
--- a/Trigger/TrigValidation/TrigUpgradeTest/python/HLTSignatureConfig.py
+++ b/Trigger/TrigValidation/TrigUpgradeTest/python/HLTSignatureConfig.py
@@ -1,3 +1,4 @@
+
 # Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
 
 from AthenaConfiguration.ComponentFactory import CompFactory
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py
index f547b63d9c9f..f0609d5622e4 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py
@@ -303,17 +303,22 @@ def isEmptyAlg(alg):
 ##########################################################
 # Now sequences and chains
 ##########################################################
-from AthenaConfiguration.ComponentFactory import CompFactory # for the default maker alg?
+from AthenaConfiguration.ComponentFactory import CompFactory
 
 class EmptyMenuSequence(object):
     """ Class to emulate reco sequences with no Hypo"""
     """ By construction it has no Hypo;"""
     
-    def __init__(self):
-        Maker = CompFactory.HLTTest__TestInputMaker("Empty", RoIsLink="initialRoI", LinkName="initialRoI")
-        self._name = "Empty"
+    def __init__(self, name):
+        Maker = CompFactory.HLTTest__TestInputMaker("IM"+name, RoIsLink="initialRoI", LinkName="initialRoI")
+        self._name = name
         self._maker       = InputMakerNode( Alg = Maker )
         self._seed=''
+        self._sequence     = Node( Alg = seqAND(name, [Maker]))
+
+    @property
+    def sequence(self):
+        return self._sequence
 
     @property
     def seed(self):
@@ -328,7 +333,7 @@ class EmptyMenuSequence(object):
         return self._maker
 
     def getOutputList(self):
-        return self.__maker.readOutputList()[0] # Only one since it's merged
+        return self.__maker.readOutputList() # Only one since it's merged
 
     def connectToFilter(self, outfilter):
         """ Connect filter to the InputMaker"""
@@ -339,7 +344,15 @@ class EmptyMenuSequence(object):
 
     def addToSequencer(self, stepReco, seqAndView, already_connected):
         # menu sequence empty do not add to athena sequencer
-        log.debug("This sequence is empty. Not added to athena sequencer")
+        log.debug("This sequence is empty. Adding Maker node only to athena sequencer")
+        ath_sequence = self.sequence.Alg
+        name = ath_sequence.name()
+        if name in already_connected:
+            log.debug("AthSequencer %s already in the Tree, not added again",name)
+            return stepReco, seqAndView, already_connected
+        else:
+            already_connected.append(name)
+            stepReco += ath_sequence
         return stepReco, seqAndView, already_connected        
 
     def buildCFDot(self, cfseq_algs, all_hypos, isCombo, last_step_hypo_nodes, file):
-- 
GitLab


From 8abcbf89e13d32fb289fe72be90fbcad6dcde29e Mon Sep 17 00:00:00 2001
From: Mark Owen <mark.andrew.owen@cern.ch>
Date: Wed, 25 Mar 2020 08:42:38 +0000
Subject: [PATCH 23/36] Try to add serial mu-e chain

---
 .../TrigUpgradeTest/python/EmuStepProcessingConfig.py      | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/Trigger/TrigValidation/TrigUpgradeTest/python/EmuStepProcessingConfig.py b/Trigger/TrigValidation/TrigUpgradeTest/python/EmuStepProcessingConfig.py
index 6e86de361d12..b8416d02058a 100644
--- a/Trigger/TrigValidation/TrigUpgradeTest/python/EmuStepProcessingConfig.py
+++ b/Trigger/TrigValidation/TrigUpgradeTest/python/EmuStepProcessingConfig.py
@@ -203,8 +203,11 @@ def generateL1DecoderAndChains():
 
      
         CombChains =[
-            makeChain(name='HLT_mu6_e8_L1MU6_EM5',  L1Thresholds=["MU6","EM5"], ChainSteps=[ ChainStep("Step1_mu_em", [emptySeq1, el11], multiplicity=[1,1], comboToolConfs=[dimuDrComboHypoTool]),
-                                                                                             ChainStep("Step2_mu_em", [mu21, el21], multiplicity=[1,1])] ),
+            makeChain(name='HLT_mu6_e8_L1MU6_EM5',  L1Thresholds=["MU6","EM5"], ChainSteps=[ ChainStep("Step1_mu_em_serial", [mu11, emptySeq1], multiplicity=[1,1]),
+                                                                                             ChainStep("Step2_mu_em_serial", [emptySeq1, el21], multiplicity=[1,1])] ),
+
+            #makeChain(name='HLT_mu6_e8_L1MU6_EM5',  L1Thresholds=["MU6","EM5"], ChainSteps=[ ChainStep("Step1_mu_em", [mu11, el11], multiplicity=[1,1], comboToolConfs=[dimuDrComboHypoTool]),
+            #                                                                                 ChainStep("Step2_mu_em", [mu21, el21], multiplicity=[1,1])] ),
 
             makeChain(name='HLT_mu6Comb_e8_L1MU6_EM5', L1Thresholds=["MU6","EM5"], ChainSteps=[ ChainStep("Step1_mu2_em", [mu12, el11], multiplicity=[1,1]),
                                                                                                 ChainStep("Step2_mu_em", [mu21, el21], multiplicity=[1,1])] ),
-- 
GitLab


From 308ac1b07a4059a55211b82a0af1b171ced3d364 Mon Sep 17 00:00:00 2001
From: Mark Owen <mark.andrew.owen@cern.ch>
Date: Wed, 25 Mar 2020 14:27:14 +0000
Subject: [PATCH 24/36] Give Output a meaningful name in EmptyMenuSequence

---
 .../TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py
index 086bde8897f3..84fdb69097e3 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py
@@ -332,7 +332,7 @@ class EmptyMenuSequence(object):
     """ By construction it has no Hypo;"""
     
     def __init__(self, name):
-        Maker = CompFactory.HLTTest__TestInputMaker("IM"+name, RoIsLink="initialRoI", LinkName="initialRoI")
+        Maker = CompFactory.HLTTest__TestInputMaker("IM"+name, RoIsLink="initialRoI", LinkName="initialRoI", Output = 'empty' + name)
         self._name = name
         self._maker       = InputMakerNode( Alg = Maker )
         self._seed=''
-- 
GitLab


From a2758fa8c1bf34924e22995f0420a27c902b3e75 Mon Sep 17 00:00:00 2001
From: Mark Owen <mark.andrew.owen@cern.ch>
Date: Wed, 25 Mar 2020 14:31:17 +0000
Subject: [PATCH 25/36] Comment all chains apart from test chain for empty
 sequences

---
 .../python/EmuStepProcessingConfig.py         | 35 +++++++++----------
 1 file changed, 17 insertions(+), 18 deletions(-)

diff --git a/Trigger/TrigValidation/TrigUpgradeTest/python/EmuStepProcessingConfig.py b/Trigger/TrigValidation/TrigUpgradeTest/python/EmuStepProcessingConfig.py
index b8416d02058a..cf1774c5301f 100644
--- a/Trigger/TrigValidation/TrigUpgradeTest/python/EmuStepProcessingConfig.py
+++ b/Trigger/TrigValidation/TrigUpgradeTest/python/EmuStepProcessingConfig.py
@@ -54,7 +54,7 @@ def generateL1DecoderAndChains():
  
     # event 2: 2e+ 3mu : HLT_e5_e8_2mu6_L1EM3_EM5_L12MU6, HLT_mu6_e8_L1MU6_EM5
     data['ctp'] [2]      =  'HLT_mu6_L1MU6 HLT_mu8_L1MU10 HLT_mu10_L1MU10 HLT_mu8_1step_L1MU6 HLT_e20_L1EM10 HLT_e8_L1EM7 HLT_mu6_e8_L1MU6_EM5 HLT_mu6Comb_e8_L1MU6_EM5 HLT_e3_e5_L1EM3_EM5 HLT_2mu6_L12MU6 HLT_2mu6Comb_L12MU6 HLT_2mu4_bDimu_L12MU4 HLT_e5_e8_L1EM3_EM5 HLT_e5_e8_2mu6_L1EM3_EM5_L12MU6 HLT_mu6_mu6noL1_L1MU6'
-    data['l1emroi'][2]   =  '2,0.2,0,EM3,EM5, EM7,EM15,EM20,EM50,EM100; 1,-1.1,0,EM3,EM5,EM7,EM15,EM20,EM50;'
+    data['l1emroi'][2]   =  '2,0.2,0,EM3,EM5,EM7,EM15,EM20,EM50,EM100; 1,-1.1,0,EM3,EM5,EM7,EM15,EM20,EM50;'
     data['emclusters'][2]=  'eta:0.5,phi:0,et:120000; eta:1,phi:-1.2,et:65000;'
     data['l1muroi'][2]   =  '2,0.5,0,MU6,MU8; 3,0.5,0,MU6,MU8,MU10;2.2,0.6,0,MU6;'
     data['msmu'][2]      =  'eta:-1.2,phi:0.7,pt:6500,pt2:8500; eta:-1.1,phi:0.6,pt:8500,pt2:8500;eta:-1.1,phi:0.6,pt:8500,pt2:8500;'
@@ -124,15 +124,14 @@ def generateL1DecoderAndChains():
         step_mu32  = ChainStep("Step3_mu32", [mu32] )
         step_mu41  = ChainStep("Step4_mu41", [mu41] )
         
-        step_empy= ChainStep("Step_empty")
-
-
+        step_empty= ChainStep("Step_empty")
+        
         MuChains  = [
-            makeChain(name='HLT_mu8_1step_L1MU6',  L1Thresholds=["MU6"],  ChainSteps=[step_mu11]),
-            makeChain(name='HLT_mu20_L1MU10',   L1Thresholds=["MU10"],   ChainSteps=[step_mu11 , step_mu21 , step_mu31] ),
-            makeChain(name='HLT_mu10_L1MU10',   L1Thresholds=["MU10"],   ChainSteps=[step_mu11 , step_mu22 , step_mu31] ),
-            makeChain(name='HLT_mu8_L1MU10',    L1Thresholds=["MU10"],   ChainSteps=[step_mu11 , step_mu21 , step_mu32, step_mu41] ),
-            makeChain(name='HLT_mu6_L1MU6',     L1Thresholds=["MU6"],    ChainSteps=[step_mu11 , step_empy , step_mu32, step_mu41] ),
+            #makeChain(name='HLT_mu8_1step_L1MU6',  L1Thresholds=["MU6"],  ChainSteps=[step_mu11]),
+            #makeChain(name='HLT_mu20_L1MU10',   L1Thresholds=["MU10"],   ChainSteps=[step_mu11 , step_mu21 , step_mu31] ),
+            #makeChain(name='HLT_mu10_L1MU10',   L1Thresholds=["MU10"],   ChainSteps=[step_mu11 , step_mu22 , step_mu31] ),
+            #makeChain(name='HLT_mu8_L1MU10',    L1Thresholds=["MU10"],   ChainSteps=[step_mu11 , step_mu21 , step_mu32, step_mu41] ),
+            #makeChain(name='HLT_mu6_L1MU6',     L1Thresholds=["MU6"],    ChainSteps=[step_mu11 , step_empty , step_mu32, step_mu41] ),
  #           Chain(name='HLT_mu6_1step_L1MU6',  L1Item="L1_MU6",  ChainSteps=[step_mu11 , step_empy , step_mu31]),
 #            Chain(name='HLT_2mu6_L12MU6',  L1Item="L1_2MU6",      ChainSteps=[ChainStep("Step_2muSA", [muSA,muSA])  ] )
             ]
@@ -155,11 +154,11 @@ def generateL1DecoderAndChains():
 
     
         ElChains  = [
-            makeChain(name='HLT_e5_L1EM7'   , L1Thresholds=["EM7"], ChainSteps=[ ChainStep("Step_em11", [el11]), ChainStep("Step_em21",  [el21]) ] ),
-            makeChain(name='HLT_e5_v2_L1EM7', L1Thresholds=["EM7"], ChainSteps=[ ChainStep("Step_em11", [el11]), ChainStep("Step_em22",  [el22]) ] ),
-            makeChain(name='HLT_e5_v3_L1EM7', L1Thresholds=["EM7"], ChainSteps=[ ChainStep("Step_em11", [el11]), ChainStep("Step_em23",  [el23]) ] ),
-            makeChain(name='HLT_e8_L1EM7'   , L1Thresholds=["EM7"], ChainSteps=[ ChainStep("Step_em11", [el11]), ChainStep("Step_em21",  [el21]), ChainStep("Step_em31",  [el31]) ] ),
-            makeChain(name='HLT_g5_L1EM7'   , L1Thresholds=["EM7"], ChainSteps=[ ChainStep("Step_gam11", [gamm11]) ] )
+            #makeChain(name='HLT_e5_L1EM7'   , L1Thresholds=["EM7"], ChainSteps=[ ChainStep("Step_em11", [el11]), ChainStep("Step_em21",  [el21]) ] ),
+            #makeChain(name='HLT_e5_v2_L1EM7', L1Thresholds=["EM7"], ChainSteps=[ ChainStep("Step_em11", [el11]), ChainStep("Step_em22",  [el22]) ] ),
+            #makeChain(name='HLT_e5_v3_L1EM7', L1Thresholds=["EM7"], ChainSteps=[ ChainStep("Step_em11", [el11]), ChainStep("Step_em23",  [el23]) ] ),
+            #makeChain(name='HLT_e8_L1EM7'   , L1Thresholds=["EM7"], ChainSteps=[ ChainStep("Step_em11", [el11]), ChainStep("Step_em21",  [el21]), ChainStep("Step_em31",  [el31]) ] ),
+            #makeChain(name='HLT_g5_L1EM7'   , L1Thresholds=["EM7"], ChainSteps=[ ChainStep("Step_gam11", [gamm11]) ] )
         ]
 
         HLTChains += ElChains
@@ -204,11 +203,11 @@ def generateL1DecoderAndChains():
      
         CombChains =[
             makeChain(name='HLT_mu6_e8_L1MU6_EM5',  L1Thresholds=["MU6","EM5"], ChainSteps=[ ChainStep("Step1_mu_em_serial", [mu11, emptySeq1], multiplicity=[1,1]),
-                                                                                             ChainStep("Step2_mu_em_serial", [emptySeq1, el21], multiplicity=[1,1])] ),
-
+                                                                                             ChainStep("Step2_mu_em_serial", [emptySeq2, el21], multiplicity=[1,1])] ),
+            
             #makeChain(name='HLT_mu6_e8_L1MU6_EM5',  L1Thresholds=["MU6","EM5"], ChainSteps=[ ChainStep("Step1_mu_em", [mu11, el11], multiplicity=[1,1], comboToolConfs=[dimuDrComboHypoTool]),
             #                                                                                 ChainStep("Step2_mu_em", [mu21, el21], multiplicity=[1,1])] ),
-
+"""
             makeChain(name='HLT_mu6Comb_e8_L1MU6_EM5', L1Thresholds=["MU6","EM5"], ChainSteps=[ ChainStep("Step1_mu2_em", [mu12, el11], multiplicity=[1,1]),
                                                                                                 ChainStep("Step2_mu_em", [mu21, el21], multiplicity=[1,1])] ),
 
@@ -229,7 +228,7 @@ def generateL1DecoderAndChains():
                                                                                        
             makeChain(name='HLT_mu6_mu6noL1_L1MU6', L1Thresholds=["MU6", "FSNOSEED"], ChainSteps=[ ChainStep("Step1_2muAs",   [mu11, mu11], multiplicity=[1,1]),
                                                                                             ChainStep("Step2_2muAs",   [mu21, mu21], multiplicity=[1,1]) ])
-                                                                              
+"""                                                                              
             ]
 
 
-- 
GitLab


From edd3095dcaa21ecb7b55af0c984877cb6c93fa88 Mon Sep 17 00:00:00 2001
From: Mark Owen <mark.andrew.owen@cern.ch>
Date: Wed, 25 Mar 2020 18:39:33 +0000
Subject: [PATCH 26/36] Fix typo

---
 .../TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py
index 1bd6046ce267..6dd7cc1dce2a 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py
@@ -1,4 +1,4 @@
-1;95;0c# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 from AthenaCommon.Logging import logging
 log = logging.getLogger( __name__ )
-- 
GitLab


From f2394523c2c501be55053209ce67ca2e77d6e888 Mon Sep 17 00:00:00 2001
From: Mark Owen <mark.andrew.owen@cern.ch>
Date: Thu, 26 Mar 2020 12:03:16 +0000
Subject: [PATCH 27/36] Modify mergeChainDefs such that merging info is taken
 from chainDict and not passed by argument. Also turn on some info msgs while
 we get this working

---
 .../python/HLTMenuConfig/Menu/ChainMerging.py   | 17 ++++++++++-------
 .../python/HLTMenuConfig/Menu/GenerateMenuMT.py |  2 +-
 2 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/ChainMerging.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/ChainMerging.py
index 8b977ab5bb32..0a7119e7ec17 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/ChainMerging.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/ChainMerging.py
@@ -8,9 +8,12 @@ from TriggerMenuMT.HLTMenuConfig.Menu.MenuComponents import Chain, ChainStep, Em
 from copy import deepcopy
 
 
-def mergeChainDefs(listOfChainDefs, chainDict, strategy="parallel", offset=-1):
+def mergeChainDefs(listOfChainDefs, chainDict):
 
-    log.debug("Combine by using %s merging", strategy)
+    strategy = chainDict["mergingStrategy"]
+    offset = chainDict["mergingOffset"]
+    log.info(chainDict['chainName'])
+    log.info("Combine by using %s merging", strategy)
 
     if strategy=="parallel":
         return mergeParallel(listOfChainDefs,  offset)
@@ -66,7 +69,7 @@ def mergeParallel(chainDefList, offset):
                                   
     combinedChainDef = Chain(chainName, ChainSteps=combChainSteps, L1Thresholds=l1Thresholds)
 
-    log.debug("Merged chain %s with these steps:", chainName)
+    log.info("Parallel merged chain %s with these steps:", chainName)
     for step in combinedChainDef.steps:
         log.debug('   %s', step)
 
@@ -110,15 +113,15 @@ def mergeSerial(chainDefList):
     # check if all chain parts have the same number of steps
     sameNSteps = all(x==nSteps[0] for x in nSteps) 
     if sameNSteps is True:
-        log.debug("All chain parts have the same number of steps")
+        log.info("All chain parts have the same number of steps")
     else:
-        log.debug("Have to deal with uneven number of chain steps, there might be none's appearing in sequence list => to be fixed")
+        log.info("Have to deal with uneven number of chain steps, there might be none's appearing in sequence list => to be fixed")
                                   
     combinedChainDef = Chain(chainName, ChainSteps=combChainSteps, L1Thresholds=l1Thresholds)
 
-    log.debug("Merged chain %s with these steps:", chainName)
+    log.info("Serial merged chain %s with these steps:", chainName)
     for step in combinedChainDef.steps:
-        log.debug('   %s', step)
+        log.info('   %s', step)
 
     return combinedChainDef
 
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/GenerateMenuMT.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/GenerateMenuMT.py
index cd1cc1aa225b..72387ca1dc29 100755
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/GenerateMenuMT.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/GenerateMenuMT.py
@@ -304,7 +304,7 @@ class GenerateMenuMT(object):
 
         elif len(listOfChainConfigs)>1:
                 log.debug("Merging strategy from dictionary: %s", mainChainDict["mergingStrategy"])
-                theChainConfig = mergeChainDefs(listOfChainConfigs, mainChainDict, mainChainDict["mergingStrategy"], mainChainDict["mergingOffset"])
+                theChainConfig = mergeChainDefs(listOfChainConfigs, mainChainDict)
 
                 # This needs to be added for topological chains - needs implementation
                 #doTopo = self.CheckIntraSignatureTopo(chainDicts) and chainDict["topo"]
-- 
GitLab


From 16a2c97c9e2c3d1edf1a2a0f523311287a83f6b2 Mon Sep 17 00:00:00 2001
From: Mark Owen <mark.andrew.owen@cern.ch>
Date: Thu, 26 Mar 2020 12:03:44 +0000
Subject: [PATCH 28/36] Put HLT_mu6_mu6noL1_L1MU6 into serial merging mode

---
 .../TriggerMenuMT/python/HLTMenuConfig/Menu/LS2_v1.py           | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/LS2_v1.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/LS2_v1.py
index c0e97af2cd3d..14d9f53fbde2 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/LS2_v1.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/LS2_v1.py
@@ -37,7 +37,7 @@ def setupMenu():
 #        ChainProp(name='HLT_mu24_idperf_L1MU20', groups=SingleMuonGroup),
 
         #ATR-20049
-        ChainProp(name='HLT_mu6_mu6noL1_L1MU6', l1SeedThresholds=['MU6','FSNOSEED'], mergingStrategy='Serial', groups=MultiMuonGroup),
+        ChainProp(name='HLT_mu6_mu6noL1_L1MU6', l1SeedThresholds=['MU6','FSNOSEED'], mergingStrategy='serial', groups=MultiMuonGroup),
 #        ChainProp(name='HLT_mu6fast_L1MU6', groups=SingleMuonGroup),
 #        ChainProp(name='HLT_mu6Comb_L1MU6', groups=SingleMuonGroup),
         ChainProp(name='HLT_mu6_L1MU6',     groups=SingleMuonGroup),
-- 
GitLab


From 9b5afc0236c572ca68291bd0e521867714e4b6b8 Mon Sep 17 00:00:00 2001
From: Mark Owen <mark.andrew.owen@cern.ch>
Date: Fri, 27 Mar 2020 13:12:56 +0000
Subject: [PATCH 29/36] Modify serial_zip to get closer to what we want for the
 empty sequences / steps

---
 .../python/HLTMenuConfig/Menu/ChainMerging.py | 46 ++++++++++++++-----
 1 file changed, 35 insertions(+), 11 deletions(-)

diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/ChainMerging.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/ChainMerging.py
index 0a7119e7ec17..752930bb18ed 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/ChainMerging.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/ChainMerging.py
@@ -75,13 +75,37 @@ def mergeParallel(chainDefList, offset):
 
     return combinedChainDef
 
-def serial_zip(allSteps):
+def serial_zip(allSteps, chainName):
     n_chains = len(allSteps)
+    newsteps = []
     for chain_index, chainsteps in enumerate(allSteps):
-        for sequence in chainsteps:
-            step = [EmptyMenuSequence() for _x in range(n_chains)]
-            step[chain_index] = sequence
-            yield step
+        for step_index, step in enumerate(chainsteps):
+            log.info('chain_index: ' + str(chain_index) + " step_index: " + str(step_index))
+            # create list of correct length
+            stepList = [None]*n_chains
+            
+            # put the step from the current sub-chain into the right place
+            stepList[chain_index] = step
+
+            # all other steps should contain an empty sequence
+            for step_index2, emptyStep in enumerate(stepList):
+                if emptyStep is None:
+                    seqName = chainName + 'EmptySeq' + str(chain_index) + '_' + str(step_index)
+                    emptySeq = EmptyMenuSequence(seqName)
+                    stepList[step_index2] = ChainStep('Step' + str(step_index) + "_" + seqName, Sequences=[emptySeq], chainDicts=step.chainDicts)
+
+            # first create a list of chain steps where each step is an empty sequence
+            #seqName = chainName + 'EmptySeq' + str(chain_index) + '_'
+            #emptySeqList = [EmptyMenuSequence(seqName + str(_x)) for _x in range(n_chains)]
+            #stepList = [ChainStep('Step_' + seqName, Sequences=[seq], chainDicts=step.chainDicts) for seq in emptySeqList]
+            # now overwrite one of these steps from the step in the current sub-chain
+            #stepList[chain_index] = step
+            
+            newsteps.append(stepList)
+    log.info('After serial_zip')
+    for s in newsteps:
+        print s
+    return newsteps
 
 def mergeSerial(chainDefList):
     allSteps = []
@@ -89,6 +113,8 @@ def mergeSerial(chainDefList):
     chainName = ''
     l1Thresholds = []
 
+    log.info('Merge chainDefList:')
+    log.info(chainDefList)
 
     for cConfig in chainDefList:
         if chainName == '':
@@ -100,10 +126,8 @@ def mergeSerial(chainDefList):
         nSteps.append(len(cConfig.steps))
         l1Thresholds.extend(cConfig.vseeds)
 
-    serialSteps = serial_zip(allSteps)
+    serialSteps = serial_zip(allSteps, chainName)
     mySerialSteps = deepcopy(serialSteps)
-    for step in serialSteps:
-        log.error("hey listen! %i, of %i",len(step),len(serialSteps))
     combChainSteps =[]
     for steps in mySerialSteps:
         mySteps = list(steps)
@@ -142,9 +166,9 @@ def makeChainSteps(steps):
     for step in steps:
         if step is None:
             continue
-        log.debug("  step %s, multiplicity  = %s", step.name, str(step.multiplicity))
+        log.info("  step %s, multiplicity  = %s", step.name, str(step.multiplicity))
         if len(step.sequences):
-            log.debug("      with sequences = %s", ' '.join(map(str, [seq.name for seq in step.sequences])))
+            log.info("      with sequences = %s", ' '.join(map(str, [seq.name for seq in step.sequences])))
 
          # this function only works if the input chains are single-object chains (one menu seuqnce)
         if len(step.sequences) > 1:
@@ -172,7 +196,7 @@ def makeChainSteps(steps):
         
     comboHypoTools = list(set(comboHypoTools))
     theChainStep = ChainStep(stepName, Sequences=stepSeq, multiplicity=stepMult, chainDicts=stepDicts, comboToolConfs=comboHypoTools) 
-    log.debug("Merged step: \n %s", theChainStep)
+    log.info("Merged step: \n %s", theChainStep)
   
     
     return theChainStep
-- 
GitLab


From 7066b406d6f89255ee0b9aec90194a1597ee5f77 Mon Sep 17 00:00:00 2001
From: Mark Owen <mark.andrew.owen@cern.ch>
Date: Mon, 30 Mar 2020 14:09:15 +0100
Subject: [PATCH 30/36] Fix combined step naming and numbering

---
 .../python/HLTMenuConfig/Menu/ChainMerging.py | 22 +++++++++----------
 1 file changed, 10 insertions(+), 12 deletions(-)

diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/ChainMerging.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/ChainMerging.py
index 752930bb18ed..a53d8e63ddf5 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/ChainMerging.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/ChainMerging.py
@@ -55,9 +55,9 @@ def mergeParallel(chainDefList, offset):
     myOrderedSteps = deepcopy(orderedSteps)
 
     combChainSteps =[]
-    for steps in myOrderedSteps:
+    for step_index, steps in enumerate(myOrderedSteps):
         mySteps = list(steps)
-        combStep = makeChainSteps(mySteps)
+        combStep = makeChainSteps(mySteps, step_index+1)
         combChainSteps.append(combStep)
 
     # check if all chain parts have the same number of steps
@@ -86,13 +86,14 @@ def serial_zip(allSteps, chainName):
             
             # put the step from the current sub-chain into the right place
             stepList[chain_index] = step
+            log.info('Put step: ' + str(step))
 
             # all other steps should contain an empty sequence
             for step_index2, emptyStep in enumerate(stepList):
                 if emptyStep is None:
-                    seqName = chainName + 'EmptySeq' + str(chain_index) + '_' + str(step_index)
+                    seqName = chainName + 'EmptySeq' + str(chain_index) + '_' + str(step_index+1)
                     emptySeq = EmptyMenuSequence(seqName)
-                    stepList[step_index2] = ChainStep('Step' + str(step_index) + "_" + seqName, Sequences=[emptySeq], chainDicts=step.chainDicts)
+                    stepList[step_index2] = ChainStep('Step' + str(step_index+1) + "_" + seqName, Sequences=[emptySeq], chainDicts=step.chainDicts)
 
             # first create a list of chain steps where each step is an empty sequence
             #seqName = chainName + 'EmptySeq' + str(chain_index) + '_'
@@ -129,9 +130,9 @@ def mergeSerial(chainDefList):
     serialSteps = serial_zip(allSteps, chainName)
     mySerialSteps = deepcopy(serialSteps)
     combChainSteps =[]
-    for steps in mySerialSteps:
+    for step_index, steps in enumerate(mySerialSteps):
         mySteps = list(steps)
-        combStep = makeChainSteps(mySteps)
+        combStep = makeChainSteps(mySteps, step_index+1)
         combChainSteps.append(combStep)
 
     # check if all chain parts have the same number of steps
@@ -150,15 +151,13 @@ def mergeSerial(chainDefList):
     return combinedChainDef
 
 
-def makeChainSteps(steps):
+def makeChainSteps(steps, stepNumber):
     from copy import deepcopy
     from TrigCompositeUtils.TrigCompositeUtils import legName
     stepName = ''
     stepSeq = []
     stepMult = []
-    stepNumber = ''
     log.verbose(" steps %s ", steps)
-    stepName = "merged"
     stepDicts = []
     count = 0
     comboHypoTools = []
@@ -177,11 +176,10 @@ def makeChainSteps(steps):
 
         currentStep = step.name
         stepNameParts = currentStep.split('_')
-        if stepNumber == '':
-            stepNumber = stepNameParts[0]
 
         # the step naming for combined chains needs to be revisted!!
-        stepName += '_' +step.name
+        stepName = "merged_Step" + str(stepNumber) + '_' + currentStep
+        #stepName += '_' +step.name
         if len(step.sequences):
             seq = step.sequences[0]
             stepSeq.append(seq)
-- 
GitLab


From 250cadc99de83ba2a60863c243a48d23db6b937e Mon Sep 17 00:00:00 2001
From: Mark Owen <mark.andrew.owen@cern.ch>
Date: Mon, 30 Mar 2020 16:44:48 +0100
Subject: [PATCH 31/36] Revert "Comment all chains apart from test chain for
 empty sequences"

This reverts commit a2758fa8c1bf34924e22995f0420a27c902b3e75.
---
 .../python/EmuStepProcessingConfig.py         | 35 ++++++++++---------
 1 file changed, 18 insertions(+), 17 deletions(-)

diff --git a/Trigger/TrigValidation/TrigUpgradeTest/python/EmuStepProcessingConfig.py b/Trigger/TrigValidation/TrigUpgradeTest/python/EmuStepProcessingConfig.py
index cf1774c5301f..b8416d02058a 100644
--- a/Trigger/TrigValidation/TrigUpgradeTest/python/EmuStepProcessingConfig.py
+++ b/Trigger/TrigValidation/TrigUpgradeTest/python/EmuStepProcessingConfig.py
@@ -54,7 +54,7 @@ def generateL1DecoderAndChains():
  
     # event 2: 2e+ 3mu : HLT_e5_e8_2mu6_L1EM3_EM5_L12MU6, HLT_mu6_e8_L1MU6_EM5
     data['ctp'] [2]      =  'HLT_mu6_L1MU6 HLT_mu8_L1MU10 HLT_mu10_L1MU10 HLT_mu8_1step_L1MU6 HLT_e20_L1EM10 HLT_e8_L1EM7 HLT_mu6_e8_L1MU6_EM5 HLT_mu6Comb_e8_L1MU6_EM5 HLT_e3_e5_L1EM3_EM5 HLT_2mu6_L12MU6 HLT_2mu6Comb_L12MU6 HLT_2mu4_bDimu_L12MU4 HLT_e5_e8_L1EM3_EM5 HLT_e5_e8_2mu6_L1EM3_EM5_L12MU6 HLT_mu6_mu6noL1_L1MU6'
-    data['l1emroi'][2]   =  '2,0.2,0,EM3,EM5,EM7,EM15,EM20,EM50,EM100; 1,-1.1,0,EM3,EM5,EM7,EM15,EM20,EM50;'
+    data['l1emroi'][2]   =  '2,0.2,0,EM3,EM5, EM7,EM15,EM20,EM50,EM100; 1,-1.1,0,EM3,EM5,EM7,EM15,EM20,EM50;'
     data['emclusters'][2]=  'eta:0.5,phi:0,et:120000; eta:1,phi:-1.2,et:65000;'
     data['l1muroi'][2]   =  '2,0.5,0,MU6,MU8; 3,0.5,0,MU6,MU8,MU10;2.2,0.6,0,MU6;'
     data['msmu'][2]      =  'eta:-1.2,phi:0.7,pt:6500,pt2:8500; eta:-1.1,phi:0.6,pt:8500,pt2:8500;eta:-1.1,phi:0.6,pt:8500,pt2:8500;'
@@ -124,14 +124,15 @@ def generateL1DecoderAndChains():
         step_mu32  = ChainStep("Step3_mu32", [mu32] )
         step_mu41  = ChainStep("Step4_mu41", [mu41] )
         
-        step_empty= ChainStep("Step_empty")
-        
+        step_empy= ChainStep("Step_empty")
+
+
         MuChains  = [
-            #makeChain(name='HLT_mu8_1step_L1MU6',  L1Thresholds=["MU6"],  ChainSteps=[step_mu11]),
-            #makeChain(name='HLT_mu20_L1MU10',   L1Thresholds=["MU10"],   ChainSteps=[step_mu11 , step_mu21 , step_mu31] ),
-            #makeChain(name='HLT_mu10_L1MU10',   L1Thresholds=["MU10"],   ChainSteps=[step_mu11 , step_mu22 , step_mu31] ),
-            #makeChain(name='HLT_mu8_L1MU10',    L1Thresholds=["MU10"],   ChainSteps=[step_mu11 , step_mu21 , step_mu32, step_mu41] ),
-            #makeChain(name='HLT_mu6_L1MU6',     L1Thresholds=["MU6"],    ChainSteps=[step_mu11 , step_empty , step_mu32, step_mu41] ),
+            makeChain(name='HLT_mu8_1step_L1MU6',  L1Thresholds=["MU6"],  ChainSteps=[step_mu11]),
+            makeChain(name='HLT_mu20_L1MU10',   L1Thresholds=["MU10"],   ChainSteps=[step_mu11 , step_mu21 , step_mu31] ),
+            makeChain(name='HLT_mu10_L1MU10',   L1Thresholds=["MU10"],   ChainSteps=[step_mu11 , step_mu22 , step_mu31] ),
+            makeChain(name='HLT_mu8_L1MU10',    L1Thresholds=["MU10"],   ChainSteps=[step_mu11 , step_mu21 , step_mu32, step_mu41] ),
+            makeChain(name='HLT_mu6_L1MU6',     L1Thresholds=["MU6"],    ChainSteps=[step_mu11 , step_empy , step_mu32, step_mu41] ),
  #           Chain(name='HLT_mu6_1step_L1MU6',  L1Item="L1_MU6",  ChainSteps=[step_mu11 , step_empy , step_mu31]),
 #            Chain(name='HLT_2mu6_L12MU6',  L1Item="L1_2MU6",      ChainSteps=[ChainStep("Step_2muSA", [muSA,muSA])  ] )
             ]
@@ -154,11 +155,11 @@ def generateL1DecoderAndChains():
 
     
         ElChains  = [
-            #makeChain(name='HLT_e5_L1EM7'   , L1Thresholds=["EM7"], ChainSteps=[ ChainStep("Step_em11", [el11]), ChainStep("Step_em21",  [el21]) ] ),
-            #makeChain(name='HLT_e5_v2_L1EM7', L1Thresholds=["EM7"], ChainSteps=[ ChainStep("Step_em11", [el11]), ChainStep("Step_em22",  [el22]) ] ),
-            #makeChain(name='HLT_e5_v3_L1EM7', L1Thresholds=["EM7"], ChainSteps=[ ChainStep("Step_em11", [el11]), ChainStep("Step_em23",  [el23]) ] ),
-            #makeChain(name='HLT_e8_L1EM7'   , L1Thresholds=["EM7"], ChainSteps=[ ChainStep("Step_em11", [el11]), ChainStep("Step_em21",  [el21]), ChainStep("Step_em31",  [el31]) ] ),
-            #makeChain(name='HLT_g5_L1EM7'   , L1Thresholds=["EM7"], ChainSteps=[ ChainStep("Step_gam11", [gamm11]) ] )
+            makeChain(name='HLT_e5_L1EM7'   , L1Thresholds=["EM7"], ChainSteps=[ ChainStep("Step_em11", [el11]), ChainStep("Step_em21",  [el21]) ] ),
+            makeChain(name='HLT_e5_v2_L1EM7', L1Thresholds=["EM7"], ChainSteps=[ ChainStep("Step_em11", [el11]), ChainStep("Step_em22",  [el22]) ] ),
+            makeChain(name='HLT_e5_v3_L1EM7', L1Thresholds=["EM7"], ChainSteps=[ ChainStep("Step_em11", [el11]), ChainStep("Step_em23",  [el23]) ] ),
+            makeChain(name='HLT_e8_L1EM7'   , L1Thresholds=["EM7"], ChainSteps=[ ChainStep("Step_em11", [el11]), ChainStep("Step_em21",  [el21]), ChainStep("Step_em31",  [el31]) ] ),
+            makeChain(name='HLT_g5_L1EM7'   , L1Thresholds=["EM7"], ChainSteps=[ ChainStep("Step_gam11", [gamm11]) ] )
         ]
 
         HLTChains += ElChains
@@ -203,11 +204,11 @@ def generateL1DecoderAndChains():
      
         CombChains =[
             makeChain(name='HLT_mu6_e8_L1MU6_EM5',  L1Thresholds=["MU6","EM5"], ChainSteps=[ ChainStep("Step1_mu_em_serial", [mu11, emptySeq1], multiplicity=[1,1]),
-                                                                                             ChainStep("Step2_mu_em_serial", [emptySeq2, el21], multiplicity=[1,1])] ),
-            
+                                                                                             ChainStep("Step2_mu_em_serial", [emptySeq1, el21], multiplicity=[1,1])] ),
+
             #makeChain(name='HLT_mu6_e8_L1MU6_EM5',  L1Thresholds=["MU6","EM5"], ChainSteps=[ ChainStep("Step1_mu_em", [mu11, el11], multiplicity=[1,1], comboToolConfs=[dimuDrComboHypoTool]),
             #                                                                                 ChainStep("Step2_mu_em", [mu21, el21], multiplicity=[1,1])] ),
-"""
+
             makeChain(name='HLT_mu6Comb_e8_L1MU6_EM5', L1Thresholds=["MU6","EM5"], ChainSteps=[ ChainStep("Step1_mu2_em", [mu12, el11], multiplicity=[1,1]),
                                                                                                 ChainStep("Step2_mu_em", [mu21, el21], multiplicity=[1,1])] ),
 
@@ -228,7 +229,7 @@ def generateL1DecoderAndChains():
                                                                                        
             makeChain(name='HLT_mu6_mu6noL1_L1MU6', L1Thresholds=["MU6", "FSNOSEED"], ChainSteps=[ ChainStep("Step1_2muAs",   [mu11, mu11], multiplicity=[1,1]),
                                                                                             ChainStep("Step2_2muAs",   [mu21, mu21], multiplicity=[1,1]) ])
-"""                                                                              
+                                                                              
             ]
 
 
-- 
GitLab


From 6f275cc99150a261b3d43a4fcc61209a0cd6611b Mon Sep 17 00:00:00 2001
From: Mark Owen <mark.andrew.owen@cern.ch>
Date: Mon, 30 Mar 2020 17:10:09 +0100
Subject: [PATCH 32/36] Fix for emu serial chain

---
 .../TrigUpgradeTest/python/EmuStepProcessingConfig.py     | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/Trigger/TrigValidation/TrigUpgradeTest/python/EmuStepProcessingConfig.py b/Trigger/TrigValidation/TrigUpgradeTest/python/EmuStepProcessingConfig.py
index b8416d02058a..6a0126eb5ba4 100644
--- a/Trigger/TrigValidation/TrigUpgradeTest/python/EmuStepProcessingConfig.py
+++ b/Trigger/TrigValidation/TrigUpgradeTest/python/EmuStepProcessingConfig.py
@@ -54,7 +54,7 @@ def generateL1DecoderAndChains():
  
     # event 2: 2e+ 3mu : HLT_e5_e8_2mu6_L1EM3_EM5_L12MU6, HLT_mu6_e8_L1MU6_EM5
     data['ctp'] [2]      =  'HLT_mu6_L1MU6 HLT_mu8_L1MU10 HLT_mu10_L1MU10 HLT_mu8_1step_L1MU6 HLT_e20_L1EM10 HLT_e8_L1EM7 HLT_mu6_e8_L1MU6_EM5 HLT_mu6Comb_e8_L1MU6_EM5 HLT_e3_e5_L1EM3_EM5 HLT_2mu6_L12MU6 HLT_2mu6Comb_L12MU6 HLT_2mu4_bDimu_L12MU4 HLT_e5_e8_L1EM3_EM5 HLT_e5_e8_2mu6_L1EM3_EM5_L12MU6 HLT_mu6_mu6noL1_L1MU6'
-    data['l1emroi'][2]   =  '2,0.2,0,EM3,EM5, EM7,EM15,EM20,EM50,EM100; 1,-1.1,0,EM3,EM5,EM7,EM15,EM20,EM50;'
+    data['l1emroi'][2]   =  '2,0.2,0,EM3,EM5,EM7,EM15,EM20,EM50,EM100; 1,-1.1,0,EM3,EM5,EM7,EM15,EM20,EM50;'
     data['emclusters'][2]=  'eta:0.5,phi:0,et:120000; eta:1,phi:-1.2,et:65000;'
     data['l1muroi'][2]   =  '2,0.5,0,MU6,MU8; 3,0.5,0,MU6,MU8,MU10;2.2,0.6,0,MU6;'
     data['msmu'][2]      =  'eta:-1.2,phi:0.7,pt:6500,pt2:8500; eta:-1.1,phi:0.6,pt:8500,pt2:8500;eta:-1.1,phi:0.6,pt:8500,pt2:8500;'
@@ -203,11 +203,9 @@ def generateL1DecoderAndChains():
 
      
         CombChains =[
+            # This is an example of a chain running in "serial"
             makeChain(name='HLT_mu6_e8_L1MU6_EM5',  L1Thresholds=["MU6","EM5"], ChainSteps=[ ChainStep("Step1_mu_em_serial", [mu11, emptySeq1], multiplicity=[1,1]),
-                                                                                             ChainStep("Step2_mu_em_serial", [emptySeq1, el21], multiplicity=[1,1])] ),
-
-            #makeChain(name='HLT_mu6_e8_L1MU6_EM5',  L1Thresholds=["MU6","EM5"], ChainSteps=[ ChainStep("Step1_mu_em", [mu11, el11], multiplicity=[1,1], comboToolConfs=[dimuDrComboHypoTool]),
-            #                                                                                 ChainStep("Step2_mu_em", [mu21, el21], multiplicity=[1,1])] ),
+                                                                                             ChainStep("Step2_mu_em_serial", [emptySeq2, el21], multiplicity=[1,1])] ),
 
             makeChain(name='HLT_mu6Comb_e8_L1MU6_EM5', L1Thresholds=["MU6","EM5"], ChainSteps=[ ChainStep("Step1_mu2_em", [mu12, el11], multiplicity=[1,1]),
                                                                                                 ChainStep("Step2_mu_em", [mu21, el21], multiplicity=[1,1])] ),
-- 
GitLab


From 7f5a95380dd32b72e05d43641fa3733499d0508b Mon Sep 17 00:00:00 2001
From: Mark Owen <mark.andrew.owen@cern.ch>
Date: Tue, 31 Mar 2020 09:22:14 +0100
Subject: [PATCH 33/36] Turn back on disabled chains

---
 .../python/HLTMenuConfig/Menu/LS2_v1.py       | 34 ++++++++++---------
 1 file changed, 18 insertions(+), 16 deletions(-)

diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/LS2_v1.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/LS2_v1.py
index 6b922cf02ff6..2c88fd2e5dcc 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/LS2_v1.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/LS2_v1.py
@@ -33,35 +33,37 @@ def setupMenu():
 
     TriggerFlags.MuonSlice.signatures = TriggerFlags.MuonSlice.signatures() + [
         #ART-19985
-#        ChainProp(name='HLT_mu6_idperf_L1MU6', groups=SingleMuonGroup),
-#        ChainProp(name='HLT_mu24_idperf_L1MU20', groups=SingleMuonGroup),
+        ChainProp(name='HLT_mu6_idperf_L1MU6', groups=SingleMuonGroup),
+        ChainProp(name='HLT_mu24_idperf_L1MU20', groups=SingleMuonGroup),
+
+        # Test chain for di-muon with full-scan, not yet working due to problem with FS seeding
+        #ChainProp(name='HLT_mu6_mu6noL1_L1MU6', l1SeedThresholds=['MU6','FSNOSEED'], mergingStrategy='serial', groups=MultiMuonGroup),
 
         #ATR-20049
-        ChainProp(name='HLT_mu6_mu6noL1_L1MU6', l1SeedThresholds=['MU6','FSNOSEED'], mergingStrategy='serial', groups=MultiMuonGroup),
-#        ChainProp(name='HLT_mu6fast_L1MU6', groups=SingleMuonGroup),
-#        ChainProp(name='HLT_mu6Comb_L1MU6', groups=SingleMuonGroup),
+        ChainProp(name='HLT_mu6fast_L1MU6', groups=SingleMuonGroup),
+        ChainProp(name='HLT_mu6Comb_L1MU6', groups=SingleMuonGroup),
         ChainProp(name='HLT_mu6_L1MU6',     groups=SingleMuonGroup),
 
-#        ChainProp(name='HLT_mu20_ivar_L1MU6',      groups=SingleMuonGroup),
-#        ChainProp(name='HLT_mu6_ivarmedium_L1MU6', groups=SingleMuonGroup),
-#        ChainProp(name='HLT_mu6noL1_L1MU6', l1SeedThresholds=['FSNOSEED'], groups=SingleMuonGroup),
+        ChainProp(name='HLT_mu20_ivar_L1MU6',      groups=SingleMuonGroup),
+        ChainProp(name='HLT_mu6_ivarmedium_L1MU6', groups=SingleMuonGroup),
+        ChainProp(name='HLT_mu6noL1_L1MU6', l1SeedThresholds=['FSNOSEED'], groups=SingleMuonGroup),
 
-#        ChainProp(name='HLT_mu6_msonly_L1MU6',     groups=SingleMuonGroup),
+        ChainProp(name='HLT_mu6_msonly_L1MU6',     groups=SingleMuonGroup),
 
-#        ChainProp(name='HLT_2mu6_10invm70_L1MU6', groups=SingleMuonGroup),
-#        ChainProp(name='HLT_mu10_lateMu_L1MU10', l1SeedThresholds=['FSNOSEED'], groups=SingleMuonGroup),
+        ChainProp(name='HLT_2mu6_10invm70_L1MU6', groups=SingleMuonGroup),
+        ChainProp(name='HLT_mu10_lateMu_L1MU10', l1SeedThresholds=['FSNOSEED'], groups=SingleMuonGroup),
 
         # this is for test only
         ChainProp(name='HLT_2mu6_Dr_L12MU4',  groups=MultiMuonGroup),
       #  ChainProp(name='HLT_mu6_Dr_mu4_Dr_L12MU4', l1SeedThresholds=['MU4']*2, groups=MultiMuonGroup),
         # ATR-20049
-#        ChainProp(name='HLT_mu6_mu4_L12MU4',  l1SeedThresholds=['MU4']*2, groups=MultiMuonGroup),
+        ChainProp(name='HLT_mu6_mu4_L12MU4',  l1SeedThresholds=['MU4']*2, groups=MultiMuonGroup),
 
         # Additional intermediate thresholds for validation comparisons
-#        ChainProp(name='HLT_mu28_ivarmedium_L1MU20', groups=SingleMuonGroup),
-#        ChainProp(name='HLT_mu35_ivarmedium_L1MU20', groups=SingleMuonGroup),
-#        ChainProp(name='HLT_2mu15_L12MU10', groups=SingleMuonGroup),
-#        ChainProp(name='HLT_3mu8_msonly_L13MU6', groups=SingleMuonGroup),
+        ChainProp(name='HLT_mu28_ivarmedium_L1MU20', groups=SingleMuonGroup),
+        ChainProp(name='HLT_mu35_ivarmedium_L1MU20', groups=SingleMuonGroup),
+        ChainProp(name='HLT_2mu15_L12MU10', groups=SingleMuonGroup),
+        ChainProp(name='HLT_3mu8_msonly_L13MU6', groups=SingleMuonGroup),
 
        # ATR-19452
         ChainProp(name='HLT_2mu4_muonqual_L12MU4',  groups=MultiMuonGroup),
-- 
GitLab


From bf20317b629025d3f67d956f2c6a22a73ff239e0 Mon Sep 17 00:00:00 2001
From: Mark Owen <mark.andrew.owen@cern.ch>
Date: Tue, 31 Mar 2020 13:59:25 +0100
Subject: [PATCH 34/36] Minor update in merged step naming. Couple of flake8
 fixes

---
 .../TrigUpgradeTest/python/EmuStepProcessingConfig.py  |  4 +---
 .../python/HLTMenuConfig/Menu/ChainMerging.py          | 10 ++++------
 2 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/Trigger/TrigValidation/TrigUpgradeTest/python/EmuStepProcessingConfig.py b/Trigger/TrigValidation/TrigUpgradeTest/python/EmuStepProcessingConfig.py
index 6a0126eb5ba4..eedfbce25f17 100644
--- a/Trigger/TrigValidation/TrigUpgradeTest/python/EmuStepProcessingConfig.py
+++ b/Trigger/TrigValidation/TrigUpgradeTest/python/EmuStepProcessingConfig.py
@@ -4,7 +4,7 @@
 from AthenaCommon.AlgScheduler import AlgScheduler
 from AthenaCommon.CFElements import parOR
 from AthenaCommon.Logging import logging
-from L1Decoder.L1DecoderConf import CTPUnpackingEmulationTool, RoIsUnpackingEmulationTool, L1Decoder, PrescalingEmulationTool
+from L1Decoder.L1DecoderConf import CTPUnpackingEmulationTool, RoIsUnpackingEmulationTool, L1Decoder
 from TriggerMenuMT.HLTMenuConfig.Menu.MenuComponents import EmptyMenuSequence
 log = logging.getLogger('EmuStepProcessingConfig')
 
@@ -170,8 +170,6 @@ def generateL1DecoderAndChains():
     if doCombo:
         emptySeq1 = EmptyMenuSequence("step1EmptySeqence")
         emptySeq2 = EmptyMenuSequence("step2EmptySeqence")
-        emptySeq3 = EmptyMenuSequence("step3EmptySeqence")
-        emptySeq4 = EmptyMenuSequence("step4EmptySeqence")
         if not doElectron:
             from TrigUpgradeTest.HLTSignatureConfig import elMenuSequence        
             el11 = elMenuSequence(step="1",reconame="v1", hyponame="v1")    
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/ChainMerging.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/ChainMerging.py
index a53d8e63ddf5..d9b38c02be58 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/ChainMerging.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/ChainMerging.py
@@ -103,9 +103,9 @@ def serial_zip(allSteps, chainName):
             #stepList[chain_index] = step
             
             newsteps.append(stepList)
-    log.info('After serial_zip')
+    log.debug('After serial_zip')
     for s in newsteps:
-        print s
+        log.debug( s )
     return newsteps
 
 def mergeSerial(chainDefList):
@@ -154,7 +154,7 @@ def mergeSerial(chainDefList):
 def makeChainSteps(steps, stepNumber):
     from copy import deepcopy
     from TrigCompositeUtils.TrigCompositeUtils import legName
-    stepName = ''
+    stepName = 'merged_Step' + str(stepNumber)
     stepSeq = []
     stepMult = []
     log.verbose(" steps %s ", steps)
@@ -175,11 +175,9 @@ def makeChainSteps(steps, stepNumber):
 
 
         currentStep = step.name
-        stepNameParts = currentStep.split('_')
 
         # the step naming for combined chains needs to be revisted!!
-        stepName = "merged_Step" + str(stepNumber) + '_' + currentStep
-        #stepName += '_' +step.name
+        stepName += '_' + currentStep
         if len(step.sequences):
             seq = step.sequences[0]
             stepSeq.append(seq)
-- 
GitLab


From 04b0f7ba49f8ee6d2c07fb599818ad53305b5e26 Mon Sep 17 00:00:00 2001
From: vcroft <vincent.croft@cern.ch>
Date: Wed, 1 Apr 2020 00:00:56 +0200
Subject: [PATCH 35/36] switched TestInputMaker to InputMakerForROI

---
 .../TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py
index ec29d034335f..ade757ddfef7 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py
@@ -320,14 +320,14 @@ def isComboHypoAlg(alg):
 ##########################################################
 # Now sequences and chains
 ##########################################################
-from AthenaConfiguration.ComponentFactory import CompFactory
+from DecisionHandling.DecisionHandlingConf import InputMakerForRoI
 
 class EmptyMenuSequence(object):
     """ Class to emulate reco sequences with no Hypo"""
     """ By construction it has no Hypo;"""
     
     def __init__(self, name):
-        Maker = CompFactory.HLTTest__TestInputMaker("IM"+name, RoIsLink="initialRoI", LinkName="initialRoI", Output = 'empty' + name)
+        Maker = InputMakerForRoI("IM"+name)
         self._name = name
         self._maker       = InputMakerNode( Alg = Maker )
         self._seed=''
-- 
GitLab


From 84d9b2d64f672f3813d57c2c99f6ce6660ccddd1 Mon Sep 17 00:00:00 2001
From: Tim Martin <Tim.Martin@cern.ch>
Date: Wed, 1 Apr 2020 10:52:08 +0200
Subject: [PATCH 36/36] Make ROI collection output optional

---
 .../DecisionHandling/src/InputMakerForRoI.cxx  | 18 +++++++++++-------
 .../DecisionHandling/src/InputMakerForRoI.h    |  3 ++-
 2 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/Trigger/TrigSteer/DecisionHandling/src/InputMakerForRoI.cxx b/Trigger/TrigSteer/DecisionHandling/src/InputMakerForRoI.cxx
index eb4be8cb27c1..340a2d6adc5f 100644
--- a/Trigger/TrigSteer/DecisionHandling/src/InputMakerForRoI.cxx
+++ b/Trigger/TrigSteer/DecisionHandling/src/InputMakerForRoI.cxx
@@ -22,7 +22,7 @@ InputMakerForRoI:: InputMakerForRoI( const std::string& name,
 
 StatusCode  InputMakerForRoI::initialize() {
   ATH_MSG_DEBUG("Will produce output RoI collections: " << m_RoIs);
-  CHECK( m_RoIs.initialize() );
+  CHECK( m_RoIs.initialize( SG::AllowEmpty ) );
   return StatusCode::SUCCESS;
 }
 
@@ -35,7 +35,7 @@ StatusCode  InputMakerForRoI::execute( const EventContext& context ) const {
   ATH_CHECK(outputHandle.isValid());
   
   // Prepare Outputs
-  std::unique_ptr< TrigRoiDescriptorCollection > oneRoIColl( new TrigRoiDescriptorCollection() );
+  std::unique_ptr<TrigRoiDescriptorCollection> oneRoIColl = std::make_unique<TrigRoiDescriptorCollection>();
 
   // use also this:    ElementLinkVector<xAOD::MuonRoIContainer> getMuonRoILinks = obj->objectCollectionLinks<xAOD::MuonRoIContainer>("ManyMuonRoIs");
   std::vector <ElementLink<TrigRoiDescriptorCollection> > RoIsFromDecision;  // used to check for duplicate features linked to different inputHandles
@@ -70,11 +70,15 @@ StatusCode  InputMakerForRoI::execute( const EventContext& context ) const {
   } // loop over decisions      
   
   
-    // Finally, record output
-  ATH_MSG_DEBUG("Produced "<<oneRoIColl->size() <<" output RoIs");
-  auto roi_outputHandle = SG::makeHandle(m_RoIs, context);
-  ATH_CHECK( roi_outputHandle.record(std::move(oneRoIColl)) );
-  
+  // Finally, record output
+  if (m_RoIs.empty()) {
+    ATH_MSG_DEBUG("No concrete output ROI collection required from this InputMaker.");
+  } else {
+    ATH_MSG_DEBUG("Produced "<<oneRoIColl->size() <<" output RoIs");
+    auto roi_outputHandle = SG::makeHandle(m_RoIs, context);
+    ATH_CHECK( roi_outputHandle.record(std::move(oneRoIColl)) );
+  }
+
   // call base class helper method to print some debug messages summarising the content of the outputHandles.
   if (msgLvl(MSG::DEBUG)) {
     debugPrintOut(context, outputHandle);
diff --git a/Trigger/TrigSteer/DecisionHandling/src/InputMakerForRoI.h b/Trigger/TrigSteer/DecisionHandling/src/InputMakerForRoI.h
index fda2d2b0cc6a..9f5119fd46c7 100644
--- a/Trigger/TrigSteer/DecisionHandling/src/InputMakerForRoI.h
+++ b/Trigger/TrigSteer/DecisionHandling/src/InputMakerForRoI.h
@@ -26,7 +26,8 @@
     virtual StatusCode  execute(const EventContext&) const override;
 
   private: 
-    SG::WriteHandleKey<TrigRoiDescriptorCollection> m_RoIs {this,"RoIs", "Unspecified", "Name of the RoIs extracted from the decisions"};
+    SG::WriteHandleKey<TrigRoiDescriptorCollection> m_RoIs {this,"RoIs", "",
+      "Name of the collection of ROI extrated from the input Decision Objects. Used as cocnrete starting handle for step's reconstruction."};
 
   }; 
 
-- 
GitLab