diff --git a/Trigger/TriggerCommon/TriggerMenuMT/CMakeLists.txt b/Trigger/TriggerCommon/TriggerMenuMT/CMakeLists.txt
index 0f06716225e314cbca3049decfe9b1053e196d21..68705d84fe3ba858a27f75e9ea0598536677b7d1 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/CMakeLists.txt
+++ b/Trigger/TriggerCommon/TriggerMenuMT/CMakeLists.txt
@@ -10,6 +10,10 @@ atlas_subdir( TriggerMenuMT )
 atlas_depends_on_subdirs( PRIVATE
                           Trigger/TriggerCommon/TriggerJobOpts)
 
+atlas_add_test( flake8
+   SCRIPT flake8 --select=F,E7,E9,W6 ${CMAKE_CURRENT_SOURCE_DIR}/python/HLTMenuConfig
+   POST_EXEC_SCRIPT nopost.sh )
+
 #----------------------------------
 # Function to build trigger menu:
 function( atlas_build_lvl1_trigger_menu menu )
@@ -140,3 +144,6 @@ atlas_add_test( generateMenuMT SCRIPT bash test_HLTmenu.sh
 #----------------------------------
 # List of menus to be created:
 atlas_build_lvl1_trigger_menu( LS2_v1 )
+
+
+
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/ElectronDef.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/ElectronDef.py
index 396c86fbb55e7f487ea7bdf144c75172807439c3..199e7bb3163609eaeabae1b70917b9811612634d 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/ElectronDef.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/ElectronDef.py
@@ -6,9 +6,7 @@ log = logging.getLogger("TriggerMenuMT.HLTMenuConfig.Egamma.ElectronDef")
 
 
 from TriggerMenuMT.HLTMenuConfig.Menu.ChainConfigurationBase import ChainConfigurationBase
-from TriggerMenuMT.HLTMenuConfig.Menu.MenuComponents import Chain, ChainStep, RecoFragmentsPool
-from TriggerMenuMT.HLTMenuConfig.Menu.TriggerConfigHLT import TriggerConfigHLT
-
+from TriggerMenuMT.HLTMenuConfig.Menu.MenuComponents import ChainStep, RecoFragmentsPool
 
 from TrigUpgradeTest.CaloMenuDefs import fastCaloMenuSequence
 from TrigUpgradeTest.electronMenuDefs import electronMenuSequence, inDetSetup
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/generateElectronChainDefs.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/generateElectronChainDefs.py
index 6634c719aa25899b3665fdad2d9e828cf573ae4b..3f6a17edb10ff6e999cbcadb1fc9c0bf5e594101 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/generateElectronChainDefs.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/generateElectronChainDefs.py
@@ -1,6 +1,5 @@
 # Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
 
-from TriggerMenuMT.HLTMenuConfig.Menu.MenuComponents import Chain
 from TriggerMenuMT.HLTMenuConfig.Menu.ChainDictTools import splitChainDict
 from TriggerMenuMT.HLTMenuConfig.Egamma.ElectronDef import ElectronChainConfiguration as ElectronChainConfiguration
 
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Electron/generateElectron.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Electron/generateElectron.py
index f19133836caffc4d78002afa535ead52dcd56f71..5ec1220829649d22ba8aaed32d8541083628ff59 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Electron/generateElectron.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Electron/generateElectron.py
@@ -1,11 +1,10 @@
 # Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
 
-from TrigUpgradeTest.ElectronMenuConfig import l2CaloRecoCfg, l2CaloHypoCfg, l2CaloAlgCfg
+from TrigUpgradeTest.ElectronMenuConfig import l2CaloRecoCfg, l2CaloHypoCfg
 from TriggerMenuMT.HLTMenuConfig.Menu.MenuComponents import MenuSequence, \
     ChainStep, Chain, RecoFragmentsPool, getChainStepName
 
 from TrigEgammaHypo.TrigL2CaloHypoTool import TrigL2CaloHypoToolFromDict
-from TrigEgammaHypo.TrigEgammaHypoConf import TrigL2CaloHypoAlgMT
 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
 
 # TODO remove once full tracking is in place
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/CPS.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/CPS.py
index 0b14852a8a3661f363e41918ee03820de95eab97..350d8f3d63d7a9f57b23cffab144908168ed20eb 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/CPS.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/CPS.py
@@ -4,8 +4,6 @@
 
 __doc__="Addition of coherent prescales to the list of chains"
 
-from TriggerJobOpts.TriggerFlags import TriggerFlags
-
 from AthenaCommon.Logging import logging
 log = logging.getLogger(__name__)
 
@@ -35,7 +33,7 @@ def genericCPSAdder(groups, signatures, chains, level, signatureOverwritten):
                     for g in c.groups:
                         if g.find('CPS') == 5:
                             cpsFound = g
-                    if cpsFound == None:
+                    if cpsFound is None:
                         log.info('CPS group %s added to %s', cpsGroup, chain_name)
                         c.addGroup(cpsGroup)
                     elif cpsFound == cpsGroup:
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/ChainConfigurationBase.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/ChainConfigurationBase.py
index 6b70ec409f90502dff480b94cac1d9016218ff2e..8bf1cb115b7a3adde60322b32d2a09e4f0cd7225 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/ChainConfigurationBase.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/ChainConfigurationBase.py
@@ -1,7 +1,7 @@
 # Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
 
 
-from TriggerMenuMT.HLTMenuConfig.Menu.MenuComponents import Chain, ChainStep, RecoFragmentsPool
+from TriggerMenuMT.HLTMenuConfig.Menu.MenuComponents import Chain, RecoFragmentsPool
 
 #----------------------------------------------------------------
 # Base class to configure chain
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/ChainDictTools.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/ChainDictTools.py
index f3abbd87114cef5567586356f03bccb2a14ddf59..326ab7510317d14859bbce354e57df8f9d6d1e3f 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/ChainDictTools.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/ChainDictTools.py
@@ -1,6 +1,5 @@
 # Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
 
-from collections import Counter
 from copy import deepcopy
 from AthenaCommon.Logging import logging
 log = logging.getLogger( 'TriggerMenu.menu.ChainDictTools' )
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/DictFromChainName.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/DictFromChainName.py
index 2a2e85080ddebcc0ecdab73ac9b0234368db21ba..3fd843917fec5b07d0205363b91f1ff8d6a41e0a 100755
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/DictFromChainName.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/DictFromChainName.py
@@ -12,8 +12,6 @@ __version__=""
 __doc__="Decoding of chain name into a dictionary"
 
 
-import re
-
 from AthenaCommon.Logging import logging
 logging.getLogger().info("Importing %s",__name__)
 logDict = logging.getLogger('TriggerMenu.menu.DictFromChainName')
@@ -68,13 +66,16 @@ class DictFromChainName(object):
             for i in xrange(6, len(chainInfo)):
                 mergingInfoFilled = False
                 tsfInfoFilled = False
-                if (type(chainInfo[i]) is list):
-                    if mergingInfoFilled == False:
+                typeOfChainInfo = type(chainInfo[i])
+
+                if typeOfChainInfo is list:
+                    if mergingInfoFilled is False:
                         m_mergingStrategy = chainInfo[i][0]
                         if not (m_mergingStrategy == "parallel" or m_mergingStrategy == "serial"):
                             logDict.error("Merging strategy %s is not known.", m_mergingStrategy)
                         m_mergingOffset = chainInfo[i][1]
                         m_mergingOrder = chainInfo[i][2]
+
                         if(len(chainInfo[i]) >3):
                             m_preserveL2EFOrder = chainInfo[i][3]
                         else:
@@ -86,14 +87,17 @@ class DictFromChainName(object):
                         chainProp['mergingPreserveL2EFOrder'] = m_preserveL2EFOrder
 
                         mergingInfoFilled = True
-                    else: logDict.error("Something went wrong here....topoStartFrom has already been filled!")                  
+                    else: 
+                        logDict.error("Something went wrong here....topoStartFrom has already been filled!")                  
 
-                elif (type(chainInfo[i]) is bool):
-                    if tsfInfoFilled == False: 
+                elif typeOfChainInfo is bool:
+                    if tsfInfoFilled is False: 
                         chainProp['topoStartFrom'] = chainInfo[i]
                         tsfInfoFilled = True
-                    else: logDict.error("Something went wrong here....topoStartFrom has already been filled!")                  
-                else: logDict.error('Input format not recognised for chainInfo[%s]', chainInfo[i])
+                    else: 
+                        logDict.error("Something went wrong here....topoStartFrom has already been filled!")                  
+                else: 
+                    logDict.error('Input format not recognised for chainInfo[%s]', chainInfo[i])
                 
         # setting the L1 item
         if (chainProp['L1item']== ''): 
@@ -145,9 +149,6 @@ class DictFromChainName(object):
 
         from SignatureDicts import getBasePattern
         pattern = getBasePattern()
-        mdicts=[]
-        multichainindex=[]
-        signatureNames = []
 
         allMultis = []
         for cpart in cNameParts:
@@ -165,9 +166,6 @@ class DictFromChainName(object):
 
         from SignatureDicts import getBasePattern
         pattern = getBasePattern()
-        mdicts=[]
-        multichainindex=[]
-        signatureNames = []
         trigType = []
         thresholdToPass = 0
 
@@ -192,7 +190,6 @@ class DictFromChainName(object):
         are defined in SliceDicts
         The naming ocnvention is defined inthis document http://
         """
-        chainName_orig = chainName
 
         # ---- dictionary with all chain properties ----
         from SignatureDicts import ChainDictTemplate
@@ -209,7 +206,10 @@ class DictFromChainName(object):
            
         # ---- identify the topo algorithm and add to genchainDict -----
         from SignatureDicts import AllowedTopos
-        topo = '';topos=[];toposIndexed={}; topoindex = -5
+        topo = ''
+        topos=[]
+        toposIndexed={} 
+        topoindex = -5
         for cindex, cpart in enumerate(cparts):
             if  cpart in AllowedTopos:
                 logDict.debug('" %s" is in this part of the name %s -> topo alg', AllowedTopos, cpart)
@@ -241,24 +241,17 @@ class DictFromChainName(object):
 
         # ---- obtain dictionary parts for signature defining patterns ----
         from SignatureDicts import getSignatureNameFromToken, AllowedCosmicChainIdentifiers, \
-            AllowedCalibChainIdentifiers, AllowedStreamingChainIdentifiers, \
-            AllowedMonitorChainIdentifiers, AllowedBeamspotChainIdentifiers, AllowedEBChainIdentifiers
-            #, AllowedMatchingKeywords
+            AllowedCalibChainIdentifiers, AllowedMonitorChainIdentifiers, AllowedBeamspotChainIdentifiers
 
         logDict.debug("cparts: %s", cparts)
         for cpart in cparts:
 
             logDict.debug("Looping over cpart: %s", cpart)
             m = pattern.match(cpart)
-            #if 'mu4antidr05' in str(cpart): continue
             if m: 
                 logDict.debug("Pattern found in this string: %s", cpart)
                 m_groupdict = m.groupdict()
                 # Check whether the extra contains a special keyword
-                skip=False
-#                for keyword in AllowedMatchingKeywords :
-#                    if keyword in m_groupdict['extra']: skip=True
-#                if skip: continue
                 
                 multiChainIndices = [i for i in range(len(chainName)) if ( chainName.startswith(cpart, i) ) ]
                 logDict.debug("MultiChainIndices: %s", multiChainIndices)
@@ -266,13 +259,10 @@ class DictFromChainName(object):
                     # this check is necessary for the bjet chains, example: j45_bloose_3j45
                     # j45 would be found in [0, 13], and 3j45 in [12]
                     # so need to make sure the multiplicities are considered here!
-                    if (theMultiChainIndex != 0) & (chainName[theMultiChainIndex-1] != '_'): continue
-                    skip=False
-#                    for keyword in AllowedMatchingKeywords :
-#                        if chainName[theMultiChainIndex:len(chainName)].startswith(cpart+keyword): skip=True
-#                    if skip: continue
-                    
-                    if not theMultiChainIndex in multichainindex:
+                    if (theMultiChainIndex != 0) & (chainName[theMultiChainIndex-1] != '_'): 
+                        continue
+
+                    if theMultiChainIndex not in multichainindex:
                         multichainindex.append(theMultiChainIndex)
 
                 logDict.debug("ChainName: %s", chainName)
@@ -284,7 +274,8 @@ class DictFromChainName(object):
                 m_groupdict['signature'] = sName
                 logDict.debug('groupdictionary m_groupdict: %s', m_groupdict)
                 sigToken = getSignatureNameFromToken(cpart)
-                if sigToken not in signatureNames: signatureNames.append(sigToken)
+                if sigToken not in signatureNames: 
+                    signatureNames.append(sigToken)
                 mdicts.append(m_groupdict)
 
                     
@@ -292,7 +283,8 @@ class DictFromChainName(object):
                 multichainindex.append(chainName.index(cpart)) 
                 m_groupdict = {'signature': 'Streaming', 'threshold': '', 'multiplicity': '', 
                                 'trigType': 'streamer', 'extra': ''}
-                if 'Streaming' not in signatureNames: signatureNames.append('Streaming')
+                if 'Streaming' not in signatureNames: 
+                    signatureNames.append('Streaming')
                 mdicts.append(m_groupdict)
                 break # stop loop here so mb doesn't get picked up from min bias slice as it's streaming info
 
@@ -301,7 +293,8 @@ class DictFromChainName(object):
                 multichainindex.append(chainName.index(cpart)) 
                 m_groupdict = {'signature': 'MinBias', 'threshold': '', 'multiplicity': '', 
                                'trigType': 'mb', 'extra': ''}
-                if 'MinBias' not in signatureNames:  signatureNames.append('MinBias')
+                if 'MinBias' not in signatureNames:  
+                    signatureNames.append('MinBias')
                 mdicts.append(m_groupdict)
 
             elif cpart=='hi':
@@ -309,7 +302,8 @@ class DictFromChainName(object):
                 multichainindex.append(chainName.index(cpart))
                 m_groupdict = {'signature': 'HeavyIon', 'threshold': '', 'multiplicity': '',
                                'trigType': 'mb', 'extra': ''}
-                if 'HeavyIon' not in signatureNames:  signatureNames.append('HeavyIon')
+                if 'HeavyIon' not in signatureNames:  
+                    signatureNames.append('HeavyIon')
                 mdicts.append(m_groupdict)
 
             elif cpart in AllowedCosmicChainIdentifiers:
@@ -317,7 +311,8 @@ class DictFromChainName(object):
                 multichainindex.append(chainName.index(cpart)) 
                 m_groupdict = {'signature': 'Cosmic', 'threshold': '', 'multiplicity': '', 
                                 'trigType': 'cosmic', 'extra': ''}
-                if 'Cosmic' not in signatureNames: signatureNames.append('Cosmic')
+                if 'Cosmic' not in signatureNames: 
+                    signatureNames.append('Cosmic')
                 logDict.debug('%s',signatureNames)
                 mdicts.append(m_groupdict)
                 
@@ -326,7 +321,8 @@ class DictFromChainName(object):
                 multichainindex.append(chainName.index(cpart)) 
                 m_groupdict = {'signature': 'Calibration', 'threshold': '', 'multiplicity': '', 
                                'trigType': 'calib', 'extra': ''}
-                if 'Calibration' not in signatureNames:  signatureNames.append('Calibration')
+                if 'Calibration' not in signatureNames:  
+                    signatureNames.append('Calibration')
                 logDict.debug('%s',signatureNames)
                 mdicts.append(m_groupdict)
 
@@ -335,7 +331,8 @@ class DictFromChainName(object):
                 multichainindex.append(chainName.index(cpart)) 
                 m_groupdict = {'signature': 'Monitoring', 'threshold': '', 'multiplicity': '', 
                                 'trigType': 'calib', 'extra': ''}
-                if 'Monitoring' not in signatureNames:  signatureNames.append('Monitoring')
+                if 'Monitoring' not in signatureNames:  
+                    signatureNames.append('Monitoring')
                 logDict.debug('%s',signatureNames)
                 mdicts.append(m_groupdict)
 
@@ -344,7 +341,8 @@ class DictFromChainName(object):
                 multichainindex.append(chainName.index(cpart)) 
                 m_groupdict = {'signature': 'Beamspot', 'threshold': '', 'multiplicity': '', 
                                 'trigType': 'beamspot', 'extra': ''}
-                if 'Beamspot' not in signatureNames:  signatureNames.append('Beamspot')
+                if 'Beamspot' not in signatureNames:  
+                    signatureNames.append('Beamspot')
                 logDict.debug('%s',signatureNames)
                 mdicts.append(m_groupdict)
 
@@ -353,7 +351,8 @@ class DictFromChainName(object):
                 multichainindex.append(chainName.index(cpart)) 
                 m_groupdict = {'signature': 'EnhancedBias', 'threshold': '', 'multiplicity': '', 
                                'trigType': 'eb', 'extra': ''}
-                if 'EnhancedBias' not in signatureNames:  signatureNames.append('EnhancedBias')
+                if 'EnhancedBias' not in signatureNames:  
+                    signatureNames.append('EnhancedBias')
                 mdicts.append(m_groupdict)
 
            
@@ -361,8 +360,6 @@ class DictFromChainName(object):
         # ---- part depending on the signature it belongs to ----
         # ----  ----
         multichainparts=[]
-
-        remainder = chainName
         multichainindex = sorted(multichainindex, key=int)
         cN = chainName
         for i in reversed(multichainindex):
@@ -385,7 +382,7 @@ class DictFromChainName(object):
             logDict.debug('chainparts %s', chainparts)
 
             # ---- check if L1 item is specified in chain Name ----
-            L1itemFromChainName = ''; L1item = ''; 
+            L1item = '' 
             chainpartsNoL1 = chainparts
             
             #Checking for L1 item for chain part and overall in the name
@@ -413,7 +410,7 @@ class DictFromChainName(object):
                     chainparts = chainparts[:allL1indices[1]]
                     
                 if (allL1items[0] not in L1items_chainParts):
-                    logDict.error("L1 chain part " +L1items_chainParts+" item does not seem to match the one in the chain name "+llL1items[0])
+                    logDict.error("L1 chain part " +L1items_chainParts+" item does not seem to match the one in the chain name "+allL1items[0])
 
 
 
@@ -501,7 +498,6 @@ class DictFromChainName(object):
 
             # ---- check remaining parts for complete machtes in allowedPropertiesAndValues Dict ----
             # ---- unmatched = list of tokens that are not found in the allowed values as a whole ----
-            unmatched = [] 
             parts = filter(None, parts)     #removing empty strings from list
 
             matchedparts = []
@@ -509,7 +505,7 @@ class DictFromChainName(object):
                 origpart = part
                 for prop, allowedValues in allowedSignaturePropertiesAndValues.items():
                     if part in allowedValues:
-                        if type(chainProperties[prop]) == list:
+                        if type(chainProperties[prop]) is list:
                             chainProperties[prop] += [part]
                         else:
                             chainProperties[prop] = part
@@ -520,7 +516,8 @@ class DictFromChainName(object):
             logDict.debug('leftoverparts %s', leftoverparts)
             for pindex, part in enumerate(leftoverparts):
                 for prop, allowedValues in allowedSignaturePropertiesAndValues.items():
-                    if prop in chainProperties.keys():  continue
+                    if prop in chainProperties.keys():  
+                        continue
                     for aV in allowedValues:
                         if (aV in part):
                             if (chainProperties['signature'] in ['Egamma', 'Muon'] )& (prop in ['trkInfo','hypoInfo']):
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/GenerateMenuMT.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/GenerateMenuMT.py
index e22da47322889acd3b3acda2004afaa49bfb71c9..438400ff5142b1024d973bfec3c6cfeef28123f4 100755
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/GenerateMenuMT.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/GenerateMenuMT.py
@@ -1,33 +1,21 @@
 # Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
 
 from TriggerJobOpts.TriggerFlags              import TriggerFlags
-from TriggerJobOpts.MuonSliceFlags            import MuonSliceFlags
-from TriggerJobOpts.EgammaSliceFlags          import EgammaSliceFlags
-from TriggerJobOpts.JetSliceFlags             import JetSliceFlags
-from TriggerJobOpts.CombinedSliceFlags        import CombinedSliceFlags
-from TriggerJobOpts.TestSliceFlags            import TestSliceFlags
-
-
 
 # Configure the scheduler
 from AthenaCommon.AlgScheduler import AlgScheduler
 AlgScheduler.ShowControlFlow( True )
 AlgScheduler.ShowDataFlow( True )
 
-from AthenaCommon.CFElements import parOR, seqAND, stepSeq
-from AthenaCommon.AlgSequence import AlgSequence, AthSequencer
-from AthenaCommon.Constants import VERBOSE,INFO,DEBUG
+from AthenaCommon.Constants import DEBUG
 
 from TriggerMenuMT.HLTMenuConfig.Menu.TriggerConfigHLT  import TriggerConfigHLT
-from TriggerMenuMT.HLTMenuConfig.Menu.HLTCFConfig import *
-from TriggerMenuMT.HLTMenuConfig.Menu.MenuComponents import *
+from TriggerMenuMT.HLTMenuConfig.Menu.HLTCFConfig import makeHLTTree
+#from TriggerMenuMT.HLTMenuConfig.Menu.MenuComponents import *
 from TriggerMenuMT.HLTMenuConfig.Menu import DictFromChainName
 from TriggerMenuMT.HLTMenuConfig.Menu.ChainDictTools import splitInterSignatureChainDict
 from TriggerMenuMT.HLTMenuConfig.Menu.MenuPrescaleConfig import MenuPrescaleConfig
 
-from TriggerMenuMT.HLTMenuConfig.Menu.HLTCFConfig import makeHLTTree
-
-import os, traceback, operator, commands, time
 
 from AthenaCommon.Logging import logging
 log = logging.getLogger( 'TriggerMenuMT.HLTMenuConfig.Menu.GenerateMenuMT' )
@@ -62,6 +50,8 @@ class GenerateMenuMT:
         self.triggerConfigHLT = TriggerConfigHLT(TriggerFlags.outputHLTconfigFile())
         self.triggerConfigHLT.menuName = TriggerFlags.triggerMenuSetup()
         log.debug("Working with menu: %s", self.triggerConfigHLT.menuName)
+        log.debug("   and prescales : %s", HLTPrescales)
+        
 
         
     def generateChainConfig(self, chainDicts):
@@ -71,14 +61,14 @@ class GenerateMenuMT:
         if self.doEgammaChains:
             try:
                 import TriggerMenuMT.HLTMenuConfig.Egamma.generateElectronChainDefs                
-            except:
+            except ImportError:
                 log.exception('Problems when importing generateElectronChainDefs, disabling Egamma chains.')
                 self.doEgammaChains = False
 
         if self.doTestChains:
             try:
                 import TriggerMenuMT.HLTMenuConfig.Test.generateTestChainDefs  
-            except:
+            except ImportError:
                 log.exception('Problems when importing generateTestChainDefs, disabling Test chains.')
                 self.doTestChains = False
               
@@ -100,14 +90,14 @@ class GenerateMenuMT:
                 try:
                     log.debug("Try to get chain config")
                     chainConfigs = TriggerMenuMT.HLTMenuConfig.Egamma.generateElectronChainDefs.generateChainConfigs(chainDict)                    
-                except:
+                except RuntimeError:
                     log.exception( 'Problems creating ChainDef for chain\n %s ' % (chainDict['chainName']) ) 
                     continue
 
             elif chainDict["signature"] == "Test" and self.doTestChains:
                 try:
-                    chainDefs = TriggerMenuMT.HLTMenuConfig.Test.generateTestChainDefs.generateChainConfigs(chainDict)
-                except:
+                    chainConfigs = TriggerMenuMT.HLTMenuConfig.Test.generateTestChainDefs.generateChainConfigs(chainDict)
+                except RuntimeError:
                     log.exception('Problems creating ChainDef for chain %s ' % (chainDict['chainName']))
                     continue
 
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/GenerateMenuMT_newJO.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/GenerateMenuMT_newJO.py
index bdd64dd97058a9b083d953ee1149bc17022018ba..ad79a5b31416599b0e154ba37e7e9829adc1070c 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/GenerateMenuMT_newJO.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/GenerateMenuMT_newJO.py
@@ -1,12 +1,12 @@
 # Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
 from AthenaCommon.CFElements import seqAND
-from TriggerMenuMT.HLTMenuConfig.Menu.HLTCFConfig import decisionTree_From_Chains, \
-    generateDecisionTreeOld
+
+from TriggerMenuMT.HLTMenuConfig.Menu.HLTCFConfig import generateDecisionTreeOld
 from TriggerMenuMT.HLTMenuConfig.Menu.HLTCFConfig_newJO import generateDecisionTree
 
 from AthenaCommon.Logging import logging
-from AthenaCommon.Constants import VERBOSE,INFO,DEBUG
+from AthenaCommon.Constants import VERBOSE
 _log = logging.getLogger('GenerateMenuMT_newJO')
 _log.setLevel( VERBOSE )
 
@@ -41,10 +41,13 @@ def generateMenu( flags ):
     menuChains = []
     allChainDicts =[]
 
-    chainAccumulators = []
+    menuAcc = ComponentAccumulator()
+    mainSequenceName = 'HLTAllSteps'
+    menuAcc.addSequence( seqAND(mainSequenceName) )
+
 
     for name, cfgFlag in list(flags._flagdict.iteritems()):
-        if not 'Trigger.menu.' in name:
+        if 'Trigger.menu.' not in name:
             continue
         value = flags._get(name)
         if len(value) == 0:
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTCFConfig.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTCFConfig.py
index 32d650c939522aa800dba327c15c557466312cbb..2e39b170ce5674eae0574ccded8ccc47d2b3b491 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTCFConfig.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTCFConfig.py
@@ -8,8 +8,7 @@ from TriggerMenuMT.HLTMenuConfig.Menu.HLTCFDot import  stepCF_DataFlow_to_dot, s
 from TriggerMenuMT.HLTMenuConfig.Menu.MenuComponentsNaming import CFNaming
 
 import sys
-import copy
-from AthenaCommon.Constants import VERBOSE,INFO,DEBUG
+from AthenaCommon.Constants import VERBOSE
 log = logging.getLogger('HLTCFConfig')
 log.setLevel( VERBOSE )
 
@@ -32,7 +31,8 @@ def createStepRecoNode(name, seq_list, dump=False):
     for seq in seq_list:        
         stepCF += createCFTree(seq)
     
-    if dump: dumpSequence (stepCF, indent=0)        
+    if dump: 
+        dumpSequence (stepCF, indent=0)        
     return stepCF
 
 
@@ -46,7 +46,8 @@ def createStepFilterNode(name, seq_list, dump=False):
         log.info("Add  %s to filter node %s", filterAlg.name(), name)
         stepCF += filterAlg
     
-    if dump: dumpSequence (stepCF, indent=0)        
+    if dump: 
+        dumpSequence (stepCF, indent=0)        
     return stepCF
 
 
@@ -138,12 +139,11 @@ def makeHLTTree(HLTChains, triggerConfigHLT = None):
     hltTop +=  steps
     
     # make CF tree
-
     finalDecisions = decisionTree_From_Chains(steps, allChainConfigs, allChainDicts)
-    EnabledChainNames = [c.name for c in allChainConfigs]
-    
+        
     flatDecisions=[]
-    for step in finalDecisions: flatDecisions.extend (step)
+    for step in finalDecisions: 
+        flatDecisions.extend (step)
     summary= makeSummary("TriggerSummaryFinal", flatDecisions)
     hltTop += summary
 
@@ -184,7 +184,6 @@ def matrixDisplay( allSeq ):
                 return sname.ljust( longestName ) + __nextSteps( index + 1, nextStepName )
         return ""
             
-    from pprint import pprint
     log.debug("" )
     log.debug("chains^ vs steps ->")
     log.debug( "="*90 )    
@@ -204,7 +203,7 @@ def decisionTree_From_Chains(HLTNode, chains, allDicts):
 
     log.debug("Run decisionTree_From_Chains on %s", HLTNode.name())
 
-    from TriggerMenuMT.HLTMenuConfig.Menu.MenuComponents import CFSequence, RoRSequenceFilterNode, ComboMaker
+    from TriggerMenuMT.HLTMenuConfig.Menu.MenuComponents import CFSequence
     HLTNodeName= HLTNode.name()
 
     # find nsteps
@@ -463,8 +462,10 @@ def buildFilter(filter_name,  filter_input):
     """
     from TriggerMenuMT.HLTMenuConfig.Menu.MenuComponents import  RoRSequenceFilterNode       
     sfilter = RoRSequenceFilterNode(name=filter_name)
-    for i in filter_input: sfilter.addInput(i)
-    for i in filter_input: sfilter.addOutput(CFNaming.filterOutName(filter_name, i))
+    for i in filter_input: 
+        sfilter.addInput(i)
+    for i in filter_input: 
+        sfilter.addOutput(CFNaming.filterOutName(filter_name, i))
 
     log.debug("Added inputs to filter: %s", sfilter.getInputList())
     log.debug("Added outputs to filter: %s", sfilter.getOutputList())
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTCFConfig_newJO.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTCFConfig_newJO.py
index 707c700706c080c4aad8d9514fd625358d7ca8bc..a074748583d68226d94c0a1504fe7484caa11342 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTCFConfig_newJO.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTCFConfig_newJO.py
@@ -1,12 +1,8 @@
 # Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
 
-from collections import defaultdict
-
-from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
 from TriggerMenuMT.HLTMenuConfig.Menu.MenuComponentsNaming import CFNaming
-from TriggerMenuMT.HLTMenuConfig.Menu.MenuComponents import CFSequence
 from TriggerMenuMT.HLTMenuConfig.Menu.HLTCFConfig import buildFilter, makeSummary
-from AthenaCommon.CFElements import parOR, seqAND, seqOR, findOwningSequence
+from AthenaCommon.CFElements import parOR, seqAND
 from AthenaCommon.Logging import logging
 from AthenaCommon.Constants import VERBOSE
 
@@ -34,8 +30,6 @@ def connectStepToFilter(chainStep, filterNode):
 def generateDecisionTree(chains, allChainDicts):
     from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
     from collections import defaultdict
-    from TriggerMenuMT.HLTMenuConfig.Menu.MenuComponents import CFSequence
-    from AthenaCommon.CFElements import findOwningSequence
 
     acc = ComponentAccumulator()
     mainSequenceName = 'HLTAllSteps'
@@ -51,8 +45,6 @@ def generateDecisionTree(chains, allChainDicts):
             chainName = chainStep.name.split('_')[0]
             chainStepsMatrix[stepNumber][chainName].append(chain)
 
-    allSequences = []
-
     ## Matrix with steps lists generated. Creating filters for each cell
     for nstep in chainStepsMatrix:
         stepDecisions = []
@@ -114,4 +106,4 @@ def generateDecisionTree(chains, allChainDicts):
         summary = makeSummary('TriggerSummary{}'.format(stepName), stepDecisions)
         acc.addSequence(summary, parentName = mainSequenceName)
 
-    return acc
\ No newline at end of file
+    return acc
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTCFDot.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTCFDot.py
index 1393617f6af55497f6a517dc07565e3df0869f39..5768accf1bd251657db63a6b8a98c751cb69fde1 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTCFDot.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTCFDot.py
@@ -1,16 +1,18 @@
 ###### Here some graphical methods to produce dot files from Decision Handling
  # to visualize: dot -T pdf Step1.dot > Step1.pdf
  
-from ViewAlgsTest.connectAlgorithmsIO import connectAlgorithmsIO, graph_generator
 from AthenaCommon.AlgSequence import AthSequencer
 from TriggerMenuMT.HLTMenuConfig.Menu.MenuComponents import isHypoBase, isInputMakerBase, isFilterAlg
 import itertools
 
 def algColor(alg):
     """ Set given color to Alg type"""
-    if isHypoBase(alg):       return "darkorchid1"
-    if isInputMakerBase(alg): return "cyan3"
-    if isFilterAlg(alg):      return "chartreuse3"
+    if isHypoBase(alg):      
+        return "darkorchid1"
+    if isInputMakerBase(alg): 
+        return "cyan3"
+    if isFilterAlg(alg):      
+        return "chartreuse3"
     return "cadetblue1"
 
 def stepCF_ControlFlow_to_dot(stepCF):
@@ -40,8 +42,11 @@ def stepCF_ControlFlow_to_dot(stepCF):
         return False
 
     def _seqColor(seq):
-        if _parOR(seq): return "red"
-        if _seqAND(seq): return "blue"
+        if _parOR(seq): 
+            return "red"
+        if _seqAND(seq): 
+            return "blue"
+
         return "black"
 
    
@@ -105,7 +110,7 @@ def all_DataFlow_to_dot(name, step_list):
                 for menuseq in cfseq.step.sequences:
                     cfseq_algs.append(menuseq.maker)
                     cfseq_algs.append(menuseq.sequence )
-                    if menuseq.reuse==False:
+                    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
@@ -166,7 +171,7 @@ def stepCF_DataFlow_to_dot(name, cfseq_list):
             for menuseq in cfseq.step.sequences:
                 cfseq_algs.append(menuseq.maker)
                 cfseq_algs.append(menuseq.sequence )
-                if menuseq.reuse==False:
+                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
@@ -236,12 +241,12 @@ def getValuesProperties(node):
     
     for alg in algs:        
         for k, cval in alg.getValuedProperties().items():
-            if type(cval) == type(list()):  
+            if type(cval) is list:  
                 for val in cval:
-                    if type(val) == type(''):
+                    if val is '': # CAT type(val) is None ??
                         if val not in Excluded:
                             values.append(val)            
-            elif type(cval) == type(''):
+            elif cval is '': # CAT type(val) is None ??
                 if cval not in Excluded:
                     values.append(cval)
             else:
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/LS2_v1.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/LS2_v1.py
index 92e5492d02c9c8f4d2424409fa49f29bd9f0f527..d8333ba5259020536f665a6caef20017ee07e1ba 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/LS2_v1.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/LS2_v1.py
@@ -8,7 +8,7 @@ def setupMenu():
     from AthenaCommon.Logging                 import logging
     log = logging.getLogger( 'TriggerMenuMT.HLTMenuConfig.Menu.LS2_v1.py' )
 
-    from TriggerMenuMT.LVL1MenuConfig.TriggerConfigLVL1 import TriggerConfigLVL1 as tcl1
+    #from TriggerMenuMT.LVL1MenuConfig.TriggerConfigLVL1 import TriggerConfigLVL1 as tcl1
     #if tcl1.current:
     #    log.info("L1 items: %s " % tcl1.current.menu.items.itemNames())
     #else:
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/LS2_v1_newJO.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/LS2_v1_newJO.py
index 9aebb97a11d6fbb78fb575dd02d54199fd5f6920..1a16de80f5d8a7354fdd7320246d30c0fb2e7d52 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/LS2_v1_newJO.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/LS2_v1_newJO.py
@@ -10,9 +10,6 @@ def setupMenu(flags):
     Assign chains for LS2_v1 to menu flags
     """
 
-    from AthenaCommon.Logging import logging
-    log = logging.getLogger( 'TriggerMenuMT.HLTMenuConfig.Menu.LS2_v1_newJO.py' )
-
     #---------------------------------------------------------------------
     # INPUT FORMAT FOR CHAINS:
     # ['chainName', [L1 items for chainParts], [stream], [groups], EBstep],
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py
index aa253f8944d0809f507e425821174e2a8364c492..9230ddb23139ac3ee311a476a3630dd569d0e544 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py
@@ -2,7 +2,7 @@
 
 import sys, re, copy
 from AthenaCommon.Logging import logging
-from AthenaCommon.Constants import VERBOSE,INFO,DEBUG
+from AthenaCommon.Constants import VERBOSE,DEBUG
 log = logging.getLogger('MenuComponents')
 log.setLevel( VERBOSE )
 logLevel=DEBUG
@@ -49,21 +49,19 @@ class AlgNode(Node):
 
     def setPar(self, prop, name):
         cval = self.Alg.getProperties()[prop]
-        try:
-            if type(cval) == type(list()):
-                cval.append(name)
-                return setattr(self.Alg, prop, cval)
-            else:
-                return setattr(self.Alg, prop, name)
-        except:
-            pass
+        if type(cval) is list:
+            cval.append(name)
+            return setattr(self.Alg, prop, cval)
+        else: 
+            return setattr(self.Alg, prop, name)
+
 
     def getPar(self, prop):
-        try:
+        if hasattr(self.Alg, prop):
             return getattr(self.Alg, prop)
-        except:
+        else:
             return self.Alg.getDefaultProperty(prop)
-        raise "Error in reading property " + prop + " from " + self.Alg
+
 
     def addOutput(self, name):
         outputs = self.readOutputList()
@@ -82,7 +80,7 @@ class AlgNode(Node):
         cval = self.getPar(self.outputProp)
         if cval == '':
             return outputs
-        if type(cval) == type(list()):
+        if type(cval) is list:
             outputs.extend(cval)
         else:
             outputs.append(cval)
@@ -105,7 +103,7 @@ class AlgNode(Node):
         cval = self.getPar(self.inputProp)
         if cval =='':
             return inputs
-        if type(cval) == type(list()):
+        if type(cval) is list:
             inputs.extend(cval)
         else:
             inputs.append(cval)
@@ -123,7 +121,7 @@ class HypoToolConf():
         self.conf=''
 
     def setConf( self, chainDict):
-        if type(chainDict) != type({}):
+        if type(chainDict) is not dict:
             raise RuntimeError("Configuring hypo with %s, not good anymore, use chainDict" % str(chainDict) )
         self.chainDict = chainDict
 
@@ -224,7 +222,7 @@ class ComboMaker(AlgNode):
             print "MEOW multiplicity ", allMultis[i]
             cval = self.Alg.getProperties()[self.prop]  # check necessary to see if chain was added already?
             print "MEOW cval ", cval
-            if type(cval) == type(dict()):
+            if type(cval) is dict:
                 ##cval[chain] = allMultis
                 if chain in cval.keys():
                     cval[chain].append(allMultis[i])
@@ -262,7 +260,6 @@ def isFilterAlg(alg):
 class MenuSequence():
     """ Class to group reco sequences with the Hypo"""
     def __init__(self, Sequence, Maker,  Hypo, HypoToolGen, CA=None ):
-        from AthenaCommon.AlgSequence import AthSequencer
         self.name = CFNaming.menuSequenceName(Hypo.name())
         self.sequence     = Node( Alg=Sequence)
         self.maker        = InputMakerNode( Alg = Maker )
@@ -345,10 +342,13 @@ class Chain:
         for seed in vseeds:
             split=re.findall(r"(\d+)?([A-Z]+\d+)", seed)
             mult,single = split[0]
-            if not mult: mult=1
-            else: mult=int(mult)
+            if not mult: 
+                mult=1
+            else: 
+                mult=int(mult)
 #            print mult,single
-            for m in range(0,mult): self.vseeds.append(single)
+            for m in range(0,mult): 
+                self.vseeds.append(single)
 
         # group_seed is used to se tthe seed type (EM, MU,JET), removing the actual threshold
         # in practice it is the L1Decoder Decision output
@@ -380,7 +380,7 @@ class Chain:
 
     def decodeHypoToolConfs(self, allChainDicts):
         """ This is extrapolating the hypotool configuration from the (combined) chain name"""
-        #from TriggerMenuMT.HLTMenuConfig.Menu.TriggerConfigHLT import getConfFromChainName
+        import copy
         from TriggerMenuMT.HLTMenuConfig.Menu.TriggerConfigHLT import getChainDictFromChainName
         chainDict = getChainDictFromChainName(self.name, allChainDicts)
 
@@ -391,9 +391,8 @@ class Chain:
                 sys.exit("ERROR, in chain configuration")
 
             for seq, chainDictPart in zip(step.sequences, chainDict['chainParts']):
-                if seq.ca != None: # The CA merging took care of everything
+                if seq.ca is not None: # The CA merging took care of everything
                     continue
-                import copy
                 onePartChainDict = copy.deepcopy( chainDict )
                 onePartChainDict['chainParts'] = [ chainDictPart ]
 
@@ -437,7 +436,8 @@ class CFSequence():
             nseq+=1
 
 
-        if self.step.isCombo: self.connectCombo()
+        if self.step.isCombo: 
+            self.connectCombo()
 
     def connectCombo(self):
         # reset sequence output, they will b ereplaced by new combo outputs
@@ -569,7 +569,6 @@ class RecoFragmentsPool:
         The flags are not part of unique identifier as creation of new reco fragments should not be caused by difference in the unrelated flags.
         TODO, if that code survives migration to New JO we need to handle the case when the creator is an inner function
         """
-        from AthenaCommon.Logging import logging
         requestHash = hash( ( creator, tuple(kwargs.keys()), tuple(kwargs.values()) ) )
         if requestHash not in cls.fragments:
             recoFragment = creator( flags, **kwargs )
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuPrescaleConfig.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuPrescaleConfig.py
index 8b8f1a28d9e53f5b35f92fa6cb5abd696a132962..93cb0aa70d6db8db9a384f4cc9d407265bbbb48e 100755
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuPrescaleConfig.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuPrescaleConfig.py
@@ -13,9 +13,12 @@ def MenuPrescaleConfig(triggerConfigHLT):
     
     menu_name = TriggerFlags.triggerMenuSetup()
     ## Do some aliasing here
-    if menu_name == 'Physics_default': menu_name = 'LS2_v1'
-    elif menu_name == 'MC_loose_default': menu_name = 'LS2_v1'
-    elif menu_name == 'MC_tight_default': menu_name = 'LS2_v1'
+    if menu_name == 'Physics_default': 
+        menu_name = 'LS2_v1'
+    elif menu_name == 'MC_loose_default': 
+        menu_name = 'LS2_v1'
+    elif menu_name == 'MC_tight_default': 
+        menu_name = 'LS2_v1'
 
     log.info( 'Menu name: '+ menu_name)
 
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuUtil.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuUtil.py
index c469180047dd54f3d68f59fcde8174ecf8f30373..7e0df8b7747d1e7ecabf4490f0318666c09ada23 100755
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuUtil.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuUtil.py
@@ -18,7 +18,8 @@ def getStreamTagForRerunChains(triggerPythonConfig, HLTPrescale):
         n = len(prescales)
         hltchain = None
         for ch in triggerPythonConfig.allChains[item]:
-            if ch.level == 'HLT': hltchain = ch
+            if ch.level == 'HLT': 
+                hltchain = ch
             if n > 3  and hltchain:
                 if hltchain.prescale != "0":
                     log.warning("chain "+ hltchain.chain_name + " in rerun mode with special strema tag does not have the correct HLT PS [=0] ")
@@ -45,7 +46,8 @@ def applyHLTPrescale(triggerPythonConfig, HLTPrescale):
         n = len(prescales)
         hltchain = None
         for ch in triggerPythonConfig.allChains[item]:
-            if ch.level == 'HLT': hltchain = ch
+            if ch.level == 'HLT': 
+                hltchain = ch
         if n > 0  and hltchain:
             hltchain.prescale = str(prescales[0])
         if n > 1  and hltchain:
@@ -104,12 +106,8 @@ def checkTriggerGroupAssignment(triggerPythonConfig):
             for group in GroupItems:
                 if group in chain.groups:
                     GroupAssigned=True
-            if not GroupAssigned and CheckGroups:
+            if GroupAssigned is False and CheckGroups is True:
                 log.warning( "IN CHAIN: GROUP (primary, supporting, ... etc) undefined for chain: " + str(chain.chain_name) + ".")
-                #log.warning( "IN CHAIN: GROUP undefined for chain: " + str(chain.chain_name) + ". The chain will be excluded from the menu!")
-                #This part will become active soon
-                #if chain in triggerPythonConfig.theL2HLTChains : triggerPythonConfig.theL2HLTChains.remove(chain)
-                #if chain in triggerPythonConfig.theEFHLTChains: triggerPythonConfig.theEFHLTChains.remove(chain)
 
 #def checkStreamConsistency(triggerPythonConfig,streamConfig):
 def checkStreamConsistency(triggerPythonConfig):
@@ -118,52 +116,10 @@ def checkStreamConsistency(triggerPythonConfig):
     """
     menu_name = TriggerFlags.triggerMenuSetup()
     log.info( "Menu: " + menu_name)
-    CheckGroups=False
 
     from TriggerMenu.menu.StreamInfo       import getAllStreams
 
     allStreams = getAllStreams()
-#    allStreams=['UPC',
-#                'TRTMonitoring',
-#                'WarmStart',      
-#                'ZeroBias',       
-#                'CosmicCalo',     
-#                'ZeroBiasOverlay',
-#                'CosmicMuons',
-#                'CosmicCalo',
-#                'IDCosmic',
-#                'IDMonitoring',
-#                'IDTracks',
-#                'Muon_Calibration',
-#                'Standby',   
-#                'Background',
-#                'MinBias',
-#                'MinBiasOverlay',
-#                'ALFA',
-#                'Bphysics',
-#                'physics',
-#                'express',
-#                'Tile',
-#                'L1Muon',
-#                'L1MinBias',
-#                'EnhancedBias',
-#                'LArCells',
-#                'LArCellsEmpty',
-#                'DISCARD',
-#                'EFCostMonitoring',
-#                'HLTPassthrough',
-#                'beamspot',
-#                'PixelBeam',
-#                'PixelNoise',
-#                'VdM',
-#                'L2CostMonitoring',
-#                'SCTNoise',
-#                'ALFACalib',
-#                'L1Calo',     
-#                'L1CaloCalib',     
-#                ]
-
-    #allStreams.extend(streamConfig)
 
     ##Check that all the streams associated to the chains exists
     ##Chech that there is no duplication of ROB_ID for the ds streams used in a specific menu
@@ -225,7 +181,8 @@ def allSignatures():
         TriggerFlags.CombinedSlice,
         )
     for a in slices:
-        if a.signatures.statusOn: sigs += a.signatures()
+        if a.signatures.statusOn: 
+            sigs += a.signatures()
     return sigs
 
 
@@ -234,11 +191,11 @@ def findL1TT(chain, triggerPythonConfig):
     if chain.level == 'EF':
         l2_chain_name = chain.lower_chain_name
         l2_chain = triggerPythonConfig.getHLTChain(l2_chain_name)
-    if l2_chain == None:
+    if l2_chain is None:
         return -2
     l1_item_name = l2_chain.lower_chain_name
     l1_item = triggerPythonConfig.getLvl1Item(l1_item_name)
-    if l1_item==None:
+    if l1_item is None:
         return -1
     return l1_item.trigger_type
 
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/SignatureDicts.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/SignatureDicts.py
index 1637d01b074e227ec7f257757f585c39b9223b8e..1901479088dad8e19e8f0fcfc53cc999f6e932dd 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/SignatureDicts.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/SignatureDicts.py
@@ -848,10 +848,9 @@ def getSignatureInformation(signature):
 #==========================================================            
 def getBasePattern():
     import re
-    import itertools
     allTrigTypes = SliceIDDict.values()
     possibleTT = '|'.join(allTrigTypes)
-    pattern = re.compile("(?P<multiplicity>\d*)(?P<trigType>(%s))(?P<threshold>\d+)(?P<extra>\w*)" % (possibleTT))
+    pattern = re.compile("(?P<multiplicity>\d*)(?P<trigType>(%s))(?P<threshold>\d+)(?P<extra>\w*)" % (possibleTT)) # noqa: W605
     return pattern
 
 
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/TriggerConfigHLT.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/TriggerConfigHLT.py
index cbf15205d8b00dded9df69a0708b54a915057da7..5a448e44818d2e9fd4a47face62a7b48099892fc 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/TriggerConfigHLT.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/TriggerConfigHLT.py
@@ -39,7 +39,7 @@ class TriggerConfigHLT:
 
     def registerHLTChain(self, chainName, chainConfig):
         """ Adds chain to the set of self.allChains which are registered for further use """
-        if logical_name in self.allChains:
+        if chainName in self.allChains:
             self.allChains[chainName].append( chainConfig )
         else:
             self.allChains[chainName] = [ chainConfig ]
@@ -89,7 +89,7 @@ def getConfFromChainName(chainName, allChainDicts = None):
                     chainPartNames.append('HLT_'+cPName)
                     
     if len(chainPartNames) == 0:
-        log.error("MenuChains.getConfFromChainName: Wrong chain name given: found %s",name)
+        log.error("MenuChains.getConfFromChainName: Wrong chain name given: found %s", chainName)
         sys.exit("ERROR, in getConfFromChainName: Wrong chain configuration") 
         return [chainName]
     else:
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Muon/MuonDef.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Muon/MuonDef.py
index b89ae7a140e1c6296d3a3975a9b87228a2b170a1..6dac01b934bcde82418c2d15cb810913a31a371a 100755
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Muon/MuonDef.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Muon/MuonDef.py
@@ -5,49 +5,52 @@
 # SliceDef file for muon chains/signatures
 #
 #########################################################################
-from AthenaCommon import CfgGetter
 from AthenaCommon.Logging import logging
 logging.getLogger().info("Importing %s",__name__)
 
 log = logging.getLogger("TriggerMenuMT.HLTMenuConfig.Muon.MuonDef")
 
-from TriggerMenuMT.HLTMenuConfig.Menu.HltConfig import *
-
-
-############################### Class/function to configure muon chains ##############################
-class Chain_mu(L2EFChainDef):
-
-  def __init__(self, chainDict):
-    self.chainName       = chainDict['chainName']
-    self.chainL1Item     = chainDict['L1item']
-    self.chainPart       = chainDict['chainParts']
-    self.chainPartL1Item = self.chainPart['L1item']
-    self.mult            = int(self.chainPart['multiplicity'])
-    self.chainPartName   = self.chainPart['chainPartName']
-    self.chainPartNameNoMult = self.chainPartName[1:] if self.mult > 1 else self.chainPartName
-    self.L2InputTE = self.chainPartL1Item or self.chainL1Item
-    if self.L2InputTE:      # cut of L1_, _EMPTY,..., & multiplicity
-      self.L2InputTE = self.L2InputTE.replace("L1_","")
-      self.L2InputTE = self.L2InputTE.split("_")[0]
-      self.L2InputTE = self.L2InputTE[1:] if self.L2InputTE[0].isdigit() else self.L2InputTE
-    
-    # --- call corresponding functions to set up chains ---
-    if        not self.chainPart['extra'] \
-          and not self.chainPart['FSinfo'] \
-          and not self.chainPart['hypoInfo'] \
-          and not self.chainPart['reccalibInfo'] :
-      self.setup_muXX()      
-    else:
-      log.error('Chain %s could not be assembled' % (self.chainPartName))
-      return False
-
-
-
-############################### DEFINE GROUPS OF CHAIN CONFIGURATIONS HERE ##############################
-  def setup_muXX(self):
-
-    log.info('Function to setup muXX chains to be implemented')
-    
-#################################################################################################
+from TriggerMenuMT.HLTMenuConfig.Menu.ChainConfigurationBase import ChainConfigurationBase
+
+
+############################################# 
+###  Class/function to configure muon chains 
+#############################################
+
+class MuonChainConfiguration(ChainConfigurationBase):
+
+    def __init__(self, chainDict):
+        ChainConfigurationBase.__init__(self,chainDict)
+        
+    # ----------------------
+    # Assemble the chain depending on information from chainName
+    # ----------------------
+    def assembleChain(self):                            
+        myStepNames = []
+        chainSteps = []
+        log.debug("Assembling chain for " + self.chainName)
+        # --------------------
+        # define here the names of the steps and obtain the chainStep configuration 
+        # --------------------
+        if        not self.chainPart['extra'] \
+              and not self.chainPart['FSinfo'] :
+          
+          myStepNames += ["Step1_etcut"]
+          myStepNames += ["Step2_etcut"]            
+          for step in myStepNames:
+            log.debug("Assembling steps for chain %s", self.chainName)
+            #chainSteps += [self.getMuonSteps(step)]
+
+        else:
+            raise RuntimeError("Chain configuration unknown for chain: " + self.chainName )
+            
+        myChain = self.buildChain(chainSteps)
+        return myChain
+        
+
+
+
+
+
 
 
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Muon/generateMuonChainDefs.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Muon/generateMuonChainDefs.py
index 7a0a4d7636159526704117d7d20805884ffcd63a..73cccc23dbf2a1cc6c833084e91c52d874adbc90 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Muon/generateMuonChainDefs.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Muon/generateMuonChainDefs.py
@@ -1,19 +1,16 @@
-# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
 
 ###########################################################################
 # SliceDef file for Muon chains
 ###########################################################################
-__author__  = 'C. Bernius'
-__doc__="Definition of muon chains for AthenaMT" 
 
 from AthenaCommon.Logging import logging
+log = logging.getLogger( 'TriggerMenuMT.HLTMenuConfig.Muon.generateChainConfigs' )
 logging.getLogger().info("Importing %s",__name__)
 
-from TriggerMenuMT.HLTMenuConfig.Menu.ChainDictTools import *
+from TriggerMenuMT.HLTMenuConfig.Menu.ChainDictTools import splitChainDict
+from TriggerMenuMT.HLTMenuConfig.Muon.MuonDef import MuonChainConfiguration as MuonChainConfiguration
 
-from TrigUpgradeTest.TrigUpgradeTestConf import HLTTest__TestRecoAlg
-from TrigUpgradeTest.TrigUpgradeTestConf import HLTTest__TestHypoAlg
-from TrigUpgradeTest.TrigUpgradeTestConf import HLTTest__TestHypoTool
 
 
 def generateChainDefs(chainDict):
@@ -21,27 +18,24 @@ def generateChainDefs(chainDict):
     listOfChainDicts = splitChainDict(chainDict)
     listOfChainDefs=[]
 
-    #define the list of keywords from Signature dicts to base the grouping on
-    groupCategories = []
+    for subChainDict in listOfChainDicts:
+        
+        Muon = MuonChainConfiguration(subChainDict).assembleChain() 
 
-    for chainDict in listOfChainDicts:
-        chainName = chainDict['chainName']
-        chainL1Item = chainDict['L1item']
-        chainPart = chainDict['chainParts']
-        chainPartL1Item = self.chainPart['L1item']
-        chainthreshhold = chainPart['threshold']
+        listOfChainDefs += [Muon]
+        log.debug('length of chaindefs %s', len(listOfChainDefs) )
         
-        nsteps = 2
-        allChainSteps=[]
-        for step in nsteps:
-            stepname="Step"+str(step)+"_"+chainName
-            
-            cstep=ChainStep(stepname, [SequenceHypoTool(muStep(str(step), chainL1Item), stepHypoTool(step, chainthreshold))])
-            allChainSteps.append(cstep)
 
-        MuonChainDef = Chain(chainName,chainL1Item,ChainSteps=allChainSteps)
+    if len(listOfChainDefs)>1:
+        log.warning("Implement case for multi-electron chain!!") 
+        theChainDef = listOfChainDefs[0] #needs to be implemented properly
+    else:
+        theChainDef = listOfChainDefs[0]
+
+    log.debug("theChainDef.name: %s" , theChainDef.name)
+    log.debug("theChainDef.seed: %s" , theChainDef.seed)
+    log.debug("theChainDef.ChainSteps: %s" , theChainDef.steps)
 
-        listOfChainDefs += MuonChainDef
+    return theChainDef
 
 
-    return listOfChainDefs
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Photon/generatePhoton.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Photon/generatePhoton.py
index cabf075efbe00f6c3a6f3154c2fbf2f41401b78c..d3e60818b8323548c00dde3c2aa9f21e6bb4e0f0 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Photon/generatePhoton.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Photon/generatePhoton.py
@@ -7,8 +7,6 @@ from TriggerMenuMT.HLTMenuConfig.Menu.MenuComponents import MenuSequence, \
 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
 
 from TrigEgammaHypo.TrigL2CaloHypoTool import TrigL2CaloHypoToolFromDict
-from TrigEgammaHypo.TrigEgammaHypoConf import TrigL2CaloHypoAlgMT
-from TrigEgammaHypo.TrigEgammaHypoConf import TrigL2PhotonHypoAlgMT
 from TrigEgammaHypo.TrigL2PhotonHypoTool import TrigL2PhotonHypoToolFromDict
 
 
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Test/TestDef.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Test/TestDef.py
index 87a21994502ba18585b0322b1c45da093ac31405..8b02f8d6e2a36a96d09c0295dd4d69952c904f21 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Test/TestDef.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Test/TestDef.py
@@ -6,8 +6,6 @@ log = logging.getLogger("TriggerMenuMT.HLTMenuConfig.Test.TestDef")
 
 
 from TriggerMenuMT.HLTMenuConfig.Menu.ChainConfigurationBase import ChainConfigurationBase
-from TriggerMenuMT.HLTMenuConfig.Menu.MenuComponents import Chain, ChainStep, RecoFragmentsPool
-from TriggerMenuMT.HLTMenuConfig.Menu.TriggerConfigHLT import TriggerConfigHLT
 
 
 #----------------------------------------------------------------
@@ -22,7 +20,6 @@ class TestChainConfiguration(ChainConfigurationBase):
     # Assemble the chain depending on information from chainName
     # ----------------------
     def assembleChain(self):                            
-        myStepNames = []
         chainSteps = []
         log.debug("Assembling chain for " + self.chainName)
         # --------------------
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Test/generateTestChainDefs.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Test/generateTestChainDefs.py
index 13291d6bc74e90868e7dc81e4b5824f7f1503e7e..27e84a98a55c85676f84827ad75cc099157f7638 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Test/generateTestChainDefs.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Test/generateTestChainDefs.py
@@ -1,6 +1,5 @@
 # Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
 
-from TriggerMenuMT.HLTMenuConfig.Menu.MenuComponents import Chain
 from TriggerMenuMT.HLTMenuConfig.Menu.ChainDictTools import splitChainDict
 from TriggerMenuMT.HLTMenuConfig.Test.TestDef import TestChainConfiguration as TestChainConfiguration