diff --git a/Trigger/TriggerCommon/TriggerJobOpts/python/CommonSignatureFlags.py b/Trigger/TriggerCommon/TriggerJobOpts/python/CommonSignatureFlags.py
new file mode 100755
index 0000000000000000000000000000000000000000..9e3b0d84be02c57af1ad683198defffc6c3158e1
--- /dev/null
+++ b/Trigger/TriggerCommon/TriggerJobOpts/python/CommonSignatureFlags.py
@@ -0,0 +1,48 @@
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+""" Common signature flags  """
+
+from AthenaCommon.JobProperties import JobProperty, jobproperties
+
+
+__author__  = 'T. Bold'
+__version__=""
+__doc__="Common signature flags  "
+
+    
+class doL2ID(JobProperty):
+    """ On/Off L2 InnerDetector trigger """
+    statusOn=True
+    allowedType=['bool']
+    StoredValue=True
+    
+class doL2Calo(JobProperty):
+    """ On/Off L2 Calorimetry trigger """
+    statusOn=True
+    allowedType=['bool']
+    StoredValue=True
+    
+class doL2Muon(JobProperty):
+    """ On/Off L2 Muons trigger """
+    statusOn=True
+    allowedType=['bool']
+    StoredValue=True
+
+class doEFID(JobProperty):
+    """ On/Off EventFilter Inner Detector trigger """
+    statusOn=True
+    allowedType=['bool']
+    StoredValue=True
+    
+class doEFCalo(JobProperty):
+    """ On/Off EventFilter Calorimetry trigger """
+    statusOn=True
+    allowedType=['bool']
+    StoredValue=True
+    
+class doEFMuon(JobProperty):
+    """ On/Off L2 Muons trigger """
+    statusOn=True
+    allowedType=['bool']
+    StoredValue=True
+
diff --git a/Trigger/TriggerCommon/TriggerJobOpts/python/CommonSignatureHelper.py b/Trigger/TriggerCommon/TriggerJobOpts/python/CommonSignatureHelper.py
new file mode 100755
index 0000000000000000000000000000000000000000..0f0a7f61836bc73b0a8f68906d968ac0ebdc510a
--- /dev/null
+++ b/Trigger/TriggerCommon/TriggerJobOpts/python/CommonSignatureHelper.py
@@ -0,0 +1,144 @@
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+""" helpers for signature flags manipulations """
+class CommonSignatureHelper:
+    def setAll(self):
+        #self.setL2()
+        #self.setEF()
+        self.signatures.set_On()
+        
+    def unsetAll(self):
+        #self.unsetL2()
+        #self.unsetEF()
+        self.signatures.set_Off()
+        
+    def setL2(self):
+        if hasattr(self, 'doL2ID'):
+            self.doL2ID=True
+        if hasattr(self, 'doL2Calo'):
+            self.doL2Calo=True
+        if hasattr(self, 'doL2Muon'):
+            self.doL2Muon=True
+        
+    def unsetL2(self):
+        if hasattr(self, 'doL2ID'):
+            self.doL2ID=False
+        if hasattr(self, 'doL2Calo'):            
+            self.doL2Calo=False
+        if hasattr(self, 'doL2Muon'):            
+            self.doL2Muon=False
+
+    def setEF(self):
+        if hasattr(self, 'doEFID'):        
+            self.doEFID=True
+        if hasattr(self, 'doEFCalo'):            
+            self.doEFCalo=True
+        if hasattr(self, 'doEFMuon'):            
+            self.doEFMuon=True
+        
+    def unsetEF(self):
+        if hasattr(self, 'doEFID'):
+            self.doEFID=False
+        if hasattr(self, 'doEFCalo'):            
+            self.doEFCalo=False
+        if hasattr(self, 'doEFMuon'):            
+            self.doEFMuon=False
+        
+    def unsetID(self):
+        if hasattr(self, 'doL2ID'):        
+            self.doL2ID = False
+        if hasattr(self, 'doEFID'):        
+            self.doEFID = False
+
+    def setID(self):
+        if hasattr(self, 'doL2ID'):        
+            self.doL2ID = True
+        if hasattr(self, 'doEFID'):        
+            self.doEFID = True
+
+    def unsetCalo(self):
+        if hasattr(self, 'doL2Calo'):        
+            self.doL2Calo = False
+        if hasattr(self, 'doEFCalo'):                
+            self.doEFCalo = False
+
+    def setCalo(self):
+        if hasattr(self, 'doL2Calo'):                
+            self.doL2Calo = True
+        if hasattr(self, 'doEFCalo'):                    
+            self.doEFCalo = True
+        return 
+
+    def unsetMuon(self):
+        if hasattr(self, 'doL2Muon'):                
+            self.doL2Muon = False
+        if hasattr(self, 'doEFMuon'):                
+            self.doEFMuon = False
+
+    def setMuon(self):
+        if hasattr(self, 'doL2Muon'):                
+            self.doL2Muon = True
+        if hasattr(self, 'doEFMuon'):                
+            self.doEFMuon = True
+
+    def doAny(self):
+        return (self.doL2() or self.doEF())
+
+    def doL2(self):
+        return (self.doL2Muon or self.doL2Calo or self.doL2ID )
+
+    def doEF(self):
+        return (self.doEFMuon or self.doEFCalo or self.doEFID )
+
+    def enableSignature(self, chainInfo):
+        """ Add signature defined by chainInfo array """
+        self.enableSignatures([chainInfo])
+        
+    def enableSignatures(self, chainInfoList):
+        """ Add list of signatures """
+        current=self.signatures.get_Value()
+        new = [sig for sig in chainInfoList if sig not in current]
+        new.extend(current)
+        self.signatures.set_Value(new)
+
+    def disableSignature(self, l):
+        """ Disable signature with name l """
+        self.disableSignatures([l])
+        
+    def disableSignatures(self, list):
+        """ Disable list of sigantures """
+        current = self.signatures.get_Value()
+        new = [sig for sig in current if sig[0] not in list ]
+        self.signatures.set_Value(new)
+
+
+class Bag:
+    def __init__(self,l):
+        self.allowedValues = l
+
+    def __str__(self):
+        return str(self.allowedValues)
+
+    def __repr__(self):
+        return "%r" % self.allowedValues
+
+    def __contains__(self, val):
+        return True in [ x == val for x in self.allowedValues]
+
+    def __eq__(self, arg):
+        if type(arg)==list or type(arg)==tuple or type(arg)==set:
+            
+            notContained = [a for a in arg if not a in self]
+
+            if len(notContained)==0: return True
+
+            from AthenaCommon.Logging import logging
+            log = logging.getLogger( 'AllowedList' )
+            log.error("the element %s is not in the list of allowed values: %s" % (notContained, self) )
+            return False
+        return True
+
+
+class AllowedList(list):
+    def __init__(self, l):
+        super(AllowedList,self).__init__([Bag(l)])
diff --git a/Trigger/TriggerCommon/TriggerJobOpts/python/SliceFlags.py b/Trigger/TriggerCommon/TriggerJobOpts/python/SliceFlags.py
new file mode 100644
index 0000000000000000000000000000000000000000..552e49cbeb1726c4b90be1a6e0f178914e2f4863
--- /dev/null
+++ b/Trigger/TriggerCommon/TriggerJobOpts/python/SliceFlags.py
@@ -0,0 +1,21 @@
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+import TriggerMenu.egamma.EgammaSliceFlags
+import TriggerMenu.jet.JetSliceFlags
+import TriggerMenu.bjet.BjetSliceFlags
+import TriggerMenu.muon.MuonSliceFlags
+import TriggerMenu.met.METSliceFlags
+import TriggerMenu.tau.TauSliceFlags
+import TriggerMenu.bphysics.BphysicsSliceFlags
+import TriggerMenu.minbias.MinBiasSliceFlags
+import TriggerMenu.heavyion.HeavyIonSliceFlags
+import TriggerMenu.combined.CombinedSliceFlags
+import TriggerMenu.calibcosmicmon.CosmicSliceFlags
+import TriggerMenu.calibcosmicmon.CalibSliceFlags
+import TriggerMenu.calibcosmicmon.StreamingSliceFlags
+import TriggerMenu.calibcosmicmon.MonitorSliceFlags
+import TriggerMenu.calibcosmicmon.BeamspotSliceFlags
+import TriggerMenu.calibcosmicmon.EnhancedBiasSliceFlags
+import TriggerMenu.test.TestSliceFlags
+
+
diff --git a/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerFlags.py b/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerFlags.py
index 6a67c41c3ac6df465cb33f3c52870728d4e8f801..f8bba0b66610fcc3ebb542d671e2194d736dd0fd 100644
--- a/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerFlags.py
+++ b/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerFlags.py
@@ -13,7 +13,7 @@ log = logging.getLogger( 'TriggerJobOpts.TriggerFlags' )
 log.setLevel(logging.DEBUG)
 
 from AthenaCommon.JobProperties import JobProperty, JobPropertyContainer, jobproperties
-from TriggerMenu.menu.CommonSliceHelper import AllowedList
+from TriggerJobOpts.CommonSignatureHelper import AllowedList
 from TrigConfigSvc.TrigConfigSvcUtils import getKeysFromNameRelease, getMenuNameFromDB
 
 
@@ -1041,6 +1041,10 @@ class triggerMenuSetup(JobProperty):
 
         'MC_pp_v6','Physics_pp_v6','MC_pp_v6_no_prescale', 'MC_pp_v6_tight_mc_prescale', 'MC_pp_v6_tightperf_mc_prescale', 'MC_pp_v6_loose_mc_prescale','Physics_pp_v6_tight_physics_prescale',
         'MC_pp_v7','Physics_pp_v7','MC_pp_v7_no_prescale', 'MC_pp_v7_tight_mc_prescale', 'MC_pp_v7_tightperf_mc_prescale', 'MC_pp_v7_loose_mc_prescale','Physics_pp_v7_tight_physics_prescale',
+        # -----------------------------------------------------------------
+        # Run 3 (and preparation for Run-3)
+        'LS2_v1', # for development of AthenaMT
+       
         ]
 
     _default_menu='MC_pp_v7_tight_mc_prescale'
@@ -1149,7 +1153,7 @@ from TriggerJobOpts.TriggerOnlineFlags      import OnlineFlags
 
 ## add slices generation flags
 
-from TriggerMenu.menu.SliceFlags import *
+from TriggerJobOpts.SliceFlags import *
 from TriggerJobOpts.Tier0TriggerFlags       import Tier0TriggerFlags
 from TrigTier0.NtupleProdFlags              import NtupleProductionFlags
 
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/CMakeLists.txt b/Trigger/TriggerCommon/TriggerMenuMT/CMakeLists.txt
new file mode 100644
index 0000000000000000000000000000000000000000..043ed482d684b33256369312473cbc944054ec7c
--- /dev/null
+++ b/Trigger/TriggerCommon/TriggerMenuMT/CMakeLists.txt
@@ -0,0 +1,24 @@
+################################################################################
+# Package: TriggerMenuMT
+################################################################################
+
+# Declare the package name:
+atlas_subdir( TriggerMenuMT )
+
+# Install files from the package:
+atlas_install_python_modules( python/*.py python/LVL1MenuConfig/*.py python/HLTMenuConfig/*.py 
+python/HLTMenuConfic/Menu python/LVL1MenuConfig/LVL1
+python/LVL1MenuConfig/LVL1Menu python/LVL1MenuConfig/LVL1Topo python/LVL1MenuConfig/L1TopoMenu 
+python/HLTMenuConfig/Egamma python/HLTMenuConfig/Muon python/HLTMenuConfig/Jet python/CommonUtils 
+python/HLTMenuConfig/Combined
+)
+atlas_install_joboptions( share/*.py )
+atlas_install_scripts( scripts/generate*Menu.py scripts/generateMenuMT.py)
+atlas_install_xmls( data/*.dtd data/*.xml )
+
+atlas_add_test( generateMenuMT SCRIPT scripts/testMenuMT.sh 
+                PROPERTIES TIMEOUT 500 
+                POST_EXEC_SCRIPT "check_log.pl --config checklogTriggerTest.conf generateMenuMT.log"
+              )
+
+
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Combined/CombinedSliceFlags.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Combined/CombinedSliceFlags.py
new file mode 100755
index 0000000000000000000000000000000000000000..51de8a007afe7f763a9a702cdfb1827dab8c965e
--- /dev/null
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Combined/CombinedSliceFlags.py
@@ -0,0 +1,38 @@
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+""" Combined slices specific flags  """
+
+from AthenaCommon.JobProperties         import JobProperty, JobPropertyContainer, jobproperties
+from TriggerMenu.menu.CommonSliceHelper import CommonSliceHelper, AllowedList
+
+__author__  = 'T. Bold, B. Demirkoz'
+__version__="$Revision: 1.53 $"
+__doc__="Flags for combined slices  "
+
+
+_flags = [] 
+
+class signatures(JobProperty):
+    """ signatures in Combined slice """
+    statusOn=True
+    allowedTypes=['list']    
+    StoredValue = []
+    
+_flags.append(signatures)
+
+# create container
+class CombinedSlice(JobPropertyContainer, CommonSliceHelper):
+    """ Combined Slices Flags """
+
+from TriggerJobOpts.TriggerFlags import TriggerFlags
+TriggerFlags.add_Container(CombinedSlice)
+
+for flag in _flags:
+    TriggerFlags.CombinedSlice.add_JobProperty(flag)
+del _flags
+
+# make an alias
+CombinedSliceFlags = TriggerFlags.CombinedSlice
+
+
+
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/EgammaSliceFlags.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/EgammaSliceFlags.py
new file mode 100755
index 0000000000000000000000000000000000000000..0c0f6abe9c4069a4da2a594f3d5ea13b08734cf9
--- /dev/null
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/EgammaSliceFlags.py
@@ -0,0 +1,132 @@
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+""" Egamma slice specific flags  """
+
+from AthenaCommon.Logging import logging
+from AthenaCommon.JobProperties import JobProperty, JobPropertyContainer
+from TriggerMenu.menu.CommonSliceHelper import CommonSliceHelper
+
+__author__  = 'T. Bold, P.Urquijo, R. White'
+__version__="$Revision: 1.42 $"
+__doc__="Egamma slice specific flags  "
+
+log = logging.getLogger( 'TriggerMenu.EgammaSliceFlags' )
+_flags = [] 
+class doSiTrack(JobProperty):
+    """ do or not to do SiTrack algo """ 
+    statusOn=True
+    allowedTypes=['bool']
+    StoredValue=True
+
+_flags.append(doSiTrack)
+
+class doIDSCAN(JobProperty):
+    """ do or not to do IDSCAN algo """ 
+    statusOn=True
+    allowedTypes=['bool']
+    StoredValue=True
+
+_flags.append(doIDSCAN)
+
+
+class doTrigEgammaRec(JobProperty):
+    """ do or not to do TrigEgammaRec (EF algorithm) algo """ 
+    statusOn=True
+    allowedTypes=['bool']
+    StoredValue=True
+
+_flags.append(doTrigEgammaRec)
+
+class signatures(JobProperty):
+    """ signatures in Egamma slice """
+    statusOn=True
+    allowedTypes=['list']
+    StoredValue   = []
+
+_flags.append(signatures)
+
+class doFastElectronFex(JobProperty):
+    '''enable L2ElectronFex cuts and sequence'''
+    statusOn=True
+    allowedTypes=['bool']
+    StoredValue=False
+
+_flags.append(doFastElectronFex)
+
+class doRinger(JobProperty):
+    '''apply ringer selection for Electron chains'''
+    statusOn=True
+    allowedTypes=['bool']
+    StoredValue=False
+
+_flags.append(doRinger) 
+
+class ringerVersion (JobProperty):
+    """ Version ringer tunes """
+    statusOn=False
+    allowedTypes=['str','None']
+    StoreValues=None
+
+_flags.append(ringerVersion)
+
+class pidVersion (JobProperty):
+    """ Version of PID tunes
+    """
+    statusOn=True
+    allowedTypes=['str']
+    StoredValue='ElectronPhotonSelectorTools/trigger/rel21_mc16a/'
+
+_flags.append(pidVersion)
+
+class clusterCorrectionVersion (JobProperty):
+    """
+    Cluster correction version for HLT Calo
+    """
+    statusOn=True
+    allowedTypes=['str','None']
+    allowedValues=['v12phiflip_noecorrnogap','None']
+    StoredValue=None
+
+_flags.append(clusterCorrectionVersion)
+
+class calibMVAVersion (JobProperty):
+    """
+    MVA calibration version
+    """
+    statusOn=True
+    allowedTypes=['str']
+    StoredValue='egammaMVACalib/online/v3'
+
+_flags.append(calibMVAVersion)
+
+# create container
+class EgammaSlice(JobPropertyContainer, CommonSliceHelper):
+    """ Egamma Slice Flags """
+
+from TriggerJobOpts.TriggerFlags import TriggerFlags
+TriggerFlags.add_Container(EgammaSlice)
+
+# add common slice flags
+TriggerFlags.EgammaSlice.import_JobProperties('TriggerMenu.menu.CommonSliceFlags')
+
+for flag in _flags:
+    TriggerFlags.EgammaSlice.add_JobProperty(flag)
+del _flags
+
+# make an alias
+EgammaSliceFlags = TriggerFlags.EgammaSlice
+
+run2Flag = TriggerFlags.run2Config
+if run2Flag=='2016':
+    log.info('EgammaSliceFlags set for %s',run2Flag)
+    EgammaSliceFlags.pidVersion = 'ElectronPhotonSelectorTools/trigger/rel21_mc16a/'
+    EgammaSliceFlags.clusterCorrectionVersion = None
+    EgammaSliceFlags.calibMVAVersion = 'egammaMVACalib/online/v3'
+elif run2Flag=='2017':
+    log.info('EgammaSliceFlags set for %s',run2Flag)
+    EgammaSliceFlags.pidVersion = 'ElectronPhotonSelectorTools/trigger/rel21_20170214/'
+    EgammaSliceFlags.clusterCorrectionVersion = 'v12phiflip_noecorrnogap'
+    EgammaSliceFlags.calibMVAVersion = 'egammaMVACalib/online/v6'
+else:
+    log.info('EgammaSliceFlags not set use defaults',run2Flag)
+
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Jet/JetSliceFlags.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Jet/JetSliceFlags.py
new file mode 100644
index 0000000000000000000000000000000000000000..6bd0c474e1fe3f7334f3dd70bb6349de7ae6e55b
--- /dev/null
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Jet/JetSliceFlags.py
@@ -0,0 +1,42 @@
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+""" Jet slice specific flags  """
+
+from AthenaCommon.JobProperties         import JobProperty, JobPropertyContainer, jobproperties
+from TriggerMenu.menu.CommonSliceHelper import CommonSliceHelper, AllowedList
+
+__author__  = 'T. Bold'
+__version__="$Revision: 1.31 $"
+__doc__="Jet slice specific flags  "
+
+
+_flags = [] 
+class signatures(JobProperty):
+    """ signatures in Jet slice """
+    statusOn=True
+    allowedTypes=['list']
+    StoredValue   = []
+    
+_flags.append(signatures)
+
+
+
+# create container
+from TriggerMenu.menu.CommonSliceHelper import CommonSliceHelper
+
+class JetSlice(JobPropertyContainer, CommonSliceHelper):
+    """ Jet Slice Flags """
+
+from TriggerJobOpts.TriggerFlags import TriggerFlags
+TriggerFlags.add_Container(JetSlice)
+
+# add add common slice flags
+TriggerFlags.JetSlice.import_JobProperties('TriggerMenu.menu.CommonSliceFlags')
+
+for flag in _flags:
+    TriggerFlags.JetSlice.add_JobProperty(flag)
+del _flags
+
+# make an alias
+JetSliceFlags = TriggerFlags.JetSlice
+
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/CPS.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/CPS.py
new file mode 100644
index 0000000000000000000000000000000000000000..0b14852a8a3661f363e41918ee03820de95eab97
--- /dev/null
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/CPS.py
@@ -0,0 +1,61 @@
+# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
+
+"""CPS addition  """
+
+__doc__="Addition of coherent prescales to the list of chains"
+
+from TriggerJobOpts.TriggerFlags import TriggerFlags
+
+from AthenaCommon.Logging import logging
+log = logging.getLogger(__name__)
+
+
+def genericCPSAdder(groups, signatures, chains, level, signatureOverwritten):
+
+    for cpsGroup, chainNames in groups.iteritems():
+        if "RATE" not in cpsGroup:
+            log.error('Following group do not start for RATE [%s]' %cpsGroup)
+        for chainName in chainNames:
+            if chainName not in signatures:
+                if not signatureOverwritten:
+                    log.error('Signature %s not registered to TriggerPythonConfig' % chainName)
+                else:
+                    log.warning('Signature %s not registered to TriggerPythonConfig' % chainName)
+                continue
+
+            if level == 'HLT':
+                chain_name = signatures[chainName][-1].chain_name
+            else:
+                log.error("Level of %s not defined", chainName)
+                
+            for c in chains:
+                if c.chain_name == chain_name:
+                    log.debug('chain: c.chain_name=%s, c.groups=%s, cpsGroup=%s', c.chain_name, c.groups, cpsGroup)
+                    cpsFound = None
+                    for g in c.groups:
+                        if g.find('CPS') == 5:
+                            cpsFound = g
+                    if cpsFound == None:
+                        log.info('CPS group %s added to %s', cpsGroup, chain_name)
+                        c.addGroup(cpsGroup)
+                    elif cpsFound == cpsGroup:
+                        log.debug('CPS group %s already assigned to %s. Nothing added', cpsGroup, chain_name)
+                    else:
+                        log.warning('CPS group with different name (%s) already exists for %s. Group %s not added', cpsFound, chain_name, cpsGroup)
+
+            #[c.addGroup(cpsGroup) for c in chains if c.chain_name == chain_name]
+
+
+
+def defineCPSGroups():
+    HLT_CPS_Groups = {				       
+        #Egamma chains
+        #"RATE:CPS:HLT_e5_vloose"  :  ['e5_lhvloose',               
+        #                              'e5_lhvloose_nod0',],
+        }        
+    
+    return (HLT_CPS_Groups)
+
+def addCPS(triggerPythonConfig,signatureOverwritten):
+    HLT_CPS_Groups = defineCPSGroups()
+    genericCPSAdder(HLT_CPS_Groups, triggerPythonConfig.allChains, triggerPythonConfig.theHLTChains, "HLT",signatureOverwritten)
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/ChainDef.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/ChainDef.py
new file mode 100644
index 0000000000000000000000000000000000000000..e56c187459b07553060a1a59928ad3fd5932795b
--- /dev/null
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/ChainDef.py
@@ -0,0 +1,119 @@
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+"""ChainDef is a simple object with state but no behaviour.
+It serves to vehical information from trigger slice menu software,
+which is often maintained by a slice domain expertto the central
+trigger menu code."""
+
+import pprint
+pp = pprint.PrettyPrinter(indent=4, depth=8)
+
+class ChainDef:
+ 
+    def __init__(self, chain_name, level, lower_chain_name, chain_counter=-1):
+        """chain_name: string. Identifies the chain within the signature
+
+        lower_chain_name: string. the name of the chain that will be run
+        immediately prior to the curent chain. Can be the empty string.
+
+        signature list: a list of 2-entry dicionaries. Each dictionary
+        gives a signature counter which is used by the central trigger
+        for optimization. The 'normal' values an integer index which
+        is incremented each time a signature is added. The second
+        entry is the name of an output trigger element at which the
+        chain is tested for success or failure. If the chain fails, its
+        actions are aborted.
+
+        sequence list. a 3-element dictionary containing the names of the
+        input and output trigger elements of the sequence, and a list
+        of Algorithms (AthenaConfigurables) which are to be run. A chain
+        may have more than one sequence.
+
+        """    
+        self.chain_name = chain_name
+        self.level = level
+        self.lower_chain_name = lower_chain_name
+        self.chain_counter = chain_counter
+        self.signatureList = []
+        self.sequenceList = []
+ 
+    def addSignature(self, signature_counter, listOfTriggerElements):
+        """add signature data to the chain"""
+
+        self.signatureList.append(
+            {'signature_counter': signature_counter,
+             'listOfTriggerElements': listOfTriggerElements})
+
+
+    def insertSignature(self, signature_counter, listOfTriggerElements):
+        """insert signature data to the chain"""
+
+        #safety: if asked to insert with sig_counter -1, use addSignature
+        if signature_counter == -1:
+            addSignature(signature_counter,listOfTriggerElements)
+        else:
+            pos_newSeq = -1
+            
+            for pos, sig in enumerate(self.signatureList):
+                if sig['signature_counter'] == signature_counter:
+                    pos_newSeq = pos
+                    
+            self.signatureList.insert(pos_newSeq,
+                                      {'signature_counter': signature_counter,
+                                       'listOfTriggerElements': listOfTriggerElements})
+            
+            for pos, sig in enumerate(self.signatureList):
+                if pos <= pos_newSeq: continue
+                sig['signature_counter'] = sig['signature_counter']+1
+                
+
+    def appendSignature(self, listOfTriggerElements):
+        """add new signature to the end of the signature list and increment chain counter automatically"""
+
+        self.signatureList.append(
+            {'signature_counter': self.signatureList[-1]["signature_counter"]+1,
+             'listOfTriggerElements': listOfTriggerElements})
+
+ 
+    def addSequence(self, listOfAlgorithmInstances, te_in, te_out, topo_start_from=None):
+        """add sequence data to the chain"""
+
+        self.sequenceList.append(
+            {'algorithm': listOfAlgorithmInstances,
+             'input': te_in,
+             'output': te_out,
+             'topo_start_from': topo_start_from})
+
+
+    def __str__(self):
+        """Provide a string representation of the chain"""
+
+        s = ['chain_name:       %s ' % self.chain_name,
+             'lower chain name: %s ' % self.lower_chain_name,
+             'no signatures     %d ' % len(self.signatureList),
+             'no sequences      %d ' % len(self.sequenceList),
+             '\n',
+             'sequences:']
+
+        s.extend([pp.pformat(ss) for ss in self.sequenceList])
+        s.extend(['\n',
+                  'signatures:'])
+        s.extend([pp.pformat(ss) for ss in self.signatureList])
+
+        return '\n'.join(s)
+
+
+class ErrorChainDef(object):
+    """Error object. Created when ChainDef creation fails."""
+
+    def __init__(self, err_msg, chain_name='unknown'):
+        self.chain_name = chain_name
+        self.err_msg = err_msg
+
+    def __str__(self):
+        return '\n'.join(['ErrorChainDef:',
+                          'chain name: ' + self.chain_name,
+                          'err msg: ' + self.err_msg])
+
+    def str_no_cr(self):
+        return str(self).replace('\n', '; ')
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/DictFromChainName.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/DictFromChainName.py
new file mode 100755
index 0000000000000000000000000000000000000000..83225cf19d58673aa28d2ffc6f9240e320d646ca
--- /dev/null
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/DictFromChainName.py
@@ -0,0 +1,520 @@
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+"""
+
+Class to obtain the chain configuration dictionary from the short or long name
+
+Authors: Catrin Bernius, Joerg Stelzer, Moritz Backes
+Written in December 2013
+
+"""
+__author__  = 'Moritz Backes & Catrin Bernius & Joerg Stelzer'
+__version__=""
+__doc__="Obtaining Dictionaries from Chain Names"
+
+
+import re
+
+from AthenaCommon.Logging import logging
+logging.getLogger().info("Importing %s",__name__)
+logDict = logging.getLogger('TriggerMenu.menu.DictFromChainName')
+
+class DictFromChainName(object):
+
+    def getChainDict(self,chainInfo):
+        logDict.debug("chainInfo %s", chainInfo)
+        
+        # ---- Loop over all chains (keys) in dictionary ----
+        # ---- Then complete the dict with other info    ----
+        # ---- of formate: # chainName :                ----
+        # ----  chainCounter (int), L1item (str), Stream (str), EBstep (str)] ----   
+        # ---- chainName = chainInfo[0]
+        
+        m_chainName = chainInfo[0]
+        m_L1item = chainInfo[1]
+        m_L1items_chainParts = chainInfo[2]
+        m_stream = chainInfo[3]
+        m_groups = chainInfo[4]
+        m_EBstep = chainInfo[5]
+
+
+        logDict.debug("Analysing chain with name: %s", m_chainName)
+        chainProp = self.analyseShortName(m_chainName,  m_L1items_chainParts, m_L1item)
+        logDict.debug('ChainProperties: %s', chainProp)
+
+        chainProp['stream'] = m_stream
+        chainProp['EBstep'] = m_EBstep
+        chainProp['groups'] = m_groups
+
+        # for additional options: mergingStrategy and topoStartFrom
+        if len(chainInfo) > 6:
+            for i in xrange(6, len(chainInfo)):
+                mergingInfoFilled = False
+                tsfInfoFilled = False
+                if (type(chainInfo[i]) is list):
+                    if mergingInfoFilled == 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]
+                            #print "Setting m_preserveL2EFOrder to " + str(chainInfo[i][3] )
+                        else:
+                            m_preserveL2EFOrder = True
+                            #print "Setting m_preserveL2EFOrder to True"
+                            
+                        # if(len(chainInfo[i]) >4):
+                        #     m_noTEreplication = chainInfo[i][4]
+                        # else:
+                        #     m_noTEreplication = False
+                            
+                        chainProp['mergingStrategy'] = m_mergingStrategy
+                        chainProp['mergingOffset'] = m_mergingOffset
+                        chainProp['mergingOrder'] = m_mergingOrder
+                        chainProp['mergingPreserveL2EFOrder'] = m_preserveL2EFOrder
+                      #  chainProp['mergingNoTEreplication'] = m_noTEreplication
+
+                        mergingInfoFilled = True
+                    else: logDict.error("Something went wrong here....topoStartFrom has already been filled!")                  
+
+                elif (type(chainInfo[i]) is bool):
+                    if tsfInfoFilled == 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])
+                
+        # setting the L1 item
+        if (chainProp['L1item']== ''): 
+            chainProp['L1item'] = m_L1item
+
+        if logDict.isEnabledFor(logging.DEBUG):
+            import pprint
+            pp = pprint.PrettyPrinter(indent=4, depth=8)
+            logDict.debug('FINAL dictionary: %s', pp.pformat(chainProp))
+
+        return chainProp
+
+
+
+    def analyseShortName(self, chainName, L1items_chainParts, L1item_main):
+        """
+        Function to obtain the chain configuration dictionay from the short name 
+        by parsing its components and finding the corrsponding properties which 
+        are defined in SliceDicts
+        The naming ocnvention is defined inthis document http://
+        """
+        chainName_orig = chainName
+
+        # ---- dictionary with all chain properties ----
+        from SignatureDicts import ChainDictTemplate
+        from copy import deepcopy
+        genchainDict = deepcopy(ChainDictTemplate)
+        genchainDict['chainName'] = chainName
+        
+
+        # ---- check for L1Topo in chain name ----
+        # This is not necessary, as CTP item names with L1Topo are extracted in the same way as the normal CTP items. (ATR-9264)
+        '''
+        L1topoitemFromChainName = ''; L1topoitem = ''; L1topoindex   = -5
+        L1topoindex = [n for n in xrange(len(chainName)) if chainName.find('L1', n) == n]
+        if (L1topoindex): 
+            logDict.debug('L1topindex: '+ str(L1topoindex))
+
+        if (len(L1topoindex) == 1):
+            L1topoitemfromChainName = chainName[L1topoindex[0]:]
+            if ('-' in L1topoitemfromChainName):
+                if (L1topoitemfromChainName[2]=='_'):
+                    raise RuntimeError('NOT FOLLOWING THE NAMING CONVENTION: L1 items in chainNames are specified e.g. L1EM4_MU4, not L1_EM4_MU4')
+                else:
+                    L1topoitem = L1topoitemfromChainName[:2]+'_'+L1topoitemfromChainName[2:]
+                    logDict.debug('L1topoitem: ', str(L1topoitem))
+                    chainName = chainName[:L1topoindex[0]-1] # -1 to also remove _
+                    # build in a check to compare l1 item given with the one found
+                    genchainDict['L1item'] = L1topoitem
+            else: 
+                logDict.debug('L1 item in name is not a L1Topo item')
+        '''
+
+        # ---- specific chain part information ----
+        allChainProperties=[]
+        cparts = chainName.split("_") 
+
+           
+        # ---- identify the topo algorithm and add to genchainDict -----
+        from SignatureDicts import AllowedTopos
+        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)
+                topo = cpart
+                topoindex = cindex
+                toposIndexed.update({topo : topoindex})
+                chainName=chainName.replace('_'+cpart, '')
+                topos.append(topo)
+
+        genchainDict['topo'] = topos
+        
+        # replace these lines belwo with cparts = chainName.split("_")
+        for t, i in enumerate(toposIndexed):
+            if (t in cparts): 
+                logDict.debug('topo %s with index %s', t, i)
+                del cparts[i]        
+        
+        
+        # ---- Find the signature defining patterns ----
+        # ---- and write them out in dictionary     ----
+        # ---- expected format: <Multiplicity(int)><TriggerType(str)>
+        #      <Threshold(int)><isolation,...(str|str+int)> ----
+        # EXCEPT FOR CHAINS ...
+        from SignatureDicts import getBasePattern
+        pattern = getBasePattern()
+        mdicts=[]
+        multichainindex=[]
+        signatureNames = []
+
+        # ---- obtain dictionary parts for signature defining patterns ----
+        from SignatureDicts import getSignatureNameFromToken, AllowedCosmicChainIdentifiers, \
+            AllowedCalibChainIdentifiers, AllowedStreamingChainIdentifiers, \
+            AllowedMonitorChainIdentifiers, AllowedBeamspotChainIdentifiers, AllowedEBChainIdentifiers
+            #, AllowedMatchingKeywords
+
+        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)
+                for theMultiChainIndex in multiChainIndices:
+                    # 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:
+                        multichainindex.append(theMultiChainIndex)
+
+                logDict.debug("ChainName: %s", chainName)
+                logDict.debug("cpart: %s", cpart)
+                logDict.debug("m_groupdict: %s", m_groupdict)
+                logDict.debug("multichainindex: %s", multichainindex)
+                                        
+                sName = getSignatureNameFromToken(cpart)
+                m_groupdict['signature'] = sName
+                logDict.debug('groupdictionary m_groupdict: %s', m_groupdict)
+                sigToken = getSignatureNameFromToken(cpart)
+                if sigToken not in signatureNames: signatureNames.append(sigToken)
+                mdicts.append(m_groupdict)
+
+                    
+            elif cpart =='noalg':
+                multichainindex.append(chainName.index(cpart)) 
+                m_groupdict = {'signature': 'Streaming', 'threshold': '', 'multiplicity': '', 
+                                'trigType': 'streamer', 'extra': ''}
+                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
+
+            elif cpart=='mb': 
+                logDict.debug('Doing MB')
+                multichainindex.append(chainName.index(cpart)) 
+                m_groupdict = {'signature': 'MinBias', 'threshold': '', 'multiplicity': '', 
+                               'trigType': 'mb', 'extra': ''}
+                if 'MinBias' not in signatureNames:  signatureNames.append('MinBias')
+                mdicts.append(m_groupdict)
+
+            elif cpart=='hi':
+                logDict.debug('Doing HI')
+                multichainindex.append(chainName.index(cpart))
+                m_groupdict = {'signature': 'HeavyIon', 'threshold': '', 'multiplicity': '',
+                               'trigType': 'mb', 'extra': ''}
+                if 'HeavyIon' not in signatureNames:  signatureNames.append('HeavyIon')
+                mdicts.append(m_groupdict)
+
+            elif cpart in AllowedCosmicChainIdentifiers:
+                logDict.debug('COSMIC CHAIN from CosmicDef.py')
+                multichainindex.append(chainName.index(cpart)) 
+                m_groupdict = {'signature': 'Cosmic', 'threshold': '', 'multiplicity': '', 
+                                'trigType': 'cosmic', 'extra': ''}
+                if 'Cosmic' not in signatureNames: signatureNames.append('Cosmic')
+                logDict.debug('%s',signatureNames)
+                mdicts.append(m_groupdict)
+                
+            elif cpart in AllowedCalibChainIdentifiers:
+                logDict.debug('CALIB CHAIN from Calibration')
+                multichainindex.append(chainName.index(cpart)) 
+                m_groupdict = {'signature': 'Calibration', 'threshold': '', 'multiplicity': '', 
+                               'trigType': 'calib', 'extra': ''}
+                if 'Calibration' not in signatureNames:  signatureNames.append('Calibration')
+                logDict.debug('%s',signatureNames)
+                mdicts.append(m_groupdict)
+
+            elif cpart in AllowedMonitorChainIdentifiers:
+                logDict.debug('Mon CHAIN from Monitor')
+                multichainindex.append(chainName.index(cpart)) 
+                m_groupdict = {'signature': 'Monitoring', 'threshold': '', 'multiplicity': '', 
+                                'trigType': 'calib', 'extra': ''}
+                if 'Monitoring' not in signatureNames:  signatureNames.append('Monitoring')
+                logDict.debug('%s',signatureNames)
+                mdicts.append(m_groupdict)
+
+            elif cpart in AllowedBeamspotChainIdentifiers:
+                logDict.debug('Beamspot CHAIN from Beamspot')
+                multichainindex.append(chainName.index(cpart)) 
+                m_groupdict = {'signature': 'Beamspot', 'threshold': '', 'multiplicity': '', 
+                                'trigType': 'beamspot', 'extra': ''}
+                if 'Beamspot' not in signatureNames:  signatureNames.append('Beamspot')
+                logDict.debug('%s',signatureNames)
+                mdicts.append(m_groupdict)
+
+            elif cpart=='eb': 
+                logDict.debug('EnhancedBias chain')
+                multichainindex.append(chainName.index(cpart)) 
+                m_groupdict = {'signature': 'EnhancedBias', 'threshold': '', 'multiplicity': '', 
+                               'trigType': 'eb', 'extra': ''}
+                if 'EnhancedBias' not in signatureNames:  signatureNames.append('EnhancedBias')
+                mdicts.append(m_groupdict)
+
+           
+        # ---- If multiple parts exist, split the string and analyse each  ----
+        # ---- part depending on the signature it belongs to ----
+        # ----  ----
+        multichainparts=[]
+
+        remainder = chainName
+        multichainindex = sorted(multichainindex, key=int)
+        cN = chainName
+        for i in reversed(multichainindex):
+            if i!=0:
+                logDict.debug('Appending to multichainparts (i!=0): %s', chainName[i:len(cN)])
+
+                multichainparts.append(chainName[i:len(cN)])
+                cN = cN[0:i-1]
+            else:
+                logDict.debug('Appending to multichainparts: %s', chainName[i:len(cN)])
+                multichainparts.append(cN)
+        logDict.debug("multichainparts: %s",multichainparts)
+
+        # ---- build the chainProperties dictionary for each part of the chain ----
+        # ---- add it to a allChainProperties ----
+        multichainparts.reverse()
+        for chainindex, chainparts in enumerate(multichainparts):
+            chainProperties = {} #will contain properties for one part of chain if multiple parts
+
+            logDict.debug('chainparts %s', chainparts)
+
+            # ---- check if L1 item is specified in chain Name ----
+            L1itemFromChainName = ''; L1item = ''; 
+            chainpartsNoL1 = chainparts
+            
+            #Checking for L1 item for chain part and overall in the name
+            #and the L1 for the overall chain
+            if (chainparts.count("_L1") > 1):
+                # get position of all L1 items
+                import re
+                allL1indices = [match.start() for match in re.finditer(re.escape("_L1"), chainparts)]
+
+                allL1items = []
+                m_chainparts = deepcopy(chainparts)
+                for index in reversed(allL1indices):
+                    newindex = index+1
+                    m_newitem = m_chainparts[newindex:]  
+                    m_chainparts = m_chainparts[:newindex-1]
+                    newitem = m_newitem[:2]+'_'+m_newitem[2:]
+                    allL1items.append(newitem)
+                    
+                allL1items.reverse()
+                
+
+                if (allL1items[1] != L1item_main):
+                    logDict.error("Typo in chain name for overall L1 item? Please check again")
+                else:#remove the last part from the chain name
+                    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])
+
+
+
+            #this only find the FIRST instance on L1
+            L1index = chainparts.find('_L1') 
+                                        
+            logDict.debug('chainparts: %s', chainparts)
+            logDict.debug('L1index: %s', L1index)
+            if L1index != -1:
+                L1index = L1index+1 # to compensate the _
+                L1itemfromChainName = chainparts[L1index:]
+                if (L1itemfromChainName[2]=='_'):
+                    raise RuntimeError('ERROR IN CHAIN NAMING: L1 items in chainNames are specified e.g. *_L1EM4, not *_L1_EM4')
+                else:
+                    L1item = L1itemfromChainName[:2]+'_'+L1itemfromChainName[2:]
+                    if (L1item[-1] == '_'): 
+                        L1item = L1item[:-1]
+                        
+                chainpartsNoL1 = chainparts[:L1index-1] # -1 to also remove _
+
+            else: 
+                logDict.debug('No L1 item specified in the name')
+                
+
+            # ---- assign L1 to chain parts from L1 item list in menu ----
+            # ---- check if enough L1 items given for chain parts ----
+            #print "BETTA: ", L1items_chainParts
+            if (len(L1items_chainParts) > 0):
+                #print "BETTA: ",len(L1items_chainParts), len(multichainparts)
+                if (len(L1items_chainParts) != len(multichainparts)):
+                    logDict.info("Not enough L1 items for chain parts of chain %s defined => fix in menu please!",
+                                 genchainDict['chainName'])
+
+                chainProperties['L1item'] = L1items_chainParts[chainindex]                
+                if (L1item !=  chainProperties['L1item']) & (L1item !=''):
+                    logDict.info("L1 item in name (%s) of chain %s does not match with given L1item list (%s)!",
+                                 L1item, chainName, chainProperties['L1item'])
+
+            else:
+                logDict.debug('No L1 item specified in the name')
+
+
+            #print 'chainpartsNoL1', chainpartsNoL1
+            parts=chainpartsNoL1.split('_')
+            parts = filter(None,parts)
+
+            #print 'parts after L1 string removal = ',parts
+            # ---- start with first pattern and write into dict and remove it afterwards ----
+            #print 'MOO chainindex', chainindex
+            #print 'MOO mdicts', mdicts
+            chainProperties['trigType']=mdicts[chainindex]['trigType']
+            chainProperties['extra']=mdicts[chainindex]['extra']
+            multiplicity = mdicts[chainindex]['multiplicity'] if not mdicts[chainindex]['multiplicity'] == '' else '1'
+            chainProperties['multiplicity'] = multiplicity
+            chainProperties['threshold']=mdicts[chainindex]['threshold']
+            chainProperties['signature']=mdicts[chainindex]['signature']
+
+            # if we have a L1 topo in a multi-chain then we want to remove it from the chain name
+            # but only if it's the same as the L1item_main; otherwise it belongs to chain part and we q
+            # have to keep it in the name
+            chainProperties['chainPartName'] = chainparts
+            if ('-' in L1item) and (len(multichainparts) > 1) and (L1item_main == L1item):
+                chainProperties['chainPartName'] = chainpartsNoL1                
+            ##if we have the overall L1 item in a multi-part chains, then we want to remove it from the chain part name
+            if( L1item==L1item_main and (len(multichainparts) > 1) and (L1item.count("_") > 1 )):                
+                chainProperties['chainPartName'] = chainpartsNoL1
+                                
+            logDict.debug('Chainparts: %s', chainparts)
+            if (chainProperties['signature'] != 'Cosmic') \
+                    & (chainProperties['signature'] != 'Calibration')\
+                    & (chainProperties['signature'] != 'Streaming') \
+                    & (chainProperties['signature'] != 'Beamspot') \
+                    & (chainProperties['signature'] != 'Monitoring') : 
+                parts.pop(0)
+
+
+            #---- Check if topo is a bphsyics topo -> change signature ----            
+            from SignatureDicts import AllowedTopos_bphys
+            for t in genchainDict['topo']:
+                if (t in AllowedTopos_bphys):
+                    chainProperties['signature'] = 'Bphysics'
+
+
+            # ---- import the relevant dictionaries for each part of the chain ---- 
+            from SignatureDicts import getSignatureInformation
+            SignatureDefaultValues, allowedSignaturePropertiesAndValues = getSignatureInformation(chainProperties['signature'])
+            logDict.debug('SignatureDefaultValues: %s', SignatureDefaultValues)
+            
+            # ---- update chain properties with default properties ----
+            result = deepcopy(SignatureDefaultValues)
+            result.update(chainProperties)
+            chainProperties = result
+
+            # ---- 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 = []
+            for pindex, part in enumerate(parts):
+                origpart = part
+                for prop, allowedValues in allowedSignaturePropertiesAndValues.items():
+                    if part in allowedValues:
+                        if type(chainProperties[prop]) == list:
+                            chainProperties[prop] += [part]
+                        else:
+                            chainProperties[prop] = part
+                        matchedparts.append(part)
+                        
+            logDict.debug("matched parts %s", matchedparts)
+            leftoverparts = set(parts)-set(matchedparts)
+            logDict.debug('leftoverparts %s', leftoverparts)
+            for pindex, part in enumerate(leftoverparts):
+                for prop, allowedValues in allowedSignaturePropertiesAndValues.items():
+                    if prop in chainProperties.keys():  continue
+                    for aV in allowedValues:
+                        if (aV in part):
+                            if (chainProperties['signature'] in ['Egamma', 'Muon'] )& (prop in ['trkInfo','hypoInfo']):
+                                chainProperties[prop] = part
+                                part = part.replace(part,'')
+                            elif (chainProperties['signature'] in ['Jet'] )& (prop in ['gscThreshold']):
+                                chainProperties[prop] = part
+                                part = part.replace(part,'')
+                            else:                                    
+                                chainProperties[prop] = aV
+                                part = part.replace(aV,'')
+                                break # done with allowed values for that property
+                            
+                if len(part.split())>0:
+                    raise RuntimeError("These parts of the chain name %s are not understood %r" % (origpart,part))
+
+
+            # ---- remove properties that aren't allowed in the chain properties for a given siganture ----
+            forbiddenProperties = set(chainProperties.keys()) - set(allowedSignaturePropertiesAndValues.keys())
+            logDict.debug('%s', set(chainProperties.keys()))
+            logDict.debug('%s', set(allowedSignaturePropertiesAndValues.keys()))
+            for fb in forbiddenProperties:
+                forbiddenValue = chainProperties.pop(fb)
+                if forbiddenValue != '':
+                    raise RuntimeError("Property %s not allowed for signature '%s', but specified '%s'" % (fb, chainProperties['signature'], forbiddenValue))
+
+
+                
+            # ---- the info of the general and the specific chain parts dict ----
+            allChainProperties.append(chainProperties)
+
+
+        # ---- depending on if signatures are different in this chain, break up the chainProperties dictionary ----
+        # ---- finally also taking care of the signatrue key ----
+        #if len(signatureNames) == 1:
+        genchainDict['chainParts'] = allChainProperties
+
+        # CB DELETE FROM DICTIONARY???? 
+        genchainDict['signature'] = allChainProperties[0]['signature']
+
+        logDict.debug('genchainDict that is passed as Final dict %s', genchainDict)
+        #for cprop in allChainProperties: del cprop['signature']
+             
+
+
+        return genchainDict
+
+
+
+
+
+
+
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/GenerateMenuMT.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/GenerateMenuMT.py
new file mode 100755
index 0000000000000000000000000000000000000000..e71660c89eb4ec915b659224ff2f68ec1df2d3f9
--- /dev/null
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/GenerateMenuMT.py
@@ -0,0 +1,215 @@
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+from TriggerJobOpts.TriggerFlags                               import TriggerFlags
+from TriggerMenuMT.HLTMenuConfig.Muon.MuonSliceFlags           import MuonSliceFlags
+from TriggerMenuMT.HLTMenuConfig.Egamma.EgammaSliceFlags       import EgammaSliceFlags
+from TriggerMenuMT.HLTMenuConfig.Jet.JetSliceFlags             import JetSliceFlags
+from TriggerMenuMT.HLTMenuConfig.Combined.CombinedSliceFlags   import CombinedSliceFlags
+
+# 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 TriggerMenuMT.HLTMenuConfig.Menu.HLTCFConfig import *
+from TriggerMenuMT.HLTMenuConfig.Menu.MenuComponents import *
+from TriggerMenuMT.HLTMenuConfig.Menu.HLTSignatureConfig import *
+
+import os, traceback, operator, commands, time
+
+from AthenaCommon.Logging import logging
+log = logging.getLogger( 'TriggerMenuMT.HLTMenuConfig.Menu.GenerateMenuMT' )
+
+_func_to_modify_the_menu = None
+_func_to_modify_signatures = None
+
+class GenerateMenuMT:   
+    
+    def __init__(self):
+        self.triggerMTConfig = None
+        self.chains = []
+        self.chainDefs = []
+        self.listOfErrorChainDefs = []
+        self.signaturesOverwritten = False
+        # flags
+        self.doEgammaChains      = True
+        self.doJetChains         = True
+        self.doMuonChains        = True
+        self.doCombinedChains    = True
+
+
+
+    def getChainDef(self,chainDicts):
+    # get the Chain object from each signature of the form Chain(chainname, L1seed, ChainSteps
+        if self.doMuonChains:
+            try:
+                import TriggerMenu.muon.generateMuonChainDefs 
+            except:
+                log.error('Problems when importing MuonDef.py, disabling muon chains.')
+                log.info(traceback.print_exc())
+                self.doMuonChains = False
+                        
+
+    allowedSignatures = ["jet","egamma","muon", "electron", "photon","met","tau", 
+                             "minbias", "heavyion", "cosmic", "calibration", "streaming", "monitoring", "ht", 'bjet','eb']        
+    
+    listOfChainDefs = []
+    chainDicts = TriggerMenuMT.HLTMenuConfig.Menu.MenuUtils.splitInterSignatureChainDict(chainDicts)        
+    log.debug("\n chainDicts2 %s", chainDicts)
+
+    for chainDict in chainDicts:
+        chainDef = None
+        print 'checking chainDict for chain %s %s %r' %(chainDict['chainName'],chainDict["signature"], self.doEnhancedBiasChains)
+
+        if chainDict["signature"] == "Muon" and self.doMuonChains:
+            try:
+                chainDef = TriggerMenuMT.HLTMenuConfig.Muon.generateMuonChainDefs.generateChainDefs(chainDict)
+            except:
+                log.error('Problems creating ChainDef for chain %s ' % (chainDict['chainName']))
+                log.info(traceback.print_exc())
+                continue
+            
+        else:
+            log.error('Chain %s ignored - either because the trigger signature ("slice") has been turned off or because the corresponding chain dictionary cannot be read.' %(chainDict['chainName']))
+            log.debug('Chain dictionary of failed chain is %s.', chainDict)
+            
+        log.debug(' ChainDef  %s ' % chainDef)
+
+        if len(listOfChainDefs) == 0:# or not (len(listOfChainDefs)==len(chainDicts)):
+            return False
+        else:
+            theChainDef = listOfChainDefs[0]
+
+        return theChainDef
+
+
+
+    def writeLvl1EmuFiles(self):
+        data = {'noreco': [';', ';', ';']}  # in the lists there are the events
+        data['emclusters'] = ['eta:1,phi:1,et:180000; eta:1,phi:-1.2,et:35000;',
+                              'eta:0.5,phi:0,et:120000; eta:1,phi:-1.2,et:65000;',
+                              'eta:-0.6,phi:1.7,et:9000;']
+        data['msmu']  = [';',
+                         'eta:-1.2,phi:0.7,pt:6500; eta:-1.1,phi:0.6,pt:8500;',
+                         'eta:-1.7,phi:-0.2,pt:9500;']
+        
+        data['ctp'] = [ 'HLT_g100',  'HLT_2g50 HLT_e20', 'HLT_mu20 HLT_mu8 HLT_2mu8 HLT_mu8_e8' ]
+        
+        data['l1emroi'] = ['1,1,0,EM3,EM7,EM15,EM20,EM50,EM100; 1,-1.2,0,EM3,EM7',
+                           '-0.6,0.2,0,EM3,EM7,EM15,EM20,EM50,EM100; 1,-1.1,0,EM3,EM7,EM15,EM20,EM50',
+                           '-0.6,1.5,0,EM3,EM7,EM7']
+        
+        data['l1muroi'] = ['0,0,0,MU0;',
+                           '-1,0.5,0,MU6,MU8; -1,0.5,0,MU6,MU8,MU10',
+                           '-1.5,-0.1,0,MU6,MU8']
+        
+        data['tracks'] = ['eta:1,phi:1,pt:120000; eta:1,phi:-1.2,et:32000;',
+                          'eta:0.5,phi:0,pt:130000; eta:1,phi:-1.2,pt:60000;eta:-1.2,phi:0.7,pt:6700; eta:-1.1,phi:0.6,pt:8600;',
+                          'eta:-0.6,phi:1.7,et:9000;'] # no MU track for MS candidate 'eta:-1.7,phi:-0.2,pt:9500;'
+        
+        data['mucomb'] = [';',
+                          'eta:-1.2,phi:0.7,pt:6600; eta:-1.1,phi:0.6,pt:8600;',
+                          ';']
+        
+        data['electrons'] = ['eta:1,phi:1,pt:120000; eta:1,phi:-1.2,et:32000;',
+                             ';',
+                             ';']
+        data['photons'] = ['eta:1,phi:1,pt:130000;',
+                           ';',
+                           ';']    
+        from TrigUpgradeTest.TestUtils import writeEmulationFiles
+        writeEmulationFiles(data)
+        
+
+    def Lvl1Decoder(self):
+        #_L1UnpackingSeq = parOR("L1UnpackingSeq")
+        from L1Decoder.L1DecoderConf import CTPUnpackingEmulationTool, RoIsUnpackingEmulationTool, L1Decoder
+        l1Decoder = L1Decoder( OutputLevel=DEBUG, RoIBResult="" )
+        l1Decoder.prescaler.EventInfo=""
+        
+        ctpUnpacker = CTPUnpackingEmulationTool( OutputLevel =  DEBUG, ForceEnableAllChains=False , InputFilename="ctp.dat" )
+        #ctpUnpacker.CTPToChainMapping = [ "0:HLT_g100",  "1:HLT_e20", "2:HLT_mu20", "3:HLT_2mu8", "3:HLT_mu8", "33:HLT_2mu8", "15:HLT_mu8_e8" ]
+        l1Decoder.ctpUnpacker = ctpUnpacker
+        
+        emUnpacker = RoIsUnpackingEmulationTool("EMRoIsUnpackingTool", OutputLevel=DEBUG, InputFilename="l1emroi.dat", OutputTrigRoIs="L1EMRoIs", Decisions="L1EM" )
+        emUnpacker.ThresholdToChainMapping = ["EM7 : HLT_mu8_e8", "EM20 : HLT_e20", "EM50 : HLT_2g50",   "EM100 : HLT_g100" ]
+        
+        muUnpacker = RoIsUnpackingEmulationTool("MURoIsUnpackingTool", OutputLevel=DEBUG, InputFilename="l1muroi.dat",  OutputTrigRoIs="L1MURoIs", Decisions="L1MU" )
+        muUnpacker.ThresholdToChainMapping = ["MU6 : HLT_mu6", "MU8 : HLT_mu8", "MU8 : HLT_2mu8",  "MU8 : HLT_mu8_e8",  "MU10 : HLT_mu20",   "EM100 : HLT_g100" ]
+        
+        l1Decoder.roiUnpackers = [emUnpacker, muUnpacker]
+
+        #print l1Decoder
+        #_L1UnpackingSeq += l1Decoder
+        print l1Decoder
+
+        return l1Decoder
+
+
+    def allChains(self):
+        # muon chains
+        muStep1 = muStep1Sequence()
+        muStep2 = muStep2Sequence()
+        MuChains  = [
+            Chain(name='HLT_mu20', Seed="L1_MU10",   ChainSteps=[ChainStep("Step1_mu20", [SequenceHypoTool(muStep1,step1mu20())]),
+                                                                 ChainStep("Step2_mu20", [SequenceHypoTool(muStep2,step2mu20())]) ] ),            
+            Chain(name='HLT_mu8',  Seed="L1_MU6",    ChainSteps=[ChainStep("Step1_mu8",  [SequenceHypoTool(muStep1,step1mu8())] ),
+                                                                 ChainStep("Step2_mu8",  [SequenceHypoTool(muStep2,step2mu8())]) ] )
+            ]
+        #electron chains
+        elStep1 = elStep1Sequence()
+        elStep2 = elStep2Sequence()
+        ElChains  = [
+            Chain(name='HLT_e20' , Seed="L1_EM10", ChainSteps=[ ChainStep("Step1_e20",  [SequenceHypoTool(elStep1,step1e20())]),
+                                                                ChainStep("Step2_e20",  [SequenceHypoTool(elStep2,step2e20())]) ] )
+            ]
+        # combined chain
+        muelStep1 = combStep1Sequence()
+        muelStep2 = combStep2Sequence()
+        CombChains =[
+            Chain(name='HLT_mu8_e8' , Seed="L1_EM6_MU6", ChainSteps=[ ChainStep("Step1_mu8_e8",  [SequenceHypoTool(muelStep1, step1mu8_e8())]),
+                                                                      ChainStep("Step2_mu8_e8",  [SequenceHypoTool(muelStep2, step2mu8_e8())]) ] )
+            ]
+
+        _allChains = MuChains + ElChains + CombChains
+        return _allChains
+
+
+
+    #----------------------#
+    # Menu generation #
+    #----------------------#
+    def generateMT(self):
+        log.info('GenerateMenuMT.py:generateMT ')
+
+        topSequence = AlgSequence()
+        TopHLTRootSeq = seqAND("TopHLTRootSeq") 
+        topSequence += TopHLTRootSeq
+        
+        #----------------------#
+        # L1 menu generation #
+        #----------------------#
+        self.writeLvl1EmuFiles()
+        Lvl1UnpackingSeq = parOR("L1UnpackingSeq")
+        Lvl1UnpackingSeq += Lvl1Decoder()
+        log.info('Lvl1UnpackingSeq: %s', Lvl1UnpackingSeq  )
+        TopHLTRootSeq += L1UnpackingSeq
+
+        #----------------------#
+        # HLT menu generation #
+        #----------------------#
+        nsetps = 2 
+
+        HLTAllStepsSeq = seqAND("HLTAllStepsSeq")
+        TopHLTRootSeq += HLTAllStepsSeq
+        
+        group_of_chains = allChains()
+        print 'all Chains ', allChains()
+        decisionTree_From_Chains(HLTAllStepsSeq, group_of_chains, NSTEPS=nsteps)
+
+ 
+
+ 
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/GroupInfo.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/GroupInfo.py
new file mode 100644
index 0000000000000000000000000000000000000000..001e8df9ba371b6af5c39f0cc21b719c6c3b4a0b
--- /dev/null
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/GroupInfo.py
@@ -0,0 +1,40 @@
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+from AthenaCommon.Logging import logging
+log = logging.getLogger( 'TriggerMenu.menu.GroupInfo' )
+
+AllowedGroups = ['Muon',
+                 'Jet',
+                 'BJet',
+                 'MET',
+                 'Tau',
+                 'Egamma',
+                 'Bphys',
+                 'BeamSpot',
+                 'MinBias',
+                 'Detector',
+                 'Other',
+                 'DISCARD',
+                 'ID',
+                 'TauOverlay',
+                 'ZeroBias',
+                 ]
+
+
+
+AllowedGroup_HI = ['UltraCentral',
+                   'EventShape',
+                   'UPC',
+                   'MinBiasOverlay',
+                   'SingleMuon',
+                   'SingleElectron',
+                   ]
+
+def getAllAllowedGroups(menu):    
+    if 'pp_v6' in menu or 'pp_v7' in menu or 'LS2_v' in menu:
+        return AllowedGroups
+    elif 'HI' in menu:
+        return AllowedGroups+AllowedGroup_HI
+    else:
+        log.error("No list of allowed groups for "+menu)
+    
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTCFConfig.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTCFConfig.py
new file mode 100644
index 0000000000000000000000000000000000000000..454fa3d13cd8dc3ec68dbe8d1b3115c9e714a219
--- /dev/null
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTCFConfig.py
@@ -0,0 +1,549 @@
+# Classes to configure the CF graph, via Nodes
+from AthenaCommon.CFElements import parOR, seqAND, stepSeq
+
+
+allAlgs={}
+def useExisting(name):
+    global allAlgs
+    return allAlgs[name]
+
+def AlgExisting(name):
+    global allAlgs
+    return name in allAlgs
+
+
+def remember(name, instance):
+    global allAlgs
+    allAlgs[name] = instance
+    return instance
+
+
+class AlgNode():
+    def __init__(self, Alg, inputProp, outputProp):
+        self.name = ("%s_%s_%s")%( Alg.name(), inputProp, outputProp)
+        self.algname = Alg.name()
+        self.outputProp=outputProp
+        self.inputProp=inputProp
+        self.configureAlg(Alg)
+                
+    def configureAlg(self, Alg):
+        alg_name = Alg.getName()
+        if AlgExisting(alg_name):
+            print "AlgNode::%s: found already Alg %s"%(self.name,alg_name)
+            self.Alg = useExisting(alg_name)
+        else:
+            print "AlgNode::%s: new Alg %s"%(self.name,alg_name)
+            self.Alg=Alg
+            remember(alg_name, self.Alg)
+            
+        if self.Alg is  None:
+            return
+
+        self.addDefaultOutput()
+
+    def addDefaultOutput(self):
+        print "This is main addDefaultOutput"
+        self.setOutput(("%s_%s_out"%(self.algname,self.outputProp)))
+        #self.setOutput(("%s_out"%(self.name)))
+        
+
+    def setPar(self, prop, name):
+        cval = self.Alg.getProperties()[prop]
+        try:
+            if type(cval) == type(list()):                
+                cval.append(name)
+                setattr(self.Alg, prop, cval)
+            else:
+                setattr(self.Alg, prop, name)
+        except:
+            pass
+
+    def setParArray(self, prop, name):
+        cval = self.Alg.getProperties()[prop]
+        try:
+            cval.append(name)
+            setattr(self.Alg, prop, cval)
+        except:
+            pass
+ 
+    def getPar(self, prop):
+        try:
+            return getattr(self.Alg, prop)
+        except:
+            return self.Alg.getDefaultProperty(prop)
+        raise "Error in reading property " + prop + " from " + self.Alg
+
+
+    def setOutput(self, name):
+        return self.setPar(self.outputProp,name)
+
+    def getOutput(self):
+        return self.getPar(self.outputProp)
+
+    def getOutputList(self):
+        outputs = []
+        cval = self.getOutput()
+        if type(cval) == type(list()):  
+            outputs.extend(cval)
+        else:
+            outputs.append(cval)
+        return outputs
+    
+    def setInput(self, name):
+        return self.setPar(self.inputProp,name)
+
+    def addInput(self, name):
+        return self.setParArray(self.inputProp,name)
+    
+    def getInput(self):
+        return self.getPar(self.inputProp)
+
+    def getInputList(self):
+        inputs = []
+        cval = self.getInput()
+        if type(cval) == type(list()):  
+            inputs.extend(cval)
+        else:
+            inputs.append(cval)
+        return inputs
+
+    def __str__(self):
+        return "Alg::%s  [%s] -> [%s]"%(self.name,' '.join(map(str, self.getInputList())), ' '.join(map(str, self.getOutputList())))
+
+
+ 
+class HypoAlgNode(AlgNode):
+    def __init__(self, Alg, inputProp, outputProp):
+        AlgNode.__init__(self, Alg, inputProp, outputProp)
+        self.tools = []
+        self.previous=[]
+       
+
+    def addHypoTool(self, hypotool):
+        if "Comb" in self.name: ###TMP combo, only one threshold
+            import re
+            thresholds = map(int, re.findall(r'\d+', hypotool.getName()))
+            self.setPar('Threshold1', thresholds[0])
+            self.setPar('Threshold2', thresholds[1])
+            status=self.setPar('DecisionLabel', hypotool.getName())
+        else:
+            self.tools.append(hypotool.getName())
+            status= self.setParArray('HypoTools',hypotool)        
+        return status
+
+    def addPreviousDecision(self,prev):
+        self.previous.append(prev)
+        status= self.setParArray('previousDecisions',prev)
+        return status
+
+    def setPreviousDecision(self,prev):
+        if "Comb" in self.name: ###TMP combo: how handle previous decisions in combo?            
+            self.previous.append(prev)
+            if  "from_L1MU" in prev:
+                if "pt" in self.getPar("Property1"):
+                    status= self.setPar('previousDecisions1',prev)
+                if "pt" in self.getPar("Property2"):
+                    status= self.setPar('previousDecisions2',prev)
+
+            if  "from_L1EM" in prev:
+                if "et" in self.getPar("Property1"):
+                    status= self.setPar('previousDecisions1',prev)
+                if "et" in self.getPar("Property2"):
+                    status= self.setPar('previousDecisions2',prev)
+
+            if  "Output1" in prev:
+                status= self.setPar('previousDecisions1',prev)
+            if  "Output2" in prev:
+                status= self.setPar('previousDecisions2',prev)
+
+        else:
+            self.previous.append(prev)
+            status= self.setPar('previousDecisions',prev)
+        return status
+    
+    def __str__(self):
+        return "HypoAlg::%s  [%s] -> [%s], previous = [%s], HypoTools=[%s] --> Alg %s"%(self.name,' '.join(map(str, self.getInputList())),
+                                                                                 ' '.join(map(str, self.getOutputList())),
+                                                                                 ' '.join(map(str, self.previous)),
+                                                                                 ' '.join(map(str, self.tools)), self.Alg)
+
+
+
+class SequenceFilterNode(AlgNode):
+    def __init__(self, Alg, inputProp, outputProp):
+        AlgNode.__init__(self,  Alg, inputProp, outputProp)
+        
+    def addDefaultOutput(self):
+        print "This is SequenceFilter addDefaultOutput"
+        return #do nothing    
+       
+    def setChains(self, name):
+        return self.setPar("Chains", name)
+    
+    def getChains(self):
+        return self.getPar("Chains")
+
+
+from TrigUpgradeTest.TrigUpgradeTestConf import HLTTest__TestRoRSeqFilter
+class TestRoRSequenceFilterNode(SequenceFilterNode):       
+    def __init__(self, name):
+        Alg= HLTTest__TestRoRSeqFilter(name, OutputLevel = 2)
+        inputProp='Inputs'
+        outputProp='Outputs'
+        SequenceFilterNode.__init__(self,  Alg, inputProp, outputProp)
+        if "Step1" in self.name: # so that we see events running through, will be gone once L1 emulation is included
+            self.Alg.AlwaysPass = True   
+  
+   
+
+from DecisionHandling.DecisionHandlingConf import RoRSeqFilter, DumpDecisions
+class RoRSequenceFilterNode(SequenceFilterNode):
+    def __init__(self, name):
+        Alg= RoRSeqFilter(name, OutputLevel = 2)
+        inputProp='Input'
+        outputProp='Output'
+        SequenceFilterNode.__init__(self,  Alg, inputProp, outputProp)
+        
+
+
+
+#### Here functions to create the CF tree from CF configuration objects
+
+
+from AthenaCommon.AlgSequence import dumpSequence
+def create_step_reco_node(name, seq_list, dump=0):
+    print "Create reco step %s with %d sequences"%(name, len(seq_list))
+    stepCF = parOR(name+"_reco")
+    for seq in seq_list:        
+        step_seq = create_CFSequence(seq)             
+        stepCF += step_seq
+    
+    if dump: dumpSequence (stepCF, indent=0)        
+    return stepCF
+
+
+def create_step_filter_node(name, seq_list, dump=0):
+    print "Create filter step %s with %d filters"%(name, len(seq_list))
+    stepCF = parOR(name+"_filter")
+    for seq in seq_list:
+        filterAlg=seq.filter.Alg                    
+        print "Add  %s to filter node %s"%(filterAlg.name(),name)
+        stepCF += filterAlg
+    
+    if dump: dumpSequence (stepCF, indent=0)        
+    return stepCF
+
+
+def create_CFSequence(CFseq):   
+    print "\n * Create CFSequence %s"%(CFseq.name)
+    filterAlg=CFseq.filter.Alg
+   
+    nodes = CFseq.getAllNodes()
+    algos = []
+    for node in nodes:
+        algos.append(node.Alg)
+
+    algos=list(set(algos))
+
+    step_seq = create_step_sequence( CFseq.name, filterAlg=filterAlg, rest=algos)       
+    return step_seq
+
+def create_step_sequence(name, filterAlg, rest):
+    """ elementary HLT step sequencer, filterAlg is gating, rest is anything that needs to happe within the step """
+    stepReco = parOR(name+"_reco", rest)
+    stepAnd = seqAND(name, [ filterAlg, stepReco ])
+    return stepAnd
+  
+
+def find_stepCF_algs(step_list):
+    algos = []
+    for step in step_list:
+        #print "Finding algos of step %s"%step
+        step_algs = []
+        step_algs.append(step.filter)
+        for seq in step.menuSeq.nodeSeqList:
+            step_algs.extend(seq.algs )
+            step_algs.append(seq.hypo)
+        algos.extend(step_algs)
+    return algos        
+            
+
+
+def addChainToHypoTool(hypotool, chain):
+    prop="Chains"
+    cval = hypotool.getProperties()[prop]
+    try:
+        cval.append(chain)
+        setattr(hypotool, prop, cval)
+    except:
+        pass
+
+
+def addChainToHypoAlg(hypoAlg, chain):
+    if "Comb" in hypoAlg.algname:
+        prop="Chains"
+        cval = hypoAlg.Alg.getProperties()[prop]
+        try:
+            cval.append(chain)
+            setattr(hypoAlg.Alg, prop, cval)
+        except:
+            pass
+
+
+#######################################
+def decisionTree_From_Chains(HLTAllStepsSeq, chains, NSTEPS=1):
+
+    testRoR=False
+    from TrigUpgradeTest.MenuComponents import CFSequence
+    #loop over chains to configure
+    count_steps=0
+    for nstep in range(0, NSTEPS):
+        stepCF_name =  "Step%i"%(nstep+1)
+        CFseq_list = []
+
+        for chain in chains:
+            chain_step_name= "%s:%s"%(stepCF_name, chain.name)
+            print "\n*******Filling step %s for chain  %s"%(stepCF_name, chain.name)
+      
+            chain_step=chain.steps[count_steps]
+            sequenceHypoTools=chain_step.sequenceHypoTools
+            countseq=0
+            for st in sequenceHypoTools:
+                sequence=st.sequence
+                hypotool=st.hypotool
+                addChainToHypoTool(hypotool, chain.name)
+                cfseq_name= sequence.name
+
+                print "Going through sequence %s with threshold %s"%(sequence.name, hypotool.getName())
+                #define sequence input
+                if count_steps == 0: # seeding
+                    sequence_input= [nodeSeq.seed for nodeSeq in sequence.nodeSeqList]
+                    print "Seeds from this chain: %s"%(sequence_input)
+                    previous_sequence="".join(chain.group_seed)
+                else:
+                    # from previous step, map the seuqence in the same order?
+                    previous_sequence=chain.steps[count_steps-1].sequences[countseq].name #menu sequence
+                    sequence_input=chain.steps[count_steps-1].sequences[countseq].outputs
+                    print "Connect to previous sequence:"
+                    print sequence_input
+                # add hypotools
+                for nodeSeq in sequence.nodeSeqList:
+                    hypoAlg= nodeSeq.hypo                
+                    print "Adding %s to %s"%(hypotool.getName(),hypoAlg.algname)
+                    hypoAlg.addHypoTool(hypotool)
+                    addChainToHypoAlg(hypoAlg, chain.name) # only for TMP Combo
+                    
+
+
+                #### FILTER
+                # one filter per previous sequence at the start of the sequence: check if it exists or create a new one        
+                # if the previous hypo has more than one output, try to get all of them
+                # one filter per previous sequence: 1 input/previous seq, 1 output/next seq 
+                filter_name="Filter%s_on_%s"%(stepCF_name,previous_sequence)
+                filter_out=["%s_from_%s_out"%(filter_name,i) for i in sequence_input]
+                filter_already_exists=False
+                findFilter= [cfseq.filter for cfseq in CFseq_list if filter_name in cfseq.filter.algname]        
+                if len(findFilter):
+                    print "Filter %s already exists"%(filter_name)
+                    filter_already_exists=True
+                    sfilter=findFilter[0]
+                    print "Adding chain %s to %s"%(chain.name,sfilter.algname)
+                    sfilter.setChains(chain.name)
+                    continue
+                else:
+                    if (testRoR):
+                        sfilter = TestRoRSequenceFilterNode(name=filter_name)
+                    else:
+                        sfilter = RoRSequenceFilterNode(name=filter_name)
+                    for o in filter_out: sfilter.setOutput(o)            
+                    for i in sequence_input: sfilter.addInput(i)
+                    sfilter.setChains(chain.name)
+                    print "Filter Done: %s"%(sfilter)
+                    
+                #loop over NodeSequences of this sequence to add inputs to InputMaker and send decisions to HypoAlg
+                for nodeSeq in sequence.nodeSeqList:
+                    seed=nodeSeq.seed                    
+                    input_maker_input= [inp for inp in sfilter.getOutputList() if ("from_"+seed) in inp]
+                    print "Adding %d inputs to sequence::%s from Filter::%s (from seed %s)"%(len(input_maker_input), nodeSeq.name, sfilter.algname, seed)
+                    for i in input_maker_input: print i
+                    if len(input_maker_input) == 0:
+#                        print "ERROR, no inputs to sequence are set!"
+                        sys.exit("ERROR, no inputs to sequence are set!") 
+#                        return                    
+                    for i in input_maker_input: nodeSeq.addInput(i)
+
+                    hypoAlg= nodeSeq.hypo
+                    #node = AlgNode(Alg=hypoAlg.Alg,inputProp='', outputProp='Output1')
+                    for i in input_maker_input: hypoAlg.setPreviousDecision(i) # works for one
+                    #for i in input_maker_input: hypoAlg.addPreviousDecision(i)
+
+                    print hypoAlg
+
+                                    
+                CF_seq = CFSequence( cfseq_name, FilterAlg=sfilter, MenuSequence=sequence)    
+                #for node in otherNodes: CF_seq.addNode(node)
+                print CF_seq
+                CFseq_list.append(CF_seq)
+                countseq+=1
+           
+            #end of sequence/threshold
+                
+        #end of loop over chains for this step, now implement CF:
+        print "\n******** Create CF Tree %s with AthSequencers",stepCF_name
+        #first make the filter step
+        stepFilter = create_step_filter_node(stepCF_name, CFseq_list, dump=0)
+        HLTAllStepsSeq += stepFilter
+        
+        stepCF = create_step_reco_node(stepCF_name, CFseq_list, dump=0)
+        HLTAllStepsSeq += stepCF
+        
+        print "Now Draw..."
+        stepCF_DataFlow_to_dot(stepCF_name, CFseq_list)
+        stepCF_ControlFlow_to_dot(stepCF)
+
+       
+        print "Added stepCF %s to the root"%stepCF_name     
+        count_steps+=1
+        print "************* End of step %s"%stepCF_name
+        # end of steps
+
+    #stepCF_ControlFlow_to_dot(HLTAllStepsSeq)
+    dumpSequence (HLTAllStepsSeq, indent=0)
+    return
+#####
+
+
+
+
+###### Here some graphical methods
+
+
+from ViewAlgsTest.connectAlgorithmsIO import connectAlgorithmsIO, graph_generator
+from AthenaCommon.AlgSequence import AthSequencer
+
+
+def algColor(alg):
+    if "Hypo" in alg: return "darkorchid1"
+    if "Filter" in alg: return "chartreuse3"
+    if "InputMaker" in alg: return "cyan3"
+    return "cadetblue1"
+    
+def stepCF_ControlFlow_to_dot(stepCF):
+    def _dump (seq, indent):
+        o = list()
+        for c in seq.getChildren():
+            if "AthSequencer" in c.getFullName():
+                o.append( ("%s[color=%s, shape=circle, width=.5, fixedsize=true ,style=filled]\n"%(c.name(),_seqColor(c)), indent) )
+            else:
+                o.append( ("%s[fillcolor=%s,style=filled]\n"%(c.name(),algColor(c.name())), indent) )
+            o.append( ("%s -> %s\n"%(seq.name(), c.name()), indent))
+            o.extend( _dump (c, indent+1) )
+        return o
+
+    def _parOR (seq):
+        if seq.ModeOR is True:
+            if seq.Sequential is False:
+                if seq.StopOverride is True:
+                    return True
+        return False
+
+    def _seqAND(seq):
+        if seq.ModeOR is False:
+            if seq.Sequential is True:
+                if seq.StopOverride is False:
+                    return True
+        return False
+
+    def _seqColor(seq):
+        if _parOR(seq): return "red"
+        if _seqAND(seq): return "blue"
+        return "black"
+
+   
+
+    # to visualize: dot -T pdf Step1.dot > Step1.pdf
+    file = open( '%s.CF.dot'%stepCF.name(), mode="wt" )
+    #strict
+    file.write( 'digraph step  {\n'\
+                +'\n'\
+                +'  node [ shape=polygon, fontname=Helvetica ]\n'\
+                +'  edge [ fontname=Helvetica ]\n'
+                +'  %s   [shape=Mdiamond]\n'%stepCF.name())
+
+    indent=0
+    out = [("%s[color=%s shape=circle]\n"%(stepCF.name(),_seqColor(stepCF)), indent)]
+  
+    out.extend( _dump( stepCF, indent=indent+1 ) )
+    for n,i in out:
+        line= "  "*i+ n
+        file.write(line)
+
+    file.write( '}\n')
+
+
+
+    
+
+def stepCF_DataFlow_to_dot(name, cfseq_list):
+    # to visualize: dot -T pdf Step1.dot > Step1.pdf
+    file = open( '%s.DF.dot'%name, mode="wt" )
+    #strict
+    file.write( 'digraph step  {\n'\
+                +'\n'\
+                +'  node [ shape=polygon, fontname=Helvetica ]\n'\
+                +'  edge [ fontname=Helvetica ]\n'
+                +'  %s   [shape=Mdiamond]\n'%name)
+
+
+    for cfseq in cfseq_list:
+        print cfseq.name
+        file.write("  %s[fillcolor=%s style=filled]\n"%(cfseq.filter.algname,algColor(cfseq.filter.algname)))
+        for inp in cfseq.filter.getInputList():
+            file.write(addConnection(name, cfseq.filter.algname, inp))
+           
+        file.write(  '\n  subgraph cluster_%s {\n'%(cfseq.name)\
+                    +'     node [color=white style=filled]\n'\
+                    +'     style=filled\n'\
+                    +'     color=lightgrey\n'\
+                    +'     fontname=Helvetica\n'\
+                    +'     label = %s\n'%(cfseq.name))
+
+        cfseq_algs = []
+        cfseq_algs.append(cfseq.filter)       
+
+        for seq in cfseq.menuSeq.nodeSeqList:
+            #            cfseq_algs.append(seq.inputMaker)
+            cfseq_algs.extend(seq.algs )
+            if seq.reuse==False:
+                #                file.write("    %s[fillcolor=%s]\n"%(seq.inputMaker.algname, algColor(seq.inputMaker.algname)))
+                for alg in seq.algs: file.write("    %s[fillcolor=%s]\n"%(alg.algname, algColor(alg.algname)))
+                seq.reuse=True
+            cfseq_algs.append(seq.hypo)
+ 
+            file.write("    %s[color=%s]\n"%(seq.hypo.algname, algColor(seq.hypo.algname)))
+        file.write('  }\n')              
+        file.write(findConnections(cfseq_algs))
+        file.write('\n')    
+  
+    file.write( '}')
+    file.close()
+
+
+def findConnections(alg_list):
+    lineconnect=''
+    for nodeA in alg_list:
+        for nodeB in alg_list:
+            if nodeA is nodeB:
+                continue
+            dataIntersection = list(set(nodeA.getOutputList()) & set(nodeB.getInputList()))
+            if len(dataIntersection) > 0:
+                for line in dataIntersection:
+                    lineconnect+=addConnection(nodeA.algname,nodeB.algname, line)
+                    print 'Data connections between %s and %s: %s'%(nodeA.algname, nodeB.algname, line)
+    return lineconnect
+
+def addConnection(nodeA, nodeB, label):
+    line = "    %s -> %s [label=%s]\n"%(nodeA,nodeB,label)
+    # print line
+    return line
+
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTConfig.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTConfig.py
new file mode 100755
index 0000000000000000000000000000000000000000..21646b4fcea2061d3a4797d0faefa2acf2960454
--- /dev/null
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTConfig.py
@@ -0,0 +1,104 @@
+# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
+
+#-----------------------------------------------------
+# Hlt configuration base classes
+#-----------------------------------------------------
+
+#from AthenaCommon.Configurable import *
+from TriggerJobOpts.TriggerFlags import *
+from TriggerMenu.menu.ChainDef import ChainDef
+
+log = logging.getLogger( 'TriggerMenu.menu.HltConfig.py' )
+
+class HltSeq:
+    def __init__(self, inputTEs, algos, outputTE, topo_start_from=None):
+        self.inputTEs = inputTEs
+        if type(inputTEs)==type(''): self.inputTEs = [inputTEs]
+        self.algos = algos
+        self.outputTE = outputTE
+        self.topo_start_from = topo_start_from
+
+class HltChainDef:
+    """signatures: dictionary from step
+    """
+    def __init__(self, sig_id,
+                 chain_name, chain_counter,                
+                 prescale,
+                 pass_through,
+                 rerun, 
+                 ):
+
+        self.sig_id = "HLT_"+sig_id
+        self.chain_name = chain_name
+        self.chain_counter = chain_counter
+        self.prescale = prescale
+        self.pass_through = pass_through
+        self.rerun = rerun
+
+        self.signatures = []
+        self.sequences = []
+        self.sequencesPerSignature = {}
+        self.combined_chains = [] # optional
+        self.defineSequences()
+        self.defineSignatures()
+        self.defineCombinedChain()
+        if len(self.combined_chains)>0: self.mergeCombinedChains()
+
+    def getClassName(self):
+        return self.__class__.__name__
+        
+    def defineSequences(self):
+        self.sequences = []
+
+    def defineSignatures(self):
+        self.signatures = []
+
+    def defineCombinedChain(self):
+        self.combined_chains = []
+        pass
+
+    def addSequence(self, inputTEs, algos, outputTE, topo_start_from=None):
+        self.sequences.append(HltSeq(inputTEs, algos, outputTE, topo_start_from))
+
+    def addSignature(self, TElist=[]):
+        self.signatures.append(TElist)
+        
+    def mergeCombinedChains(self):
+        for (i, c) in enumerate(self.combined_chains):
+            for seq in c.sequences:
+                seq.inputTEs = map(lambda x: c.renameTE(x), seq.inputTEs)
+                seq.outputTE = c.renameTE(seq.outputTE)
+            self.sequences.extend(c.sequences)
+        n = max(map(lambda x: len(x.signatures), self.combined_chains))
+        for i in range(1, n+1):
+            tes = []
+            for c in self.combined_chains:
+                if len(c.signatures)>=i:
+                    for te in c.signatures[i-1]:
+                        tes.append(c.renameTE(te))
+            self.addSignature(tes)
+        pass
+    
+    
+    def generateChainDef(self):
+        chainDef = ChainDef(chain_name=self.chain_name, lower_chain_name=self.lower_chain_name, level=self.level)
+          
+        log.debug("HltConfig: all sequences %s" % self.sequencesPerSignature)
+        log.debug("HltConfig: all signatures %s" % self.signatures)
+        log.debug("HltConfig: self.sequecnes %s" % self.sequences)
+        for sequence in self.sequences:
+            chainDef.addSequence(filter(lambda x: x!=None, sequence.algos), map(lambda x: self.renameTE(x), sequence.inputTEs), self.renameTE(sequence.outputTE))
+
+        for (isig, sig) in enumerate(self.signatures):
+            tes = []
+            for te in sig:
+                #print "HltConfig te",te
+                out = self.renameTE(te)
+                tes.append(out)                
+            if len(tes)>0: 
+                chainDef.addSignature(isig+1+self.signatureCounterOffset,tes)  #addHLTSignature(tes, isig+1)
+        #print "HltConfig : DONE ==================="
+        return chainDef
+
+
+
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTObjects.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTObjects.py
new file mode 100755
index 0000000000000000000000000000000000000000..803955f85c3901f20c294d23f8a23b319700dd36
--- /dev/null
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTObjects.py
@@ -0,0 +1,404 @@
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+import os
+import time
+import re
+import string
+from sys import settrace
+import xml.etree.cElementTree as etree
+
+from AthenaCommon.Logging import logging  # loads logger
+
+def logger():
+    return logging.getLogger( "TriggerMenu.menu.HLTObjects" )
+
+#########################################################################################
+# HLT Chain classes
+#
+class HLTChain:
+    """ the HLT Chain definition class """
+    class HLTSignature:
+        """ HLT Signature, internal class of HLT Chain """
+        def __init__(self, telist, sigcounter, logic='1'):
+            self.sigcounter = sigcounter
+            if type(telist) != type([]):
+                self.tes    = [ telist ]
+            else:
+                self.tes    = telist
+            self.logic      = logic
+
+
+        def __eq__(self, other):
+            if self.tes == other.tes:
+                return True
+            return False
+
+        def multiplicity(self):
+            return len(self.tes)
+
+        def uniqueTEs(self):
+            return len(self.tes)
+
+        def xml(self, xlist):
+            if len(self.tes) != 0:
+                xSignature = etree.SubElement(xlist,'SIGNATURE',
+                                              logic='1', signature_counter=str(self.sigcounter))
+                for te in self.tes:
+                    if type(te) != type(''): # check if this is a string
+                        raise Exception("The trigger element: " + str(te) + " in the signature: " + self.sigcounter + "is not a plain string" )
+                    xTriggerElement = etree.SubElement(xSignature, 'TRIGGERELEMENT', te_name=str(te))
+                    
+    # construction
+    def __init__(self, chain_name, chain_counter,
+                 lower_chain_name, level, prescale='1', pass_through='0', rerun_prescale='-1',stream_tag=None, groups=None, EBstep="-1"):
+        self.chain_name       = chain_name
+        self.chain_counter  = chain_counter
+        self.level          = level
+        self.siglist        = []
+        self.prescale       = prescale
+        self.rerun_prescale = rerun_prescale
+        self.pass_through   = pass_through
+        self.lower_chain_name = lower_chain_name
+        self.stream_tag     = []
+        if stream_tag is not None: self.stream_tag += stream_tag
+        self.trigger_type_bits = []
+        self.groups           = []
+        if groups is not None: self.addGroup(groups)
+        self.chainBindings = []
+        self.chains_to_merge   = []
+        self.sigs_n_before_merge   = 0
+        self.EBstep = EBstep
+
+
+
+        
+    def addHLTSignature(self, telist, sigcounter=None, logic='1'):
+        if sigcounter is None:       # figure out sigcounter if not specified
+            if len(self.siglist) == 0:
+                sigcounter = 1
+            else:
+                sigcounter =  self.siglist[-1].sigcounter+1
+        else:
+            if  len(self.siglist) != 0:
+                if sigcounter >= self.siglist[-1].sigcounter:
+                    sigcounter =  self.siglist[-1].sigcounter+1
+                    
+        self.siglist.append( HLTChain.HLTSignature(telist, sigcounter, logic) )
+        return self
+
+    def getHLTSignatureOfStep(self, step):
+        """ Returns signature at given step
+
+        If no signature at given step is present then method recursively searches back.
+        If step 0 is reached and no signature is found then empty one is returned.
+        """
+        for sig in self.siglist:
+            if sig.sigcounter == step:
+                return sig
+        if step == 0:
+            return HLTChain.HLTSignature([], step)
+        else:
+            return self.getHLTSignatureOfStep(step -1)
+
+    def mergeAndAppendChains_Order(self, chains_list):
+        """ Helps definig complex chains made out of other chains.
+
+        All chains from the chains_list are scanned and thier signatures are merged and appended to the list of existing signatures.
+        Note, this is appending one chain to another, e.g. runs first all xe and then egamma, not in parallel
+        """
+        self.chains_to_merge = chains_list
+        self.sigs_n_before_merge = len(self.siglist)
+        self.doChainsMerging_Order()
+
+    def doChainsMerging_Order(self):
+        if type(self.chains_to_merge) != type([]):
+            logger().error( "Not a chains list given to mergeAndAppendChains for chain: "+ self.chain_name+ " it is: "+ str(type(self.chains_to_merge)) )
+            raise Exception("Incorrect usage of: mergeAndAppendChains_Order")
+
+        logger().debug("merging chains seq:"+str([ c.chain_name for c in self.chains_to_merge]))
+
+        copysigs = self.siglist
+        self.siglist = copysigs[0:self.sigs_n_before_merge]
+
+        # find out counter of last signature
+        last_counter = 1
+        if len(self.siglist) != 0:
+            last_counter = self.siglist[-1].sigcounter
+            logger().debug( "The chain: " + self.chain_name + " contains already signatures. Will align sinatures to it." )
+
+
+        total_counter = 0
+        for chain in self.chains_to_merge:
+            if len(chain.siglist) != 0:
+                total_counter += chain.siglist[-1].sigcounter
+                logger().debug("Total counter in merged chains "+str(total_counter))
+            else:
+                logger().debug("Chain: "+ chain.chain_name + " is having empty signature list wil lbe ignored in merging")
+                del self.chains_to_merge[self.chains_to_merge.index(chain)]
+
+        current_counter = 0        
+        for chain in self.chains_to_merge:
+            if len(chain.siglist) != 0:
+                for te in [chain.getHLTSignatureOfStep(step).tes for step in range(1,chain.siglist[-1].sigcounter+1)]:
+                    current_counter += 1
+                    self.addHLTSignature(te, sigcounter=current_counter)                    
+                    
+        # now append all signatures which were added after merging
+        for sig in copysigs[self.sigs_n_before_merge:]:
+            current_counter = current_counter+1
+            self.addHLTSignature(sig.tes, sigcounter=current_counter)
+
+    def mergeAndAppendChains(self, chains_list):
+        """ Helps definig complex chains made out of other chains.
+
+        All chains from the chains_list are scanned and thier signatures are merged and appended to the list of existing signatures.
+        """
+        self.chains_to_merge = chains_list
+        self.sigs_n_before_merge = len(self.siglist)
+        self.doChainsMerging() # TB this needs to be cut short as we do noeed alignements anymore (TODO remove alignChain(s) etc.)
+
+    def doChainsMerging(self):
+        if type(self.chains_to_merge) != type([]):
+            logger().error( "Not a chains list given to mergeAndAppendChains for chain: "+ self.chain_name+ " it is: "+ str(type(self.chains_to_merge)) )
+            raise Exception("Incorrect usage of: mergeAndAppendChains")
+
+        logger().debug("merging chains:"+str([ c.chain_name for c in self.chains_to_merge]))
+
+        copysigs = self.siglist
+        self.siglist = copysigs[0:self.sigs_n_before_merge]
+
+        # find out counter of last signature
+        last_counter = 1
+        if len(self.siglist) != 0:
+            last_counter = self.siglist[-1].sigcounter
+            logger().debug( "The chain: " + self.chain_name + " contains already signatures. Will align sinatures to it." )
+
+
+        max_counter = 0;
+        for chain in self.chains_to_merge:
+            if len(chain.siglist) != 0:
+                max_counter = max(chain.siglist[-1].sigcounter, max_counter)
+                logger().debug("Max counter in merged chains "+str(max_counter))
+            else:
+                logger().debug("Chain: "+ chain.chain_name + " is having empty signature list wil lbe ignored in merging")
+                del self.chains_to_merge[self.chains_to_merge.index(chain)]
+
+
+        # make dictionary with TE sigantures
+        for i in range(1, max_counter+1):
+            telist = []
+            [ telist.extend(x) for x in [chain.getHLTSignatureOfStep(i).tes for chain in self.chains_to_merge]] # repack TEs from other chain signatures
+            self.addHLTSignature(telist, sigcounter=i)
+
+        # now append all signatures which were added after merging
+        for sig in copysigs[self.sigs_n_before_merge:]:
+            max_counter = max_counter+1
+            self.addHLTSignature(sig.tes, sigcounter=max_counter)
+
+    def continueOn(self, chain):
+        self.siglist = chain.siglist
+        return self
+
+    def evaluateSignatureAfter(self, mySig, otherChain, otherChainSig):
+        """ Adds chain binding. Note that at this point action is only scheduled. Real work is done be alignChain method """
+        if type(otherChain) == type(''):
+            self.chainBindings.append( (mySig, otherChain, otherChainSig) )
+        else:
+            self.chainBindings.append( (mySig, otherChain.chain_name, otherChainSig) )
+#        self.alignChain(mySig, otherChain, otherChainSig)
+
+    def alignChain(self, mySig, otherChain, otherChainSigName ):
+        """ Changes internals of this chains and makes sure that selected signatures of other chain are evaluated first """
+        # check if any binding is required
+        if len(self.chainBindings) == 0:
+            return False
+
+        # find this chain signature
+        thisChainSig = filter(lambda x: x.tes == HLTChain.HLTSignature(mySig, 0).tes, self.siglist)
+        if len(thisChainSig) == 0:
+            logger().debug( "Chains binding ineffective (1), can't find signature: " + mySig + " in chain " + self.chain_name )
+            return False
+        thisChainSig = thisChainSig[0] # unpack it from list
+
+        # find sigcounter of the otherChainSig
+        otherChainSig = filter(lambda x: x.tes == HLTChain.HLTSignature(otherChainSigName, 0).tes, otherChain.siglist)
+        if len(otherChainSig) == 0:
+            logger().debug( "Chains binding ineffective (2), can't find signature: " + str(otherChainSigName) + " in chain " + otherChain.chain_name )
+            return False
+
+        otherChainSig = otherChainSig[0]
+
+        # fianlly we have both, check if we need to do anything
+        if thisChainSig.sigcounter > otherChainSig.sigcounter:
+            logger().debug( "Chains binding ineffective (3), signatures steps already ordered" )
+            return False
+
+        # and real work to be done here
+        counterShift = otherChainSig.sigcounter - thisChainSig.sigcounter + 1
+        for i in range (self.siglist.index(thisChainSig), len(self.siglist)):
+            self.siglist[i].sigcounter = self.siglist[i].sigcounter + counterShift
+            logger().debug( "Chains binding effective: signature: " + str(self.siglist[i].tes) + " will be shifted to step: "+ str(self.siglist[i].sigcounter) )
+        # true means that there was something to do
+        return True
+
+    def getOutputTEs(self):
+        tes = []
+        for sig in self.siglist:
+            tes.extend(sig.tes)
+        return tes
+
+    def isL2(self):
+        if self.level == "L2":
+            return True
+        else:
+            return False
+
+    def isEF(self):
+        if self.level == "EF":
+            return True
+        else:
+            return False
+
+    def isHLT(self):
+        if self.level == "HLT":
+            return True
+        else:
+            return False
+
+    def addTriggerTypeBit(self, bit):
+        self.trigger_type_bits.append(bit)
+
+    def addStreamTag(self, stream, type="physics", obeyLB="yes", prescale='1'):
+        self.stream_tag.append( (stream, type, obeyLB, prescale) )
+
+    def addGroup(self, name ):
+        if type(name) == type(''):
+            self.groups += [name]
+        if type(name) == type([]):
+            self.groups += name
+
+    def xml(self, xChainList):
+        """ Returns XML representation of this chain """
+        xChain = etree.SubElement(xChainList, 'CHAIN',                                
+                                  chain_name = self.chain_name,
+                                  chain_counter = str(self.chain_counter),
+                                  lower_chain_name = self.lower_chain_name,
+                                  level = str(self.level),
+                                  prescale = str(self.prescale),
+                                  pass_through = str(self.pass_through),
+                                  rerun_prescale = str(self.rerun_prescale),
+                                  EBstep = str(self.EBstep))
+
+
+        xTriggerTypeList = etree.SubElement(xChain, 'TRIGGERTYPE_LIST')
+        for bit in self.trigger_type_bits:
+            xTriggerType = etree.SubElement(xTriggerTypeList, 'TRIGGERTYPE', bit = str(bit))
+
+        xStreamTagList = etree.SubElement(xChain, 'STREAMTAG_LIST')
+        for stream in self.stream_tag:
+            xStreamTag = etree.SubElement(xStreamTagList, 'STREAMTAG',
+                                          stream = stream[0],
+                                          type = stream[1],
+                                          obeyLB = stream[2],
+                                          prescale = str(stream[3]))
+            
+#         ## remove the CPS group from the EF chain    
+#         if self.chain_name.startwith("EF_"):
+#             for g in self.groups:
+#                 if "CPS" in g:
+#                     self.groups.remove(g)
+
+        xGroupList = etree.SubElement(xChain, 'GROUP_LIST')
+        for g in self.groups:
+            xGroup = etree.SubElement(xGroupList, 'GROUP', name = g)
+            
+        xSignatureList = etree.SubElement(xChain, 'SIGNATURE_LIST')
+        for sig in self.siglist:
+            sig.xml(xSignatureList)
+
+
+#
+# EF Chain classes
+#########################################################################################
+
+
+#########################################################################################
+# HLT Sequence
+#
+class HLTSequence:
+    def __init__(self, inputTEs, algos, outputTE, topo_start_from=None):
+        """HLT Steering Sequence class constructor
+        inputTEs argument is a one or list of names TEs for the sequence,
+        if empty string is passed then sequence is considered as UNSEEDED
+        algos is one or list of algo instances
+        """
+
+        if type(inputTEs) == type(""):
+            self.input  = [ inputTEs ]
+        else:
+            self.input  = inputTEs
+
+        # make algos always to be alist of ... something ...
+        if type(algos) != type([]):
+            algos = [ algos ]
+        from AthenaCommon.Configurable import ConfigurableAlgorithm
+        self.algs = []
+        self.algInstances = [] # needed such that configurables don't go out of scope
+        for alg in algos:
+            if type(alg) == type(""): # plain string
+                self.algs.append( alg );
+                logger().warning("Algorithm named %s has no instance. It will not appear in the list of configurables and thus can not be run." % (alg))
+            elif issubclass(type(alg), ConfigurableAlgorithm): # configurable given to us
+                self.algs.append(alg.getFullName())
+                self.algInstances.append(alg)
+
+        self.output = outputTE
+        self.topo_start_from = topo_start_from
+
+        self.__used = None
+
+    def used(self):
+        return self.__used
+
+    def use(self, level):
+        if level == 'L2' or level == 'EF' or level == 'HLT':
+            self.__used = level
+        else:
+            raise Exception('setting for the sequence level to incorrect value: '+str(level))
+
+    def __str__(self):
+        return str(self.input)+" -> "+ str(self.algs)+" -> "+self.output
+
+    def xml(self, xlist):
+        """Generates piece of XML used to configure HLT Steering"""
+        if not self.used():
+            return
+        
+        xSequence = etree.SubElement(xlist, 'SEQUENCE',
+                                     input = reduce(lambda x,y: x+' '+y, self.input),
+                                     output = self.output,
+                                     algorithm = reduce(lambda x,y: x+' '+y, self.algs))
+                                     
+        if self.topo_start_from!= None:
+            xSequence.set('topo_start_from', self.topo_start_from)
+
+    def dot(self, algs=True):
+        if not self.used():
+            return ''
+        #example EM10_1 -> em10t2calo_1  [label="T2Calo,\n T2Hypo10"]        
+        line = ''
+        for i in self.input:
+            if i == '':
+                line += '"UNSEEDED"  [style=filled, fillcolor=blue]\n'
+                line += 'UNSEEDED'
+            else:
+                line += '"'+i+'"'
+            line += ' -> ' + '"' + self.output + '"'
+            if algs:
+                line += ' [label="' + reduce(lambda x,y: x+'\\n '+y, self.algs) + '"]'
+            line += '\n'
+        return line
+    
+#
+# EOF Sequences
+#########################################################################################
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTSignatureConfig.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTSignatureConfig.py
new file mode 100644
index 0000000000000000000000000000000000000000..35a9f9c872f9017bfa92361df69dde01e663f686
--- /dev/null
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTSignatureConfig.py
@@ -0,0 +1,158 @@
+from TrigUpgradeTest.TrigUpgradeTestConf import HLTTest__TestRecoAlg
+from TrigUpgradeTest.TrigUpgradeTestConf import HLTTest__TestHypoAlg
+from TrigUpgradeTest.TrigUpgradeTestConf import HLTTest__TestHypoTool
+from TrigUpgradeTest.TrigUpgradeTestConf import HLTTest__TestComboHypoAlg
+
+def TestHypoTool(name, prop, threshold_value):
+#    threshold_value=''.join(filter(lambda x: x.isdigit(), name))
+    value  =  int(threshold_value)*1000
+    h = HLTTest__TestHypoTool(name, OutputLevel=DEBUG, Threshold=value, Property=prop)
+    return h
+
+from TrigUpgradeTest.TrigUpgradeTestConf import HLTTest__TestInputMaker
+def InputMakerAlg(name):
+    return HLTTest__TestInputMaker(name, OutputLevel = DEBUG, LinkName="initialRoI")
+
+  
+
+# here define the sequences from the signatures
+# signatures do this:
+# - declare all the RecoAlg and the HypoAlg -> create the Sequence
+# - creates the InputMaker, without the inputs
+  
+
+#muon signatures
+
+def muMSRecAlg(name, FileName="noreco.dat"):
+    return HLTTest__TestRecoAlg(name=name, FileName=FileName, OutputLevel = DEBUG)
+
+def MuHypo(name):
+    return HLTTest__TestHypoAlg(name=name, OutputLevel = DEBUG)
+
+def step1mu20():
+    return TestHypoTool("step1mu20", "pt",20)
+
+def step1mu8():
+    return TestHypoTool("step1mu8", "pt",8)
+
+def step2mu20():
+    return TestHypoTool("step2mu20", "pt", 20)
+
+def step2mu8():
+    return TestHypoTool("step2mu8", "pt", 8)
+
+
+muIM= InputMakerAlg(name="Step1MuInputMaker")
+step1_mu_inputMaker = AlgNode(Alg=muIM, inputProp='Inputs', outputProp='Output')
+
+muAlg = muMSRecAlg(name="muMSRecAlg", FileName="msmu.dat")
+step1_mu_recoAlg = AlgNode( Alg=muAlg,inputProp='Input', outputProp='Output')
+
+muHypo = MuHypo(name="Step1MuHypo")
+
+step1_mu_HypoAlg = HypoAlgNode( Alg=muHypo,inputProp='Input', outputProp='Output')
+nodeSequence_mu = NodeSequence("muNodeSeq1",  Algs=[step1_mu_inputMaker, step1_mu_recoAlg], Hypo=step1_mu_HypoAlg, Seed="L1MU")
+
+def muStep1Sequence():
+    return MenuSequence("muStep1Seq", nodeSeqList=[nodeSequence_mu])
+
+# mu step2
+muIM2= InputMakerAlg(name="Step2MuInputMaker")
+step2_mu_inputMaker = AlgNode(Alg=muIM2, inputProp='Inputs', outputProp='Output')
+
+muAlg2 = muMSRecAlg(name="muMSRecAlg2", FileName="msmu.dat")
+step2_mu_recoAlg = AlgNode( Alg=muAlg2,inputProp='Input', outputProp='Output')
+
+muHypo2 = MuHypo(name="Step2MuHypo2")
+step2_mu_HypoAlg = HypoAlgNode( Alg=muHypo2,inputProp='Input', outputProp='Output')
+nodeSequence2_mu = NodeSequence("muNodeSeq2",  Algs=[step2_mu_inputMaker, step2_mu_recoAlg], Hypo=step2_mu_HypoAlg, Seed="")
+
+def muStep2Sequence():
+    return MenuSequence("muStep2Seq", nodeSeqList=[nodeSequence2_mu])
+
+
+
+#electron signatures
+
+def CaloClustering(name,  FileName="noreco.dat"):
+    return HLTTest__TestRecoAlg(name=name, FileName=FileName, OutputLevel = DEBUG)
+
+def ElGamHypo(name):
+    return HLTTest__TestHypoAlg(name=name, OutputLevel = DEBUG)
+
+
+def step1e20():
+    return TestHypoTool("step1e20", "et",20)
+
+def step1e8():
+    return TestHypoTool("step1e8", "et",8)
+
+def step2e20():
+    return TestHypoTool("step2e20", "et",20)
+
+def step2e8():
+    return TestHypoTool("step2e8", "et",8)
+
+elIM= InputMakerAlg(name="Step1ElInputMaker")
+step1_el_inputMaker = AlgNode(Alg=elIM, inputProp='Inputs', outputProp='Output')
+
+elAlg = CaloClustering(name="CaloClustering", FileName="emclusters.dat")
+step1_el_recoAlg = AlgNode( Alg=elAlg,inputProp='Input', outputProp='Output')
+
+elHypo = ElGamHypo(name="Step1ElHypo")
+step1_el_HypoAlg = HypoAlgNode( Alg=elHypo,inputProp='Input', outputProp='Output')
+
+nodeSequence_el = NodeSequence("elNodeSeq1",  Algs=[step1_el_inputMaker, step1_el_recoAlg], Hypo=step1_el_HypoAlg, Seed="L1EM")
+def elStep1Sequence():
+    return MenuSequence("elStep1Seq", nodeSeqList=[nodeSequence_el])
+
+#step2
+elIM2= InputMakerAlg(name="Step2ElInputMaker")
+step2_el_inputMaker = AlgNode(Alg=elIM2, inputProp='Inputs', outputProp='Output')
+
+elAlg2 = CaloClustering(name="CaloClustering2", FileName="emclusters.dat")
+step2_el_recoAlg = AlgNode( Alg=elAlg2,inputProp='Input', outputProp='Output')
+
+elHypo2 = ElGamHypo(name="Step2ElHypo")
+step2_el_HypoAlg = HypoAlgNode( Alg=elHypo2,inputProp='Input', outputProp='Output')
+
+nodeSequence2_el = NodeSequence("elNodeSeq2",  Algs=[step2_el_inputMaker, step2_el_recoAlg], Hypo=step2_el_HypoAlg, Seed="")
+def elStep2Sequence():
+    return MenuSequence("elStep2Seq", nodeSeqList=[nodeSequence2_el])
+
+
+# combined Hypo #
+#################
+
+def ComboMuEHypo(name):
+    return HLTTest__TestComboHypoAlg(name=name, OutputLevel = DEBUG, Property1="pt", Property2="et")
+
+def step1mu8_e8():
+    return TestHypoTool("step1mu8_e8", "pt",8)
+
+def step2mu8_e8():
+    return TestHypoTool("step2mu8_e8", "pt",8)
+
+comboAlg = ComboMuEHypo("Step1ComboMuElHypo")
+step1_comb_HypoAlgMu =  HypoAlgNode( Alg=comboAlg,inputProp='Input1', outputProp='Output1')
+step1_comb_HypoAlgEl =  HypoAlgNode( Alg=comboAlg,inputProp='Input2', outputProp='Output2')
+
+nodeSequence_muComb = NodeSequence("CombmuNodeSeq1",  Algs=[step1_mu_inputMaker, step1_mu_recoAlg], Hypo=step1_comb_HypoAlgMu, Seed="L1MU")
+nodeSequence_elComb = NodeSequence("CombelNodeSeq1",  Algs=[step1_el_inputMaker, step1_el_recoAlg], Hypo=step1_comb_HypoAlgEl, Seed="L1EM")
+
+
+def combStep1Sequence():
+    return MenuSequence("combStep1Seq", nodeSeqList=[nodeSequence_muComb,nodeSequence_elComb])
+
+# step2
+
+comboAlg2 = ComboMuEHypo("Step2ComboMuElHypo")
+step2_comb_HypoAlgMu =  HypoAlgNode( Alg=comboAlg2,inputProp='Input1', outputProp='Output1')
+step2_comb_HypoAlgEl =  HypoAlgNode( Alg=comboAlg2,inputProp='Input2', outputProp='Output2')
+
+nodeSequence2_muComb = NodeSequence("CombmuNodeSeq2",  Algs=[step2_mu_inputMaker, step2_mu_recoAlg], Hypo=step2_comb_HypoAlgMu, Seed="")
+nodeSequence2_elComb = NodeSequence("CombelNodeSeq2",  Algs=[step2_el_inputMaker, step2_el_recoAlg], Hypo=step2_comb_HypoAlgEl, Seed="")
+
+
+def combStep2Sequence():
+    return MenuSequence("combStep2Seq", nodeSeqList=[nodeSequence2_muComb,nodeSequence2_elComb])
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/LS2_v1.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/LS2_v1.py
new file mode 100644
index 0000000000000000000000000000000000000000..46348f929e201bc7d1fded34a736955508659582
--- /dev/null
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/LS2_v1.py
@@ -0,0 +1,105 @@
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+#----------phy--------------------------------------------------------------#
+#------------------------------------------------------------------------#
+def setupMenu():
+
+    from TriggerJobOpts.TriggerFlags          import TriggerFlags
+    from AthenaCommon.Logging                 import logging
+    log = logging.getLogger( 'TriggerMenuMT.HLTMenuConfig.Menu.LS2_v1.py' )
+
+    from TriggerMenuMT.LVL1MenuConfig.TriggerConfigLVL1 import TriggerConfigLVL1 as tcl1
+    #if tcl1.current:
+    #    log.info("L1 items: %s " % tcl1.current.menu.items.itemNames())
+    #else:
+    #    log.info("ERROR L1 menu has not yet been defined")
+
+    PhysicsStream="Main"
+
+    #---------------------------------------------------------------------
+    # INPUT FORMAT FOR CHAINS:
+    # ['chainName',  'L1itemforchain', [L1 items for chainParts], [stream], [groups], EBstep], OPTIONAL: [mergingStrategy, offset,[merginOrder] ]], topoStartsFrom = False
+    #---------------------------------------------------------------------
+
+    #---------------------------------------------------------------------
+    # if it's needed to temporary remove almost all the chains from the menu
+    # be aware that it is necessary to leave at least one chain in the muon slice
+    # otherwise athenaHLT will seg-fault 
+    #---------------------------------------------------------------------
+
+    TriggerFlags.Slices_all_setOff()
+
+    TriggerFlags.TestSlice.signatures = []
+
+    TriggerFlags.MuonSlice.signatures = [
+        ['mu20',      'L1_MU10',   [], [PhysicsStream], ['RATE:SingleMuon', 'BW:Muon'], -1],
+        ['mu8',	      'L1_MU6',	   [], [PhysicsStream], ['RATE:SingleMuon', 'BW:Muon'], -1],
+
+     ]
+    TriggerFlags.EgammaSlice.signatures = [
+        ['e20',	      'L1_EM10',   [], [PhysicsStream], ['RATE:SingleElectron', 'BW:Electron'], -1],        
+        ]
+    TriggerFlags.CombinedSlice.signatures = [
+        ['e8_mu8',    'L1_EM6_MU6',	   [], [PhysicsStream], ['RATE:SingleMuon', 'BW:Muon'], -1],
+        ]
+    TriggerFlags.JetSlice.signatures = [ ]
+    TriggerFlags.BjetSlice.signatures = [] 
+    TriggerFlags.METSlice.signatures = []
+    TriggerFlags.TauSlice.signatures = []
+    TriggerFlags.BphysicsSlice.signatures = [ ]
+    TriggerFlags.HeavyIonSlice.signatures  = []
+    TriggerFlags.BeamspotSlice.signatures  = []   
+    TriggerFlags.MinBiasSlice.signatures   = []    
+    TriggerFlags.CalibSlice.signatures     = []
+    TriggerFlags.CosmicSlice.signatures    = []
+    TriggerFlags.StreamingSlice.signatures = [] 
+    TriggerFlags.MonitorSlice.signatures   = []
+
+    # Random Seeded EB chains which select at the HLT based on L1 TBP bits
+    TriggerFlags.EnhancedBiasSlice.signatures = [ ]
+
+
+
+
+    signatureList=[]
+    for prop in dir(TriggerFlags):
+        if prop[-5:]=='Slice':
+            sliceName=prop
+            slice=getattr(TriggerFlags,sliceName)
+            if slice.signatures():
+                signatureList.extend(slice.signatures())
+            else:
+                log.debug('SKIPPING '+str(sliceName))
+    mySigList=[]
+    for allInfo in signatureList:
+        mySigList.append(allInfo[0])
+    mydict={}
+    for chain in mySigList:
+        mydict[chain]=[-1,0,0]
+    mydict.update(Prescales.HLTPrescales_cosmics)
+    from copy import deepcopy
+    Prescales.HLTPrescales_cosmics = deepcopy(mydict)
+    
+
+class Prescales:
+    #   Item name             | Prescale
+    #----------------------------------------------------------
+    L1Prescales = {}
+
+    #   Signature name   | [ HLTprescale, HLTpass-through, rerun]
+    #   - Prescale values should be a positive integer (default=1)
+    #   - If the current pass_through value is non-zero,
+    #     the value given here will be used as pass_through rate
+    #     Assuming that pass through chains are configured so
+    #     in the slice files and won't change. Also prescale
+    #     and pass_through will not be used together.
+    #   - If only the first value is specified,
+    #     the default value of pass-through (=0) will be used
+    #----------------------------------------------------------
+    HLTPrescales = {
+        }
+
+    L1Prescales_cosmics  = {}
+    HLTPrescales_cosmics = {}
+    chain_list=[]
+
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/Lumi.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/Lumi.py
new file mode 100755
index 0000000000000000000000000000000000000000..6359a5f403e0f6d1863ed8a5164bec09e73b0317
--- /dev/null
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/Lumi.py
@@ -0,0 +1,223 @@
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+from TriggerJobOpts.TriggerFlags import TriggerFlags
+from TriggerMenu.menu.MenuUtil import applyHLTPrescale, resetAllPrescales
+
+from AthenaCommon.Logging import logging
+log = logging.getLogger( 'TriggerMenu.menu.Lumi' )
+
+def lumi(triggerPythonConfig):
+
+    L1Prescales = {}
+    HLTPrescales = {}
+    
+    menu_name = TriggerFlags.triggerMenuSetup()
+    ## Do some aliasing here
+    if menu_name == 'Physics_default': menu_name = 'Physics_pp_v6'
+    elif menu_name == 'MC_loose_default': menu_name = 'MC_pp_v6_loose_mc_prescale'
+    elif menu_name == 'MC_tight_default': menu_name = 'MC_pp_v6_tight_mc_prescale'
+    elif menu_name == 'default_loose': menu_name = 'MC_pp_v6_loose_mc_prescale'
+    elif menu_name == 'default_tight': menu_name = 'MC_pp_v6_tight_mc_prescale'
+
+    log.info( 'Menu name: '+ menu_name)
+
+
+    if menu_name.startswith('Physics_pp_v7') :
+        log.info('In physics pp v7 menu setup')
+        from TriggerMenu.menu.Physics_pp_v7 import setupMenu, Prescales
+        setupMenu()
+        if 'cosmics_prescale' in menu_name:
+            L1Prescales = Prescales.L1Prescales_cosmics
+            HLTPrescales = Prescales.HLTPrescales_cosmics
+        elif 'tight' in menu_name:
+            L1Prescales = Prescales.L1Prescales_tight_physics_prescale
+            HLTPrescales = Prescales.HLTPrescales_tight_physics_prescale
+        else:
+            L1Prescales = Prescales.L1Prescales
+            HLTPrescales = Prescales.HLTPrescales
+
+
+    elif  menu_name.startswith('MC_pp_v7'):
+        from TriggerMenu.menu.MC_pp_v7 import setupMenu, Prescales
+        setupMenu()
+        if 'tight_mc_prescale' in menu_name:
+            L1Prescales = Prescales.L1Prescales_tight_mc_prescale
+            HLTPrescales = Prescales.HLTPrescales_tight_mc_prescale
+        elif 'tightperf_mc_prescale' in menu_name:
+            L1Prescales = Prescales.L1Prescales_tightperf_mc_prescale
+            HLTPrescales = Prescales.HLTPrescales_tightperf_mc_prescale
+            log.info(" HLTPrescales %s" % HLTPrescales)
+        elif 'loose_mc_prescale' in menu_name:
+            L1Prescales = Prescales.L1Prescales_loose_mc_prescale
+            HLTPrescales = Prescales.HLTPrescales_loose_mc_prescale
+            log.info(" HLTPrescales %s" % HLTPrescales)
+        elif 'special_mc_prescale' in menu_name:
+            L1Prescales = Prescales.L1Prescales_special_mc_prescale
+            HLTPrescales = Prescales.HLTPrescales_special_mc_prescale
+            log.info(" HLTPrescales %s" % HLTPrescales)
+        elif 'no_prescale' in menu_name:
+            L1Prescales = Prescales.L1Prescales_no_prescale
+            HLTPrescales = Prescales.HLTPrescales_no_prescale
+            log.info(" HLTPrescales %s" % HLTPrescales)
+        elif 'upgrade_mc_prescale' in menu_name:
+            L1Prescales = Prescales.L1Prescales_upgrade_mc_prescale
+            HLTPrescales = Prescales.HLTPrescales_upgrade_mc_prescale            
+            log.info(" HLTPrescales %s" %  HLTPrescales)
+        else:
+            L1Prescales = Prescales.L1Prescales
+            HLTPrescales = Prescales.HLTPrescales
+    elif menu_name.startswith('Physics_pp_v6') :
+        log.info('In physics pp v6 menu setup')
+        from TriggerMenu.menu.Physics_pp_v6 import setupMenu, Prescales
+        setupMenu()
+        if 'cosmics_prescale' in menu_name:
+            L1Prescales = Prescales.L1Prescales_cosmics
+            HLTPrescales = Prescales.HLTPrescales_cosmics
+        elif 'tight' in menu_name:
+            L1Prescales = Prescales.L1Prescales_tight_physics_prescale
+            HLTPrescales = Prescales.HLTPrescales_tight_physics_prescale
+        else:
+            L1Prescales = Prescales.L1Prescales
+            HLTPrescales = Prescales.HLTPrescales
+
+
+    elif  menu_name.startswith('MC_pp_v6'):
+        from TriggerMenu.menu.MC_pp_v6 import setupMenu, Prescales
+        setupMenu()
+        if 'tight_mc_prescale' in menu_name:
+            L1Prescales = Prescales.L1Prescales_tight_mc_prescale
+            HLTPrescales = Prescales.HLTPrescales_tight_mc_prescale
+        elif 'tightperf_mc_prescale' in menu_name:
+            L1Prescales = Prescales.L1Prescales_tightperf_mc_prescale
+            HLTPrescales = Prescales.HLTPrescales_tightperf_mc_prescale
+            log.info(" HLTPrescales %s" % HLTPrescales)
+        elif 'loose_mc_prescale' in menu_name:
+            L1Prescales = Prescales.L1Prescales_loose_mc_prescale
+            HLTPrescales = Prescales.HLTPrescales_loose_mc_prescale
+            log.info(" HLTPrescales %s" % HLTPrescales)
+        elif 'special_mc_prescale' in menu_name:
+            L1Prescales = Prescales.L1Prescales_special_mc_prescale
+            HLTPrescales = Prescales.HLTPrescales_special_mc_prescale
+            log.info(" HLTPrescales %s" % HLTPrescales)
+        elif 'no_prescale' in menu_name:
+            L1Prescales = Prescales.L1Prescales_no_prescale
+            HLTPrescales = Prescales.HLTPrescales_no_prescale
+            log.info(" HLTPrescales %s" % HLTPrescales)
+        elif 'upgrade_mc_prescale' in menu_name:
+            L1Prescales = Prescales.L1Prescales_upgrade_mc_prescale
+            HLTPrescales = Prescales.HLTPrescales_upgrade_mc_prescale            
+            log.info(" HLTPrescales %s" %  HLTPrescales)
+        else:
+            L1Prescales = Prescales.L1Prescales
+            HLTPrescales = Prescales.HLTPrescales
+
+    elif menu_name.startswith('Physics_HI_v3') :
+        log.info('Physics_HI_v3 menu setup')
+        from TriggerMenu.menu.Physics_HI_v3 import setupMenu, Prescales
+        setupMenu()
+        if 'cosmics_prescale' in menu_name:
+            L1Prescales = Prescales.L1Prescales_cosmics
+            HLTPrescales = Prescales.HLTPrescales_cosmics
+        else:
+            L1Prescales = Prescales.L1Prescales
+            HLTPrescales = Prescales.HLTPrescales
+            
+
+    elif menu_name.startswith('MC_HI_v3') :
+        log.info('MC_HI_v3 menu setup')
+        from TriggerMenu.menu.MC_HI_v3 import setupMenu, Prescales
+        setupMenu()
+        if 'cosmics_prescale' in menu_name:
+            L1Prescales = Prescales.L1Prescales_cosmics
+            HLTPrescales = Prescales.HLTPrescales_cosmics
+        elif 'tight_mc_prescale' in menu_name:
+            L1Prescales = Prescales.L1Prescales_tight_mc_prescale
+            HLTPrescales = Prescales.HLTPrescales_tight_mc_prescale
+        else:
+            L1Prescales = Prescales.L1Prescales
+            HLTPrescales = Prescales.HLTPrescales
+    
+    elif menu_name.startswith('Physics_HI_v4') :
+        log.info('Physics_HI_v4 menu setup')
+        from TriggerMenu.menu.Physics_HI_v4 import setupMenu, Prescales
+        setupMenu()
+        if 'cosmics_prescale' in menu_name:
+            L1Prescales = Prescales.L1Prescales_cosmics
+            HLTPrescales = Prescales.HLTPrescales_cosmics
+        else:
+            L1Prescales = Prescales.L1Prescales
+            HLTPrescales = Prescales.HLTPrescales
+            
+
+    elif menu_name.startswith('MC_HI_v4') :
+        log.info('MC_HI_v4 menu setup')
+        from TriggerMenu.menu.MC_HI_v4 import setupMenu, Prescales
+        setupMenu()
+        if 'cosmics_prescale' in menu_name:
+            L1Prescales = Prescales.L1Prescales_cosmics
+            HLTPrescales = Prescales.HLTPrescales_cosmics
+        elif 'tight_mc_prescale' in menu_name:
+            L1Prescales = Prescales.L1Prescales_tight_mc_prescale
+            HLTPrescales = Prescales.HLTPrescales_tight_mc_prescale
+        else:
+            L1Prescales = Prescales.L1Prescales
+            HLTPrescales = Prescales.HLTPrescales        
+
+    elif menu_name.startswith('LS2_v1') :
+        log.info('LS2_v1 menu setup')
+        from TriggerMenu.menu.MC_HI_v4 import setupMenu, Prescales
+        setupMenu()
+        if 'cosmics_prescale' in menu_name:
+            L1Prescales = Prescales.L1Prescales_cosmics
+            HLTPrescales = Prescales.HLTPrescales_cosmics
+        elif 'tight_mc_prescale' in menu_name:
+            L1Prescales = Prescales.L1Prescales_tight_mc_prescale
+            HLTPrescales = Prescales.HLTPrescales_tight_mc_prescale
+        else:
+            L1Prescales = Prescales.L1Prescales
+            HLTPrescales = Prescales.HLTPrescales        
+            
+    else:
+        log.fatal ('Menu with name %s is not known in this version of TriggerMenu! ', menu_name)
+        return
+
+    return (L1Prescales, HLTPrescales)
+
+
+
+
+def applyPrescales(triggerPythonConfig, HLTPrescales):
+    no_prescale = False
+    if 'no_prescale' in TriggerFlags.triggerMenuSetup() or \
+       TriggerFlags.triggerMenuSetup() == 'default': no_prescale = True
+        
+    #if L1Prescales==None and TriggerFlags.L1PrescaleSet()!='':
+    #    log.warning('Cannot find L1 prescale set %s, not explicitly setting them' % \
+    #                TriggerFlags.L1PrescaleSet())
+    #    L1Prescales = {}
+    if HLTPrescales==None and TriggerFlags.HLTPrescaleSet()!='':
+        log.warning('Cannot find HLT prescale set %s, not explicitly setting them' % \
+                    TriggerFlags.HLTPrescaleSet())
+        HLTPrescales = {}
+        
+    if TriggerFlags.doHLT():
+        applyHLTPrescale(triggerPythonConfig, HLTPrescales)
+
+    if TriggerFlags.L1PrescaleSet() == 'None':
+        for item in triggerPythonConfig.allItems.values():
+            item.prescale = '1' 
+    if TriggerFlags.HLTPrescaleSet() == 'None':
+        for  sig in triggerPythonConfig.allChains.values():
+            for chain in sig:
+                chain.prescale = '1'
+                chain.pass_through = '0'
+                tmp_stag = chain.stream_tag
+                chain.stream_tag = []
+                for s in tmp_stag:
+                    chain.addStreamTag(s[0], s[1], s[2], 1)
+
+    if no_prescale:
+        resetAllPrescales(triggerPythonConfig)
+
+
+                
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py
new file mode 100644
index 0000000000000000000000000000000000000000..9b722ff51b14204f74f52d1aee9ce54d5ab4d421
--- /dev/null
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py
@@ -0,0 +1,96 @@
+
+
+
+
+##########################################################
+
+
+class NodeSequence():
+    def __init__(self, name, Algs, Hypo, Seed):
+        self.name = name
+        self.algs = Algs
+        self.hypo = Hypo
+        self.seed = Seed
+        self.output = Hypo.getOutput()
+        self.reuse = 0
+        self.connect()
+
+ 
+    def connect(self):
+        alg_input = ""
+        #alg_input = self.inputMaker.getOutput()
+        for Alg in self.algs:
+            Alg.setInput(alg_input) 
+            alg_input = Alg.getOutput()
+        self.hypo.setInput(Alg.getOutput())
+        print "connect NodeSequence %s"%self.name
+
+    def setInput(self,input):
+        self.algs[0].setInput(input)
+
+    def addInput(self,input):
+        self.algs[0].addInput(input)
+        
+    def __str__(self):
+        return "NodeSequence::%s with \n Seed::%s \n %s \n Hypo::%s"%(self.name, self.seed, ',\n '.join(map(str, self.algs)), self.hypo)
+
+class MenuSequence():
+    def __init__(self, name, nodeSeqList):
+        self.name = name
+        self.nodeSeqList=nodeSeqList
+        self.outputs=[seq.output for seq in nodeSeqList]
+
+    def __str__(self):
+        return "MenuSequence::%s \n %s"%(self.name,',\n '.join(map(str, self.nodeSeqList)))
+
+
+class CFSequence():
+    def __init__(self, name, FilterAlg, MenuSequence):
+        self.name = name        
+        self.filter = FilterAlg
+        self.menuSeq = MenuSequence
+        self.otherNodes = []
+
+    def addNode(self, node):
+        self.otherNodes.append(node)
+    
+    def __str__(self):
+        return "--- CFSequence %s ---\n + Filter: %s \n +  %s \n "%(self.name,\
+            self.filter, \
+            self.menuSeq)
+
+    def getAllNodes(self):
+        nodes = []
+        for seq in self.menuSeq.nodeSeqList:
+            nodes.extend(seq.algs)
+            nodes.append(seq.hypo)
+        for node in self.otherNodes:
+            nodes.append(node)            
+
+        return nodes
+        
+
+class SequenceHypoTool:
+    def __init__(self, MenuSequence, HypoTool):
+        self.sequence = MenuSequence
+        self.hypotool = HypoTool
+        
+
+class ChainStep:
+     def __init__(self, name,  SequenceHypoTools=[]):
+        self.name = name        
+        self.sequenceHypoTools = SequenceHypoTools
+        self.sequences = [sh.sequence for sh in SequenceHypoTools ] 
+
+
+class Chain: # going to be my HLTChainDef
+     def __init__(self, name, Seed, ChainSteps=[]):
+         self.name = name
+         self.seed=Seed
+         self.steps=ChainSteps
+         
+         seeds = Seed.strip().split("_")
+         seeds.pop(0) 
+         self.group_seed  = ["L1"+filter(lambda x: x.isalpha(), stri) for stri in seeds]
+
+
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuUtil.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuUtil.py
new file mode 100755
index 0000000000000000000000000000000000000000..68c966865d93f2aa6b5920593e37c910437889de
--- /dev/null
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuUtil.py
@@ -0,0 +1,242 @@
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+from TriggerJobOpts.TriggerFlags import TriggerFlags
+from AthenaCommon.Logging        import logging
+
+
+log = logging.getLogger('TriggerMenu.menu.MenuUtil.py')
+
+
+
+def getStreamTagForRerunChains(triggerPythonConfig, HLTPrescale):
+    list=[]
+    for item, prescales in HLTPrescale.iteritems():
+        # prescales is a list of 3 integers [HLT_prescale, HLT_pass_through, rerun_prescale]
+        if item not in triggerPythonConfig.allChains.keys():
+            log.debug('Signature %s not registered to TriggerPythonConfig' % item)
+            continue
+        n = len(prescales)
+        hltchain = None
+        for ch in triggerPythonConfig.allChains[item]:
+            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] ")
+                if hltchain.rerun_prescale !=  "1":
+                    log.error("chain "+ hltchain.chain_name + " has special stream tag but it's not in rerun mode")
+                list.append( "%s:%s" %(str(hltchain.chain_name),str(prescales[3])) )
+            
+
+    return list
+
+                
+
+
+def applyHLTPrescale(triggerPythonConfig, HLTPrescale):
+    for item, prescales in HLTPrescale.iteritems():
+        # prescales is a list of 3 integers [HLT_prescale, HLT_pass_through, rerun_prescale]
+        if item not in triggerPythonConfig.allChains.keys():
+            if triggerPythonConfig.signaturesOverwritten:
+                log.warning('Attempt to set prescales for nonexisting chain: %s' % item)
+                continue
+            else:
+                log.error('Attempt to set prescales for nonexisting chain: %s' % item)
+                continue
+        n = len(prescales)
+        hltchain = None
+        for ch in triggerPythonConfig.allChains[item]:
+            if ch.level == 'HLT': hltchain = ch
+        if n > 0  and hltchain:
+            hltchain.prescale = str(prescales[0])
+        if n > 1  and hltchain:
+            hltchain.pass_through = str(prescales[1])
+        if n > 2  and hltchain:
+            hltchain.rerun_prescale = str(prescales[2])
+       
+        log.info('Applied HLTPS to the item '+item+': PS'+ hltchain.prescale+" PT"+hltchain.pass_through+" RerunPS"+hltchain.rerun_prescale)
+
+def checkGroups(triggerPythonConfig):
+    """ Make sure the groups used in Physics and MC menu exists
+    """
+    menu_name = TriggerFlags.triggerMenuSetup()
+    log.info( "Menu: " + menu_name)
+    
+    from TriggerMenu.menu.GroupInfo       import getAllAllowedGroups
+    allgroup=getAllAllowedGroups(menu_name)
+
+    for chain in triggerPythonConfig.theHLTChains:
+        if len(chain.groups) == 0:
+            log.error( "group undefined for chain: " + str(chain.chain_name) )
+        for i in chain.groups:
+            if 'BW' in i:
+                if i.split('BW:')[1] not in allgroup:
+                    log.error( "BW Group " + str(i)+ " for chain "+ str(chain.chain_name) + " not allowed." )
+
+                  
+        
+def checkTriggerGroupAssignment(triggerPythonConfig):
+    """ Checks menu consistency
+
+    Checks trigger-groups assignment in Physics_ and MC_ menus.
+    Excludes those chains which either have no group assigned or have a wrong group attached in Physics_
+    which allows only primary, supporting and calibration triggers. 
+    """
+    menu_name = TriggerFlags.triggerMenuSetup()
+    log.info( "Menu: " + menu_name)
+    GroupItems = []
+    CheckGroups=False
+
+    if menu_name.startswith('Physics_lumi'):
+        CheckGroups=True
+        GroupItems = ['Primary', 'Supporting', 'Calibration', 'Monitoring']
+    elif menu_name.startswith('MC_lumi'):
+        CheckGroups=True
+        GroupItems = ['Primary', 'Supporting', 'Calibration', 'Monitoring', 'Backup', 'Commissioning', 'Test']
+
+    for chain in triggerPythonConfig.theL2HLTChains + triggerPythonConfig.theEFHLTChains:
+        if len(chain.groups) == 0:
+            log.error( "IN CHAIN: GROUP undefined for chain: " + str(chain.chain_name) )
+        else:
+            GroupAssigned=False
+            
+            for group in GroupItems:
+                if group in chain.groups:
+                    GroupAssigned=True
+            if not GroupAssigned and CheckGroups:
+                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):
+    """ Checks streamer consistency
+    Checks that all chains are assigned to existing streams
+    """
+    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
+    already_used_robs={}
+    for chain in triggerPythonConfig.theHLTChains:
+        if len(chain.stream_tag) == 0:
+            log.error( "IN CHAIN: STREAMTAG undefined for chain: " + str(chain.chain_name) )
+        else:
+            for stream in chain.stream_tag:
+                if stream[0] not in allStreams:
+                    log.error(' Chain: ' + chain.chain_name + ' has the wrong streamer ' + stream[0])
+                else:
+                    ##check data scouting streaming name
+                    if "DataScouting" in stream[0]:
+                        rob_id= stream[0].split("_")[1]                        
+                        if rob_id  in already_used_robs and stream[0] is not already_used_robs[rob_id]:
+                            log.error( "Duplicated ROB in stream " + stream[0] + 
+                                       "(ROB number " + str(stream[0].split("_")[1]) + " already used in stream " +  already_used_robs[stream[0].split("_")[1]] + ")")
+                            already_used_robs[rob_id]=stream[0]
+                        else:                 
+                            already_used_robs[rob_id]=stream[0] 
+
+    
+    ##Chech that there is no duplication of ROB_ID for the ds streams defined in the all TM
+    already_used_robs={}
+    for stream in allStreams:
+        if "DataScouting" in stream:
+            rob_id= stream.split("_")[1]                        
+            if rob_id  in already_used_robs:
+                log.error( "Duplicated ROB in stream " + stream + 
+                           "(ROB number " + str(rob_id) + " already used in stream " +  already_used_robs[rob_id] + ")")
+                already_used_robs[rob_id]=stream
+            else:
+                already_used_robs[rob_id]=stream
+                
+
+def resetAllPrescales(triggerPythonConfig):
+    for sig in triggerPythonConfig.allChains.values():
+        for chain in sig:
+            if float(chain.prescale) > 0.:
+                chain.prescale = '1'
+            if float(chain.pass_through) > 0.:
+                chain.pass_through = '1'
+            if float(chain.rerun_prescale) > 0.:   
+                chain.rerun_prescale = '1'
+    for item in triggerPythonConfig.allItems.values():
+        if float(item.prescale) > 0.:
+            item.prescale = '1'
+        
+def allSignatures():
+    sigs = []
+    slices = (
+        TriggerFlags.MuonSlice,
+        TriggerFlags.JetSlice,
+        TriggerFlags.METSlice,
+        TriggerFlags.TauSlice,
+        TriggerFlags.EgammaSlice,
+        TriggerFlags.MinBiasSlice,
+        TriggerFlags.CombinedSlice,
+        )
+    for a in slices:
+        if a.signatures.statusOn: sigs += a.signatures()
+    return sigs
+
+
+def findL1TT(chain, triggerPythonConfig):
+    l2_chain = chain
+    if chain.level == 'EF':
+        l2_chain_name = chain.lower_chain_name
+        l2_chain = triggerPythonConfig.getHLTChain(l2_chain_name)
+    if l2_chain == None:
+        return -2
+    l1_item_name = l2_chain.lower_chain_name
+    l1_item = triggerPythonConfig.getLvl1Item(l1_item_name)
+    if l1_item==None:
+        return -1
+    return l1_item.trigger_type
+
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuUtils.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuUtils.py
new file mode 100644
index 0000000000000000000000000000000000000000..41c6d631ae91c07f55444b07c36a980000ad58ea
--- /dev/null
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuUtils.py
@@ -0,0 +1,444 @@
+# Copyright (C) 2002-2017 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.MenuUtils' )
+
+
+def splitInterSignatureChainDict(chainDict):
+    listOfSplitChainDicts = []
+    for chainPart in chainDict['chainParts']:
+        thisSignature = chainPart['signature']
+        chainPartAdded = False        
+        for splitChainDict in listOfSplitChainDicts:
+            if thisSignature == splitChainDict['chainParts'][0]['signature']:            
+                splitChainDict['chainParts'] += [chainPart]
+                chainPartAdded = True
+                break
+        if not chainPartAdded:
+            newSplitChainDict = deepcopy(chainDict)
+            newSplitChainDict['chainParts'] = [chainPart]
+            newSplitChainDict['signature'] = chainPart['signature']
+            listOfSplitChainDicts += [newSplitChainDict]
+            
+    #special code to handle chains with "AND" in the name
+    #jet,ht and bjet jet chains belong to the same signature
+    #so an extra key is needed to make sure the part are treated separately
+    for splitChainDict in listOfSplitChainDicts:
+        if 'AND' in [part['extra'] for part in  splitChainDict['chainParts']]:
+            log.info("Implement extra splitting, triggered by AND key (%s.)", chainDict['chainName'])
+                
+            listOfSplitChainDicts=[]        
+            addNewSplit= False      
+            for chainPart in chainDict['chainParts']:
+                thisSignature = chainPart['signature']
+                chainPartAdded = False        
+                
+                #chainPart coming after the AND, change temporaly the Signature name, 
+                #so it does not get added to existing dictionary
+                if addNewSplit:                    
+                    thisSignature = 'extraSplit'            
+                    addNewSplit = False        
+
+                #chainPart containing at AND,
+                # make sure next chainPart is added as a new elemented to the listOfSplitChainDicts
+                if 'AND' in chainPart['extra']:
+                    addNewSplit = True
+                    #log.info("AND key found, next chainPart will be added as a new element of listOfSplitChainDicts")
+                    
+                for splitChainDict in listOfSplitChainDicts:
+                    #if AND present in an elemenent of listOfSplitChainDicts, don't add anything to it
+                    if 'AND' in [part['extra'] for part in splitChainDict['chainParts']]:
+                        continue
+                    if thisSignature == splitChainDict['chainParts'][0]['signature']:            
+                        #log.info("Adding %s to existing element %s.", chainPart['chainPartName'], splitChainDict)
+                        splitChainDict['chainParts'] += [chainPart]
+                        chainPartAdded = True
+                        break
+                if not chainPartAdded:
+                    newSplitChainDict = deepcopy(chainDict)
+                    newSplitChainDict['chainParts'] = [chainPart]
+                    newSplitChainDict['signature'] = chainPart['signature']
+                    listOfSplitChainDicts += [newSplitChainDict]
+                    #log.info("Adding %s as a new element of listOfSplitChainDicts", chainPart['chainPartName'])
+                    
+    #log.info("ListOfSplitChainDicts", chainPart['chainPartName'])
+    
+    #oder the splitted dicts
+    orderedListOfSplitChainDicts = []
+    if "mergingOrder" not in chainDict:
+        log.debug("No merging order given for chain %s.", chainDict['chainName'])
+    elif chainDict["mergingOrder"] == []:
+        log.info("No merging order given for chain %s.", chainDict['chainName'])
+    else:
+        for chainPartName in chainDict["mergingOrder"]:
+            for splitChainDict in listOfSplitChainDicts:                
+                if splitChainDict['chainParts'][0]['chainPartName'] == chainPartName:
+                    orderedListOfSplitChainDicts += [splitChainDict]
+
+        if not len(orderedListOfSplitChainDicts) == len(listOfSplitChainDicts):
+            for chainPartName in chainDict["mergingOrder"]:
+                log.error("Ordering of split chain dicts failed. Please check that orderedListOfSplitChainDicts and listOfSplitChainDicts contain the same elements!!")                
+            log.info(chainDict)
+            
+        return orderedListOfSplitChainDicts
+
+    return listOfSplitChainDicts
+
+
+def splitChainDict(chainDict):
+    listOfChainDicts = []
+    for chainPart in chainDict['chainParts']:
+        newChainDict = deepcopy(chainDict)
+        newChainDict['chainParts'] = chainPart
+        listOfChainDicts += [newChainDict]
+    return listOfChainDicts
+
+
+def _addSequence(chainDef,sequenceToAdd):
+    """
+    Check if sequence is already in chainDef, if not add it
+    """
+    for chainDefSequence in chainDef.sequenceList:
+        if chainDefSequence['output'] == sequenceToAdd['output']:
+            return chainDef
+    chainDef.sequenceList += [sequenceToAdd]
+    return chainDef        
+
+
+def _getSigList(chainDef,sigType="HLT"):
+    """
+    Little helper function to get the list of signatures associated to a trigger level (L2/EF/HLT)
+    """
+    sigList = []
+    for signature in chainDef.signatureList:
+        if signature['listOfTriggerElements'][0][0:len(sigType)] == sigType:
+            sigList += [signature]
+    return sigList
+
+
+def _replicateMissingSignatures(listOfChainDefs,unevenSigs,level):
+    """
+    Loops over the listOfChainDefs, and fills up those ChainDefs that have a shorter signature list at a given level than the largest one with dummy signatures
+    """
+
+    for chainDef in listOfChainDefs:
+
+        # if this is already the chainDef with the longest signatureList nothing has to be done
+        if len(_getSigList(chainDef,level)) == max(unevenSigs):
+            continue
+        else:
+            maxSignatureCounter = -1
+            numberOfSignatures = 0      
+            maxSignatureIndex = -1
+            for signatureIndex,signature in enumerate(chainDef.signatureList):
+                if signature['listOfTriggerElements'][0][0:len(level)] == level:
+                    maxSignatureCounter = max(maxSignatureCounter,signature['signature_counter'])
+                    numberOfSignatures += 1
+                    maxSignatureIndex = signatureIndex
+                    
+            if maxSignatureIndex == -1:
+                log.error('maxSignatureIndex has not been set. Maybe there is no sequence at this level? CHECK IN CODE - fix in work. ')
+                
+            listOfLastTEs = chainDef.signatureList[maxSignatureIndex]['listOfTriggerElements']   
+
+            for i in range(maxSignatureCounter+1, maxSignatureCounter+1+max(unevenSigs)-numberOfSignatures):  
+                if level in ["EF","HLT"]:
+                    chainDef.signatureList += deepcopy([{'signature_counter': i, 'listOfTriggerElements': listOfLastTEs}])
+                elif level == "L2":
+                    chainDef.addSignatureL2(deepcopy(listOfLastTEs))
+                log.info("Added %s signature with TEs %s to ChainDef of chain %s in preparation for parallel merging." % (level,str(listOfLastTEs),chainDef.chain_name))
+                log.debug("ChainDef with replicated signatures at %s: %s", level, chainDef)
+                
+
+
+
+def mergeChainDefs(listOfChainDefs, strategy="parallel", offset=-1,
+                   preserveL2EFOrder=True, removeDuplicateTEs=False, doTopo=True,
+                   chainDicts='', noTEreplication=False, noMergeBJet=False):
+
+    log.debug("Combine using %s  merging", strategy)
+
+    if strategy=="parallel":
+        return _mergeChainDefsParallel(listOfChainDefs,offset,removeDuplicateTEs,noMergeBJet=noMergeBJet)
+    elif strategy=="serial":
+        return _mergeChainDefsSerial(chainDicts,listOfChainDefs,offset,preserveL2EFOrder=preserveL2EFOrder,doTopo=doTopo,noTEreplication=noTEreplication)
+    else:
+        log.error("Merging failed for %s. Merging strategy '%s' not known.", (listOfChainDefs, strategy))
+        return -1
+
+
+
+def _mergeChainDefsSerial(ChainDicts,listOfChainDefs,offset,preserveL2EFOrder=True,doTopo=True,noTEreplication=False):
+
+    """
+    serial merging of chain def objects for combined chains
+    """
+
+    
+    #noTEreplication=False
+    #Add few exception to the replication of the TE
+    jet_count=0
+    met_count=0
+    ht_count=0
+    other_count=0
+    try:
+        if 'upc' in ChainDicts[0]['chainName'] :
+            noTEreplication=True  
+
+        if 'hi' in ChainDicts[0]['chainName'] and 'v2' in  ChainDicts[1]['chainName'] :
+            noTEreplication=True  
+        
+        for chainDict in ChainDicts:
+            if (chainDict["signature"] == "Jet"):
+                jet_count+=1
+            elif (chainDict["signature"] == "HT"):
+                ht_count+=1
+            elif (chainDict["signature"] == "MET"):
+                for chainpart in chainDict["chainParts"]:
+                    if 'xe' in chainpart['trigType'] and 'cell' not in chainpart['EFrecoAlg']:
+                        met_count+=1
+            else:
+                other_count+=1
+
+        #print "BETTA Total count: jet-", jet_count, " HT-", ht_count, " xe-", met_count, "other:-", other_count, " in: ",ChainDicts[0]['chainName']          
+        
+    except:
+        pass
+
+
+    if jet_count > 0 and met_count > 0:
+        noTEreplication=True        
+    if jet_count > 1:
+        noTEreplication=True        
+    if met_count > 1:
+        noTEreplication=True        
+    if jet_count > 0 and ht_count > 0:
+        noTEreplication=True        
+
+
+    listOfChainDefs = deepcopy(listOfChainDefs) 
+
+    # copy the chaindef into which we want to merge the other chaindefs
+    mergedChainDef = deepcopy(listOfChainDefs[0])
+
+    #remove the first chaindef from the list
+    listOfChainDefs.pop(0)
+    
+    # Loop remaining chain defs to be merged
+    #doTopo=False
+    #preserveL2EFOrder=False
+
+    
+    for chainDef in listOfChainDefs:
+        currentLastTEs = mergedChainDef.signatureList[-1]['listOfTriggerElements']
+        
+        for sequence in chainDef.sequenceList:
+            mergedChainDef = _addSequence(mergedChainDef,sequence)
+
+        for signatureIdx,signature in enumerate(chainDef.signatureList):
+            # if a topo is appended after the chain merging, or in same special cases, the replication of the last TEs is not necessary
+            if noTEreplication:
+                log.info("Removing replication of the TE for chain: %s", chainDef.chain_name)
+                signatureToAdd = signature['listOfTriggerElements'] 
+            else:
+                signatureToAdd = signature['listOfTriggerElements'] if doTopo else signature['listOfTriggerElements'] + currentLastTEs 
+            #signatureToAdd = signature['listOfTriggerElements'] 
+            if preserveL2EFOrder:
+                if not offset == -1:
+                    log.error("L2/EF preserving serial merging with offset not yet implemented.")
+                else:
+                    if signature['listOfTriggerElements'][0].startswith("L2"):
+                        mergedChainDef.addSignatureL2(signatureToAdd)
+                    elif signature['listOfTriggerElements'][0].startswith("EF") or signature['listOfTriggerElements'][0].startswith("HLT"):
+                        mergedChainDef.appendSignature(signatureToAdd)
+
+                    else:
+                        log.error("Unknown TE naming :",str(signature['listOfTriggerElements'][0]))
+            else:
+                if offset ==-1:
+                    mergedChainDef.appendSignature(signatureToAdd)
+                else:
+                    if offset+signatureIdx > len(mergedChainDef.signatureList):
+                        mergedChainDef.signatureList[offset+signatureIdx]['listOfTriggerElements'] += signatureToAdd
+                    else:
+                        mergedChainDef.appendSignature(signatureToAdd)
+                    
+    return mergedChainDef
+        
+
+
+def _mergeChainDefsParallel(listOfChainDefs,offset=-1,removeDuplicateTEs=False, noMergeBJet=False):
+
+    """
+    merge chain def objects for combined chains
+    the order of signatures corresponds to the signature counters in the constituent chainDefs
+    """
+
+    listOfChainDefs = deepcopy(listOfChainDefs) 
+
+    for chainDef in listOfChainDefs:
+        log.debug("List of ChainDefs to be merged %s ", chainDef)
+        
+    if offset!=-1:
+        log.warning("Parallel merging with offset has been tested only for EF-only chains. If you're doing something different, check it works ok!!")
+    
+    # check length of signature list in each chain def
+    # if not even, take measures as the sig of the short chain
+    # needs to be propagated to the end
+
+    nL2sigs = []
+    nEFsigs = []
+    nHLTsigs = []
+
+    for cD in listOfChainDefs:
+        
+        nL2sigs += [len(_getSigList(cD,"L2"))]
+        nEFsigs += [len(_getSigList(cD,"EF"))]
+        nHLTsigs += [len(_getSigList(cD,"HLT"))]
+
+        ##Hardocode that the offset is only applied to the second chain in the list
+        if cD==listOfChainDefs[1] and offset!=-1:
+            nL2sigs[-1] = nL2sigs[-1]+offset if nL2sigs[-1]!=0 else nL2sigs[-1]
+            nEFsigs[-1] = nEFsigs[-1]+offset if nEFsigs[-1]!=0 else nEFsigs[-1]
+            nHLTsigs[-1]= nHLTsigs[-1]+offset if nHLTsigs[-1]!=0 else nHLTsigs[-1]
+
+    countsL2 = Counter(nL2sigs)
+    unevenL2Sigs = [val for val, count in countsL2.items() if count <= 1]
+    countsEF = Counter(nEFsigs)
+    unevenEFSigs = [val for val, count in countsEF.items() if count <= 1]
+    countsHLT = Counter(nHLTsigs)
+    unevenHLTSigs = [val for val, count in countsHLT.items() if count <= 1]
+
+    log.debug("nL2sigs %s", nL2sigs)
+    log.debug("countsL2 %s", countsL2)
+    log.debug("unevenL1Sigs %s", unevenL2Sigs)
+    log.debug("nEFsigs %s", nEFsigs)
+    log.debug("countsEF %s", countsEF)
+    log.debug("unevenEFSigs %s", unevenEFSigs)
+    log.debug("nHLTsigs %s", nHLTsigs)
+    log.debug("countsHLT %s", countsHLT)
+    log.debug("unevenHLTSigs %s", unevenHLTSigs)
+
+    nL2sigs = []
+    nEFsigs = []
+    nHLTsigs = []
+
+    if unevenL2Sigs:
+        _replicateMissingSignatures(listOfChainDefs,unevenL2Sigs,"L2")
+    if unevenEFSigs:
+        _replicateMissingSignatures(listOfChainDefs,unevenEFSigs,"EF")
+    if unevenHLTSigs:
+        _replicateMissingSignatures(listOfChainDefs,unevenHLTSigs,"HLT")
+
+    # Now check if the replication of missing signatures worked and all chains have same length signature list
+
+    for cD in listOfChainDefs:
+        nL2sigs += [len(_getSigList(cD,"L2"))]
+        nEFsigs += [len(_getSigList(cD,"EF"))]
+        nHLTsigs += [len(_getSigList(cD,"HLT"))]
+
+        if cD==listOfChainDefs[1] and offset!=-1:
+            #print "Second Chain ",cD.chain_name, _getSigList(cD,"EF")
+            nL2sigs[-1] = nL2sigs[-1]+offset if nL2sigs[-1]!=0 else nL2sigs[-1]
+            nEFsigs[-1] = nEFsigs[-1]+offset if nEFsigs[-1]!=0 else nEFsigs[-1]
+            nHLTsigs[-1]= nHLTsigs[-1]+offset if nHLTsigs[-1]!=0 else nHLTsigs[-1]
+
+    countsL2 = Counter(nL2sigs)
+    unevenL2Sigs = [val for val, count in countsL2.items() if count <= 1]
+    countsEF = Counter(nEFsigs)
+    unevenEFSigs = [val for val, count in countsEF.items() if count <= 1]
+    countsHLT = Counter(nHLTsigs)
+    unevenHLTSigs = [val for val, count in countsHLT.items() if count <= 1]
+    
+
+    if unevenL2Sigs or unevenEFSigs or unevenHLTSigs:
+        log.error("Replication of trigger elements failed. There is still an uneven number of signatures in the ChainDefs of this combined chain.")
+
+
+    # Loop over all chain defs to be merged
+
+
+    
+    mergedChainDef = listOfChainDefs[0]
+    listOfChainDefs.pop(0)
+
+    log.debug("mergedChainDef prior to merging: %s", mergedChainDef)
+
+
+    for chainDef in listOfChainDefs:
+        for sequence in chainDef.sequenceList:
+            mergedChainDef = _addSequence(mergedChainDef,sequence)
+
+        for chainDefSignature in chainDef.signatureList:
+            for mergedChainDefSignature in mergedChainDef.signatureList: 
+                if int(chainDefSignature['signature_counter']) == int(mergedChainDefSignature['signature_counter']):
+                    log.debug("mergedChainDef signatureList before a step: %s", mergedChainDef.signatureList)
+                    mergedChainDefSignature['listOfTriggerElements'] += chainDefSignature['listOfTriggerElements']
+                    log.debug("mergedChainDef signatureList after a step: %s", mergedChainDef.signatureList)
+
+
+
+    if removeDuplicateTEs:
+        for signature in mergedChainDef.signatureList:
+
+            if noMergeBJet: 
+                hasBJetTE = False
+                for TE in set(signature['listOfTriggerElements']):
+                    if not (TE.find("bjet") == -1): hasBJetTE = True
+
+                if not hasBJetTE:
+                    signature['listOfTriggerElements'] = list(set(signature['listOfTriggerElements']))
+            else:
+                signature['listOfTriggerElements'] = list(set(signature['listOfTriggerElements']))
+
+    return mergedChainDef
+        
+
+
+def setupTopoStartFrom(topoThresholds, theChainDef):
+
+    from TrigGenericAlgs.TrigGenericAlgsConf import MergeTopoStarts
+
+    if len(topoThresholds) > 1:
+        from TrigGenericAlgs.TrigGenericAlgsConfig import MergeTopoStartsConfig
+        m = MergeTopoStartsConfig("testInstance")
+        log.debug(m)
+
+
+    te0 = None
+    te1 = None 
+    outTE = None
+    
+    for i in range(len(topoThresholds)):
+        if i == 0:
+            te0 = topoThresholds[i]
+            continue
+        te1 = topoThresholds[i]
+        combTes = te0+"_"+te1
+        outTE = "L2_merged_"+combTes
+        theMergeTopoStarts = MergeTopoStarts("MergeTopoStarts_"+combTes)
+        theChainDef.addSequence( theMergeTopoStarts,[te0,te1], outTE)   
+        theChainDef.addSignatureL2([outTE])   
+        te0=outTE
+
+    return te0
+
+
+    # if ntopoTes ==1:
+    #     topoStartFrom = str(chainDict['topoThreshold'][0])
+    # elif ntoppoTes == 2:
+
+
+    #     te1= str(topoThresholds[0])
+    #     te2=str(topoThresholds[1])
+    #     from TrigGenericAlgs import MergeTopoStarts
+    #     theMergeTopoStarts = MergeTopoStarts("MergeTopoStarts_"+te1+"_"+te2)
+    #     theChainDef.addSequence([te1,te2], theMergeTopoStarts, "merged_"+te1+"_"+te2)
+    #     topoStartFrom = "merged_"+te1+"_"+te2
+    # else:
+    #     log.error('3 topo Tes to merge not implemented (can be done though!')                    
+
+
+
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/SignatureDicts.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/SignatureDicts.py
new file mode 100644
index 0000000000000000000000000000000000000000..fac6245ac727e4c667bb0b2043549dc3814c16ac
--- /dev/null
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/SignatureDicts.py
@@ -0,0 +1,900 @@
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+from AthenaCommon.Logging import logging
+logging.getLogger().info("Importing %s",__name__)
+logSignatureDict = logging.getLogger("TriggerMenu.menu.SignatureDicts")
+from copy import deepcopy
+
+#==========================================================
+##This is stored in chainDict['Signature']
+#==========================================================
+SliceIDDict = {
+    'Electron': 'e',
+    'Jet'     : 'j',
+    'HT'      : 'ht',
+    'Photon'  : 'g',
+    'Muon'    : 'mu',
+    'Tau'     : 'tau',
+    'MET'     : 'xe',
+    'XS'      : 'xs',
+    'TE'      : 'te',
+    'MinBias' : 'mb',
+    'HeavyIon' : 'hi',
+    'Cosmic'  : 'cosmic',
+    'Calibration'   : 'calib',
+    'Streaming'     : 'streamer',
+    'Monitoring'    : 'mon',
+    'Beamspot'      : 'beamspot',
+    'EnhancedBias'  : 'eb',
+    'Test'          : 'TestChain',
+}
+
+#==========================================================
+# ---- Generic Template for all chains          ----
+# ---- chainParts specific information given in ----
+# ---- signature specific dictionaries below    ----
+#==========================================================
+ChainDictTemplate = {
+    'chainName'    : '',
+    'L1item'        : '',
+    'topo'          : '',
+    'signatures'    : '',
+    'stream'        : '',
+    'groups'        : [],
+    'EBstep'        : '',
+    'chainParts'   : [],
+    'topoStartFrom' : False,
+}
+
+
+
+#==========================================================
+# ----- Allowed HLT Topo Keywords (in addition to generic topos like DR, DETA, DPHI...)
+#==========================================================
+AllowedTopos_e = ["Jpsiee","Zeg","Zee"]
+AllowedTopos_mu = ['Jpsimumu']
+AllowedTopos_xe = ['1dphi10', '2dphi05', '6dphi05', '6dphi15', '2dphi05', '2dphi15', 'mt25', 'mt35', 'razor140', 'razor170', 'razor200','razor220','razor100','razor185','razor195']
+AllowedTopos_bphys = ['bJpsi', 'bTau', 'bDimu', 
+                      'bJpsimumu', 'bUpsimumu', 
+                      'bBmumu', 'bBmumux', 
+                      'bBmumuxv2', 'bBmumuxv3',
+                      '02dr-2mu6', '2invm', 
+                      'BcmumuDs' ,   'BcmumuDsloose' ,
+                      '7invm9', 'noos', 'noid', 'novtx',
+                      '11invm60','18invm60', 'bUpsi',
+                      'Trkloose', 'Zmumu', 'noL2', 'noEFbph',
+                      'noinvm', 'ss', 'BpmumuKp', 'Taumumux', 'Dsmumux', 'LbmumuLambda',
+                      'trkTau', 'bTauTrk', 'bDsPhiX', 'bPhi','bDsPhiXtight',
+                      '11invm24', '24invm60',
+                      'tightChi2', 'Lxy0', 'Ftk','legacyVtx',
+                      'BsmumuPhi', 'BsJpsiPhi']
+AllowedTopos_jet = ['muvtx',
+                    'revllp',
+                    'llp',
+		    'trkiso',
+		    'noiso',
+                    'pufix',
+                    'deta2',
+                    'deta20',
+                    'deta25',
+                    'deta30',
+                    'deta35',
+                    'invm250',
+                    'invm400',
+                    'invm500',
+                    'invm600',
+                    'invm700',
+                    'invm800',
+                    'invm1000']
+AllowedTopos_Tau = ['ditauL', 'ditauM', 'ditauT','tautsf','notautsf','50mVis10000','60mVis10000','03dR27','03dR30']
+AllowedTopos_comb = ['taumass', 'dr05', 'dz02','dz99']
+
+#AllowedTopos = AllowedTopos_e+AllowedTopos_mu+AllowedTopos_bphys+AllowedTopos_jet+AllowedTopos_xe+AllowedTopos_comb
+
+#NOTE: removed jets from list, special case for VBF triggers
+AllowedTopos = AllowedTopos_e + AllowedTopos_mu + AllowedTopos_bphys + AllowedTopos_xe + AllowedTopos_Tau + AllowedTopos_comb
+
+
+#==========================================================
+# Jet
+#==========================================================
+# ---- Jet Dictinary of all allowed Values ----
+JetChainParts = {
+    'signature'    : ['Jet'],
+    'L1item'       : '',
+    'chainPartName': '',
+    'threshold'    : '',
+    'multiplicity' : '',
+    'etaRange'     : ['0eta490','0eta320','0eta240', '240eta490',
+                      '280eta320', '320eta490', 'n320eta490', 'p320eta490'],
+    'gscThreshold' : ['gsc'],
+    'trigType'     : ['j'],
+    'extra'        : ['noL1','test1','test2','test3', 'test4',
+                      'test5', 'test6', 'delayed','AND'],
+    'cleaning'     : ['cleanL','cleanT','cleanLLP',
+                      'cleanLA','cleanTA','cleanLLPA', 'noCleaning'
+                      ],
+    'recoAlg'      : ["a3","a4", "a10", "a10r", "a10t"],
+    'dataType'     : ['TT', 'tc', 'cc', 'ion'],
+    'calib'        : ["had","lcw","em"],
+    'jetCalib'     : ["jes","sub","subjes","subjesIS", "nojcalib"],
+    'scan'         : ['FS','PS'],
+    'addInfo'      : ['perf'],    
+    'TLA'          : ['0i1c200m400TLA', '0i1c400m600TLA', '0i1c600m800TLA',
+                      '0i1c800m1000TLA', '0i1c500m2000TLA',
+                      '1i2c100m300TLA','1i2c300m500TLA','1i2c500m700TLA',
+                      '1i2c100m8000TLA','1i2c200m8000TLA','0i1c500m900TLA','1i2c500m900TLA','1i2c600m800TLA'],
+    'topo'         : AllowedTopos_jet,
+    'bTag'         : ['bloose', 'bmedium', 'btight', 'bperf','boffperf', 'bmv2c2040', 'bmv2c2050', 'bmv2c2060', 'bmv2c2070', 'bmv2c2077', 'bmv2c2085'],
+    'bTracking'    : ['EFID','FTK','FTKVtx','FTKRefit'],
+    'bConfig'      : ['split', 'hybrid', 'singlepass'],
+#    'bMatching'    : ['mu4antidr05', 'mu6antidr05'],
+    'bMatching'    : ['antimatchdr05mu'],
+    'dataScouting' : ['ds1', 'ds2'],
+    'trkopt'       : ['notrk', 'ftk', 'ftkrefit'],
+}
+
+
+# ---- Jet Dictinary of default Values ----
+JetChainParts_Default = {
+    'signature'    : ['Jet'],
+    'L1item'       : '',
+    'threshold'    : '',
+    'multiplicity' : '',
+    'etaRange'     : '0eta320',
+    'trigType'     :'j',
+    'extra'        : '',
+    'cleaning'     : 'noCleaning',
+    'recoAlg'      :'a4',
+    'dataType'     :'tc',
+    'calib'        :'em',
+    'jetCalib'     :'subjesIS',
+    'scan'         :'FS',
+    'addInfo'      : [],    
+    'TLA'          : '',    
+    'topo'         : [],  
+    'bTag'         : '',
+    'bTracking'    : '',
+    'bConfig'      : [],
+    'bMatching'    : [],
+    'dataScouting' : '',
+    'trkopt'       : 'notrk',
+    }
+from TriggerJobOpts.TriggerFlags import TriggerFlags
+
+if "v6" in TriggerFlags.triggerMenuSetup():
+    JetChainParts_Default.update({'jetCalib'     :'subjes',})
+
+#==========================================================
+# HT chains
+#==========================================================
+# ---- HT Dictinary of all allowed Values ----
+HTChainParts = deepcopy(JetChainParts)
+HTChainParts['signature']    = ['HT']
+HTChainParts['trigType']     = ['ht']
+HTChainParts['extra']     = ['j20', 'j25', 'j30', 'test4']
+# ---- HTDictinary of default Values ----
+HTChainParts_Default = deepcopy(JetChainParts_Default)
+HTChainParts_Default['signature']    = ['HT']
+HTChainParts_Default['trigType']     = 'ht'
+HTChainParts_Default['extra']     = ''
+
+#==========================================================
+# Muon 
+#==========================================================
+# ---- Muon Dictinary of all allowed Values ----
+MuonChainParts = {
+    'signature'      : ['Muon'],
+    'L1item'         : '',
+    'chainPartName'  : '',
+    'multiplicity'   : '',    
+    'trigType'       : ['mu'],
+    'etaRange'       : ['0eta105', '0eta250','0eta010','0eta500'],
+    'threshold'      : '',
+    'extra'          : ['noL1'],
+    'IDinfo'         : [],
+    'isoInfo'        : ['iloose', 'imedium', 'itight', 'ivarloose', 'ivarmedium','icalo','iloosecalo','imediumcalo','iloosems', 'ivarloosecalo', 'ivarmediumcalo'],
+    'reccalibInfo'   : ['msonly', 'l2msonly', 'l2idonly', 'nomucomb', 'idperf','muoncalib', 'mucombTag','muL2', 'mgonly'],
+    'trkInfo'        : ['fasttr', 'hlttr', 'ftk', 'IDT'],
+    'hypoInfo'       : [],
+    'FSinfo'         : ['ftkFS', 'nscan03', 'l2nscan03', 'nscan05', 'l2nscan05', 'JpsimumuFS', 'JpsimumuL2','calotag'],
+    'L2IDAlg'        : ['L2Star','IdScan','FTK','FTKRefit'],
+    'L2SAAlg'        : ['muFast', 'l2muonSA',],
+    'L2CBAlg'        : ['muComb',],
+    'EFAlg'          : ['SuperEF'],
+    'addInfo'        : ['cosmicEF', 'cosmic','IdTest','fsperf', 'ds1', 'ds2','ds3', 'r1extr', 'perf', 'noEF','10invm30','pt2','z10','llns','noComb'],
+    'overlapRemoval' : ['wOvlpRm', 'noOvlpRm', 'noMuCombOvlpRm'],
+    'topo'           : AllowedTopos_mu,
+    'flavour'        : ['hf'],
+    'specialStream'  : ['delayed']
+    }
+# ---- MuonDictinary of default Values ----
+MuonChainParts_Default = {
+    'signature'      : ['Muon'],
+    'L1item'         : '',
+    'multiplicity'   : '',    
+    'trigType'       : ['mu'],
+    'etaRange'       : '0eta250',    
+    'threshold'      : '',
+    'extra'          : '',    
+    'IDinfo'         : '',    
+    'isoInfo'        : '',    
+    'reccalibInfo'   : '',    
+    'trkInfo'        : '',    
+    'hypoInfo'       : '',    
+    'FSinfo'         : '',
+    'L2IDAlg'        : ['L2StarA'],
+    'L2SAAlg'        : ['l2muonSA'],
+    'L2CBAlg'        : ['muComb'],
+    'EFAlg'          : ['SuperEF'],
+    'overlapRemoval' : ['wOvlpRm'],
+    'addInfo'        : [],
+    'topo'           : [],
+    'flavour'        : '',
+    'specialStream'  : '',
+    }
+
+#==========================================================
+# Bphysics
+#==========================================================
+# ---- Allowed Keywords ----
+#AllowedMatchingKeywords = ['antidr']
+# ---- Bphysics Dictinary of all allowed Values ----
+BphysicsChainParts = deepcopy(MuonChainParts)
+#BphysicsChainParts['bTracking'] = ['FTK']
+BphysicsChainParts['signature'] = ['Bphysics']
+BphysicsChainParts['topo'] = AllowedTopos_bphys
+# ---- Bphysics Dictinary of default Values ----
+BphysicsChainParts_Default = deepcopy(MuonChainParts_Default)
+BphysicsChainParts_Default['signature'] = ['Bphysics']
+BphysicsChainParts_Default['topo'] = []
+BphysicsChainParts_Default['overlapRemoval'] = ['noOvlpRm']
+
+#==========================================================
+# Taus
+#==========================================================
+# ---- Tau Dictionary of all allowed Values ----
+TauChainParts = {
+    'signature'    : ['Tau'],
+    'L1item'       : '',
+    'chainPartName': '',
+    'threshold'    : '',
+    'preselection' : ['r1', 'FTK', 'FTKRefit', 'FTKNoPrec', 'calo', 'track', 'mvonly', 'ptonly', 'caloonly', 'trackonly', 'tracktwo', 'trackcalo', 'tracktwocalo','tracktwo2015'],
+    'selection'    : ['medium0','loose1', 'medium1', 'tight1', 'perf', 'perf0', 'r1medium1', 'r1perf', 'cosmic', 'kaonpi1', 'kaonpi2', 'dipion1', 'dipion1loose', 'dipion2', 'dikaon', 'dikaontight', 'dikaonmass', 'dikaonmasstight', 'singlepion', 'singlepiontight',  'medium1HighptL', 'medium1HighptM', 'medium1HighptH'],
+    'multiplicity' : '',
+    'trigType'     : ['tau'],   
+    'trkInfo'      : ['idperf'],
+    'extra'        : '',
+    'recoAlg'      : '',
+    'calib'        : '',
+    'addInfo'      : ['IdTest'],
+    'topo'         : AllowedTopos_Tau,
+}
+TauChainParts_Default = {
+    'signature'    : ['Tau'],
+    'L1item'       : '',
+    'chainPartName': '',
+    'threshold'    : '20',
+    'preselection' : 'tracktwo',
+    'selection'    : 'medium1',
+    'multiplicity' : '',
+    'trigType'     : ['tau'],   
+    'trkInfo'      : [],
+    'extra'        : '',
+    'recoAlg'      : '',
+    'calib'        : '',
+    'addInfo'      : '',
+    'topo'         : [],
+}
+
+#==========================================================
+# MET
+#==========================================================
+# ---- Met Dictinary of all allowed Values ----
+METChainParts = {
+    'signature'    : ['MET'],
+    'L1item'       : '',
+    'chainPartName': '',
+    'threshold'    : '',
+    'multiplicity' : '',
+    'topo'         : AllowedTopos_xe,
+    'trigType'     : ['xe'],   
+    'extra'        : ['noL1'],
+    'calib'        : ['lcw','had','em'],    
+    'L2recoAlg'    : ['','l2fsperf','L2FS'],
+    'EFrecoAlg'    : ['tc','cell','pueta','mht','pufit'],
+    'L2muonCorr'   : ['','wL2MuFEB','wEFMuFEB'],
+    'EFmuonCorr'   : ['','wEFMu'],
+    'addInfo'      : ['FStracks'],
+    }
+# ---- MetDictinary of default Values ----
+METChainParts_Default = {
+    'signature'      : ['MET'],
+    'L1item'         : '',
+    'trigType'       : ['xe'],
+    'threshold'      : '',
+    'extra'          : '',
+    'calib'          : 'lcw',
+    'L2recoAlg'      : '',
+    'EFrecoAlg'      : 'cell',
+    'L2muonCorr'     : '',
+    'EFmuonCorr'     : '',
+    'addInfo'        : '',
+    }
+
+
+#==========================================================
+# XS
+#==========================================================
+# ---- xs Dictinary of all allowed Values ----
+XSChainParts = METChainParts 
+XSChainParts['signature'] = ['XS']
+XSChainParts['trigType']  = ['xs'],   
+
+# ---- xs Dictinary of default Values ----
+XSChainParts_Default = METChainParts_Default
+XSChainParts_Default['signature'] = ['XS']
+XSChainParts_Default['trigType']  = ['xs']
+
+#==========================================================
+# TE
+#==========================================================
+# ---- te Dictinary of all allowed Values ----
+TEChainParts = METChainParts 
+TEChainParts['signature'] = ['TE']
+TEChainParts['trigType']  = ['te'],   
+
+# ---- te Dictinary of default Values ----
+TEChainParts_Default = METChainParts_Default
+TEChainParts_Default['signature'] = ['TE']
+TEChainParts_Default['trigType']  = ['te']
+
+
+#==========================================================
+# Electron Chains
+#==========================================================
+# ---- Electron Dictinary of all allowed Values ----
+ElectronChainParts = {
+    'signature'      : ['Electron'],
+    'chainPartName'  : '',
+    'L1item'         : '',
+    'extra'          : 'ion',
+    'multiplicity'   : '',    
+    'trigType'       : ['e'],
+    'threshold'      : '',
+    'etaRange'       : ['0eta250', '250eta490'],
+    'IDinfo'         : ['loose', 'medium', 'tight', 'lhloose', 'lhmedium', 'lhtight', 'loose1', 'medium1', 'tight1', 'vloose', 'lhvloose', 'mergedtight'],
+    'isoInfo'        : [ 'iloose','ivarloose'],
+    'trkInfo'        : ['fasttr', 'hlttr', 'IDTrkNoCut','FwdBackTrk','idperf'],
+    'caloInfo'       : ['L2EFCalo','HLTCalo'],
+    'lhInfo'         : ['cutd0dphideta','nod0','nodphires','nodeta','smooth'],
+    'L2IDAlg'        : ['L2StarA','L2StarB','L2StarC','FTK','TRT','SiTrack','IdScan'],
+    'addInfo'        : ['etcut','ringer','conv','etisem','gsf','trkcut',
+                        'L2Star','perf','IdTest'],
+    }
+# ---- Egamma Dictinary of default Values ----
+ElectronChainParts_Default = {
+    'signature'      : ['Electron'],
+    'multiplicity'   : '',    
+    'L1item'         : '',
+    'trigType'       : '',
+    'threshold'      : '',
+    'etaRange'       : '0eta250',
+    'extra'          : '',
+    'IDinfoType'     : '',
+    'IDinfo'         : '',
+    'isoInfo'        : '',
+    'reccalibInfo'   : '',
+    'trkInfo'        : '',
+    'caloInfo'       : '',   
+    'lhInfo'         : '',
+    'L2IDAlg'        : '',
+    'hypoInfo'       : '',
+    'recoAlg'        : '',
+    'FSinfo'         : '',
+    'addInfo'        : [],
+    }
+
+
+#==========================================================
+# Photon chains
+#==========================================================
+# ---- Photon Dictinary of all allowed Values ----
+PhotonChainParts = {
+    'L1item'         : '',
+    'signature'      : ['Photon'],
+    'chainPartName'  : '',
+    'multiplicity'   : '',    
+    'trigType'       : ['g'],
+    'threshold'      : '',
+    'extra'          : ['i', 'i5', 'i6', 'ns', 'Tvh', 'ion'],
+    'IDinfo'         : ['loose', 'medium', 'tight', 'NoCut', 'nocut','loose1', 'medium1', 'tight1'],
+    'isoInfo'        : ['ivloose', 'iloose', 'itight'],
+    'reccalibInfo'   : ['MSonly', 'MGonly'],
+    'trkInfo'        : ['fasttr', 'hlttr', 'ftk'],
+    'caloInfo'       : ['HLTCalo'],
+    'hypoInfo'       : '',
+    'recoAlg'        : [],
+    'FSinfo'         : ['ftkFS',],
+    'addInfo'        : ['etcut', 'jetcalibdelayed', 'cosmic', 'perf', 'hiptrt','ringer','conv','larpeb',],
+    }
+
+# ---- Photon Dictinary of default Values ----
+PhotonChainParts_Default = {
+    'signature'      : ['Photon'],
+    'L1item'         : '',
+    'multiplicity'   : '',    
+    'trigType'       : '',
+    'threshold'      : '',
+    'extra'          : '',
+    'IDinfo'         : '',
+    'isoInfo'        : '',
+    'reccalibInfo'   : '',
+    'trkInfo'        : '',
+    'caloInfo'       : '',    
+    'hypoInfo'       : '',
+    'recoAlg'        : '',
+    'FSinfo'         : '',
+    'addInfo'        : [],
+    }
+
+#==========================================================
+# Test chains
+#==========================================================
+# ---- Test Dictinary of all allowed Values ----
+TestChainParts = {
+    'L1item'         : '',
+    'signature'      : ['Test'],
+    'chainPartName'  : '',
+    'multiplicity'   : '',    
+    'trigType'       : ['TestChain'],
+    'threshold'      : '',
+    'addInfo'        : [''],
+    }
+
+# ---- Test Dictionary of default Values ----
+TestChainParts_Default = {
+    'signature'      : ['Test'],
+    'L1item'         : '',
+    'multiplicity'   : '',    
+    'trigType'       : '',
+    'threshold'      : '',
+    'addInfo'        : [],
+    }
+
+
+
+
+#==========================================================
+# Combined Chains
+#==========================================================
+# ---- Combined Dictinary of all allowed Values ----
+CombinedChainParts = deepcopy(PhotonChainParts)
+CombinedChainParts['signature'] = ['Photon','Muon']
+CombinedChainParts['chainParts'] = ['g','mu'],
+CombinedChainParts['topo'] = AllowedTopos_comb
+# ---- Combined Dictinary of default Values ----
+CombinedChainParts_Default = deepcopy(PhotonChainParts_Default)
+CombinedChainParts_Default['signature'] = ['Photon','Muon']
+CombinedChainParts_Default['chainParts'] = ['g','mu'],
+CombinedChainParts_Default['trigType'] =['g','mu']
+CombinedChainParts_Default['topo'] = []
+
+#==========================================================
+# MinBias chains
+#==========================================================
+# ---- MinBias Dictionary of all allowed Values ----
+MinBiasChainParts = {
+    'signature'      : ['MinBias'],
+    'L1item'         : '',
+    'chainPartName'  : '',
+    'multiplicity'   : '',    
+    'trigType'       : ['mb'],
+    'threshold'      : '',
+    'extra'          : ['noisesup', 'vetombts2in', 'vetombts1side2in',  'vetospmbts2in', "vetosp" ,'ion', 'ncb', 'blayer', 'exclusiveloose', 'exclusivetight'], #ncb = non collision background, blayer = only sum innermost pix layer
+    'IDinfo'         : [],
+    'ZDCinfo'        : ['lg', 'hg'],
+    'trkInfo'        : ['hlttr', 'ftk', 'costr'],
+    'hypoL2Info'     : ['sp2', 'sp3', 'sp5', 'sp10', 'sp15', 'sp100', 'sp300', 'sp400', 'sp500', 'sp600', 'sp700', 'sp800', 'sp900',
+                        'sp1000', 'sp1200', 'sp1300', 'sp1400', 'sp1500', 'sp1600', 'sp1700', 'sp1800', 
+                        'sp2000', 'sp2100', 'sp2200', 'sp2300', 'sp2400', 'sp2500', 'sp2700', 'sp2800', 'sp2900', 'sp3000',
+                        'sp3100', 'sp3500', 'sp4100', 'sp4500', 'sp4800', 'sp5000', 'sp5200',],
+    'pileupInfo'     : ['pusup200','pusup300','pusup350', 'pusup400', 'pusup450', 'pusup500', 'pusup550', 'pusup600', 'pusup700', 'pusup750', 'pusup800', 'pusup900',
+                        'pusup1000', 'pusup1100', 'pusup1200', 'pusup1300', 'pusup1400', 'pusup1500',],
+    'hypoEFInfo'     : ['trk3','trk5','trk10','trk15',  'trk20',  'trk30',  'trk40', 'trk45', 'trk50', 'trk55', 'trk60', 'trk65', 'trk70', 'trk75', 'trk80', 'trk90',
+                        'trk100', 'trk110', 'trk120', 'trk130', 'trk140', 'trk150', 'trk160', 'trk180', 'trk200', 'trk220', 'trk240', 'trk260', 'trk280',      
+                        'pt2', 'pt4', 'pt6', 'pt8', ],
+    'hypoEFsumEtInfo': ['sumet40', 'sumet50', 'sumet60', 'sumet70', 'sumet80', 'sumet90', 'sumet110', 'sumet150',],
+    'recoAlg'        : ['mbts', 'sptrk', 'sp', 'noalg', 'perf', 'hmt', 'hmtperf', 'idperf', 'zdcperf'],
+    'addInfo'        : ['peb'],
+    }
+# ---- MinBiasDictinary of default Values ----
+MinBiasChainParts_Default = {
+    'signature'      : ['MinBias'],
+    'L1item'         : '',
+    'chainPartName'  : '',
+    'multiplicity'   : '',    
+    'trigType'       : ['mb'],
+    'threshold'      : '',
+    'extra'          : '',    
+    'IDinfo'         : '',
+    'ZDCinfo'        : '',    
+    'trkInfo'        : '',    
+    'hypoL2Info'       : '',
+    'pileupInfo'       : '',
+    'hypoEFInfo'       : '',
+    'hypoEFsumEtInfo': '',    
+    'recoAlg'        : [],
+    'addInfo'        : [],
+    }
+
+#==========================================================
+# HeavyIon chains
+#==========================================================
+# ---- HeavyIon Dictionary of all allowed Values ----
+HeavyIonChainParts = {
+    'signature'      : ['HeavyIon'],
+    'L1item'         : '',
+    'chainPartName'  : '',
+    'multiplicity'   : '',
+    'trigType'       : ['hi'],
+    'threshold'      : '',
+    'extra'          : ['th1', 'th2', 'th3', 'th4', 'th5', 'th6', 'th7', 'th8', 'th9', 'th10', 'th11', 'th12', 'th13', 'th14', 'th15', 'th16', 
+                        'th0p', 'th005p', 'th01p', 'th025p', 'th05p', 'th10p', 'th15p', 'th20p',
+                        'perf', 'perfzdc'],
+    'IDinfo'         : [],
+    'trkInfo'        : [],
+    'eventShape'     : ['v2', 'v3', 'v23', 'v2A', 'v2C'],    
+    'eventShapeVeto' : ['veto2', 'veto3'],
+    'hypoL2Info'     : ['loose', 'medium', 'tight', 'gg',],
+    'pileupInfo'     : ['zdcpu'],
+    'hypoEFInfo'     : [],
+    'hypoEFsumEtInfo': ['fcalet3000', 'fcalet3306', 'fcalet3391', 'fcalet3516',],
+    'recoAlg'        : ['ucc', 'upc'],
+    'addInfo'        : [ ],
+    'gap'            : [ 'FgapA', 'FgapC', 'FgapAC',   'L2FgapA', 'L2FgapC', 'L2FgapAC',   'EFFgapA', 'EFFgapC', 'EFFgapAC' ],
+    }
+
+# ---- HeavyIonDictinary of default Values ----
+HeavyIonChainParts_Default = { 
+    'signature'      : ['HeavyIon'],
+    'L1item'         : '',
+    'chainPartName'  : '',
+    'multiplicity'   : '',
+    'trigType'       : ['hi'],
+    'threshold'      : '',
+    'extra'          : '',
+    'IDinfo'         : '',
+    'trkInfo'        : '',
+    'eventShape'     : '',
+    'eventShapeVeto' : '',
+    'hypoL2Info'       : '',
+    'pileupInfo'       : '',
+    'hypoEFInfo'       : '',
+    'hypoEFsumEtInfo': '',    
+    'recoAlg'        : [],
+    'addInfo'        : [],
+    'gap'            : ''
+    }
+
+
+#==========================================================
+# ---- CosmicDef chains -----
+#==========================================================
+AllowedCosmicChainIdentifiers = ['larps',
+                                 'larhec',
+                                 'tilecalib', 
+                                 #'pixel', 
+                                 'sct', 
+                                 'id',]
+
+# ---- Cosmic Chain Dictinary of all allowed Values ----
+CosmicChainParts = {
+    'signature'      : ['Cosmic'],
+    'chainPartName'  : '',
+    'L1item'       : '',
+    'purpose'        : AllowedCosmicChainIdentifiers,
+    'addInfo'        : ['cosmicid','noise', 'beam', 'laser', 'AllTE', 'central', 'ds'], #'trtd0cut'
+    'trackingAlg'    : ['idscan', 'sitrack', 'trtxk'],
+    'hits'           : ['4hits'],
+    'threshold'      : '',
+    'multiplicity'   : '',
+    'trigType'       : 'cosmic', 
+    'extra'          : '',
+    }
+
+# ---- Cosmic Chain Default Dictinary of all allowed Values ----
+CosmicChainParts_Default = {
+    'signature'      : ['Cosmic'],
+    'chainPartName'  : '',
+    'L1item'       : '',
+    'purpose'        : [],
+    'addInfo'        : [],
+    'trackingAlg'    : [],
+    'hits'           : [],
+    'threshold'      : '',
+    'multiplicity'   : '',
+    'trigType'       : '', 
+    'extra'          : '',
+
+    }
+
+#==========================================================
+# ---- StreamingDef chains -----
+#==========================================================
+AllowedStreamingChainIdentifiers = ['noalg']
+
+# ---- Streaming Chain Dictinary of all allowed Values ----
+StreamingChainParts = {
+    'signature'      : ['Streaming'],
+    'chainPartName'  : '',
+    'L1item'       : '',
+    'threshold'      : '',
+    'multiplicity'   : '',
+    'streamingInfo'  : ['bkg', 'idmon', 'mb', 'eb', 'zb','to','standby',
+                        'hltpassthrough', 'jettauetmiss', 'larcells', 
+                        'cosmiccalo', 'cosmicmuons','idcosmic', 'dcmmon','zb', 'l1calo', 'l1topo','ftk'],
+    'trigType'       : 'streamer', 
+    'extra'          : '',
+    'streamType'        : AllowedStreamingChainIdentifiers,
+    'algo' : ['NoAlg']
+    }
+
+# ---- Cosmic Chain Default Dictinary of all allowed Values ----
+StreamingChainParts_Default = {
+    'signature'      : ['Streaming'],
+    'chainPartName'  : '',
+    'L1item'       : '',
+    'threshold'      : '',
+    'multiplicity'   : '',
+    'streamingInfo'  : 'hltpassthrough',
+    'trigType'       : '', 
+    'extra'          : '',
+    'streamType'     : '',
+    'algo' : [],
+    }
+#==========================================================
+# ---- CalibDef chains -----
+#==========================================================
+AllowedCalibChainIdentifiers = ['csccalib',
+                                'larcalib', 
+                                'idcalib', 
+                                'l1calocalib', 
+                                'tilelarcalib',
+                                'alfacalib',
+                                'larnoiseburst',
+                                'ibllumi', 
+                                'lumipeb',
+                                #'vdm',
+                                'lhcfpeb',
+                                'alfaidpeb',
+                                'larpebj',
+                                'l1satmon',
+                                'zdcpeb',
+                                'calibAFP',
+                                ]
+
+# ---- Calib Chain Dictinary of all allowed Values ----
+##stramingInfo not use in ChainConfiguration, only to distinguish streaming
+
+CalibChainParts = {
+    'signature'      : ['Calibration'],
+    'chainPartName'  : '',
+    'L1item'         : '',
+    'purpose'        : AllowedCalibChainIdentifiers,
+    'location'       : ['central', 'fwd'],
+    'calibType'      : [],
+    'addInfo'        : ['loose','noise','beam'],
+    'hypo'           : ['trk9', 'trk16', 'trk29', 'conej40', 'conej165', 'conej75_320eta490', 'conej140_320eta490','satu20em'],
+    'hits'           : [],
+    'streamingInfo'  : ['vdm',],
+    'threshold'      : '',
+    'multiplicity'   : '',
+    'trigType'       : ['trk'], 
+    'extra'          : ['rerun','bs',''],
+    }
+
+# ---- Calib Chain Default Dictinary of all allowed Values ----
+CalibChainParts_Default = {
+    'signature'      : ['Calibration'],
+    'chainPartName'  : '',
+    'L1item'       : '',
+    'purpose'        : [],
+    'calibType'      : [],
+    'addInfo'        : [],
+    'hypo'           : '',
+    'hits'           : [],
+    'streamingInfo'  : [],
+    'threshold'      : '',
+    'multiplicity'   : '',
+    'location'   : '',
+    'trigType'       : '', 
+    'extra'          : '',
+
+    }
+#==========================================================
+# ---- MonitorDef chains -----
+#==========================================================
+AllowedMonitorChainIdentifiers = ['robrequest', 'timeburner', 'idmon', 'costmonitor','cscmon','l1calooverflow','mistimemonl1bccorr','mistimemonl1bccorrnomu','mistimemoncaltimenomu','mistimemoncaltime','mistimemonj400','l1topodebug']
+
+# ---- Monitor Chain Dictinary of all allowed Values ----
+MonitorChainParts = {
+    'signature'      : ['Monitoring'],
+    'chainPartName'  : '',
+    'L1item'       : '',
+    'monType'        : AllowedMonitorChainIdentifiers,
+    'location'       : [],
+    'calibType'      : [],
+    'addInfo'        : [],
+    'hypo'           : ['trkFS',],
+    'hits'           : [],
+    'threshold'      : '',
+    'multiplicity'   : '',
+    'trigType'       : 'mon',
+    'extra'          : '',
+    }
+
+# ---- Monitor Chain Default Dictinary of all allowed Values ----
+MonitorChainParts_Default = {
+    'signature'      : ['Monitoring'],
+    'chainPartName'  : '',
+    'L1item'       : '',
+    'monType'        : [],
+    'calibType'      : [],
+    'addInfo'        : [],
+    'hypo'           : '',
+    'hits'           : [],
+    'threshold'      : '',
+    'multiplicity'   : '',
+    'location'   : '',
+    'trigType'       : '', 
+    'extra'          : '',
+
+    }
+
+#==========================================================
+# ---- EB chains -----
+#==========================================================
+AllowedEBChainIdentifiers = ['eb']
+
+# ---- Enhanced Bias Chain Dictinary of all allowed Values ----
+EnhancedBiasChainParts = {
+    'signature'      : ['EnhancedBias'],
+    'chainPartName'  : '',
+    'L1item'       : '',
+    'algType'        : ['high','firstempty','empty','unpairediso','unpairednoniso', 'low'],
+    'threshold'      : '',
+    'multiplicity'   : '',
+    'trigType'       : '',
+    'extra'          : '',
+    }
+
+# ---- EnhancedBias Chain Default Dictinary of all allowed Values ----
+EnhancedBiasChainParts_Default = {
+    'signature'      : ['EnhancedBias'],
+    'chainPartName'  : '',
+    'L1item'         : '',
+    'algType'        : 'physics',
+    'threshold'      : '',
+    'multiplicity'   : '',
+    'location'   : '',
+    'trigType'       : '', 
+    'extra'          : '',
+
+    }
+
+#==========================================================
+# ---- BeamspotDef chains -----
+#==========================================================
+AllowedBeamspotChainIdentifiers = ['beamspot',]
+BeamspotChainParts = {
+    'signature'      : ['Beamspot'],
+    'chainPartName'  : '',
+    'L1item'         : '',
+    'monType'        : AllowedBeamspotChainIdentifiers,
+    'location'       : ['vtx'],
+#    'addInfo'        : ['trkFS','idperf'],
+    'addInfo'        : ['trkFS', 'allTE', 'activeTE','idperf'],
+    'hypo'           : [],
+    'l2IDAlg'        : ['L2StarB','trkfast','FTK','FTKRefit'],
+    'threshold'      : '',
+    'multiplicity'   : '',
+    'trigType'       : 'beamspot',
+    'extra'          : '',
+    'eventBuildType' : ['peb','pebTRT'],
+    }
+
+# ---- Beamspot Chain Default Dictinary of all allowed Values ----
+BeamspotChainParts_Default = {
+    'signature'      : ['Beamspot'],
+    'chainPartName'  : '',
+    'L1item'       : '',
+    'monType'        : [],
+    'addInfo'        : [],
+    'hypo'           : [],
+    'l2IDAlg'        : [],
+    'threshold'      : '',
+    'multiplicity'   : '',
+    'location'   : 'vtx',
+    'trigType'       : 'beamspot', 
+    'extra'          : '',
+    'eventBuildType' : '',
+    }
+
+#==========================================================
+#==========================================================
+def getSignatureNameFromToken(chainpart):
+    theMatchingTokens = []
+    reverseSliceIDDict = dict([(value, key) for key, value in SliceIDDict.iteritems()]) #reversed SliceIDDict
+    for sig,token in SliceIDDict.items():
+            if (token in chainpart):
+                theMatchingTokens += [token]
+    theToken = max(theMatchingTokens, key=len) # gets the longest string in t
+    if len(theMatchingTokens)>0:
+        if len(theMatchingTokens)>1:
+            logSignatureDict.info('There are several signatures tokens, %s, matching this chain part %s. Picked %s.' % (theMatchingTokens,chainpart,theToken))            
+        return reverseSliceIDDict[theToken]
+    logSignatureDict.error('No signature matching chain part %s was found.' % (chainpart))
+    return False
+
+
+            
+def getSignatureInformation(signature):
+    if signature == 'Electron':
+        return [ElectronChainParts_Default, ElectronChainParts]
+    if signature == 'Photon':
+        return [PhotonChainParts_Default, PhotonChainParts]
+    if signature == "Jet":
+        return [JetChainParts_Default, JetChainParts]
+#    if signature == "Bjet":
+#        return [BjetChainParts_Default, BjetChainParts]
+    if signature == "HT":
+        return [HTChainParts_Default, HTChainParts]
+    if signature == "Tau":
+        return [TauChainParts_Default, TauChainParts] 
+    if (signature == "Muon"):
+        return [MuonChainParts_Default, MuonChainParts]
+    if  (signature == "Bphysics"):
+        return [BphysicsChainParts_Default, BphysicsChainParts]
+    if  (signature == "Combined"):
+        return [CombinedChainParts_Default, CombinedChainParts]
+    if signature == "MET":
+        return [METChainParts_Default, METChainParts]
+    if signature == "XS":
+        return [XSChainParts_Default, XSChainParts]
+    if signature == "TE":
+        return [TEChainParts_Default, TEChainParts]
+    if signature == "MinBias":
+        return [MinBiasChainParts_Default, MinBiasChainParts]
+    if signature == "HeavyIon":
+        return [HeavyIonChainParts_Default, HeavyIonChainParts]
+    if signature == "Cosmic":
+        return [CosmicChainParts_Default, CosmicChainParts]
+    if signature == "Calibration":
+        return [CalibChainParts_Default, CalibChainParts]
+    if signature == "Streaming":
+        return [StreamingChainParts_Default, StreamingChainParts]
+    if signature == "Monitoring":
+        return [MonitorChainParts_Default, MonitorChainParts]
+    if signature == "Beamspot":
+        return [BeamspotChainParts_Default, BeamspotChainParts]
+    if signature == "EnhancedBias":
+        return [EnhancedBiasChainParts_Default, EnhancedBiasChainParts]
+    if signature == "Test":
+        return [TestChainParts_Default, TestChainParts]
+    else:
+        raise RuntimeError("ERROR Cannot find corresponding dictionary")
+
+
+def getBasePattern():
+    import re
+    import itertools
+    # possibleTT = '|'.join(allowedSignaturePropertiesAndValues['trigType'])
+    #print 'SignatureDicts.py: Allowed values for triType in base pattern', SliceIDDict.values()
+    allTrigTypes = SliceIDDict.values()
+    possibleTT = '|'.join(allTrigTypes)
+    pattern = re.compile("(?P<multiplicity>\d*)(?P<trigType>(%s))(?P<threshold>\d+)(?P<extra>\w*)" % (possibleTT))
+    return pattern
+
+
+
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/StreamInfo.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/StreamInfo.py
new file mode 100644
index 0000000000000000000000000000000000000000..038168dc73b586482f69b0e5ebcc16484e5ec035
--- /dev/null
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/StreamInfo.py
@@ -0,0 +1,114 @@
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+from AthenaCommon.Logging import logging
+log = logging.getLogger( 'TriggerMenu.menu.StreamInfo' )
+
+monStreams = ['monitoring_random', 
+              'CSC',
+              'IDMonitoring',
+              'MetRateStudies',
+              ]
+
+physicsStreams = ['Main',
+                  'Physics',
+                  'Background',
+                  'DISCARD',
+                  'Egamma', 
+                  'Bphysics',
+                  'Combined',
+                  'Muon', 
+                  'Met', 'Jet', 'Tau', 
+                  'MinBias',
+                  'ZeroBias',
+                  'TauOverlay',
+                  'Standby', 
+                  'L1Muon', 'L1Calo', 'L1MinBias', 'L1Topo',
+                  'IDCosmic','CosmicCalo',
+                  'HLTPassthrough',
+                  'JetTauEtmiss', # needed for LS1menu
+                  'EnhancedBias',
+                  'CosmicMuons',
+                  'HLT_IDCosmic',
+                  'CosmicID',
+                  'Late',
+                  'HardProbes',
+                  'MinBiasOverlay',
+                  'UPC',
+                  'Mistimed',
+                  'ExoDelayed',
+                  'BphysDelayed',
+                  ]
+
+calibStreams = [
+                'Tile', 
+                'L1CaloCalib',
+                'LArNoiseBurst',
+                'LArCellsEmpty',
+                'LArCells',
+                'PixelNoise', 'PixelBeam', 
+                'SCTNoise',
+                'CostMonitoring',
+                'beamspot',
+                'Muon_Calibration',
+                'ALFACalib',
+                'IBLLumi',
+                'IDTracks',
+                'TgcNoiseBurst',
+                'VdM',
+                'IDFwd',
+                'BeamSpot',
+                'zdcCalib',
+                'AFP',
+                'L1TopoMismatches'
+                ]
+
+##NOTE: DataScouting_xx_NAME: 
+##xx stands for the unique ROB_ID associated with the stream. If you add a new one,
+##make sure to use a unique number
+dataScoutingStreams = ['DataScouting_01_CosmicMuons',
+                       'DataScouting_02_CosmicMuons',
+                       'DataScouting_03_CosmicMuons',
+                       'DataScouting_04_IDCosmic',                    
+                       'DataScouting_05_Jets',
+                       'DataScouting_06_Jets',
+                       ]
+
+expressStreams = ['express']
+
+
+def getAllStreams():
+
+    return monStreams + physicsStreams + calibStreams + dataScoutingStreams + expressStreams
+
+
+def getStreamTag(streams):
+
+
+    # stream is a tuple (stream, type, obeyLB, prescale)
+    streamTags = []
+
+    for stream in streams:
+        
+        if stream in physicsStreams:
+            streamTags += [(stream, 'physics', 'yes', '1')]
+        elif stream in calibStreams:
+            if 'BeamSpot' in stream or 'Background' in stream or "IDTracks" in stream or 'VdM' in stream or 'PixelBeam' in stream:
+               streamTags += [(stream, 'calibration', 'yes', '1')]
+            else: 
+               streamTags += [(stream, 'calibration', 'no', '1')]
+        elif stream in expressStreams:
+            streamTags += [(stream, 'express', 'yes', '1')]
+        elif stream in monStreams:
+            streamTags += [(stream, 'monitoring', 'yes', '1')]
+        elif stream in dataScoutingStreams:
+            streamTags += [(stream, 'calibration', 'yes', '1')]
+            
+        else:
+            log.error('Stream %s not defined, returning dummy stream!' % stream)
+            return [ ('jettauetmiss','physics','yes','1') ]#[('','','','')]
+            
+
+    log.debug('StreamTags '+str(streamTags))
+    return streamTags
+
+#[ ('jettauetmiss','physics','yes','1') ]
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/TriggerMTConfig.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/TriggerMTConfig.py
new file mode 100755
index 0000000000000000000000000000000000000000..4d7ed0d12e2f9428bc8bb9f0c481e56ae8e6acbd
--- /dev/null
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/TriggerMTConfig.py
@@ -0,0 +1,628 @@
+# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
+
+#########################################################################################
+# User interface for the configuration, nothing beneath this class need to be studied
+#
+import re
+import string
+from collections import defaultdict
+import xml.dom.minidom as minidom
+import xml.etree.cElementTree as etree
+
+from AthenaCommon.CFElements import parOR, seqAND, stepSeq
+
+
+from AthenaCommon.Logging import logging
+log = logging.getLogger( 'TriggerMTConfig' )
+
+
+
+class TriggerMTConfig:
+    sCurrentTriggerConfig = None
+    def currentTriggerConfig():
+        return TriggerMTConfig.sCurrentTriggerConfig
+    currentTriggerConfig = staticmethod(currentTriggerConfig)
+
+    def __init__(self, hltfile=None, signaturesOverwritten=False):
+        self.menuName = 'TestMenu'
+        self.__HLTFile = hltfile
+        self.allThresholds     = {}
+        self.allItems          = {}
+        self.allChains         = {}
+
+        self.theHLTChains      = []
+        self.theSeqLists       = []
+        self.theSeqDict        = {} 
+        self.theTopoStartFrom    = []
+
+        # Sanity check since the second argument in __init__ used to be the l1 xml file name
+        if type(signaturesOverwritten)!=bool:
+            log.error('Wrong type for signaturesOverwritten. Received %s but expected bool', signaturesOverwritten)
+
+        self.signaturesOverwritten = signaturesOverwritten
+        TriggerMTConfig.sCurrentTriggerConfig = self
+
+    def printIt(self):
+        log.debug("self.theSeqLists: %s",  self.theSeqLists)
+        log.debug("self.theSeqDict: %s", self.theSeqDict) 
+        log.debug("self.theTopoStartFrom: %s", self.theTopoStartFrom) 
+        
+
+
+#########################################################################################
+#########################################################################################
+##### From HLTCFConfig.py
+#########################################################################################
+#########################################################################################
+
+
+# Classes to configure the CF graph, via Nodes
+from AthenaCommon.CFElements import parOR, seqAND, stepSeq
+
+
+allAlgs={}
+def useExisting(name):
+    global allAlgs
+    return allAlgs[name]
+
+def AlgExisting(name):
+    global allAlgs
+    return name in allAlgs
+
+
+def remember(name, instance):
+    global allAlgs
+    allAlgs[name] = instance
+    return instance
+
+
+class AlgNode():
+    def __init__(self, Alg, inputProp, outputProp):
+        self.name = ("%s_%s_%s")%( Alg.name(), inputProp, outputProp)
+        self.algname = Alg.name()
+        self.outputProp=outputProp
+        self.inputProp=inputProp
+        self.configureAlg(Alg)
+                
+    def configureAlg(self, Alg):
+        alg_name = Alg.getName()
+        if AlgExisting(alg_name):
+            print "AlgNode::%s: found already Alg %s"%(self.name,alg_name)
+            self.Alg = useExisting(alg_name)
+        else:
+            print "AlgNode::%s: new Alg %s"%(self.name,alg_name)
+            self.Alg=Alg
+            remember(alg_name, self.Alg)
+            
+        if self.Alg is  None:
+            return
+
+        self.addDefaultOutput()
+
+    def addDefaultOutput(self):
+        print "This is main addDefaultOutput"
+        self.setOutput(("%s_%s_out"%(self.algname,self.outputProp)))
+        #self.setOutput(("%s_out"%(self.name)))
+        
+
+    def setPar(self, prop, name):
+        cval = self.Alg.getProperties()[prop]
+        try:
+            if type(cval) == type(list()):                
+                cval.append(name)
+                setattr(self.Alg, prop, cval)
+            else:
+                setattr(self.Alg, prop, name)
+        except:
+            pass
+
+    def setParArray(self, prop, name):
+        cval = self.Alg.getProperties()[prop]
+        try:
+            cval.append(name)
+            setattr(self.Alg, prop, cval)
+        except:
+            pass
+ 
+    def getPar(self, prop):
+        try:
+            return getattr(self.Alg, prop)
+        except:
+            return self.Alg.getDefaultProperty(prop)
+        raise "Error in reading property " + prop + " from " + self.Alg
+
+
+    def setOutput(self, name):
+        return self.setPar(self.outputProp,name)
+
+    def getOutput(self):
+        return self.getPar(self.outputProp)
+
+    def getOutputList(self):
+        outputs = []
+        cval = self.getOutput()
+        if type(cval) == type(list()):  
+            outputs.extend(cval)
+        else:
+            outputs.append(cval)
+        return outputs
+    
+    def setInput(self, name):
+        return self.setPar(self.inputProp,name)
+
+    def addInput(self, name):
+        return self.setParArray(self.inputProp,name)
+    
+    def getInput(self):
+        return self.getPar(self.inputProp)
+
+    def getInputList(self):
+        inputs = []
+        cval = self.getInput()
+        if type(cval) == type(list()):  
+            inputs.extend(cval)
+        else:
+            inputs.append(cval)
+        return inputs
+
+    def __str__(self):
+        return "Alg::%s  [%s] -> [%s]"%(self.name,' '.join(map(str, self.getInputList())), ' '.join(map(str, self.getOutputList())))
+
+
+ 
+class HypoAlgNode(AlgNode):
+    def __init__(self, Alg, inputProp, outputProp):
+        AlgNode.__init__(self, Alg, inputProp, outputProp)
+        self.tools = []
+        self.previous=[]
+       
+
+    def addHypoTool(self, hypotool):
+        if "Comb" in self.name: ###TMP combo, only one threshold
+            import re
+            thresholds = map(int, re.findall(r'\d+', hypotool.getName()))
+            self.setPar('Threshold1', thresholds[0])
+            self.setPar('Threshold2', thresholds[1])
+            status=self.setPar('DecisionLabel', hypotool.getName())
+        else:
+            self.tools.append(hypotool.getName())
+            status= self.setParArray('HypoTools',hypotool)        
+        return status
+
+    def addPreviousDecision(self,prev):
+        self.previous.append(prev)
+        status= self.setParArray('previousDecisions',prev)
+        return status
+
+    def setPreviousDecision(self,prev):
+        if "Comb" in self.name: ###TMP combo: how handle previous decisions in combo?            
+            self.previous.append(prev)
+            if  "from_L1MU" in prev:
+                if "pt" in self.getPar("Property1"):
+                    status= self.setPar('previousDecisions1',prev)
+                if "pt" in self.getPar("Property2"):
+                    status= self.setPar('previousDecisions2',prev)
+
+            if  "from_L1EM" in prev:
+                if "et" in self.getPar("Property1"):
+                    status= self.setPar('previousDecisions1',prev)
+                if "et" in self.getPar("Property2"):
+                    status= self.setPar('previousDecisions2',prev)
+
+            if  "Output1" in prev:
+                status= self.setPar('previousDecisions1',prev)
+            if  "Output2" in prev:
+                status= self.setPar('previousDecisions2',prev)
+
+        else:
+            self.previous.append(prev)
+            status= self.setPar('previousDecisions',prev)
+        return status
+    
+    def __str__(self):
+        return "HypoAlg::%s  [%s] -> [%s], previous = [%s], HypoTools=[%s] --> Alg %s"%(self.name,' '.join(map(str, self.getInputList())),
+                                                                                 ' '.join(map(str, self.getOutputList())),
+                                                                                 ' '.join(map(str, self.previous)),
+                                                                                 ' '.join(map(str, self.tools)), self.Alg)
+
+
+
+class SequenceFilterNode(AlgNode):
+    def __init__(self, Alg, inputProp, outputProp):
+        AlgNode.__init__(self,  Alg, inputProp, outputProp)
+        
+    def addDefaultOutput(self):
+        print "This is SequenceFilter addDefaultOutput"
+        return #do nothing    
+       
+    def setChains(self, name):
+        return self.setPar("Chains", name)
+    
+    def getChains(self):
+        return self.getPar("Chains")
+
+
+from TrigUpgradeTest.TrigUpgradeTestConf import HLTTest__TestRoRSeqFilter
+class TestRoRSequenceFilterNode(SequenceFilterNode):       
+    def __init__(self, name):
+        Alg= HLTTest__TestRoRSeqFilter(name, OutputLevel = 2)
+        inputProp='Inputs'
+        outputProp='Outputs'
+        SequenceFilterNode.__init__(self,  Alg, inputProp, outputProp)
+        if "Step1" in self.name: # so that we see events running through, will be gone once L1 emulation is included
+            self.Alg.AlwaysPass = True   
+  
+   
+
+from DecisionHandling.DecisionHandlingConf import RoRSeqFilter, DumpDecisions
+class RoRSequenceFilterNode(SequenceFilterNode):
+    def __init__(self, name):
+        Alg= RoRSeqFilter(name, OutputLevel = 2)
+        inputProp='Input'
+        outputProp='Output'
+        SequenceFilterNode.__init__(self,  Alg, inputProp, outputProp)
+        
+
+
+
+#### Here functions to create the CF tree from CF configuration objects
+
+
+from AthenaCommon.AlgSequence import dumpSequence
+def create_step_reco_node(name, seq_list, dump=0):
+    print "Create reco step %s with %d sequences"%(name, len(seq_list))
+    stepCF = parOR(name+"_reco")
+    for seq in seq_list:        
+        step_seq = create_CFSequence(seq)             
+        stepCF += step_seq
+    
+    if dump: dumpSequence (stepCF, indent=0)        
+    return stepCF
+
+
+def create_step_filter_node(name, seq_list, dump=0):
+    print "Create filter step %s with %d filters"%(name, len(seq_list))
+    stepCF = parOR(name+"_filter")
+    for seq in seq_list:
+        filterAlg=seq.filter.Alg                    
+        print "Add  %s to filter node %s"%(filterAlg.name(),name)
+        stepCF += filterAlg
+    
+    if dump: dumpSequence (stepCF, indent=0)        
+    return stepCF
+
+
+def create_CFSequence(CFseq):   
+    print "\n * Create CFSequence %s"%(CFseq.name)
+    filterAlg=CFseq.filter.Alg
+   
+    nodes = CFseq.getAllNodes()
+    algos = []
+    for node in nodes:
+        algos.append(node.Alg)
+
+    algos=list(set(algos))
+
+    step_seq = create_step_sequence( CFseq.name, filterAlg=filterAlg, rest=algos)       
+    return step_seq
+
+def create_step_sequence(name, filterAlg, rest):
+    """ elementary HLT step sequencer, filterAlg is gating, rest is anything that needs to happe within the step """
+    stepReco = parOR(name+"_reco", rest)
+    stepAnd = seqAND(name, [ filterAlg, stepReco ])
+    return stepAnd
+  
+
+def find_stepCF_algs(step_list):
+    algos = []
+    for step in step_list:
+        #print "Finding algos of step %s"%step
+        step_algs = []
+        step_algs.append(step.filter)
+        for seq in step.menuSeq.nodeSeqList:
+            step_algs.extend(seq.algs )
+            step_algs.append(seq.hypo)
+        algos.extend(step_algs)
+    return algos        
+            
+
+
+def addChainToHypoTool(hypotool, chain):
+    prop="Chains"
+    cval = hypotool.getProperties()[prop]
+    try:
+        cval.append(chain)
+        setattr(hypotool, prop, cval)
+    except:
+        pass
+
+
+def addChainToHypoAlg(hypoAlg, chain):
+    if "Comb" in hypoAlg.algname:
+        prop="Chains"
+        cval = hypoAlg.Alg.getProperties()[prop]
+        try:
+            cval.append(chain)
+            setattr(hypoAlg.Alg, prop, cval)
+        except:
+            pass
+
+
+#######################################
+def decisionTree_From_Chains(HLTAllStepsSeq, chains, NSTEPS=1):
+
+    testRoR=False
+    from TrigUpgradeTest.MenuComponents import CFSequence
+    #loop over chains to configure
+    count_steps=0
+    for nstep in range(0, NSTEPS):
+        stepCF_name =  "Step%i"%(nstep+1)
+        CFseq_list = []
+
+        for chain in chains:
+            chain_step_name= "%s:%s"%(stepCF_name, chain.name)
+            print "\n*******Filling step %s for chain  %s"%(stepCF_name, chain.name)
+      
+            chain_step=chain.steps[count_steps]
+            sequenceHypoTools=chain_step.sequenceHypoTools
+            countseq=0
+            for st in sequenceHypoTools:
+                sequence=st.sequence
+                hypotool=st.hypotool
+                addChainToHypoTool(hypotool, chain.name)
+                cfseq_name= sequence.name
+
+                print "Going through sequence %s with threshold %s"%(sequence.name, hypotool.getName())
+                #define sequence input
+                if count_steps == 0: # seeding
+                    sequence_input= [nodeSeq.seed for nodeSeq in sequence.nodeSeqList]
+                    print "Seeds from this chain: %s"%(sequence_input)
+                    previous_sequence="".join(chain.group_seed)
+                else:
+                    # from previous step, map the seuqence in the same order?
+                    previous_sequence=chain.steps[count_steps-1].sequences[countseq].name #menu sequence
+                    sequence_input=chain.steps[count_steps-1].sequences[countseq].outputs
+                    print "Connect to previous sequence:"
+                    print sequence_input
+                # add hypotools
+                for nodeSeq in sequence.nodeSeqList:
+                    hypoAlg= nodeSeq.hypo                
+                    print "Adding %s to %s"%(hypotool.getName(),hypoAlg.algname)
+                    hypoAlg.addHypoTool(hypotool)
+                    addChainToHypoAlg(hypoAlg, chain.name) # only for TMP Combo
+                    
+
+
+                #### FILTER
+                # one filter per previous sequence at the start of the sequence: check if it exists or create a new one        
+                # if the previous hypo has more than one output, try to get all of them
+                # one filter per previous sequence: 1 input/previous seq, 1 output/next seq 
+                filter_name="Filter%s_on_%s"%(stepCF_name,previous_sequence)
+                filter_out=["%s_from_%s_out"%(filter_name,i) for i in sequence_input]
+                filter_already_exists=False
+                findFilter= [cfseq.filter for cfseq in CFseq_list if filter_name in cfseq.filter.algname]        
+                if len(findFilter):
+                    print "Filter %s already exists"%(filter_name)
+                    filter_already_exists=True
+                    sfilter=findFilter[0]
+                    print "Adding chain %s to %s"%(chain.name,sfilter.algname)
+                    sfilter.setChains(chain.name)
+                    continue
+                else:
+                    if (testRoR):
+                        sfilter = TestRoRSequenceFilterNode(name=filter_name)
+                    else:
+                        sfilter = RoRSequenceFilterNode(name=filter_name)
+                    for o in filter_out: sfilter.setOutput(o)            
+                    for i in sequence_input: sfilter.addInput(i)
+                    sfilter.setChains(chain.name)
+                    print "Filter Done: %s"%(sfilter)
+                    
+                #loop over NodeSequences of this sequence to add inputs to InputMaker and send decisions to HypoAlg
+                for nodeSeq in sequence.nodeSeqList:
+                    seed=nodeSeq.seed                    
+                    input_maker_input= [inp for inp in sfilter.getOutputList() if ("from_"+seed) in inp]
+                    print "Adding %d inputs to sequence::%s from Filter::%s (from seed %s)"%(len(input_maker_input), nodeSeq.name, sfilter.algname, seed)
+                    for i in input_maker_input: print i
+                    if len(input_maker_input) == 0:
+#                        print "ERROR, no inputs to sequence are set!"
+                        sys.exit("ERROR, no inputs to sequence are set!") 
+#                        return                    
+                    for i in input_maker_input: nodeSeq.addInput(i)
+
+                    hypoAlg= nodeSeq.hypo
+                    #node = AlgNode(Alg=hypoAlg.Alg,inputProp='', outputProp='Output1')
+                    for i in input_maker_input: hypoAlg.setPreviousDecision(i) # works for one
+                    #for i in input_maker_input: hypoAlg.addPreviousDecision(i)
+
+                    print hypoAlg
+
+                                    
+                CF_seq = CFSequence( cfseq_name, FilterAlg=sfilter, MenuSequence=sequence)    
+                #for node in otherNodes: CF_seq.addNode(node)
+                print CF_seq
+                CFseq_list.append(CF_seq)
+                countseq+=1
+           
+            #end of sequence/threshold
+                
+        #end of loop over chains for this step, now implement CF:
+        print "\n******** Create CF Tree %s with AthSequencers",stepCF_name
+        #first make the filter step
+        stepFilter = create_step_filter_node(stepCF_name, CFseq_list, dump=0)
+        HLTAllStepsSeq += stepFilter
+        
+        stepCF = create_step_reco_node(stepCF_name, CFseq_list, dump=0)
+        HLTAllStepsSeq += stepCF
+        
+        print "Now Draw..."
+        stepCF_DataFlow_to_dot(stepCF_name, CFseq_list)
+        stepCF_ControlFlow_to_dot(stepCF)
+
+       
+        print "Added stepCF %s to the root"%stepCF_name     
+        count_steps+=1
+        print "************* End of step %s"%stepCF_name
+        # end of steps
+
+    #stepCF_ControlFlow_to_dot(HLTAllStepsSeq)
+    dumpSequence (HLTAllStepsSeq, indent=0)
+    return
+#####
+
+
+
+
+###### Here some graphical methods
+
+
+from ViewAlgsTest.connectAlgorithmsIO import connectAlgorithmsIO, graph_generator
+from AthenaCommon.AlgSequence import AthSequencer
+
+
+def algColor(alg):
+    if "Hypo" in alg: return "darkorchid1"
+    if "Filter" in alg: return "chartreuse3"
+    if "InputMaker" in alg: return "cyan3"
+    return "cadetblue1"
+    
+def stepCF_ControlFlow_to_dot(stepCF):
+    def _dump (seq, indent):
+        o = list()
+        for c in seq.getChildren():
+            if "AthSequencer" in c.getFullName():
+                o.append( ("%s[color=%s, shape=circle, width=.5, fixedsize=true ,style=filled]\n"%(c.name(),_seqColor(c)), indent) )
+            else:
+                o.append( ("%s[fillcolor=%s,style=filled]\n"%(c.name(),algColor(c.name())), indent) )
+            o.append( ("%s -> %s\n"%(seq.name(), c.name()), indent))
+            o.extend( _dump (c, indent+1) )
+        return o
+
+    def _parOR (seq):
+        if seq.ModeOR is True:
+            if seq.Sequential is False:
+                if seq.StopOverride is True:
+                    return True
+        return False
+
+    def _seqAND(seq):
+        if seq.ModeOR is False:
+            if seq.Sequential is True:
+                if seq.StopOverride is False:
+                    return True
+        return False
+
+    def _seqColor(seq):
+        if _parOR(seq): return "red"
+        if _seqAND(seq): return "blue"
+        return "black"
+
+   
+
+    # to visualize: dot -T pdf Step1.dot > Step1.pdf
+    file = open( '%s.CF.dot'%stepCF.name(), mode="wt" )
+    #strict
+    file.write( 'digraph step  {\n'\
+                +'\n'\
+                +'  node [ shape=polygon, fontname=Helvetica ]\n'\
+                +'  edge [ fontname=Helvetica ]\n'
+                +'  %s   [shape=Mdiamond]\n'%stepCF.name())
+
+    indent=0
+    out = [("%s[color=%s shape=circle]\n"%(stepCF.name(),_seqColor(stepCF)), indent)]
+  
+    out.extend( _dump( stepCF, indent=indent+1 ) )
+    for n,i in out:
+        line= "  "*i+ n
+        file.write(line)
+
+    file.write( '}\n')
+
+
+
+    
+
+def stepCF_DataFlow_to_dot(name, cfseq_list):
+    # to visualize: dot -T pdf Step1.dot > Step1.pdf
+    file = open( '%s.DF.dot'%name, mode="wt" )
+    #strict
+    file.write( 'digraph step  {\n'\
+                +'\n'\
+                +'  node [ shape=polygon, fontname=Helvetica ]\n'\
+                +'  edge [ fontname=Helvetica ]\n'
+                +'  %s   [shape=Mdiamond]\n'%name)
+
+
+    for cfseq in cfseq_list:
+        print cfseq.name
+        file.write("  %s[fillcolor=%s style=filled]\n"%(cfseq.filter.algname,algColor(cfseq.filter.algname)))
+        for inp in cfseq.filter.getInputList():
+            file.write(addConnection(name, cfseq.filter.algname, inp))
+           
+        file.write(  '\n  subgraph cluster_%s {\n'%(cfseq.name)\
+                    +'     node [color=white style=filled]\n'\
+                    +'     style=filled\n'\
+                    +'     color=lightgrey\n'\
+                    +'     fontname=Helvetica\n'\
+                    +'     label = %s\n'%(cfseq.name))
+
+        cfseq_algs = []
+        cfseq_algs.append(cfseq.filter)       
+
+        for seq in cfseq.menuSeq.nodeSeqList:
+            #            cfseq_algs.append(seq.inputMaker)
+            cfseq_algs.extend(seq.algs )
+            if seq.reuse==False:
+                #                file.write("    %s[fillcolor=%s]\n"%(seq.inputMaker.algname, algColor(seq.inputMaker.algname)))
+                for alg in seq.algs: file.write("    %s[fillcolor=%s]\n"%(alg.algname, algColor(alg.algname)))
+                seq.reuse=True
+            cfseq_algs.append(seq.hypo)
+ 
+            file.write("    %s[color=%s]\n"%(seq.hypo.algname, algColor(seq.hypo.algname)))
+        file.write('  }\n')              
+        file.write(findConnections(cfseq_algs))
+        file.write('\n')    
+  
+    file.write( '}')
+    file.close()
+
+
+def findConnections(alg_list):
+    lineconnect=''
+    for nodeA in alg_list:
+        for nodeB in alg_list:
+            if nodeA is nodeB:
+                continue
+            dataIntersection = list(set(nodeA.getOutputList()) & set(nodeB.getInputList()))
+            if len(dataIntersection) > 0:
+                for line in dataIntersection:
+                    lineconnect+=addConnection(nodeA.algname,nodeB.algname, line)
+                    print 'Data connections between %s and %s: %s'%(nodeA.algname, nodeB.algname, line)
+    return lineconnect
+
+def addConnection(nodeA, nodeB, label):
+    line = "    %s -> %s [label=%s]\n"%(nodeA,nodeB,label)
+    # print line
+    return line
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Muon/MuonDef.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Muon/MuonDef.py
new file mode 100755
index 0000000000000000000000000000000000000000..b89ae7a140e1c6296d3a3975a9b87228a2b170a1
--- /dev/null
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Muon/MuonDef.py
@@ -0,0 +1,53 @@
+# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
+
+########################################################################
+#
+# 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')
+    
+#################################################################################################
+
+
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Muon/MuonSliceFlags.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Muon/MuonSliceFlags.py
new file mode 100755
index 0000000000000000000000000000000000000000..151d4083dbb7870004121c2d74c1c9e79b886a8b
--- /dev/null
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Muon/MuonSliceFlags.py
@@ -0,0 +1,63 @@
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+""" Muon slice specific flags  """
+
+from AthenaCommon.JobProperties         import JobProperty, JobPropertyContainer, jobproperties
+from TriggerMenu.menu.CommonSliceHelper import CommonSliceHelper
+
+
+__author__  = 'T. Bold, B.Demirkoz'
+__version__="$Revision: 1.46 $"
+__doc__="Muon slice specific flags  "
+
+
+_flags = [] 
+class doSiTrack(JobProperty):
+    """ do or not to do SiTrack algo """ 
+    statusOn=True
+    allowedTypes=['bool']
+    StoredValue=False
+
+_flags.append(doSiTrack)
+
+class doMuonCalibrationStream(JobProperty):
+    """ do or not to do the setup for the muon calibration stream"""
+    statusOn = True
+    allowedType = ['bool']
+    StoredValue = False
+_flags.append(doMuonCalibrationStream)
+
+class doEFRoIDrivenAccess(JobProperty):
+    """ do or not do the EF Roi driven access"""
+    statusOn = True
+    allowedType = ['bool']
+    StoredValue = False
+
+_flags.append(doEFRoIDrivenAccess)
+
+class signatures(JobProperty):
+    """ signatures in Muon slice """
+    statusOn=True
+    allowedTypes = ['list']
+    StoredValue  = []
+
+_flags.append(signatures)
+
+
+# create container
+
+class MuonSlice(JobPropertyContainer, CommonSliceHelper):
+    """ Muon Slice Flags """
+
+from TriggerJobOpts.TriggerFlags import TriggerFlags
+TriggerFlags.add_Container(MuonSlice)
+
+# add add common slice flags
+TriggerFlags.MuonSlice.import_JobProperties('TriggerMenu.menu.CommonSliceFlags')
+
+for flag in _flags:
+    TriggerFlags.MuonSlice.add_JobProperty(flag)
+del _flags
+
+# make an alias
+MuonSliceFlags = TriggerFlags.MuonSlice
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Muon/generateMuonChainDefs.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Muon/generateMuonChainDefs.py
new file mode 100644
index 0000000000000000000000000000000000000000..dfd569e250de0b61d20e12be4878b49ea2876c69
--- /dev/null
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Muon/generateMuonChainDefs.py
@@ -0,0 +1,47 @@
+# Copyright (C) 2002-2017 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
+logging.getLogger().info("Importing %s",__name__)
+
+from TriggerMenuMT.HLTMenuConfig.Menu.MenuUtils import *
+
+from TrigUpgradeTest.TrigUpgradeTestConf import HLTTest__TestRecoAlg
+from TrigUpgradeTest.TrigUpgradeTestConf import HLTTest__TestHypoAlg
+from TrigUpgradeTest.TrigUpgradeTestConf import HLTTest__TestHypoTool
+
+
+def generateChainDefs(chainDict):
+    
+    listOfChainDicts = splitChainDict(chainDict)
+    listOfChainDefs=[]
+
+    #define the list of keywords from Signature dicts to base the grouping on
+    groupCategories = []
+
+    for chainDict in listOfChainDicts:
+        chainName = chainDict['chainName']
+        chainL1Item = chainDict['L1item']
+        chainPart = chainDict['chainParts']
+        chainPartL1Item = self.chainPart['L1item']
+        chainthreshhold = chainPart['threshold']
+        
+        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)
+
+        listOfChainDefs += MuonChainDef
+
+
+    return listOfChainDefs
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/L1Seeds.py b/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/L1Seeds.py
new file mode 100644
index 0000000000000000000000000000000000000000..b90546620ad996ab0d47619cf9fae963d35f8531
--- /dev/null
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/L1Seeds.py
@@ -0,0 +1,435 @@
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+from AthenaCommon.Logging import logging
+log = logging.getLogger("TriggerMenuMT.LVL1MenuConfig.L1Seeds")
+
+from TriggerJobOpts.TriggerFlags  import TriggerFlags
+
+#######################################
+# trigger type definitions
+######################################
+from TriggerMenu.l1.Lvl1Flags import Lvl1Flags
+run1 = Lvl1Flags.CTPVersion()<=3
+
+if run1:
+    from TriggerMenu.l1.TriggerTypeDefRun1 import TT
+    rpcout_type = TT.rpcout | TT.phys
+    rpcin_type  = TT.rpcin  | TT.phys             
+else:
+    from TriggerMenu.l1.TriggerTypeDef import TT
+    rpcout_type = TT.muon   | TT.phys
+    rpcin_type  = TT.muon   | TT.phys             
+
+
+cl_type     = TT.calo      | TT.phys
+mb_type     = TT.minb      | TT.phys
+
+
+calo_exceptions = set([])
+
+
+#######################################################
+# obtain the l1 items according to the the trigger type
+# function taken originally from TriggerPythonConfig
+#######################################################
+def Lvl1ItemByTriggerType(l1object, triggertypebit, triggertypebitmask):
+    """For a triggertypebit between 0 and 7, returns a list of names of
+    those Lvl1 items that have that bit set in the triggertype"""
+    if triggertypebit<0 or triggertypebit>0xFF:
+        raise RuntimeError('TriggerPythonConfig.Lvl1ItemByTriggerType(triggertypebit,triggertypebitmask) needs to be called with 0<=triggertypebit<=0xFF, ' + \
+                               + 'but is called with triggertypebit=%i' % triggertypebit)
+    if triggertypebitmask<0 or triggertypebitmask>0xFF:
+        raise RuntimeError('TriggerPythonConfig.Lvl1ItemByTriggerType(triggertypebit,triggertypebitmask) needs to be called with 0<=triggertypebitmask<=0xFF, ' + \
+                               + 'but is called with triggertypebitmask=%i' % triggertypebitmask)
+    
+    itemsForMenu = [item for item in l1object if item.ctpid != -1]    
+    if not itemsForMenu:
+        log.error( 'No item defined for the L1 Menu, the TriggerConfL1 object does not contain items')
+    res = [item.name for item in itemsForMenu if (triggertypebitmask & item.trigger_type)==triggertypebit ]
+    return res
+
+##############################
+# define the various seeds
+##############################
+def getL1BackgroundSeed(menul1items):        
+    l1background_seeds = 'L1_BCM_AC_CA_BGRP0,L1_BCM_Wide_EMPTY,L1_BCM_Wide_UNPAIRED_ISO,L1_BCM_Wide_UNPAIRED_NONISO,L1_J30.31ETA49_UNPAIRED_ISO,L1_J12_UNPAIRED_ISO,L1_J12_UNPAIRED_NONISO,L1_J12_ABORTGAPNOTCALIB,L1_BCM_AC_UNPAIRED_ISO,L1_BCM_CA_UNPAIRED_ISO,L1_BCM_AC_UNPAIRED_NONISO,L1_BCM_CA_UNPAIRED_NONISO,L1_J30.31ETA49_UNPAIRED_NONISO,L1_BCM_AC_ABORTGAPNOTCALIB,L1_BCM_CA_ABORTGAPNOTCALIB,L1_BCM_Wide_ABORTGAPNOTCALIB,L1_BCM_AC_CALIB,L1_BCM_CA_CALIB,L1_BCM_Wide_CALIB,L1_J50_UNPAIRED_ISO,L1_J50_UNPAIRED_NONISO,L1_J50_ABORTGAPNOTCALIB'
+    
+    if TriggerFlags.triggerMenuSetup() == 'LS1_v1':
+        l1background_seeds = 'L1_BCM_AC_CA_BGRP0,L1_BCM_AC_CA_UNPAIRED_ISO,L1_BCM_Wide_EMPTY,L1_BCM_Wide_UNPAIRED_ISO,L1_BCM_Wide_UNPAIRED_NONISO,L1_EM3_UNPAIRED_ISO,L1_FJ30_UNPAIRED_ISO,L1_J10_UNPAIRED_ISO,L1_J10_UNPAIRED_NONISO,L1_LUCID_A_C_EMPTY,L1_LUCID_A_C_UNPAIRED_ISO,L1_LUCID_A_C_UNPAIRED_NONISO,L1_LUCID_EMPTY,L1_LUCID_UNPAIRED_ISO,L1_MU4_UNPAIRED_ISO,L1_LUCID_COMM_UNPAIRED_ISO,L1_LUCID_COMM_EMPTY'
+        
+    # check if all the l1 background seeds given are in the current L1 menu
+    l1bgditems = l1background_seeds.split(',')
+    for item in l1bgditems:
+        if item not in menul1items:
+            log.error('L1 item %s from background seeds is not in current L1 menu' % item)
+            
+    return l1background_seeds
+
+##############################
+def getL1_ALFA_Diff_Phys_Seeds(menul1items):        
+    # comma separated list fo l1 seeds
+    l1_seeds = 'L1_ALFA_SDIFF5,L1_ALFA_SDIFF6,L1_ALFA_SDIFF7,L1_ALFA_SDIFF8,L1_MBTS_1_A_ALFA_C,L1_MBTS_1_C_ALFA_A,L1_MBTS_1_A_ALFA_C_UNPAIRED_ISO,L1_MBTS_1_C_ALFA_A_UNPAIRED_ISO,L1_MBTS_2_A_ALFA_C,L1_MBTS_2_C_ALFA_A,L1_MBTS_2_A_ALFA_C_UNPAIRED_ISO,L1_MBTS_2_C_ALFA_A_UNPAIRED_ISO,L1_LUCID_A_ALFA_C,L1_LUCID_C_ALFA_A,L1_LUCID_A_ALFA_C_UNPAIRED_ISO,L1_LUCID_C_ALFA_A_UNPAIRED_ISO,L1_EM3_ALFA_ANY,L1_EM3_ALFA_ANY_UNPAIRED_ISO,L1_TE5_ALFA_ANY,L1_TE5_ALFA_ANY_UNPAIRED_ISO'
+     
+    # check if all the l1 background seeds given are in the current L1 menu
+    l1items = l1_seeds.split(',')
+    for item in l1items:
+        if item not in menul1items:
+            log.error('L1 item %s from background seeds is not in current L1 menu' % item)
+            
+    return l1_seeds
+
+##############################
+def getL1_ALFA_CDiff_Phys_Seeds (menul1items):        
+    # comma separated list fo l1 seeds
+    l1_seeds = 'L1_EM3_ALFA_EINE,L1_TE5_ALFA_EINE'
+     
+    # check if all the l1 background seeds given are in the current L1 menu
+    l1items = l1_seeds.split(',')
+    for item in l1items:
+        if item not in menul1items:
+            log.error('L1 item %s from background seeds is not in current L1 menu' % item)
+            
+    return l1_seeds
+##############################
+def getL1_ALFA_Jet_Phys_Seeds (menul1items):        
+    # comma separated list fo l1 seeds
+    l1_seeds = 'L1_J12_ALFA_ANY,L1_J12_ALFA_ANY_UNPAIRED_ISO'
+     
+    # check if all the l1 background seeds given are in the current L1 menu
+    l1items = l1_seeds.split(',')
+    for item in l1items:
+        if item not in menul1items:
+            log.error('L1 item %s from background seeds is not in current L1 menu' % item)
+            
+    return l1_seeds
+
+
+##############################
+def getL1StandbySeed(l1items):        
+    standby_seeds    = ",".join([ x for x in l1items if "_EMPTY" not in x and "CALREQ" not in x and "ZB" not in x and "-" not in x and "CMU" not in x and "ALFA" not in x  and "RD" not in x and "BCM" not in x and "BGRP12" not in x and "FTK" not in x])
+    return standby_seeds
+##############################
+def getL1TopoSeed(l1items):
+    l1topo_seeds = ",".join([ x for x in l1items if  "FTK" not in x and ("-" in x or "CMU" in x) ])
+    return l1topo_seeds
+
+##############################
+def getL1CaloSeed(l1seed, l1object):
+    if ('EMPTY' in l1seed):
+        #l1calo_seeds = ','.join([ x for x in Lvl1ItemByTriggerType(l1object, cl_type, cl_type) \
+        #                              if (x not in calo_exceptions)  ])
+        l1calo_seeds = ','.join([ x for x in Lvl1ItemByTriggerType(l1object, cl_type, cl_type) \
+                                      if ('EMPTY' in x and 'FIRSTEMPTY' not in x)  ])
+    else:
+        l1calo_seeds = ','.join([ x for x in Lvl1ItemByTriggerType(l1object, cl_type, cl_type) if ("EMPTY" not in x or "FIRSTEMPTY" in x) \
+                                      and (x not in calo_exceptions)  ])
+    return l1calo_seeds
+
+
+
+##############################
+def getL1TauSeed(l1items):
+
+    tau_seeds    = ",".join([ x for x in l1items if "TAU" in x and "-" not in x and  "EMPTY" not in x  and "ISO" not in x and "FTK" not in x])
+    return tau_seeds
+
+##############################
+def getL1BSSeed(menul1items):
+    l1_seeds = 'L1_J15,L1_3J15,L1_3J10,L1_4J10'
+    # check if all the l1 background seeds given are in the current L1 menu
+    l1items = l1_seeds.split(',')
+    for item in l1items:
+        if item not in menul1items:
+            log.error('L1 item %s from beamspot seeds is not in current L1 menu' % item)
+            
+    return l1_seeds
+
+
+##############################
+def getL1MinBiasSeed(l1seed, l1object):
+    if ('EMPTY' in l1seed):
+        l1minbias_seeds = ','.join([ x for x in Lvl1ItemByTriggerType(l1object, mb_type, mb_type)])
+    else:
+        l1minbias_seeds = ','.join([ x for x in Lvl1ItemByTriggerType(l1object, mb_type, mb_type)])
+    return l1minbias_seeds
+
+def getL1JetBS():
+    return 'L1_J15,L1_3J15,L1_3J10,L1_4J10'
+
+##############################
+def getL1MuonSeed(l1seed, l1object):
+    if ('EMPTY' in l1seed): # to only get MU*_EMPTY items
+        muon_seeds_list = [ x for x in Lvl1ItemByTriggerType(l1object, rpcout_type, rpcout_type) if ('MU' in x and '_EMPTY' in x )  ]
+        muon_seeds_list = list(set(muon_seeds_list))
+        muon_seeds      = ','.join(muon_seeds_list)
+    else: #this one does NOT include the EMPTY items
+        muon_seeds_list = [ x for x in Lvl1ItemByTriggerType(l1object, rpcout_type, rpcout_type) if ('MU' in x and 'FIRSTEMPTY' in x )  ]
+        muon_seeds_list += [ x for x in Lvl1ItemByTriggerType(l1object, rpcin_type, rpcin_type)  ]
+        muon_seeds_list = list(set(muon_seeds_list))
+        muon_seeds      = ','.join(muon_seeds_list)
+
+    return muon_seeds
+
+##############################
+def getEBnoL1PSSeed(l1items, l1seedname):
+
+    # All of these L1 items must be PS=1 for an EB campaign
+    noL1PS_seeds = ''
+    if ('L1_PhysicsLow' in l1seedname):
+      noL1PS_seeds = 'L1_MU6_3MU4,L1_EM15HI_2TAU12IM_J25_3J12,L1_EM15HI_2TAU12IM_XE35,L1_EM15HI_TAU40_2TAU15,L1_EM15VH_MU10,L1_EM15VH_3EM7,L1_EM22VHI,L1_2EM8VH_MU10,L1_MU10_TAU12IM_J25_2J12,L1_MU10_TAU12IM_XE35,L1_MU10_TAU20IM,L1_4J15,L1_XE50,L1_2J15_XE55,L1_TAU60,L1_TAU20IM_2TAU12IM_J25_2J20_3J12,L1_TAU20IM_2TAU12IM_XE35,L1_TAU20IM_2J20_XE45,L1_MU20,L1_MU6_J30.0ETA49_2J20.0ETA49,L1_MU10_3J20,L1_J40.0ETA25_2J15.31ETA49,L1_3MU6,L1_MU10_2J15_J20,L1_J40.0ETA25_2J25_J20.31ETA49,L1_2MU6_3MU4,L1_MU11_2MU6'
+    elif ('L1_PhysicsHigh' in l1seedname):
+      noL1PS_seeds = 'L1_XE80,L1_J100.31ETA49,L1_J400,L1_6J15'
+    elif ('L1_EMPTY' in l1seedname):
+      noL1PS_seeds = 'L1_J12_EMPTY,L1_MU11_EMPTY,L1_TAU8_EMPTY,L1_TAU30_EMPTY,L1_EM7_EMPTY'
+    elif ('L1_FIRSTEMPTY' in l1seedname):
+      noL1PS_seeds = 'L1_J12_FIRSTEMPTY,L1_MU20_FIRSTEMPTY,L1_TAU8_FIRSTEMPTY,L1_EM7_FIRSTEMPTY'
+    elif ('L1_UNPAIRED_ISO' in l1seedname):
+      noL1PS_seeds = 'L1_J12_UNPAIRED_ISO,L1_J15.31ETA49_UNPAIRED_ISO,L1_BCM_Wide_UNPAIRED_ISO,L1_BCM_AC_UNPAIRED_ISO,L1_BCM_CA_UNPAIRED_ISO,L1_MU4_UNPAIRED_ISO,L1_EM7_UNPAIRED_ISO,L1_TAU8_UNPAIRED_ISO,L1_TAU30_UNPAIRED_ISO'
+    elif ('L1_UNPAIRED_NONISO' in l1seedname):
+      noL1PS_seeds = 'L1_J12_UNPAIRED_NONISO,L1_BCM_Wide_UNPAIRED_NONISO,L1_BCM_AC_UNPAIRED_NONISO,L1_BCM_CA_UNPAIRED_NONISO'
+    elif ('L1_ABORTGAPNOTCALIB' in l1seedname): 
+      noL1PS_seeds = 'L1_J12_ABORTGAPNOTCALIB'
+    else:
+      log.error('Do not know how to supply EnhancedBias L1 seeds for %s' % l1seedname)
+
+    # check if all the l1 seeds given are in the current L1 menu
+    l1EBitems = noL1PS_seeds.split(',')
+    for item in l1EBitems:
+        if item not in l1items:
+            log.error('L1 item %s from %s seed is not in current L1 menu (EnhancedBias)' % (item, l1seedname))
+            
+    return noL1PS_seeds
+
+##############################
+def getL1_ALFA_Phys(l1seed):
+
+    L1ALFA_Phys_seeds = 'L1_ALFA_ELAST1,L1_ALFA_ELAST2,L1_ALFA_ELAST11,L1_ALFA_ELAST12,L1_ALFA_ELAST13,L1_ALFA_ELAST14,L1_ALFA_ELAST15,L1_ALFA_ELAST16,L1_ALFA_ELAST17,L1_ALFA_ELAST18,L1_ALFA_SHOWSYST5,L1_ALFA_ANY_A_EMPTY,L1_ALFA_ANY_C_EMPTY'
+
+    # check if all the l1 background seeds given are in the current L1 menu
+    l1bgditems = L1ALFA_Phys_seeds.split(',')
+    for item in l1bgditems:
+        if item not in l1seed:
+            log.error('L1 item %s from L1ALFA_Phys seeds is not in current L1 menu' % item)
+            
+    return L1ALFA_Phys_seeds
+
+##############################
+def getL1_ALFA_Phys_Any(l1seed):
+
+    L1ALFA_Phys_Any_seeds = 'L1_ALFA_ANY,L1_ALFA_ANY_EMPTY,L1_ALFA_ANY_FIRSTEMPTY,L1_ALFA_ANY_UNPAIRED_ISO,L1_ALFA_ANY_UNPAIRED_NONISO,L1_ALFA_ANY_BGRP10'
+
+    # check if all the l1 background seeds given are in the current L1 menu
+    l1bgditems = L1ALFA_Phys_Any_seeds.split(',')
+    for item in l1bgditems:
+        if item not in l1seed:
+            log.error('L1 item %s from L1ALFA_Phys_Any_seeds seeds is not in current L1 menu' % item)
+            
+    return L1ALFA_Phys_Any_seeds
+
+##############################
+def getL1ALFA_Calib(l1seed):
+
+    L1ALFA_Calib_seeds = 'L1_ALFA_B7L1U,L1_ALFA_B7L1L,L1_ALFA_A7L1U,L1_ALFA_A7L1L,L1_ALFA_A7R1U,L1_ALFA_A7R1L,L1_ALFA_B7R1U,L1_ALFA_B7R1L'
+        #ATR-13743 'L1_ALFA_ELAST15_Calib,L1_ALFA_ELAST18_Calib,L1_ALFA_BGT,L1_ALFA_BGT_UNPAIRED_ISO,L1_ALFA_BGT_BGRP10,L1_ALFA_SHOWSYST5,L1_ALFA_ANY_EMPTY,L1_ALFA_ANY_FIRSTEMPTY,L1_ALFA_ANY_UNPAIRED_ISO,L1_ALFA_ANY_UNPAIRED_NONISO,L1_ALFA_ANY_BGRP10,L1_ALFA_ANY_CALIB,L1_ALFA_ANY_ABORTGAPNOTCALIB,
+           #L1_ALFA_B7L1U_OD,L1_ALFA_B7L1L_OD,L1_ALFA_A7L1U_OD,L1_ALFA_A7L1L_OD,L1_ALFA_A7R1U_OD,L1_ALFA_A7R1L_OD,L1_ALFA_B7R1U_OD,L1_ALFA_B7R1L_OD,L1_ALFA_B7L1_OD,L1_ALFA_A7L1_OD,L1_ALFA_A7R1_OD,L1_ALFA_B7R1_OD,L1_ALFA_ANY_A_EMPTY,L1_ALFA_ANY_C_EMPTY'
+
+    # check if all the l1 background seeds given are in the current L1 menu
+    l1bgditems = L1ALFA_Calib_seeds.split(',')
+    for item in l1bgditems:
+        if item not in l1seed:
+            log.error('L1 item %s from L1ALFA_Calib_seeds seeds is not in current L1 menu' % item)
+            
+    return L1ALFA_Calib_seeds
+
+
+##############################
+def getL1ALFA_CEP(l1seed):
+
+    L1ALFA_CEP_seeds = 'L1_ALFA_ELAST15,L1_ALFA_ELAST18,L1_ALFA_SYST17,L1_ALFA_SYST18,L1_ALFA_ELASTIC_UNPAIRED_ISO,L1_ALFA_ANTI_ELASTIC_UNPAIRED_ISO'
+
+    # check if all the l1 background seeds given are in the current L1 menu
+    l1bgditems = L1ALFA_CEP_seeds.split(',')
+    for item in l1bgditems:
+        if item not in l1seed:
+            log.error('L1 item %s from L1ALFA_CEP_seeds seeds is not in current L1 menu' % item)
+            
+    return L1ALFA_CEP_seeds
+
+
+
+##############################
+def getL1ALFA_SYS(l1seed):
+
+    L1ALFA_SYS_seeds = 'L1_ALFA_SYST9,L1_ALFA_SYST10,L1_ALFA_SYST11,L1_ALFA_SYST12,L1_ALFA_SYST17,L1_ALFA_SYST18'
+
+    # check if all the l1 background seeds given are in the current L1 menu
+    l1bgditems = L1ALFA_SYS_seeds.split(',')
+    for item in l1bgditems:
+        if item not in l1seed:
+            log.error('L1 item %s from L1ALFA_SYS_seeds seeds is not in current L1 menu' % item)
+            
+    return L1ALFA_SYS_seeds
+
+##############################
+def getL1ALFA_ELAS(l1seed):
+
+    L1ALFA_ELAS_seeds = 'L1_ALFA_ELAST1,L1_ALFA_ELAST2,L1_ALFA_ELAST11,L1_ALFA_ELAST12,L1_ALFA_ELAST13,L1_ALFA_ELAST14,L1_ALFA_ELAST15,L1_ALFA_ELAST16,L1_ALFA_ELAST17,L1_ALFA_ELAST18'
+
+    # check if all the l1 background seeds given are in the current L1 menu
+    l1bgditems = L1ALFA_ELAS_seeds.split(',')
+    for item in l1bgditems:
+        if item not in l1seed:
+            log.error('L1 item %s from L1ALFA_ELAS_seeds seeds is not in current L1 menu' % item)
+            
+    return L1ALFA_ELAS_seeds
+
+
+
+#####################################
+def getL1LowLumi(l1seed):
+
+    L1LowLumi_seeds = 'L1_EM20VH,L1_2EM10VH,L1_MU15,L1_2MU6,L1_3MU4,L1_EM15VH_MU10,L1_EM15I_MU4,L1_EM7_MU10,L1_2EM8VH_MU10,L1_TAU60,L1_TAU20IM_2TAU12IM_J25_2J20_3J12,L1_EM15HI_2TAU12IM_XE35,L1_MU10_TAU12IM_XE35,L1_TAU20_2TAU12_XE35,L1_TAU20IM_2TAU12IM_XE35,L1_EM15HI_2TAU12IM,L1_EM15HI_2TAU12IM_J25_3J12,L1_EM15HI_TAU40_2TAU15,L1_MU10_TAU12IM_J25_2J12,L1_MU10_TAU12IM,L1_J75,L1_4J15,L1_XE50,L1_3J25.0ETA23,L1_3J40,L1_2J15_XE55,L1_MU6_J40,L1_J75.31ETA49'
+
+
+    # check if all the l1 background seeds given are in the current L1 menu
+    l1bgditems = L1LowLumi_seeds.split(',')
+    for item in l1bgditems:
+        if item not in l1seed:
+            log.error('L1 item %s from L1LowLumi_seeds seeds is not in current L1 menu' % item)
+            
+    return L1LowLumi_seeds
+        
+#####################################
+# assigned the seeds to the L1 names
+#####################################
+def getSpecificL1Seeds(l1seedname, l1itemobject):
+    l1items = [i.name for i in l1itemobject]
+    l1ctpid = [i.ctpid for i in l1itemobject]
+    L1Seed = ''
+    if l1seedname == 'L1_J':
+        L1Seed = getL1JetBS()
+    if (l1seedname == 'L1_Bkg'):
+        L1Seed = getL1BackgroundSeed(l1items)
+#    elif (l1seedname == 'L1_ALFA_Diff_Phys' ):
+#        L1Seed = getL1_ALFA_Diff_Phys_Seeds(l1items)
+#    elif (l1seedname == 'L1_ALFA_CDiff_Phys' ):
+#        L1Seed = getL1_ALFA_CDiff_Phys_Seeds(l1items)
+#    elif (l1seedname == 'L1_ALFA_Jet_Phys' ):
+#        L1Seed = getL1_ALFA_Jet_Phys_Seeds(l1items)
+
+    elif (l1seedname in ['L1_PhysicsLow_noPS', 'L1_PhysicsHigh_noPS', 'L1_EMPTY_noPS', 'L1_FIRSTEMPTY_noPS', 'L1_UNPAIRED_ISO_noPS', 'L1_UNPAIRED_NONISO_noPS', 'L1_ABORTGAPNOTCALIB_noPS']):
+        L1Seed =  getEBnoL1PSSeed(l1items, l1seedname)
+        
+    elif (l1seedname == 'L1_Standby'):
+        L1Seed = getL1StandbySeed(l1items)
+
+    elif (l1seedname == 'L1_Topo'):
+        L1Seed = getL1TopoSeed(l1items)
+
+    elif (l1seedname in ['L1_Calo', 'L1_Calo_EMPTY']):
+        L1Seed = getL1CaloSeed(l1seedname, l1itemobject)
+
+    elif (l1seedname in ['L1_Muon', 'L1_Muon_EMPTY']):
+        L1Seed = getL1MuonSeed(l1seedname, l1itemobject)
+
+    elif (l1seedname == 'L1_TAU'):
+        L1Seed = getL1TauSeed(l1items)
+
+    elif (l1seedname == 'L1_BS'):
+        L1Seed = getL1BSSeed(l1items)
+        
+    elif (l1seedname in ['L1_MinBias', 'L1_MinBias_EMPTY']):
+        L1Seed = getL1MinBiasSeed(l1seedname, l1itemobject)
+
+#    elif (l1seedname == 'L1_ALFA_Phys'):
+#        L1Seed = getL1_ALFA_Phys(l1items)
+#
+#    elif (l1seedname == 'L1_ALFA_PhysAny'):
+#        L1Seed = getL1_ALFA_Phys_Any(l1items)
+#
+#    elif (l1seedname == 'L1_ALFA_Diff'):
+#        L1Seed = getL1ALFA_Diff(l1items)
+#
+#    elif (l1seedname == 'L1_ALFA_TRT_Diff'):
+#        L1Seed = getL1ALFA_TRT_Diff(l1items)
+#        
+    elif (l1seedname == 'L1_ALFA_Calib'):
+        L1Seed = getL1ALFA_Calib(l1items)
+#
+#    elif (l1seedname == 'L1_ALFA_ELAS'):
+#        L1Seed = getL1ALFA_ELAS(l1items)
+#
+#    elif (l1seedname == 'L1_ALFA_TRT_Calib'):
+#        L1Seed = getL1ALFA_TRT_Calib(l1items)
+#
+#    elif (l1seedname == 'L1_ALFA_Jet'):
+#        L1Seed = getL1ALFA_Jet(l1items)
+#        
+#    elif (l1seedname == 'L1_ALFA_SDiff'):
+#        L1Seed = getL1ALFA_SDiff(l1items)
+#
+#    elif (l1seedname == 'L1_ALFA_CEP'):
+#        L1Seed = getL1ALFA_CEP(l1items)
+#
+#    elif (l1seedname == 'L1_ALFA_TRT'):
+#        L1Seed = getL1ALFA_TRT(l1items)
+#
+#    elif (l1seedname == 'L1_ALFA_SYS'):
+#        L1Seed = getL1ALFA_SYS(l1items)
+
+
+    elif (l1seedname == 'L1_LowLumi'):
+        L1Seed = getL1LowLumi(l1items)
+        
+    elif (l1seedname == 'L1_All'):
+        return ''
+
+    elif (l1seedname == ''):
+        log.warning('No L1item name given!')
+
+    else: 
+        #log.error('Given seed %s could not be found!' %l1seedname)
+        return 'ERROR_'+l1seedname
+
+    L1Seed = L1Seed.split(",")
+    L1Seed.sort()
+    L1Seed = ",".join(L1Seed)
+
+    return L1Seed
+
+#####################################
+# map from l1item name to inputTE
+#####################################
+def getInputTEfromL1Item(l1item):
+    
+    L1Map = {
+        'L1_TAU8_EMPTY':      ['HA8'],
+        'L1_TAU8_FIRSTEMPTY': ['HA8'],
+        'L1_TAU8_UNPAIRED_ISO': ['HA8'],
+        'L1_TAU8_UNPAIRED_NONISO': ['HA8'],
+	'L1_TAU12_EMPTY':      ['HA12'],
+        'L1_TAU12_FIRSTEMPTY': ['HA12'],
+        'L1_TAU12_UNPAIRED_ISO': ['HA12'],
+        'L1_RD0_FIRSTEMPTY':  [''],
+        'L1_TAU30'         :  ['HA30'],
+        'L1_TAU30_EMPTY':      ['HA30'],
+        'L1_TAU30_UNPAIRED_ISO': ['HA30'],
+        'L1_TAU40'         :  ['HA40'],
+        'L1_TAU60'         :  ['HA60'],
+        'L1_TAU100'         :  ['HA100'],
+        }
+
+    if TriggerFlags.triggerMenuSetup() == 'LS1_v1': 
+        L1Map['L1_CALREQ2']=['NIM30']
+    else:
+        L1Map['L1_CALREQ2']=['CAL2']
+        
+    if l1item in L1Map:
+        TE = L1Map[l1item]
+        log.debug('Mapped L1 input TE from %s to %s.'% (l1item, TE)) 
+        return TE
+    else:
+        TE = l1item.replace("L1_","").split("_")[0]
+        TE = TE[1:] if TE[0].isdigit() else TE
+        return TE
+    
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/L1Topo/L1TopoFlags.py b/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/L1Topo/L1TopoFlags.py
new file mode 100644
index 0000000000000000000000000000000000000000..9114f8db9e19f2b895ed277f95b707c87199be9e
--- /dev/null
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/L1Topo/L1TopoFlags.py
@@ -0,0 +1,35 @@
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+"""
+L1Topo specific flags
+"""
+
+from AthenaCommon.JobProperties import JobProperty, JobPropertyContainer, jobproperties
+from TriggerMenu.menu.CommonSliceHelper import AllowedList
+from AthenaCommon.Logging import logging
+
+log = logging.getLogger('TriggerMenu.L1TopoFlags.py')
+
+_flags = [] 
+
+class algos(JobProperty):
+    """Names of algos enabled in the selected L1Topo menu"""
+    statusOn=True
+    allowedTypes=['list']
+    StoredValue=[]
+
+_flags.append(algos)  
+
+class L1TopoTriggerFlags(JobPropertyContainer):
+    """ L1Topo flags used in menu generation """
+
+from TriggerJobOpts.TriggerFlags import TriggerFlags
+TriggerFlags.add_Container(L1TopoTriggerFlags)
+
+for flag in _flags:
+    TriggerFlags.L1TopoTriggerFlags.add_JobProperty(flag)
+del _flags
+
+# make an alias
+L1TopoFlags = TriggerFlags.L1TopoTriggerFlags
+            
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/L1Topo/L1TopoMenu.py b/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/L1Topo/L1TopoMenu.py
new file mode 100644
index 0000000000000000000000000000000000000000..fd8aa97e27f8de9a51c5bcb28ce6d11d37ec0c79
--- /dev/null
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/L1Topo/L1TopoMenu.py
@@ -0,0 +1,142 @@
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+from TopoOutput import TopoOutput, TriggerLine
+from AthenaCommon.Logging import logging
+log = logging.getLogger("TriggerMenu.l1topo.L1TopoMenu")
+
+class L1TopoMenu:
+
+    def __init__(self, menuName):
+        self.menuName = menuName
+        # algorithms and their output location
+        self.topoOutput = []
+
+        self.globalConfig = dict()
+
+    def __iter__(self):
+        return self.topoOutput.__iter__()
+
+    def __call__(self):
+        return self.topoOutput
+        
+    def algoNames(self):
+        return [x.algoname for x in self.topoOutput]         
+
+    def __len__(self):
+        return len(self.topoOutput)
+
+    def addTopoLine(self, topoline):
+        self.topoOutput += topoline
+
+    def __iadd__(self, topoline):
+        if topoline is not None:
+            self.topoOutput += [ topoline ]
+        return self
+
+    def addGlobalConfig(self, name, value):
+        self.globalConfig[name]=str(value)
+
+
+    def getTriggerLines(self):
+        from operator import attrgetter
+        outputLines = []
+        for output in self.topoOutput:
+            outputLines += TriggerLine.createTriggerlinesFromTopoOutput(output)
+        return sorted(outputLines, key=attrgetter('ordinal')) # return the TriggerLines, sorted by the ordinal
+
+
+
+    def xml(self, ind=1, step=2):
+        from operator import attrgetter        
+        s  = '<?xml version="1.0" ?>\n'
+        s += '<TOPO_MENU menu_name="Topo_pp_vX" menu_version="1">\n' # % (self.menuName.replace("Physics_pp_","").replace("MC_pp_",""))
+        s += '  <!--File is generated by TriggerMenu-->\n'
+        s += '  <!--No. L1Topo algos defined: %i-->\n' % len(self.topoOutput)
+        s += '  <OutputList>\n'
+        for output in self.topoOutput:  # (Setup for module, fpga, firstbit, clock should be modified in more flexible way.)
+            s += output.xml(ind+1,step)
+        s += '  </OutputList>\n\n'
+        s += '  <TopoConfig>\n'
+        
+        for gPar in sorted(self.globalConfig.keys()):
+            s += '    <Entry name="%s" value="%s"/>\n' % (gPar, self.globalConfig[gPar])
+        s += '  </TopoConfig>\n\n'
+        
+        allSortAlgs = set()
+        for output in self.topoOutput:
+            allSortAlgs.update(output.sortingAlgos)
+        for sortAlg in sorted(allSortAlgs, key=attrgetter('algoId')):
+            s += sortAlg.xml()+"\n"
+
+        for output in self.topoOutput:
+            s += output.algo.xml()+"\n"
+
+        s += '</TOPO_MENU>\n'
+        return s
+
+
+
+
+    def readMenuFromXML(self,inputFile):
+        from XMLMenuReader import readMenuFromXML
+        readMenuFromXML(self, inputFile)
+
+
+
+    def check(self):
+
+        allOk = self.check_consecutiveAlgId()
+        
+        allOk &= self.check_OutputOverlap()
+
+        allOk &= self.check_LUTassignment()
+
+        return allOk
+
+    def check_consecutiveAlgId(self):
+        """
+        This method is only for quick solutions but should be intermediate
+        """
+        allOk = True
+        idlist = [x.algo.algoId for x in self.topoOutput]
+        if len(idlist)>0 and len(idlist) != max(idlist)+1:
+            idlist.sort()
+            from itertools import groupby
+            partition = [list(g) for k,g in groupby(enumerate(idlist), lambda (x,y) : y-x)]
+            log.error("Algorithm IDs must start at 0 and be consecutive, but algorithm IDs are %s" % ','.join(["%i-%i" % (x[0][1],x[-1][1]) for x in partition]))
+            allOk = False
+        return allOk
+        
+
+    def check_OutputOverlap(self):
+
+        triggerlines = self.getTriggerLines()
+
+        allOk = True
+
+        tlKeys = [ (tl.cable, tl.fpga, tl.clock, tl.bit) for tl in triggerlines]
+        
+        from collections import Counter
+        c = Counter( tlKeys ).most_common()
+        for key,count in c:
+            if count == 1: break
+            print "Output cable %s, fpga %s, clock %s, bit %i" % key, "is uses more than once (%i times)!" % count
+            print "Check these trigger lines:"
+            for tl in triggerlines:
+                if key == (tl.cable, tl.fpga, tl.clock, tl.bit):
+                    print "     ",tl.trigger
+
+            allOk = False
+
+
+        return allOk
+
+
+    def check_LUTassignment(self):
+        """
+        Check if multibit algos are on a single LUT
+        """
+
+        allOk = True
+
+        return allOk
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/L1Topo/TopoAlgos.py b/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/L1Topo/TopoAlgos.py
new file mode 100644
index 0000000000000000000000000000000000000000..4b09969e45fbc8f44478f585ef59b6518bcb852b
--- /dev/null
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/L1Topo/TopoAlgos.py
@@ -0,0 +1,148 @@
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+from AthenaCommon.Logging import logging
+from copy import deepcopy 
+from TriggerJobOpts.TriggerFlags import TriggerFlags
+
+log = logging.getLogger("TopoAlgo") 
+
+class TopoAlgo(object):
+
+    _availableVars = []
+
+    #__slots__ = ['_name', '_selection', '_value', '_generic']
+    def __init__(self, classtype, name, algoId=0):
+        self.classtype = classtype
+        self.name = name
+        self.algoId = int(algoId)
+        self.generics = []
+        self.variables = []
+        
+    def __str__(self):  
+        return self.name
+
+    def addvariable(self, name, value, selection = -1):
+        if name in self._availableVars:
+            self.variables += [ Variable(name, selection, value) ]
+        else:
+            raise RuntimeError("Variable parameter '%s' does not exist for algorithm %s of type %s,\navailable parameters are %r" % (name,self.name, self.classtype, self._availableVars))
+        return self
+
+    def addgeneric(self, name, value):
+        if name in self._availableVars:
+            self.generics += [ Generic(name, value) ]
+        else:
+            raise RuntimeError("Generic parameter '%s' does not exist for algorithm %s of type %s,\navailable parameters are %r" % (name,self.name, self.classtype, self._availableVars))
+        return self
+
+
+    
+class Variable(object):
+    def __init__(self, name, selection, value):
+        self.name = name
+        self.selection = int(selection)
+        self.value = int(value)
+            
+class Generic(object):
+    def __init__(self, name, value):
+        self.name = name
+        from L1TopoHardware.L1TopoHardware import HardwareConstrainedParameter
+        if isinstance(value,HardwareConstrainedParameter):
+            self.value = ":%s:" % value.name
+        else:
+            self.value = str(int(value))
+
+        
+class SortingAlgo(TopoAlgo):
+    
+    def __init__(self, classtype, name, inputs, outputs, algoId):
+        super(SortingAlgo, self).__init__(classtype=classtype, name=name, algoId=algoId)
+        self.inputs = inputs
+        self.outputs = outputs
+        self.inputvalue=  self.inputs
+        if self.inputs.find("Cluster")>=0: # to extract inputvalue (for FW) from output name
+            if self.outputs.find("TAU")>=0: self.inputvalue= self.inputvalue.replace("Cluster","Tau")            
+            if self.outputs.find("EM")>=0:  self.inputvalue= self.inputvalue.replace("Cluster","Em")
+            
+    def xml(self):
+        _emscale_for_decision=2
+        _mu_for_decision=1 # MU4->3GeV, MU6->5GeV, MU10->9GeV
+        if hasattr(TriggerFlags, 'useRun1CaloEnergyScale'):
+            if TriggerFlags.useRun1CaloEnergyScale :
+                _emscale_for_decision=1
+                log.info("Changed mscale_for_decision %s for Run1CaloEnergyScale" % _emscale_for_decision)  
+        
+        s='  <SortAlgo type="%s" name="%s" output="%s" algoId="%i">\n' % (self.classtype, self.name, self.outputs, self.algoId)
+        s+='    <Fixed>\n'
+        s+='      <Input name="%s" value="%s"/>\n' % (self.inputs, self.inputvalue) 
+        s+='      <Output name="TobArrayOut" value="%s"/>\n' % (self.outputs)
+        for gene in self.generics:
+            s += '      <Generic name="%s" value="%s"/>\n' % (gene.name, gene.value)
+        s+='    </Fixed>\n'            
+        s+='    <Variable>\n'
+
+        for (pos, variable) in enumerate(self.variables):
+            # scale MinET if outputs match with EM or TAU
+            if variable.name=="MinET" and (self.outputs.find("TAU")>=0 or self.outputs.find("EM")>=0):
+                variable.value = variable.value * _emscale_for_decision
+            if variable.name=="MinET" and self.outputs.find("MU")>=0:
+                variable.value = ((variable.value - _mu_for_decision) if variable.value>0 else variable.value)
+            s+='      <Parameter pos="%i" name="%s" value="%i"/>\n' % ( pos, variable.name, variable.value )
+        s+='    </Variable>\n'    
+        s+='  </SortAlgo>\n'
+        return s
+        
+class DecisionAlgo(TopoAlgo):
+
+    def __init__(self, classtype, name, inputs, outputs, algoId):
+        super(DecisionAlgo, self).__init__(classtype=classtype, name=name, algoId=algoId)
+        self.inputs = inputs if type(inputs)==list else [inputs]
+        self.outputs = outputs if type(outputs)==list else [outputs]
+        
+    def xml(self): 
+        _emscale_for_decision=2
+        _mu_for_decision=1 
+        if hasattr(TriggerFlags, 'useRun1CaloEnergyScale'):
+            if TriggerFlags.useRun1CaloEnergyScale :
+                _emscale_for_decision=1
+                log.info("Changed mscale_for_decision %s for Run1CaloEnergyScale" % _emscale_for_decision)  
+        
+        s='  <DecisionAlgo type="%s" name="%s" algoId="%i">\n' % (self.classtype, self.name, self.algoId )
+        s+='    <Fixed>\n'
+        input_woovlp = []
+        for (tobid, _input) in enumerate(self.inputs):
+            if len(self.inputs)>1:
+                if _input not in input_woovlp:
+                    s+='      <Input name="Tob%s" value="%s" position="%s"/>\n' % (str(tobid+1), _input, str(tobid))
+                    input_woovlp += [_input]
+                else:
+                    s+='      <Input name="Tob%s" value="%s" position="%s"/>\n' % (str(tobid+1), _input, str(tobid))
+            else:
+                s+='      <Input name="Tob" value="%s" position="%s"/>\n' % (_input, str(tobid))
+        s+='      <Output name="Results" bits="%s">\n' % str(len(self.outputs))
+        for (bitid, _output) in enumerate(self.outputs):
+            s+='        <Bit selection="%s" name="%s"/>\n' % (str(bitid), _output)
+        s+='      </Output>\n'
+        for gene in self.generics:
+            s += '      <Generic name="%s" value="%s"/>\n' % (gene.name, gene.value)
+        s+='    </Fixed>\n'     
+        s+='    <Variable>\n'
+
+        for (pos, variable) in enumerate(self.variables):
+            # scale MinET if inputs match with EM or TAU
+            for _minet in ["MinET"]:
+                if variable.name==_minet+"1" or variable.name==_minet+"2" or variable.name==_minet+"3" or variable.name==_minet:
+                    for (tobid, _input) in enumerate(self.inputs):
+                        if (_input.find("TAU")>=0 or _input.find("EM")>=0):
+                            if (len(self.inputs)>1 and (variable.name==_minet+str(tobid+1) or (tobid==0 and variable.name==_minet))) or (len(self.inputs)==1 and (variable.name.find(_minet)>=0)):
+                                variable.value = variable.value * _emscale_for_decision
+
+                        if _input.find("MU")>=0:
+                            if (len(self.inputs)>1 and (variable.name==_minet+str(tobid+1) or (tobid==0 and variable.name==_minet))) or (len(self.inputs)==1 and (variable.name.find(_minet)>=0)):
+                                variable.value = ((variable.value - _mu_for_decision ) if variable.value>0 else variable.value)
+                            
+            s+='      <Parameter pos="%i" name="%s"%s value="%i"/>\n' % ( pos, variable.name, ((' selection="%i"'%variable.selection) if (variable.selection>=0) else ""), variable.value )
+        s+='    </Variable>\n'    
+        s+='  </DecisionAlgo>\n'
+        return s
+
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/L1Topo/TopoOutput.py b/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/L1Topo/TopoOutput.py
new file mode 100644
index 0000000000000000000000000000000000000000..0738fbce77ee03dbfd92463ac28d3d80af36675d
--- /dev/null
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/L1Topo/TopoOutput.py
@@ -0,0 +1,95 @@
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+
+class TopoOutput(object):
+    def __init__(self, algoname, module, fpga, clock, firstbit):
+        self.algo = None
+        self.sortingAlgos = []
+        self.algoname = algoname
+        self.module = module
+        self.fpga = fpga
+        self.clock = clock
+        self.firstbit = firstbit
+
+    def xml(self, ind, step=2):
+        t = (self.algoname, ",".join(self.algo.outputs), self.algo.algoId, self.module, self.fpga, self.firstbit, self.clock)
+        s = (' '*ind*step) + '<Output algname="%s" triggerline="%s" algoId="%i" module="%i" fpga="%i" firstbit="%i" clock="%i"/>\n' % t
+        return s
+
+
+    def __str__(self):
+        return "%s [id=%i] --> %s" % (self.algoname, self.algo.algoId, ",".join(self.algo.outputs))
+
+
+
+from collections import namedtuple
+class TriggerLine(object):
+
+    import re
+    multibitPattern = re.compile("(?P<line>.*)\[(?P<bit>\d+)\]")
+
+    def __init__(self, trigger, cable, bit, clock, fpga, ordinal, firstbit):
+        """
+        trigger    name of the trigger line
+        cable      0 or 1, depending on the topo module
+        bit
+        """
+        # namedtuple("TriggerLine","trigger cable bit clock fpga ordinal firstbit")
+        self.trigger  = trigger 
+        self.cable    = cable   
+        self.bit      = bit     
+        self.clock    = clock   
+        self.fpga     = fpga    
+        self.ordinal  = ordinal 
+        self.firstbit = firstbit
+
+    def __str__(self):
+        return "{0} on cable {1}, fpga {2}, bit {3}, ordinal {4}".format(self.trigger,self.cable, self.fpga, self.bit, self.ordinal)
+
+    @staticmethod
+    def createTriggerlinesFromTopoOutput(topoOutput):
+
+        tl = []
+        for (idx,line) in enumerate(topoOutput.algo.outputs):
+                
+            ordinal = 64*topoOutput.module + 32*topoOutput.clock + 16*topoOutput.fpga + topoOutput.firstbit+idx
+        
+            tl += [ TriggerLine( trigger = line,
+                                 cable = topoOutput.module,
+                                 bit = topoOutput.firstbit+idx+16*topoOutput.fpga,
+                                 clock = topoOutput.clock,
+                                 fpga = topoOutput.fpga,
+                                 ordinal = ordinal,
+                                 firstbit = topoOutput.firstbit )
+                    ]
+        return tl
+            
+
+    @staticmethod
+    def checkMultibitConsistency(multibitTriggerlines):
+
+        cs = set()  # set to check consistency
+
+        bitlist = []
+        for tl in multibitTriggerlines:
+            m = TriggerLine.multibitPattern.match(tl.trigger)
+
+            if not m:
+                raise RuntimeError("Triggerline %s does not match multibit pattern 'line[bit]'" % tl.trigger)
+
+            cs.add( (m.groupdict()['line'], tl.bit - int(m.groupdict()['bit']), tl.cable, tl.clock, tl.fpga, tl.ordinal-int(m.groupdict()['bit'])) )
+
+            bitlist += [ int(m.groupdict()['bit']) ]
+
+        minimum = min(bitlist)
+        numberOfBits = max(bitlist)+1
+        if ( (minimum !=0) or
+             (numberOfBits != len(bitlist)) or
+             (len(cs) != 1) ):
+            raise RuntimeError("This set of triggerlines does not consistently describe a multiplicity topo trigger output %r" % [tl.trigger for tl in multibitTriggerlines])
+
+        uniqueDescription = cs.pop()
+
+        (commonNameOfLines, firstbit, cable, clock, fpga, ordinal) = uniqueDescription
+
+        return (commonNameOfLines, firstbit, numberOfBits, cable, clock, fpga, ordinal)
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/L1TopoMenu/Menu_LS2_v1.py b/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/L1TopoMenu/Menu_LS2_v1.py
new file mode 100644
index 0000000000000000000000000000000000000000..3d621fe33f22751b3aad5f7fc96106efa6915c69
--- /dev/null
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/L1TopoMenu/Menu_LS2_v1.py
@@ -0,0 +1,206 @@
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+def defineMenu():
+    """
+    Defines the following LlTopoFlags:
+    
+    algos   .... list of all algo names in the menu 
+
+    """
+    
+    from TriggerMenu.l1topo.L1TopoFlags import L1TopoFlags
+    from TriggerMenu.l1topo.TopoOutput import TopoOutput
+    from TriggerJobOpts.TriggerFlags import TriggerFlags
+
+    # if this flag is True for mc v7: produce xml with full v7 menu
+    # if this flag is False for physics v7: produce xml with v7 new items removed, so to match with FW 
+    mcv7_flag = True
+
+    if 'Physics_pp_v7' in TriggerFlags.triggerMenuSetup() or 'Physics_pp_v6' in TriggerFlags.triggerMenuSetup() or 'HI' in TriggerFlags.triggerMenuSetup():
+        mcv7_flag = False
+
+    newalgos_onlyinv6 = [
+#          TopoOutput( algoname='15MINDPHI-EM12s6-XE0',                        module=0, fpga=0, clock=1, firstbit=14 ),#v6n        
+#          TopoOutput( algoname='15MINDPHI-EM15s6-XE0',                        module=0, fpga=0, clock=1, firstbit=15 ),#v6n
+#          TopoOutput( algoname='35MT-EM12s6-XE0',                             module=0, fpga=0, clock=1, firstbit=13 ),#v6n
+#          TopoOutput( algoname='DISAMB-0DR28-EM15his2-TAU12abi',              module=0, fpga=1, clock=0, firstbit=15 ),#v6n
+#          TopoOutput( algoname='LATE-MU10s1',                                  module=1, fpga=0, clock=1, firstbit=10 ),#v6n
+#          TopoOutput( algoname='SC111-CJ15ab.ETA26',                          module=1, fpga=1, clock=0, firstbit=11 ),#v6n
+#          TopoOutput( algoname='SC85-CJ15ab.ETA26',                           module=1, fpga=1, clock=0, firstbit=12 ),#v6n
+#          TopoOutput( algoname='10MINDPHI-AJ20s2-XE50',                       module=1, fpga=0, clock=1, firstbit=9 ),#v6n
+
+#          TopoOutput( algoname='0DR22-2MU6ab',                                module=1, fpga=0, clock=0, firstbit=10 ),#v6diff
+#          TopoOutput( algoname='7INVM15-2MU4ab',                              module=0, fpga=1, clock=0, firstbit=5 ),#v6diff 
+#          TopoOutput( algoname='0DR22-MU6ab-MU4ab',                           module=1, fpga=1, clock=1, firstbit=10 ), #v6diff
+ #         TopoOutput( algoname='0DR15-2MU4ab',                                module=1, fpga=0, clock=1, firstbit=0 ), #v6diff
+  #        TopoOutput( algoname='0DR24-2MU4ab',                                module=1, fpga=0, clock=1, firstbit=2 ),#v6diff
+#          TopoOutput( algoname='INVM_EMs6',                                   module=0, fpga=0, clock=0, firstbit=11 ), # 3bits
+#          TopoOutput( algoname='100RATIO-0MATCH-TAU30si2-EMall',              module=0, fpga=0, clock=1, firstbit=7 ),
+
+#          TopoOutput( algoname='2INVM9-2MU4ab',                               module=0, fpga=1, clock=1, firstbit=2 ),  #v6 new
+#          TopoOutput( algoname='2INVM9-MU6ab-MU4ab',                          module=0, fpga=1, clock=1, firstbit=3 ),  #v6 new
+#          TopoOutput( algoname='0DR25-TAU20abi-TAU12abi',                     module=0, fpga=1, clock=0, firstbit=14 ), #v6 new
+#          TopoOutput( algoname='1DISAMB-J25ab-0DR25-TAU20abi-TAU12abi',       module=1, fpga=0, clock=1, firstbit=8 ), #v6 new 
+#          TopoOutput( algoname='0DR15-2MU6ab',                                module=1, fpga=0, clock=1, firstbit=11 ), #v6 new
+#          TopoOutput( algoname='10MINDPHI-J20s2-XE30',                        module=1, fpga=0, clock=1, firstbit=12 ),  #v6 new
+#          TopoOutput( algoname='DISAMB-30INVM-EM20his2-TAU12ab',              module=0, fpga=1, clock=1, firstbit=0 ),  #v6 new
+#          TopoOutput( algoname='400INVM9999-AJ30s6.ETA31-AJ20s6.31ETA49',     module=0, fpga=1, clock=1, firstbit=1 ),  #v6 new
+        ]
+
+    newalgos_onlyinv5 = [
+#        TopoOutput( algoname='2DR15-CMU6ab-CMU4ab',                         module=1, fpga=0, clock=0, firstbit=10 ),#v6diff
+#        TopoOutput( algoname='4INVM8-ONEBARREL-MU6ab-MU4ab',                module=0, fpga=1, clock=0, firstbit=5 ),#v6diff 
+#        TopoOutput( algoname='2DR15-ONEBARREL-MU6ab-MU4ab',                 module=1, fpga=1, clock=1, firstbit=10 ), #v6diff
+#        TopoOutput( algoname='2INVM999-CMU6ab-CMU4ab',                      module=1, fpga=0, clock=1, firstbit=0 ), #v6diff
+#        TopoOutput( algoname='4INVM8-CMU6ab-CMU4ab',                        module=1, fpga=0, clock=1, firstbit=2 ),#v6diff
+#        TopoOutput( algoname='INVM_EMall',                                  module=0, fpga=0, clock=0, firstbit=11 ), # 3bits
+#        TopoOutput( algoname='210RATIO-0MATCH-TAU30si2-EMall',              module=0, fpga=0, clock=1, firstbit=7 ),
+    ]
+    
+    L1TopoFlags.algos = [
+        
+        # module: 0, FPGA: 0
+        TopoOutput( algoname='INVM_AJ_HighMass',                            module=0, fpga=0, clock=0, firstbit=0 ), # need 4bits 
+        TopoOutput( algoname='INVM_AJ_LowMass',                             module=0, fpga=0, clock=0, firstbit=4 ), # 4 bits 
+        TopoOutput( algoname='HT150-J20s5.ETA31',                           module=0, fpga=0, clock=0, firstbit=9 ),
+        TopoOutput( algoname='HT190-J15s5.ETA21',                           module=0, fpga=0, clock=0, firstbit=10 ),
+        TopoOutput( algoname='05MINDPHI-EM12s6-XE0',                        module=0, fpga=0, clock=0, firstbit=14 ),#v6
+#        TopoOutput( algoname='10MINDPHI-EM12s6-XE0',                        module=0, fpga=0, clock=0, firstbit=15 ),#v6
+        TopoOutput( algoname='05MINDPHI-EM15s6-XE0',                        module=0, fpga=0, clock=1, firstbit=0 ),
+        TopoOutput( algoname='25MT-EM12s6-XE0',                             module=0, fpga=0, clock=1, firstbit=1 ),#v6
+#        TopoOutput( algoname='30MT-EM12s6-XE0',                             module=0, fpga=0, clock=1, firstbit=2 ),#v6
+        TopoOutput( algoname='35MT-EM15s6-XE0',                             module=0, fpga=0, clock=1, firstbit=3 ),
+#        TopoOutput( algoname='0DETA10-Js1-Js2',                             module=0, fpga=0, clock=1, firstbit=4 ),
+#        TopoOutput( algoname='10MINDPHI-Js2-XE50',                          module=0, fpga=0, clock=1, firstbit=5 ),
+        TopoOutput( algoname='10MINDPHI-J20s2-XE50',                        module=0, fpga=0, clock=1, firstbit=6 ),
+        TopoOutput( algoname='100RATIO-0MATCH-TAU30si2-EMall',              module=0, fpga=0, clock=1, firstbit=7 ),
+        TopoOutput( algoname='NOT-0MATCH-TAU30si2-EMall',                   module=0, fpga=0, clock=1, firstbit=8 ), 
+        TopoOutput( algoname='LAR-EM50s1',                                  module=0, fpga=0, clock=1, firstbit=9 ), 
+        TopoOutput( algoname='LAR-J100s1',                                  module=0, fpga=0, clock=1, firstbit=10 ), 
+        TopoOutput( algoname='NOT-02MATCH-EM10s1-AJj15all.ETA49',           module=0, fpga=0, clock=1, firstbit=11 ), 
+#        TopoOutput( algoname='05RATIO-XE0-SUM0-EM10s1-HT0-AJj15all.ETA49',  module=0, fpga=0, clock=1, firstbit=12 ), 
+        TopoOutput( algoname='15MINDPHI-EM12s6-XE0',                        module=0, fpga=0, clock=1, firstbit=14 ),#v6n        
+        TopoOutput( algoname='15MINDPHI-EM15s6-XE0',                        module=0, fpga=0, clock=1, firstbit=15 ),#v6n
+        TopoOutput( algoname='35MT-EM12s6-XE0',                             module=0, fpga=0, clock=1, firstbit=13 ),#v6n
+        
+        # module: 0, FPGA: 1
+#        TopoOutput( algoname='1DISAMB-TAU20ab-J20ab',                       module=0, fpga=1, clock=0, firstbit=0 ), 
+#        TopoOutput( algoname='DISAMB-EM15abhi-TAU12abi',                    module=0, fpga=1, clock=0, firstbit=1 ),
+        TopoOutput( algoname='1DISAMB-EM15his2-TAU12abi-J25ab',             module=0, fpga=1, clock=0, firstbit=2 ), 
+        TopoOutput( algoname='1DISAMB-J25ab-0DR28-EM15his2-TAU12abi',       module=0, fpga=1, clock=0, firstbit=3 ),
+#        TopoOutput( algoname='4INVM8-2MU6ab',                               module=0, fpga=1, clock=0, firstbit=4 ), 
+        TopoOutput( algoname='2INVM9-2MU6ab',                               module=0, fpga=1, clock=0, firstbit=4 ),#v6
+#        TopoOutput( algoname='2INVM999-ONEBARREL-MU6ab-MU4ab',              module=0, fpga=1, clock=0, firstbit=5 ), 
+#        TopoOutput( algoname='4INVM8-ONEBARREL-MU6ab-MU4ab',                module=0, fpga=1, clock=0, firstbit=6 ),
+        TopoOutput( algoname='2INVM8-ONEBARREL-MU6ab-MU4ab',                module=0, fpga=1, clock=0, firstbit=6 ),#v6
+#        TopoOutput( algoname='5DETA99-5DPHI99-2MU4ab',                      module=0, fpga=1, clock=0, firstbit=7 ), 
+        TopoOutput( algoname='5DETA99-5DPHI99-MU6ab-MU4ab',                 module=0, fpga=1, clock=0, firstbit=8 ), 
+        TopoOutput( algoname='5DETA99-5DPHI99-2MU6ab',                      module=0, fpga=1, clock=0, firstbit=9 ), 
+        TopoOutput( algoname='1DISAMB-TAU20abi-TAU12abi-J25ab',             module=0, fpga=1, clock=0, firstbit=10 ),
+        TopoOutput( algoname='0DR28-MU10ab-TAU12abi',                       module=0, fpga=1, clock=0, firstbit=11 ),
+        TopoOutput( algoname='0DETA20-0DPHI20-TAU20abi-TAU12abi',           module=0, fpga=1, clock=0, firstbit=12 ),
+#        TopoOutput( algoname='DISAMB-EM15abhi-TAU40ab',                     module=0, fpga=1, clock=0, firstbit=13 ), 
+        TopoOutput( algoname='DISAMB-0DR28-EM15his2-TAU12abi',              module=0, fpga=1, clock=0, firstbit=15 ),#v6n
+
+        TopoOutput( algoname='DISAMB-30INVM-EM20his2-TAU12ab',              module=0, fpga=1, clock=1, firstbit=0 ),  #v6 new
+        TopoOutput( algoname='400INVM9999-AJ30s6.ETA31-AJ20s6.31ETA49',     module=0, fpga=0, clock=0, firstbit=15 ),  #v6 new
+
+        TopoOutput( algoname='0DR22-2MU6ab',                                module=0, fpga=1, clock=1, firstbit=4 ),#v6
+        TopoOutput( algoname='7INVM15-2MU4ab',                              module=0, fpga=1, clock=1, firstbit=5 ),#v6
+        TopoOutput( algoname='0DR22-MU6ab-MU4ab',                           module=0, fpga=1, clock=1, firstbit=6 ),#v6
+        TopoOutput( algoname='0DR15-2MU4ab',                                module=0, fpga=1, clock=1, firstbit=7 ),#v6
+        TopoOutput( algoname='0DR24-2MU4ab',                                module=0, fpga=1, clock=1, firstbit=8 ),#v6
+        TopoOutput( algoname='0DR15-2MU6ab',                                module=0, fpga=1, clock=1, firstbit=9 ), #v6 new
+        TopoOutput( algoname='2INVM9-2MU4ab',                               module=0, fpga=1, clock=1, firstbit=10 ),  #v6 new
+        TopoOutput( algoname='2INVM9-MU6ab-MU4ab',                          module=0, fpga=1, clock=1, firstbit=11 ),  #v6 new       
+        TopoOutput( algoname='INVM_EMs6',                                   module=0, fpga=0, clock=0, firstbit=11 ), # 3bits
+ 
+        # module: 1, FPGA: 0        
+        TopoOutput( algoname='05MINDPHI-AJj10s6-XE0',                       module=1, fpga=0, clock=0, firstbit=0 ),#v6
+        TopoOutput( algoname='10MINDPHI-AJj10s6-XE0',                       module=1, fpga=0, clock=0, firstbit=1 ),#v6
+        TopoOutput( algoname='15MINDPHI-AJj10s6-XE0',                       module=1, fpga=0, clock=0, firstbit=2 ),#v6
+        TopoOutput( algoname='0DR04-MU4ab-CJ15ab',                          module=1, fpga=0, clock=0, firstbit=3 ), 
+        TopoOutput( algoname='0DR04-MU4ab-CJ20ab',                          module=1, fpga=0, clock=0, firstbit=4 ),
+        TopoOutput( algoname='0DR04-MU4ab-CJ30ab',                          module=1, fpga=0, clock=0, firstbit=5 ),
+        TopoOutput( algoname='0DR04-MU6ab-CJ20ab',                          module=1, fpga=0, clock=0, firstbit=6 ),
+        TopoOutput( algoname='0DR04-MU6ab-CJ25ab',                          module=1, fpga=0, clock=0, firstbit=7 ),
+        TopoOutput( algoname='10MINDPHI-CJ20ab-XE50',                       module=1, fpga=0, clock=0, firstbit=8 ),
+#        TopoOutput( algoname='2DR15-2CMU4ab',                               module=1, fpga=0, clock=0, firstbit=9 ),
+        TopoOutput( algoname='0DR24-2CMU4ab',                               module=1, fpga=0, clock=0, firstbit=9 ),#v6
+#        TopoOutput( algoname='2DR15-CMU6ab-CMU4ab',                         module=1, fpga=0, clock=0, firstbit=10 ),
+        TopoOutput( algoname='MULT-CMU4ab',                                 module=1, fpga=0, clock=0, firstbit=11 ), # 2bits
+        TopoOutput( algoname='MULT-CMU6ab',                                 module=1, fpga=0, clock=0, firstbit=13 ), # 2bits
+#        TopoOutput( algoname='2INVM999-2CMU4ab',                            module=1, fpga=0, clock=0, firstbit=15 ), 
+#        TopoOutput( algoname='1INVM19-2CMU4ab',                             module=1, fpga=0, clock=0, firstbit=15 ),#v6
+#        TopoOutput( algoname='2INVM999-CMU6ab-CMU4ab',                      module=1, fpga=0, clock=1, firstbit=0 ), 
+#        TopoOutput( algoname='4INVM8-2CMU4ab',                              module=1, fpga=0, clock=1, firstbit=1 ),
+#        TopoOutput( algoname='2INVM8-2CMU4ab',                              module=1, fpga=0, clock=1, firstbit=1 ),#v6
+#        TopoOutput( algoname='4INVM8-CMU6ab-CMU4ab',                        module=1, fpga=0, clock=1, firstbit=2 ),
+#        TopoOutput( algoname='0DETA04-0DPHI03-EM8abi-MU10ab',               module=1, fpga=0, clock=1, firstbit=3 ),
+         TopoOutput( algoname='0DETA04-EM8abi-MU10ab',                       module=1, fpga=0, clock=1, firstbit=3 ), #ATR-14282
+         TopoOutput( algoname='0DPHI03-EM8abi-MU10ab',                       module=1, fpga=0, clock=1, firstbit=6 ),
+
+#        TopoOutput( algoname='0DETA04-0DPHI03-EM15abi-MUab',                module=1, fpga=0, clock=1, firstbit=4 ),
+         TopoOutput( algoname='0DETA04-EM15abi-MUab',                       module=1, fpga=0, clock=1, firstbit=4 ), #ATR-14282
+         TopoOutput( algoname='0DPHI03-EM15abi-MUab',                       module=1, fpga=0, clock=1, firstbit=8 ),
+
+#        TopoOutput( algoname='2DR15-CMU4ab-MU4ab',                          module=1, fpga=0, clock=1, firstbit=5 ),
+        TopoOutput( algoname='0DR24-CMU4ab-MU4ab',                          module=1, fpga=0, clock=1, firstbit=5 ),#v6
+#        TopoOutput( algoname='2INVM999-CMU4ab-MU4ab',                       module=1, fpga=0, clock=1, firstbit=6 ), 
+#        TopoOutput( algoname='1INVM19-CMU4ab-MU4ab',                        module=1, fpga=0, clock=1, firstbit=6 ),#v6
+#        TopoOutput( algoname='4INVM8-CMU4ab-MU4ab',                         module=1, fpga=0, clock=1, firstbit=7 ),         
+        TopoOutput( algoname='2INVM8-CMU4ab-MU4ab',                         module=1, fpga=0, clock=1, firstbit=7 ),#v6
+
+        TopoOutput( algoname='0DR25-TAU20abi-TAU12abi',                     module=1, fpga=1, clock=1, firstbit=10 ), #v6 new
+        TopoOutput( algoname='10MINDPHI-AJ20s2-XE50',                       module=1, fpga=0, clock=1, firstbit=9 ),#v6n
+        TopoOutput( algoname='LATE-MU10s1',                                  module=1, fpga=0, clock=1, firstbit=10 ),#v6n
+        TopoOutput( algoname='1DISAMB-J25ab-0DR25-TAU20abi-TAU12abi',       module=1, fpga=1, clock=1, firstbit=11 ), #v6 new 
+#          TopoOutput( algoname='0DR15-2MU6ab',                                module=1, fpga=0, clock=1, firstbit=11 ), #v6 new
+        TopoOutput( algoname='10MINDPHI-J20s2-XE30',                        module=0, fpga=0, clock=1, firstbit=5 ),  #v6 new
+
+
+        # module: 1, FPGA: 1        
+        TopoOutput( algoname='KF-XE-AJall',                                 module=1, fpga=1, clock=0, firstbit=0 ), # 6 bits        
+        TopoOutput( algoname='0MATCH-4AJ20.ETA31-4AJj15.ETA31',             module=1, fpga=1, clock=0, firstbit=6 ),
+        TopoOutput( algoname='HT190-AJ15all.ETA21',                         module=1, fpga=1, clock=0, firstbit=7 ),
+        TopoOutput( algoname='HT150-AJ20all.ETA31',                         module=1, fpga=1, clock=0, firstbit=8 ),
+        TopoOutput( algoname='HT150-AJj15all.ETA49',                        module=1, fpga=1, clock=0, firstbit=9 ),
+        TopoOutput( algoname='HT20-AJj15all.ETA49',                         module=1, fpga=1, clock=0, firstbit=10 ),
+        TopoOutput( algoname='SC111-CJ15ab.ETA26',                          module=1, fpga=0, clock=1, firstbit=11 ),#v6n
+        TopoOutput( algoname='SC85-CJ15ab.ETA26',                           module=1, fpga=0, clock=1, firstbit=12 ),#v6n
+        TopoOutput( algoname='05RATIO-XE0-HT0-AJj15all.ETA49',              module=1, fpga=1, clock=0, firstbit=13 ), 
+#        TopoOutput( algoname='08RATIO-XE0-HT0-AJj15all.ETA49',              module=1, fpga=1, clock=0, firstbit=14 ), 
+        TopoOutput( algoname='90RATIO2-XE0-HT0-AJj15all.ETA49',             module=1, fpga=1, clock=0, firstbit=15 ),
+        TopoOutput( algoname='250RATIO2-XE0-HT0-AJj15all.ETA49',            module=1, fpga=1, clock=1, firstbit=0 ),
+        TopoOutput( algoname='10MINDPHI-J20ab-XE50',                        module=1, fpga=1, clock=1, firstbit=1 ), 
+        TopoOutput( algoname='0DR28-TAU20abi-TAU12abi',                     module=1, fpga=1, clock=1, firstbit=2 ),
+        TopoOutput( algoname='1DISAMB-J25ab-0DR28-TAU20abi-TAU12abi',       module=1, fpga=1, clock=1, firstbit=3 ), 
+        TopoOutput( algoname='1DISAMB-TAU12abi-J25ab',                      module=1, fpga=1, clock=1, firstbit=4 ), 
+        TopoOutput( algoname='0DR10-MU10ab-MU6ab',                          module=1, fpga=1, clock=1, firstbit=5 ),  
+        TopoOutput( algoname='2DR99-2MU4ab',                                module=1, fpga=1, clock=1, firstbit=6 ), 
+#        TopoOutput( algoname='2DR15-2MU4ab',                                module=1, fpga=1, clock=1, firstbit=7 ),
+        TopoOutput( algoname='0DR34-2MU4ab',                                module=1, fpga=1, clock=1, firstbit=7 ), #v6
+        TopoOutput( algoname='2DR15-2MU6ab',                                module=1, fpga=1, clock=1, firstbit=8 ), 
+#        TopoOutput( algoname='2DR15-MU6ab-MU4ab',                           module=1, fpga=1, clock=1, firstbit=9 ), 
+        TopoOutput( algoname='0DR15-MU6ab-MU4ab',                           module=1, fpga=1, clock=1, firstbit=9 ), #v6
+#        TopoOutput( algoname='2DR15-ONEBARREL-MU6ab-MU4ab',                 module=1, fpga=1, clock=1, firstbit=10 ),
+#        TopoOutput( algoname='2INVM999-2MU4ab',                             module=1, fpga=1, clock=1, firstbit=11 ),
+#        TopoOutput( algoname='1INVM19-2MU4ab',                              module=1, fpga=1, clock=1, firstbit=11 ), #v6
+#        TopoOutput( algoname='2INVM999-MU6ab-MU4ab',                        module=1, fpga=1, clock=1, firstbit=12 ),
+        TopoOutput( algoname='8INVM15-MU6ab-MU4ab',                         module=1, fpga=1, clock=1, firstbit=12 ), #v6
+#        TopoOutput( algoname='2INVM999-2MU6ab',                             module=1, fpga=1, clock=1, firstbit=13 ),
+        TopoOutput( algoname='8INVM15-2MU6ab',                              module=1, fpga=1, clock=1, firstbit=13 ), #v6
+#        TopoOutput( algoname='4INVM8-2MU4ab',                               module=1, fpga=1, clock=1, firstbit=14 ), 
+        TopoOutput( algoname='2INVM8-2MU4ab',                               module=1, fpga=1, clock=1, firstbit=14 ), #v6
+# ATR-15197        TopoOutput( algoname='2INVM9-2MU4ab',                               module=1, fpga=1, clock=1, firstbit=14 ), #v6
+#        TopoOutput( algoname='4INVM8-MU6ab-MU4ab',                          module=1, fpga=1, clock=1, firstbit=15 ), 
+        TopoOutput( algoname='2INVM8-MU6ab-MU4ab',                          module=1, fpga=1, clock=1, firstbit=15 ), #v6
+# ATR-15197        TopoOutput( algoname='2INVM9-MU6ab-MU4ab',                          module=1, fpga=1, clock=1, firstbit=15 ), #v6
+
+        ]
+
+
+    if mcv7_flag:
+        L1TopoFlags.algos +=  newalgos_onlyinv6
+    else:
+        L1TopoFlags.algos +=  newalgos_onlyinv5 
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/L1TopoMenu/TopoAlgoDef.py b/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/L1TopoMenu/TopoAlgoDef.py
new file mode 100644
index 0000000000000000000000000000000000000000..d1f0594bcd5fa47d814fc0350fc193ed89f60efb
--- /dev/null
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/L1TopoMenu/TopoAlgoDef.py
@@ -0,0 +1,1474 @@
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+from AthenaCommon.Logging import logging
+log = logging.getLogger('TriggerMenu.L1Topo.py')
+
+from TriggerMenu.l1topo.TopoAlgos import SortingAlgo, DecisionAlgo
+from TriggerJobOpts.TriggerFlags import TriggerFlags
+
+# algorithm python base classes generated from C++ code
+import L1TopoAlgorithms.L1TopoAlgConfig as AlgConf
+import L1TopoHardware.L1TopoHardware as HW
+
+import re
+
+
+class TopoAlgoDef:
+
+    @staticmethod
+    def registerTopoAlgos(tm):
+        currentAlgoId = 0
+
+        _etamax = 49
+        _minet = 0
+        usev6 = False
+        usev7 = False
+        doPhysics = False
+
+        if '_v6' in TriggerFlags.triggerMenuSetup() or '_v7' in TriggerFlags.triggerMenuSetup() or 'HI' in TriggerFlags.triggerMenuSetup():
+            usev6 = True
+        if '_v7' in TriggerFlags.triggerMenuSetup():
+            usev7 = True
+        if 'Physics' in TriggerFlags.triggerMenuSetup() or 'HI' in TriggerFlags.triggerMenuSetup():
+            doPhysics = True
+        if 'LS2_v' in TriggerFlags.triggerMenuSetup():
+            usev7 = True
+        
+        _emscale_for_decision = 2 # global scale for EM, TAU        
+        if hasattr(TriggerFlags, 'useRun1CaloEnergyScale'):
+            if TriggerFlags.useRun1CaloEnergyScale :
+                _emscale_for_decision=1     
+                log.info("Changed mscale_for_decision %s for Run1CaloEnergyScale" % _emscale_for_decision)
+
+        alg = AlgConf.ClusterNoSort( name = 'EMall', inputs = 'ClusterTobArray', outputs = 'EMall', algoId = currentAlgoId) ; currentAlgoId += 1
+        alg.addgeneric('InputWidth', HW.InputWidthEM)
+        alg.addgeneric('OutputWidth', HW.InputWidthEM)
+        alg.addvariable('IsoMask', 0)
+        tm.registerAlgo(alg)  
+                                
+        alg = AlgConf.ClusterSelect( name = 'TAUabi', inputs = 'ClusterTobArray', outputs = 'TAUabi', algoId = currentAlgoId ); currentAlgoId += 1
+        alg.addgeneric('InputWidth',  HW.InputWidthTAU)
+        alg.addgeneric('InputWidth1stStage', HW.InputWidth1stStageSelectTAU )
+        alg.addgeneric('OutputWidth', HW.OutputWidthSelectTAU)        
+        alg.addvariable('MinET', 12) 
+        alg.addvariable('IsoMask', 2) 
+        alg.addvariable('MinEta', 0)
+        alg.addvariable('MaxEta', _etamax)
+        alg.addgeneric('DoIsoCut', 1)
+        tm.registerAlgo(alg) 
+
+        alg = AlgConf.ClusterSelect( name = 'EMabi', inputs = 'ClusterTobArray', outputs = 'EMabi', algoId = currentAlgoId ); currentAlgoId += 1
+        alg.addgeneric('InputWidth',  HW.InputWidthEM)
+        alg.addgeneric('InputWidth1stStage', HW.InputWidth1stStageSelectEM ) 
+        alg.addgeneric('OutputWidth', HW.OutputWidthSelectEM)
+        alg.addvariable('MinET', 8)
+        alg.addvariable('IsoMask', 2)
+        alg.addvariable('MinEta', 0)
+        alg.addvariable('MaxEta', _etamax)
+        alg.addgeneric('DoIsoCut', 1)
+        tm.registerAlgo(alg) 
+
+        alg = AlgConf.ClusterSelect( name = 'EMabhi', inputs = 'ClusterTobArray', outputs = 'EMabhi', algoId = currentAlgoId ); currentAlgoId += 1
+        alg.addgeneric('InputWidth',  HW.InputWidthEM)
+        alg.addgeneric('InputWidth1stStage', HW.InputWidth1stStageSelectEM ) 
+        alg.addgeneric('OutputWidth', HW.OutputWidthSelectEM)
+        alg.addvariable('MinET', 8)
+        alg.addvariable('IsoMask', 3)
+        alg.addvariable('MinEta', 0)
+        alg.addvariable('MaxEta', _etamax)
+        alg.addgeneric('DoIsoCut', 1)
+        tm.registerAlgo(alg) 
+        
+        alg = AlgConf.ClusterSelect( name = 'TAUab', inputs = 'ClusterTobArray', outputs = 'TAUab', algoId = currentAlgoId ); currentAlgoId += 1
+        alg.addgeneric('InputWidth',  HW.InputWidthTAU)
+        alg.addgeneric('InputWidth1stStage', HW.InputWidth1stStageSelectTAU )
+        alg.addgeneric('OutputWidth', HW.OutputWidthSelectTAU)
+        alg.addvariable('MinET', 12) 
+        alg.addvariable('IsoMask', 0)
+        alg.addvariable('MinEta', 0)
+        alg.addvariable('MaxEta', _etamax)
+        alg.addgeneric('DoIsoCut', 0)
+        tm.registerAlgo(alg) 
+
+        alg = AlgConf.ClusterSort( name = 'EMs', inputs = 'ClusterTobArray', outputs = 'EMs', algoId = currentAlgoId ); currentAlgoId += 1
+        alg.addgeneric('InputWidth', HW.InputWidthEM)
+        alg.addgeneric('InputWidth1stStage', HW.InputWidth1stStageSortEM)
+        alg.addgeneric('OutputWidth', HW.OutputWidthSortEM)
+        alg.addvariable('IsoMask', 0)
+        alg.addvariable('MinEta', 0)
+        alg.addvariable('MaxEta', _etamax) 
+        alg.addgeneric('DoIsoCut', '0')
+        #alg.addgeneric('DoEtaCut', '1')
+        tm.registerAlgo(alg) 
+        
+        alg = AlgConf.ClusterSort( name = 'EMshi', inputs = 'ClusterTobArray', outputs = 'EMshi', algoId = currentAlgoId ); currentAlgoId += 1
+        alg.addgeneric('InputWidth', HW.InputWidthEM)
+        alg.addgeneric('InputWidth1stStage', HW.InputWidth1stStageSortEM)
+        alg.addgeneric('OutputWidth', HW.OutputWidthSortEM)
+        alg.addvariable('IsoMask', 3) 
+        alg.addvariable('MinEta', 0)
+        alg.addvariable('MaxEta', _etamax)
+        alg.addgeneric('DoIsoCut', '1')
+        #alg.addgeneric('DoEtaCut', '1')
+        tm.registerAlgo(alg)
+                
+        alg = AlgConf.ClusterSort( name = 'TAUsi', inputs = 'ClusterTobArray', outputs = 'TAUsi', algoId = currentAlgoId ); currentAlgoId += 1
+        alg.addgeneric('InputWidth', HW.InputWidthTAU)
+        alg.addgeneric('InputWidth1stStage', HW.InputWidth1stStageSortTAU)
+        alg.addgeneric('OutputWidth', HW.OutputWidthSortTAU)
+        alg.addvariable('IsoMask', 2) 
+        alg.addvariable('MinEta', 0)
+        alg.addvariable('MaxEta', _etamax)
+        alg.addgeneric('DoIsoCut', '1')
+        #alg.addgeneric('DoEtaCut', '1')
+        tm.registerAlgo(alg)
+        
+        alg = AlgConf.JetNoSort( name = 'AJall', inputs = 'JetTobArray', outputs = 'AJall', algoId = currentAlgoId ) ; currentAlgoId += 1
+        alg.addgeneric('InputWidth', HW.InputWidthJET)
+        alg.addgeneric('OutputWidth', HW.InputWidthJET)
+        alg.addgeneric('JetSize', HW.DefaultJetSize)
+        tm.registerAlgo(alg)
+
+        alg = AlgConf.JetNoSort( name = 'AJjall', inputs = 'JetTobArray', outputs = 'AJjall', algoId = currentAlgoId ) ; currentAlgoId += 1
+        alg.addgeneric('InputWidth', HW.InputWidthJET)
+        alg.addgeneric('OutputWidth', HW.InputWidthJET)
+        alg.addgeneric('JetSize', 1 if HW.DefaultJetSize.value==2 else 2)
+        tm.registerAlgo(alg)
+
+        # for 0MATCH-4AJ20-4AJj15
+        alg = AlgConf.JetNoSortMatch( name = 'AJMatchall', inputs = 'JetTobArray', outputs = 'AJMatchall', algoId = currentAlgoId ) ; currentAlgoId += 1
+        alg.addgeneric('InputWidth', HW.InputWidthJET)
+        alg.addgeneric('OutputWidth', HW.InputWidthJET)
+        alg.addgeneric('JetSize', 2 if HW.DefaultJetSize.value==2 else 1)
+        alg.addvariable('MinET1', 15) # 4x4       
+        alg.addvariable('MinET2', 20) # 8x8
+        tm.registerAlgo(alg)        
+
+
+        # ab J lists:
+        for jet_type in ['J', 'CJ']:
+            jetabseta = _etamax
+            _minet = 25
+            if jet_type=='J':
+                jetabseta = 31
+                _minet = 20
+            elif jet_type=='CJ':
+                jetabseta = 26 
+                _minet = 15
+            
+            alg = AlgConf.JetSelect( name = jet_type+'ab', inputs = 'JetTobArray', outputs = jet_type+'ab', algoId = currentAlgoId ); currentAlgoId += 1
+
+            alg.addgeneric('InputWidth', HW.InputWidthJET)
+            alg.addgeneric('InputWidth1stStage', HW.InputWidth1stStageSelectJET )            
+            alg.addgeneric('OutputWidth', HW.OutputWidthSelectJET)
+            alg.addgeneric('JetSize', HW.DefaultJetSize.value)
+            alg.addvariable('MinET', _minet)  
+            alg.addvariable('MinEta', 0)
+            alg.addvariable('MaxEta', jetabseta)
+            alg.addgeneric('DoEtaCut', 1)
+            tm.registerAlgo(alg) 
+
+        alg = AlgConf.JetSort( name = 'AJjs', inputs = 'JetTobArray', outputs = 'AJjs', algoId = currentAlgoId); currentAlgoId += 1
+
+        alg.addgeneric('InputWidth',  HW.InputWidthJET)
+        alg.addgeneric('InputWidth1stStage', HW.InputWidth1stStageSortJET )
+        alg.addgeneric('OutputWidth', HW.OutputWidthSortJET )
+        alg.addgeneric('JetSize', 1 if HW.DefaultJetSize.value==2 else 2)                
+        alg.addvariable('MinEta', 0)
+        alg.addvariable('MaxEta', _etamax)
+        alg.addgeneric('DoEtaCut', 0)
+        tm.registerAlgo(alg) 
+        
+        # Sorted J lists:
+        for jet_type in ['AJ']:
+            jetabseta = _etamax
+            _minet = 25
+            if jet_type=='J':
+                jetabseta = 31
+                _minet = 20
+            elif jet_type=='CJ':
+                jetabseta = 26 
+                _minet = 15
+                
+            alg = AlgConf.JetSort( name = jet_type+'s', inputs = 'JetTobArray', outputs = jet_type+'s', algoId = currentAlgoId ); currentAlgoId += 1
+
+            alg.addgeneric('InputWidth',  HW.InputWidthJET)
+            alg.addgeneric('InputWidth1stStage', HW.InputWidth1stStageSortJET )
+            alg.addgeneric('OutputWidth', HW.OutputWidthSortJET )
+            alg.addgeneric('JetSize', HW.DefaultJetSize.value) 
+            alg.addvariable('MinEta', 0)
+            alg.addvariable('MaxEta', jetabseta)
+            alg.addgeneric('DoEtaCut', 0)
+            tm.registerAlgo(alg) 
+
+        for jet_type in ['J']:
+            jetabseta = _etamax
+            _minet = 25
+            if jet_type=='J':
+                jetabseta = 31
+                _minet = 20
+            elif jet_type=='CJ':
+                jetabseta = 26
+                _minet = 15
+
+            alg = AlgConf.JetSort( name = jet_type+'s', inputs = 'JetTobArray', outputs = jet_type+'s', algoId = currentAlgoId ); currentAlgoId += 1
+
+            alg.addgeneric('InputWidth',  HW.InputWidthJET)
+            alg.addgeneric('InputWidth1stStage', HW.InputWidth1stStageSortJET )
+            alg.addgeneric('OutputWidth', HW.OutputWidthSortJET )
+            alg.addgeneric('JetSize', HW.DefaultJetSize.value)
+            alg.addvariable('MinEta', 0)
+            alg.addvariable('MaxEta', jetabseta)
+            alg.addgeneric('DoEtaCut', 1)
+            tm.registerAlgo(alg)
+
+        alg = AlgConf.METNoSort( name = 'XENoSort', inputs = 'MetTobArray', outputs = 'XENoSort', algoId = currentAlgoId ); currentAlgoId += 1
+
+        alg.addgeneric('InputWidth', HW.InputWidthMET)
+        alg.addgeneric('OutputWidth', HW.OutputWidthMET)
+        tm.registerAlgo(alg)
+                
+        alg = AlgConf.MetSort( name = 'XE', inputs = 'MetTobArray', outputs = 'XE', algoId = currentAlgoId ); currentAlgoId += 1
+        alg.addgeneric('InputWidth', HW.InputWidthMET)
+        alg.addgeneric('OutputWidth', HW.OutputWidthMET)
+        tm.registerAlgo(alg)
+        
+        alg = AlgConf.MuonSelect( name = 'MUab', inputs = 'MuonTobArray', outputs = 'MUab', algoId = currentAlgoId ); currentAlgoId += 1                                      
+
+        alg.addgeneric('InputWidth', HW.InputWidthMU)
+        alg.addgeneric('InputWidth1stStage', HW.InputWidth1stStageSelectMU )
+        alg.addgeneric('OutputWidth', HW.OutputWidthSelectMU)
+        alg.addvariable('MinET', 4) 
+        alg.addvariable('MinEta', 0)
+        alg.addvariable('MaxEta', 25)
+        tm.registerAlgo(alg)            
+
+        alg = AlgConf.MuonSelect( name = 'CMUab', inputs = 'MuonTobArray', outputs = 'CMUab', algoId = currentAlgoId ); currentAlgoId += 1                                     
+
+        alg.addgeneric('InputWidth', HW.InputWidthMU)
+        alg.addgeneric('InputWidth1stStage', HW.InputWidth1stStageSelectMU )
+        alg.addgeneric('OutputWidth', HW.OutputWidthSelectMU)
+        alg.addvariable('MinET', 4) 
+        alg.addvariable('MinEta', 0)
+        alg.addvariable('MaxEta', 10)
+        tm.registerAlgo(alg)
+
+        alg = AlgConf.MuonSort_1BC( name = 'LMUs', inputs = 'LateMuonTobArray', outputs = 'LMUs', algoId = currentAlgoId ); currentAlgoId += 1
+        #alg = AlgConf.MuonSort_1BC( name = 'LMUs', inputs = 'MuonTobArray', outputs = 'LMUs', algoId = currentAlgoId ); currentAlgoId += 1
+
+        alg.addgeneric('InputWidth', HW.InputWidthMU)
+        #alg.addgeneric('InputWidth1stStage', HW.InputWidth1stStageSortMU )
+        alg.addgeneric('OutputWidth', HW.OutputWidthSortMU)
+        alg.addgeneric('nDelayedMuons', 1)
+        alg.addvariable('MinEta', 0)
+        alg.addvariable('MaxEta', 25)
+        tm.registerAlgo(alg)
+        
+        # Abbreviated lists:
+        alg = AlgConf.ClusterSelect( name = 'EMab', inputs = 'ClusterTobArray', outputs = 'EMab', algoId = currentAlgoId ); currentAlgoId += 1
+
+        alg.addgeneric('InputWidth',  HW.InputWidthEM)
+        alg.addgeneric('InputWidth1stStage', HW.InputWidth1stStageSelectEM ) 
+        alg.addgeneric('OutputWidth', HW.OutputWidthSelectEM)
+        alg.addvariable('MinET', 8)
+        alg.addvariable('IsoMask', 0)                
+        alg.addvariable('MinEta', 0)
+        alg.addvariable('MaxEta', _etamax)
+        #alg.addgeneric('DoIsoCut', 1)
+        tm.registerAlgo(alg) 
+        
+        # All lists:
+
+        alg = AlgConf.ClusterNoSort( name = 'TAUall', inputs = 'ClusterTobArray', outputs = 'TAUall', algoId = currentAlgoId) ; currentAlgoId += 1                                         
+
+        alg.addgeneric('InputWidth', HW.InputWidthTAU)
+        alg.addgeneric('OutputWidth', HW.InputWidthTAU)
+        alg.addvariable('IsoMask', 0)
+        tm.registerAlgo(alg)
+
+        alg = AlgConf.MuonNoSort( name = 'MUall', inputs = 'MuonTobArray', outputs = 'MUall',algoId = currentAlgoId) ; currentAlgoId += 1                                      
+
+        alg.addgeneric('InputWidth', HW.InputWidthMU)
+        alg.addgeneric('OutputWidth', HW.InputWidthMU)
+        tm.registerAlgo(alg)
+                
+        # Decision algorithms
+        currentAlgoId = 0
+        
+
+
+
+        # VBF items    
+        for x in [
+            {"algoname": 'INVM_AJ_HighMass', "Threlist": [ 900, 800, 700, 500 ], "maxInvm": 9999, "otype" : "AJ", "ocut1" : 30, "olist" : "s", "nleading1" : 6, "inputwidth1": HW.OutputWidthSortJET, "ocut2" : 20, "nleading2" : 6},
+            {"algoname": 'INVM_AJ_LowMass',  "Threlist": [ 400, 300, 200, 100 ], "maxInvm": 9999, "otype" : "AJ", "ocut1" : 30, "olist" : "s", "nleading1" : 6, "inputwidth1": HW.OutputWidthSortJET, "ocut2" : 20, "nleading2" : 6},
+            ]:
+            
+            for k in x:
+                exec("%s = x[k]" % k)
+
+            inputList = otype + olist
+            toponames=[]
+
+            for minInvm in Threlist:
+                toponame = "%iINVM%i-%s%s%s%s-%s%s%s%s"  % (minInvm, maxInvm,
+                                                            otype, str(ocut1) , olist, str(nleading1) if olist=="s" else "",
+                                                            otype, str(ocut2) , olist, str(nleading2) if olist=="s" else "")   
+                toponames.append(toponame)
+                
+            alg = AlgConf.InvariantMassInclusive1( name = algoname, inputs = inputList, outputs = toponames, algoId = currentAlgoId); currentAlgoId += 1
+
+            alg.addgeneric('InputWidth', inputwidth1)
+            alg.addgeneric('MaxTob', nleading1)
+            alg.addgeneric('NumResultBits', len(toponames))
+
+            for bitid, minInvm in enumerate(Threlist): 
+                alg.addvariable('MinET1', ocut1, bitid)
+                alg.addvariable('MinET2', ocut2, bitid)
+                alg.addvariable('MinMSqr', minInvm * minInvm, bitid)
+                alg.addvariable('MaxMSqr', maxInvm * maxInvm, bitid)
+
+            tm.registerAlgo(alg)
+
+
+        # dimu INVM items
+
+        listofalgos=[
+
+            #{"minInvm": 1, "maxInvm": 19, "mult": 2, "otype1" : "MU", "ocut1": 4, "olist" : "ab", "otype2" : "",  "ocut2" : 0, "onebarrel": 0},#1INVM19-2MU4ab 
+            {"minInvm": 2, "maxInvm": 8, "mult": 2, "otype1" : "MU", "ocut1": 4, "olist" : "ab", "otype2" : "",  "ocut2" : 0, "onebarrel": 0}, #2INVM8-2MU4ab 
+            {"minInvm": 2, "maxInvm": 9, "mult": 2, "otype1" : "MU", "ocut1": 4, "olist" : "ab", "otype2" : "",  "ocut2" : 0, "onebarrel": 0}, #2INVM9-2MU4ab 
+            {"minInvm": 8, "maxInvm": 15, "mult": 1, "otype1" : "MU", "ocut1": 6, "olist" : "ab", "otype2" : "MU","ocut2" : 4, "onebarrel": 0}, #8INVM15-MU6ab-MU4ab
+            {"minInvm": 2, "maxInvm": 8, "mult": 1, "otype1" : "MU", "ocut1": 6, "olist" : "ab", "otype2" : "MU","ocut2" : 4, "onebarrel": 0}, #2INVM8-MU6ab-MU4ab
+            {"minInvm": 2, "maxInvm": 9, "mult": 1, "otype1" : "MU", "ocut1": 6, "olist" : "ab", "otype2" : "MU","ocut2" : 4, "onebarrel": 0}, #2INVM9-MU6ab-MU4ab
+            {"minInvm": 8, "maxInvm": 15, "mult": 2, "otype1" : "MU", "ocut1": 6, "olist" : "ab", "otype2" : "",  "ocut2" : 0, "onebarrel": 0}, #8INVM15-2MU6ab
+            {"minInvm": 2, "maxInvm": 9, "mult": 2, "otype1" : "MU", "ocut1": 6, "olist" : "ab", "otype2" : "",  "ocut2" : 0, "onebarrel": 0},  #2INVM9-2MU6ab 
+            {"minInvm": 7, "maxInvm": 15, "mult": 2, "otype1" : "MU", "ocut1": 4, "olist" : "ab", "otype2" : "",  "ocut2" : 0, "onebarrel": 0}, #7INVM15-2MU4ab 
+
+            ]
+
+        for x in listofalgos:
+            for k in x:
+                exec("%s = x[k]" % k)
+
+            obj1 = "%s%s%s%s" % ((str(mult) if mult>1 else ""), otype1, str(ocut1), olist)
+            obj2 = "-%s%s%s" % (otype2, str(ocut2), olist)
+            toponame = "%iINVM%i-%s%s%s"  % (minInvm, maxInvm, "ONEBARREL-" if onebarrel==1 else "", obj1, "" if mult>1 else obj2)
+
+            log.info("Define %s" % toponame)
+
+
+            inputList = [otype1 + olist] if (mult>1 or otype1==otype2) else [otype1 + olist, otype2 + olist]
+            algoname = AlgConf.InvariantMassInclusive1 if (mult>1 or otype1==otype2) else AlgConf.InvariantMassInclusive2
+            alg = algoname( name = toponame,  inputs = inputList, outputs = [ toponame ], algoId = currentAlgoId); currentAlgoId += 1
+
+            if (mult>1 or otype1==otype2):
+                alg.addgeneric('InputWidth', HW.OutputWidthSelectMU) 
+                alg.addgeneric('MaxTob', HW.OutputWidthSelectMU)
+                alg.addgeneric('RequireOneBarrel', onebarrel)
+            else:
+                alg.addgeneric('InputWidth1', HW.OutputWidthSelectMU)
+                alg.addgeneric('InputWidth2', HW.OutputWidthSelectMU) 
+                alg.addgeneric('MaxTob1', HW.OutputWidthSelectMU)
+                alg.addgeneric('MaxTob2', HW.OutputWidthSelectMU)
+
+            alg.addgeneric('NumResultBits', 1)
+            alg.addvariable('MinET1', ocut1)
+            alg.addvariable('MinET2', ocut2 if ocut2>0 else ocut1)
+            alg.addvariable('MinMSqr', minInvm * minInvm)
+            alg.addvariable('MaxMSqr', maxInvm * maxInvm)
+            tm.registerAlgo(alg)
+
+
+        # dimu DR items
+        listofalgos=[  
+            {"minDr": 2, "maxDr": 99, "mult": 2, "otype1" : "MU" ,"ocut1": 4,  "olist" : "ab", "otype2" : "",   "ocut2": 4, "onebarrel": 0}, # SM Y  x
+            {"minDr": 0, "maxDr": 10, "mult": 1, "otype1" : "MU" ,"ocut1": 10, "olist" : "ab", "otype2" : "MU", "ocut2": 6, "onebarrel": 0}, # Exotic LFV x 
+            {"minDr": 2, "maxDr": 15, "mult": 2, "otype1" : "MU" ,"ocut1": 6,  "olist" : "ab", "otype2" : "",   "ocut2": 6, "onebarrel": 0},   #x
+            {"minDr": 0, "maxDr": 15, "mult": 2, "otype1" : "MU" ,"ocut1": 4,  "olist" : "ab", "otype2" : "",   "ocut2": 4, "onebarrel": 0}, #0DR15-2MU4ab
+            {"minDr": 0, "maxDr": 15, "mult": 1, "otype1" : "MU", "ocut1": 6,  "olist" : "ab", "otype2" : "MU", "ocut2": 4, "onebarrel": 0}, #0DR15-MU6ab-MU4ab
+            {"minDr": 0, "maxDr": 34, "mult": 2, "otype1" : "MU" ,"ocut1": 4,  "olist" : "ab", "otype2" : "",   "ocut2": 4, "onebarrel": 0}, #0DR34-2MU4ab 
+            {"minDr": 0, "maxDr": 24, "mult": 2, "otype1" : "MU" ,"ocut1": 4,  "olist" : "ab", "otype2" : "",   "ocut2": 4, "onebarrel": 0}, #0DR24-2MU4ab 
+            {"minDr": 0, "maxDr": 22, "mult": 2, "otype1" : "MU" ,"ocut1": 6,  "olist" : "ab", "otype2" : "",   "ocut2": 6, "onebarrel": 0}, #0DR22-2MU6ab
+            {"minDr": 0, "maxDr": 22, "mult": 1, "otype1" : "MU", "ocut1": 6,  "olist" : "ab", "otype2" : "MU", "ocut2": 4, "onebarrel": 0}, #0DR22-MU6ab-MU4ab
+            {"minDr": 0, "maxDr": 15, "mult": 2, "otype1" : "MU", "ocut1": 6,  "olist" : "ab", "otype2" : "",   "ocut2": 6, "onebarrel": 0}, #0DR15-2MU6ab  
+            ]
+
+        for x in listofalgos:
+            for k in x:
+                exec("%s = x[k]" % k)
+
+            obj1 = "%s%s%s%s" % ((str(mult) if mult>1 else ""), otype1, str(ocut1), olist)
+            obj2 = "-%s%s%s" % (otype2, str(ocut2), olist)
+            toponame = "%iDR%i-%s%s%s"  % (minDr, maxDr, "ONEBARREL-" if onebarrel==1 else "", obj1, "" if mult>1 else obj2)
+
+            log.info("Define %s" % toponame)
+
+            inputList = [otype1 + olist] if (mult>1 or otype1==otype2) else [otype1 + olist, otype2 + olist]
+            algoname = AlgConf.DeltaRSqrIncl1 if (mult>1 or otype1==otype2) else AlgConf.DeltaRSqrIncl2
+            alg = algoname( name = toponame,  inputs = inputList, outputs = [ toponame ], algoId = currentAlgoId); currentAlgoId += 1
+
+            if (mult>1 or otype1==otype2):
+                alg.addgeneric('InputWidth', HW.OutputWidthSelectMU)
+                alg.addgeneric('MaxTob', HW.OutputWidthSelectMU)
+                alg.addgeneric('RequireOneBarrel', onebarrel)
+            else:
+                alg.addgeneric('InputWidth1', HW.OutputWidthSelectMU)
+                alg.addgeneric('InputWidth2', HW.OutputWidthSelectMU) 
+                alg.addgeneric('MaxTob1', HW.OutputWidthSelectMU)
+                alg.addgeneric('MaxTob2', HW.OutputWidthSelectMU)
+
+
+            alg.addgeneric('NumResultBits', 1)
+            alg.addvariable('MinET1', ocut1)
+            alg.addvariable('MinET2', ocut2)
+            alg.addvariable('DeltaRMin', minDr*minDr)
+            alg.addvariable('DeltaRMax', maxDr*maxDr)
+            tm.registerAlgo(alg)
+        
+
+            
+        # deta-dphi with ab+ab
+        for x in [     
+            #{"minDeta": 5, "maxDeta": 99, "minDphi": 5, "maxDphi": 99, "mult": 2, "otype1" : "MU", "ocut1": 4, "olist1" : "ab", "nleading1": HW.OutputWidthSelectMU, "otype2" : "", "ocut2": 4, "olist2": "", "nleading2": HW.OutputWidthSelectMU},
+            {"minDeta": 5, "maxDeta": 99, "minDphi": 5, "maxDphi": 99, "mult": 1, "otype1" : "MU", "ocut1": 6, "olist1" : "ab", "nleading1": HW.OutputWidthSelectMU, "otype2" : "MU", "ocut2": 4, "olist2": "ab", "nleading2": HW.OutputWidthSelectMU},
+            {"minDeta": 5, "maxDeta": 99, "minDphi": 5, "maxDphi": 99, "mult": 2, "otype1" : "MU", "ocut1": 6, "olist1" : "ab", "nleading1": HW.OutputWidthSelectMU, "otype2" : "", "ocut2": 6, "olist2": "", "nleading2": HW.OutputWidthSelectMU},
+            ]:
+            
+            for k in x:
+                exec("%s = x[k]" % k)
+
+            obj1 = "%s%s%s%s" % ((str(mult) if mult>1 else ""), otype1, str(ocut1), olist1)
+            obj2 = "-%s%s%s" % (otype2, str(ocut2) if ocut2>0 else "", olist2)
+            toponame = "%sDETA%s-%sDPHI%s-%s%s"  % (minDeta, maxDeta, minDphi, maxDphi, obj1, "" if mult>1 else obj2)
+            
+            log.info("Define %s" % toponame)
+            
+            inputList = [otype1 + olist1] if (mult>1 or otype1==otype2) else [otype1 + olist1, otype2 + olist2]
+            algoname = AlgConf.DeltaEtaPhiIncl1 if (mult>1 or otype1==otype2) else AlgConf.DeltaEtaPhiIncl2            
+            alg = algoname( name = toponame, inputs = inputList, outputs = [ toponame ], algoId = currentAlgoId); currentAlgoId += 1
+            alg.addgeneric('NumResultBits', 1)                        
+
+            
+            if (mult>1 or otype1==otype2):
+                alg.addgeneric('InputWidth', nleading1)
+                alg.addgeneric('MaxTob', nleading1)
+                alg.addvariable('MinET1', ocut1)
+                alg.addvariable('MinET2', ocut2)
+                alg.addvariable('MinDeltaEta', minDeta)
+                alg.addvariable('MaxDeltaEta', maxDeta)
+                alg.addvariable('MinDeltaPhi', minDphi)
+                alg.addvariable('MaxDeltaPhi', maxDphi)
+            else:
+                alg.addgeneric('InputWidth1', nleading1)
+                alg.addgeneric('InputWidth2', nleading2)
+                alg.addgeneric('MaxTob1', nleading1)
+                alg.addgeneric('MaxTob2', nleading2)
+                alg.addvariable('DeltaEtaMin', minDeta)
+                alg.addvariable('DeltaEtaMax', maxDeta)
+                alg.addvariable('DeltaPhiMin', minDphi)
+                alg.addvariable('DeltaPhiMax', maxDphi)
+                alg.addvariable('MinET1', ocut1)
+                alg.addvariable('MinET2', ocut2)
+            
+            tm.registerAlgo(alg)
+
+
+
+        algolist=[
+               {"minDr": 0, "maxDr": 28, "otype1" : "MU" ,"ocut1": 10, "olist1" : "ab", "nleading1": HW.OutputWidthSelectMU, "inputwidth1": HW.OutputWidthSelectMU, "otype2" : "TAU", "ocut2": 12, "olist2" : "abi", "nleading2": HW.OutputWidthSelectTAU, "inputwidth2": HW.OutputWidthSelectTAU},   # 0DR28-MU10ab-TAU12abi
+               {"minDr": 0, "maxDr": 28, "otype1" : "TAU" ,"ocut1": 20, "olist1" : "abi","nleading1": HW.OutputWidthSelectTAU, "inputwidth1": HW.OutputWidthSelectTAU,"otype2" : "TAU", "ocut2": 12, "olist2" : "abi", "nleading2": HW.OutputWidthSelectTAU, "inputwidth2": HW.OutputWidthSelectTAU}, # 0DR28-TAU20abi-TAU12abi
+               {"minDr": 0, "maxDr": 25, "otype1" : "TAU" ,"ocut1": 20, "olist1" : "abi","nleading1": HW.OutputWidthSelectTAU, "inputwidth1": HW.OutputWidthSelectTAU,"otype2" : "TAU", "ocut2": 12, "olist2" : "abi", "nleading2": HW.OutputWidthSelectTAU, "inputwidth2": HW.OutputWidthSelectTAU}, #	0DR25-TAU20abi-TAU12abi
+            ] 
+
+
+        for x in algolist:
+
+            for k in x:
+                exec("%s = x[k]" % k)
+
+            obj1 = "%s%s%s" % (otype1, str(ocut1), olist1)
+            obj2 = "-%s%s%s" % (otype2, str(ocut2), olist2)
+            toponame = "%iDR%i-%s%s"  % (minDr, maxDr, obj1, obj2)
+
+            log.info("Define %s" % toponame)
+            
+            inputList = [otype1 + olist1] if otype1==otype2 else [otype1 + olist1, otype2 + olist2]
+            algoname = AlgConf.DeltaRSqrIncl1 if otype1==otype2 else AlgConf.DeltaRSqrIncl2
+            alg = algoname( name = toponame,  inputs = inputList, outputs = [ toponame ], algoId = currentAlgoId); currentAlgoId += 1
+
+                            
+            if otype1==otype2:
+                alg.addgeneric('InputWidth', inputwidth1)
+                alg.addgeneric('MaxTob', nleading1)
+            else:
+                alg.addgeneric('InputWidth1', inputwidth1)
+                alg.addgeneric('InputWidth2', inputwidth2) 
+                alg.addgeneric('MaxTob1', nleading1)
+                alg.addgeneric('MaxTob2', nleading2)
+            alg.addgeneric('NumResultBits', 1)
+
+            if otype1==otype2:
+                alg.addvariable('MinET1', ocut1)
+                alg.addvariable('MinET2', ocut2)
+                alg.addvariable('DeltaRMin', minDr*minDr)
+                alg.addvariable('DeltaRMax', maxDr*maxDr)
+            else:
+                alg.addvariable('MinET1', ocut1, 0)
+                alg.addvariable('MinET2', ocut2, 0)
+                alg.addvariable('DeltaRMin', minDr*minDr, 0)
+                alg.addvariable('DeltaRMax', maxDr*maxDr, 0)
+                
+            tm.registerAlgo(alg)        
+
+            
+        # (ATR-8194) L1Topo HT Trigger
+        for x in [            
+            {"minHT": 150, "otype" : "J", "ocut" : 20, "olist" : "s",   "nleading" : 5, "inputwidth": HW.OutputWidthSortJET, "oeta" : 31},
+            {"minHT": 190, "otype" : "J", "ocut" : 15, "olist" : "s",   "nleading" : 5, "inputwidth": HW.OutputWidthSortJET, "oeta" : 21},
+            {"minHT": 190, "otype" : "AJ", "ocut" : 15, "olist" : "all", "nleading" : HW.InputWidthJET, "inputwidth": HW.InputWidthJET, "oeta" : 21},
+            {"minHT": 150, "otype" : "AJ", "ocut" : 20, "olist" : "all", "nleading" : HW.InputWidthJET, "inputwidth": HW.InputWidthJET, "oeta" : 31},
+            {"minHT": 150, "otype" : "AJj","ocut" : 15, "olist" : "all", "nleading" : HW.InputWidthJET, "inputwidth": HW.InputWidthJET, "oeta" : 49},
+            {"minHT": 20,  "otype" : "AJj","ocut" : 15,  "olist" : "all", "nleading" : HW.InputWidthJET, "inputwidth": HW.InputWidthJET, "oeta" : 49},
+            ]:
+            
+            for k in x:
+                exec("%s = x[k]" % k)
+                
+            toponame = "HT%d-%s%s%s%s.ETA%s" % (minHT, otype, str(ocut), olist, str(nleading) if olist=="s" else "", str(oeta))
+            
+            log.info("Define %s" % toponame)
+            
+            inputList = otype + olist
+
+            alg = AlgConf.JetHT( name = toponame, inputs = inputList, outputs = [toponame], algoId = currentAlgoId ); currentAlgoId += 1
+
+
+            alg.addgeneric('InputWidth', inputwidth)
+            alg.addgeneric('MaxTob', nleading)        
+            alg.addgeneric('NumRegisters', 2 if olist=="all" else 0)
+            alg.addgeneric('NumResultBits', 1)
+            alg.addvariable('MinET', ocut)                        
+            alg.addvariable('MinEta', 0)
+            alg.addvariable('MaxEta', oeta)            
+            alg.addvariable('MinHt', minHT) 
+            tm.registerAlgo(alg)  
+
+        # INVM_EM for Jpsi    
+        invm_map = {"algoname": 'INVM_EMs6' , "ocutlist": [ 0, 7, 12 ], "minInvm": 1, "maxInvm": 5, "otype" : "EM", "olist" : "s", "nleading" : 1, "inputwidth": HW.OutputWidthSortEM}
+        for x in [ invm_map,
+            ]:
+            
+            for k in x:
+                exec("%s = x[k]" % k)
+
+            inputList = otype + olist
+            toponames=[]
+
+            for ocut in ocutlist:
+                toponame = "%iINVM%i-%s%s%s%s-EMs6"   % (minInvm, maxInvm, otype, str(ocut) if ocut > 0 else "", olist, str(nleading) if olist=="s" else "")
+                toponames.append(toponame)
+
+            alg = AlgConf.InvariantMassInclusive2( name = algoname, inputs = [inputList, 'EMs'], outputs = toponames, algoId = currentAlgoId); currentAlgoId += 1    
+
+
+            alg.addgeneric('InputWidth1', inputwidth)
+            #alg.addgeneric('InputWidth2', HW.InputWidthEM)
+            alg.addgeneric('InputWidth2', HW.OutputWidthSortEM)
+            alg.addgeneric('MaxTob1', nleading)
+            #alg.addgeneric('MaxTob2', HW.InputWidthEM)
+            alg.addgeneric('MaxTob2', HW.OutputWidthSortEM)
+            alg.addgeneric('NumResultBits', len(toponames))
+
+            for bitid, ocut in enumerate(ocutlist):
+                alg.addvariable('MinET1', ocut, bitid)
+                alg.addvariable('MinET2', 0, bitid)
+                alg.addvariable('MinMSqr', (minInvm * _emscale_for_decision)*(minInvm * _emscale_for_decision), bitid)                
+                alg.addvariable('MaxMSqr', (maxInvm * _emscale_for_decision)*(maxInvm * _emscale_for_decision), bitid)
+                
+            tm.registerAlgo(alg)
+
+        # W T&P: MINDPHI(J, XE0), (EM, XE0)
+
+
+        alglist = [
+            {"minDPhi":  5, "otype" : "AJj", "ocut" : 10, "olist" : "s", "nleading" : 6, "inputwidth": HW.OutputWidthSortJET},
+            {"minDPhi": 10, "otype" : "AJj", "ocut" : 10, "olist" : "s", "nleading" : 6, "inputwidth": HW.OutputWidthSortJET},
+            {"minDPhi": 15, "otype" : "AJj", "ocut" : 10, "olist" : "s", "nleading" : 6, "inputwidth": HW.OutputWidthSortJET},
+            {"minDPhi": 05, "otype" : "EM",  "ocut" : 12, "olist" : "s", "nleading" : 6, "inputwidth": HW.OutputWidthSortEM},#new
+            #{"minDPhi": 10, "otype" : "EM",  "ocut" : 12, "olist" : "s", "nleading" : 6, "inputwidth": HW.OutputWidthSortEM},#new
+            {"minDPhi": 05, "otype" : "EM",  "ocut" : 15, "olist" : "s", "nleading" : 6, "inputwidth": HW.OutputWidthSortEM},#same
+            ]
+
+        for x in alglist:
+            
+            for k in x:
+                exec("%s = x[k]" % k)
+                
+            toponame = "%02dMINDPHI-%s%s%s%s-XE0"  % (minDPhi, otype, str(ocut) if ocut > 0 else "", olist, str(nleading) if olist=="s" else "")
+            log.info("Define %s" % toponame)
+
+            inputList = otype + olist
+
+            alg = AlgConf.MinDeltaPhiIncl2( name = toponame, inputs = [ inputList, 'XE'], outputs = [ toponame ], algoId = currentAlgoId ); currentAlgoId += 1
+
+
+            alg.addgeneric('InputWidth1', inputwidth)
+            alg.addgeneric('InputWidth2', 1) 
+            alg.addgeneric('MaxTob1', nleading)
+            alg.addgeneric('MaxTob2', 1)
+            alg.addgeneric('NumResultBits', 1)
+            alg.addvariable('MinET1', ocut)
+            alg.addvariable('MinET2', 0)
+            alg.addvariable('DeltaPhiMin', minDPhi, 0)
+            tm.registerAlgo(alg)
+
+        # W T&P MT
+
+        alglistmt = [
+            {"minMT": 25, "otype" : "EM", "ocut" : "12", "olist" : "s", "nleading" : 6, "inputwidth": HW.OutputWidthSortEM},
+            #{"minMT": 30, "otype" : "EM", "ocut" : "12", "olist" : "s", "nleading" : 6, "inputwidth": HW.OutputWidthSortEM},
+            {"minMT": 35, "otype" : "EM", "ocut" : "15", "olist" : "s", "nleading" : 6, "inputwidth": HW.OutputWidthSortEM},
+            ]
+        for x in alglistmt:
+            for k in x:
+                exec("%s = x[k]" % k)
+
+            toponame = "%iMT-%s%s%s%s-XE0"  % (minMT, otype, str(ocut) if ocut > 0 else "", olist, str(nleading) if olist=="s" else "")
+            log.info("Define %s" % toponame)
+
+            inputList = otype + olist
+            
+            alg = AlgConf.TransverseMassInclusive1( name = toponame, inputs = [ inputList, 'XE'], outputs = [ toponame ], algoId = currentAlgoId ); currentAlgoId += 1
+
+
+
+            alg.addgeneric('InputWidth', HW.OutputWidthSortEM)
+            alg.addgeneric('MaxTob', str(nleading))
+            alg.addgeneric('NumResultBits', 1)
+            alg.addvariable('MinET1', str(ocut))
+            alg.addvariable('MinET2', 0)
+            alg.addvariable('MinMTSqr', minMT*minMT)                        
+            tm.registerAlgo(alg)
+
+            
+        # VBF deta     
+        for x in [
+            #{"minDeta": 0,  "maxDeta": 10, "otype" : "J",  "ocut1" : 0,  "olist" : "s", "nleading1" : 1, "inputwidth1": HW.OutputWidthSortJET, "ocut2" : 0, "nleading2": 2},
+            ]:
+
+            for k in x:
+                exec("%s = x[k]" % k)
+
+            toponame = "%iDETA%i-%s%s%s%s-%s%s%s%s"  % (minDeta, maxDeta,
+                                                        otype, str(ocut1) if ocut1 > 0 else "", olist, str(nleading1) if olist=="s" else "",
+                                                        otype, str(ocut2) if ocut2 > 0 else "", olist, str(nleading2) if olist=="s" else "")
+            
+            log.info("Define %s" % toponame)
+            inputList = otype + olist
+            
+            alg = AlgConf.DeltaEtaIncl1( name = toponame, inputs = inputList, outputs = toponame, algoId = currentAlgoId ); currentAlgoId += 1
+
+
+
+            alg.addgeneric('InputWidth', inputwidth1)
+            alg.addgeneric('MaxTob', nleading2)
+            alg.addgeneric('NumResultBits', 1)                        
+            alg.addvariable('MinET1', str(ocut1), 0)            
+            alg.addvariable('MinET2', str(ocut2), 0)
+            alg.addvariable('MinDeltaEta', minDeta, 0)
+            alg.addvariable('MaxDeltaEta', maxDeta, 0)
+            tm.registerAlgo(alg)
+            
+        # ZH Trigger
+
+        supportedalgolist = [
+               #{"minDPhi": 10, "otype" : "J", "ocut" : 0,  "olist" : "s", "nleading" : 2, "inputwidth": HW.OutputWidthSortJET, "ocut2": 50 },
+               {"minDPhi": 10, "otype" : "J", "ocut" : 20, "olist" : "s", "nleading" : 2, "inputwidth": HW.OutputWidthSortJET, "ocut2": 50 },
+               {"minDPhi": 10, "otype" : "J", "ocut" : 20, "olist" : "ab", "nleading" : HW.OutputWidthSelectJET, "inputwidth": HW.OutputWidthSelectJET, "ocut2": 50},
+               {"minDPhi": 10, "otype" : "CJ","ocut" : 20, "olist" : "ab", "nleading" : HW.OutputWidthSelectJET, "inputwidth": HW.OutputWidthSelectJET, "ocut2": 50},
+               {"minDPhi": 10, "otype" : "J", "ocut" : 20, "olist" : "s", "nleading" : 2, "inputwidth": HW.OutputWidthSortJET, "ocut2": 30 }, # NEW
+            ]
+
+        for x in supportedalgolist:
+            
+            for k in x:
+                exec("%s = x[k]" % k)
+                
+            toponame = "%iMINDPHI-%s%s%s%s-XE%i"  % (minDPhi, otype, str(ocut) if ocut > 0 else "", olist, str(nleading) if olist=="s" else "",ocut2)
+            log.info("Define %s" % toponame)
+            
+            inputList = otype + olist
+
+            alg = AlgConf.MinDeltaPhiIncl2( name = toponame, inputs = [inputList, 'XE'], outputs = [ toponame ], algoId = currentAlgoId ); currentAlgoId += 1
+
+            alg.addgeneric('InputWidth1', inputwidth)
+            alg.addgeneric('InputWidth2', 1)  
+            alg.addgeneric('MaxTob1', nleading)
+            alg.addgeneric('MaxTob2', 1)
+            alg.addgeneric('NumResultBits', 1)
+            alg.addvariable('MinET1', ocut)
+            alg.addvariable('MinET2', ocut2)
+            alg.addvariable('DeltaPhiMin', minDPhi, 0)
+            tm.registerAlgo(alg)
+
+            
+        # added for muon-jet:
+        for x in [  
+            {"minDr": 0, "maxDr": 4, "otype1" : "MU" ,"ocut1": 4,  "olist1" : "ab", "otype2" : "CJ", "ocut2": 15, "olist2" : "ab"},
+            {"minDr": 0, "maxDr": 4, "otype1" : "MU" ,"ocut1": 4,  "olist1" : "ab", "otype2" : "CJ", "ocut2": 30, "olist2" : "ab"},
+            {"minDr": 0, "maxDr": 4, "otype1" : "MU" ,"ocut1": 6,  "olist1" : "ab", "otype2" : "CJ", "ocut2": 20, "olist2" : "ab"},
+            {"minDr": 0, "maxDr": 4, "otype1" : "MU" ,"ocut1": 6,  "olist1" : "ab", "otype2" : "CJ", "ocut2": 25, "olist2" : "ab"},
+            {"minDr": 0, "maxDr": 4, "otype1" : "MU" ,"ocut1": 4,  "olist1" : "ab", "otype2" : "CJ", "ocut2": 20, "olist2" : "ab"} 
+            ]:
+
+            for k in x:
+                exec("%s = x[k]" % k)
+
+            toponame = "%iDR%02d-%s%s%s-%s%s%s"  % (minDr, maxDr, otype1, str(ocut1), olist1, otype2, str(ocut2), olist2)
+            log.info("Define %s" % toponame)
+            
+            inputList = [otype1 + olist1, otype2 + olist2]
+
+            alg = AlgConf.DeltaRSqrIncl2( name = toponame, inputs = inputList, outputs = [ toponame ], algoId = currentAlgoId); currentAlgoId += 1
+
+            alg.addgeneric('InputWidth1', HW.OutputWidthSelectMU)
+            alg.addgeneric('InputWidth2', HW.OutputWidthSelectJET)
+            alg.addgeneric('MaxTob1', HW.OutputWidthSelectMU)
+            alg.addgeneric('MaxTob2', HW.OutputWidthSelectJET)
+            alg.addgeneric('NumResultBits', 1)                        
+            alg.addvariable('MinET1', ocut1, 0)
+            alg.addvariable('MinET2', ocut2, 0)
+            alg.addvariable('DeltaRMin', minDr*minDr, 0)
+            alg.addvariable('DeltaRMax', maxDr*maxDr, 0)
+            tm.registerAlgo(alg)
+            
+        # dimu INVM items
+
+        algolist=[
+                #            {"minInvm": 2, "maxInvm": 999, "mult": 2, "otype1" : "CMU","ocut1": 4, "olist" : "ab", "otype2" :"", "ocut2" : 0, "onebarrel": 0},
+                #            {"minInvm": 2, "maxInvm": 999, "mult": 1, "otype1" : "CMU","ocut1": 4, "olist" : "ab", "otype2" :"MU", "ocut2" : 4, "onebarrel": 0},
+                #            {"minInvm": 2, "maxInvm": 999, "mult": 1, "otype1" : "MU", "ocut1": 6, "olist" : "ab", "otype2" :"MU", "ocut2" : 4, "onebarrel": 1},
+                #            {"minInvm": 2, "maxInvm": 999, "mult": 1, "otype1" : "CMU","ocut1": 6, "olist" : "ab", "otype2" :"CMU","ocut2" : 4, "onebarrel": 0},
+
+
+                #            {"minInvm": 4, "maxInvm": 8, "mult": 2, "otype1" : "CMU","ocut1": 4, "olist" : "ab", "otype2" : "",  "ocut2" : 0, "onebarrel": 0},
+                #            {"minInvm": 4, "maxInvm": 8, "mult": 1, "otype1" : "CMU","ocut1": 4, "olist" : "ab", "otype2" : "MU","ocut2" : 4, "onebarrel": 0},
+                #            {"minInvm": 4, "maxInvm": 8, "mult": 1, "otype1" : "MU", "ocut1": 6, "olist" : "ab", "otype2" : "MU","ocut2" : 4, "onebarrel": 1},
+                #            {"minInvm": 4, "maxInvm": 8, "mult": 1, "otype1" : "CMU","ocut1": 6, "olist" : "ab", "otype2" : "CMU","ocut2": 4, "onebarrel": 0},
+                #SX
+                #{"minInvm": 1, "maxInvm": 19, "mult": 1, "otype1" : "CMU","ocut1": 4, "olist" : "ab", "otype2" :"MU", "ocut2" : 4, "onebarrel": 0}, #1INVM19-CMU4ab-MU4ab
+                {"minInvm": 2, "maxInvm": 8, "mult": 1, "otype1" : "CMU","ocut1": 4, "olist" : "ab", "otype2" :"MU", "ocut2" : 4, "onebarrel": 0}, #2INVM8-CMU4ab-MU4ab
+                #{"minInvm": 1, "maxInvm": 19, "mult": 2, "otype1" : "CMU","ocut1": 4, "olist" : "ab", "otype2" :"", "ocut2" : 0, "onebarrel": 0}, #1INVM19-2CMU4ab
+                #{"minInvm": 2, "maxInvm": 8, "mult": 2, "otype1" : "CMU","ocut1": 4, "olist" : "ab", "otype2" :"", "ocut2" : 0, "onebarrel": 0}, #2INVM8-2CMU4ab
+                {"minInvm": 2, "maxInvm": 8, "mult": 1, "otype1" : "MU", "ocut1": 6, "olist" : "ab", "otype2" : "MU","ocut2" : 4, "onebarrel": 1}, #2INVM8-ONEBARREL-MU6ab-MU4ab
+            ]
+
+        for x in algolist:
+
+            for k in x:
+                exec("%s = x[k]" % k)
+
+            obj1 = "%s%s%s%s" % ((str(mult) if mult>1 else ""), otype1, str(ocut1), olist)
+            obj2 = "-%s%s%s" % (otype2, str(ocut2), olist)
+            toponame = "%iINVM%i-%s%s%s"  % (minInvm, maxInvm, "ONEBARREL-" if onebarrel==1 else "", obj1, "" if mult>1 else obj2)
+
+            log.info("Define %s" % toponame)
+
+
+            inputList = [otype1 + olist] if (mult>1 or otype1==otype2) else [otype1 + olist, otype2 + olist]
+            algoname = AlgConf.InvariantMassInclusive1 if (mult>1 or otype1==otype2) else AlgConf.InvariantMassInclusive2
+            alg = algoname( name = toponame,  inputs = inputList, outputs = [ toponame ], algoId = currentAlgoId); currentAlgoId += 1
+            if (mult>1 or otype1==otype2):
+                alg.addgeneric('InputWidth', HW.OutputWidthSelectMU) 
+                alg.addgeneric('MaxTob', HW.OutputWidthSelectMU)
+                alg.addgeneric('RequireOneBarrel', onebarrel)
+            else:
+                alg.addgeneric('InputWidth1', HW.OutputWidthSelectMU)
+                alg.addgeneric('InputWidth2', HW.OutputWidthSelectMU) 
+                alg.addgeneric('MaxTob1', HW.OutputWidthSelectMU)
+                alg.addgeneric('MaxTob2', HW.OutputWidthSelectMU)
+
+            alg.addgeneric('NumResultBits', 1)
+            alg.addvariable('MinET1', ocut1)
+            alg.addvariable('MinET2', ocut2 if ocut2>0 else ocut1)
+            alg.addvariable('MinMSqr', minInvm * minInvm)
+            alg.addvariable('MaxMSqr', maxInvm * maxInvm)
+            tm.registerAlgo(alg)
+
+        # dimu DR items
+        algolist=[#            {"minDr": 2, "maxDr": 15, "mult": 1, "otype1" : "CMU","ocut1": 4,  "olist" : "ab", "otype2" : "MU", "ocut2": 4, "onebarrel": 0},
+                #            {"minDr": 2, "maxDr": 15, "mult": 2, "otype1" : "CMU","ocut1": 4,  "olist" : "ab", "otype2" : "",   "ocut2": 4, "onebarrel": 0},
+                #            {"minDr": 2, "maxDr": 15, "mult": 1, "otype1" : "MU", "ocut1": 6,  "olist" : "ab", "otype2" : "MU","ocut2": 4, "onebarrel": 1},            
+                #            {"minDr": 2, "maxDr": 15, "mult": 1, "otype1" : "CMU","ocut1": 6,  "olist" : "ab", "otype2" : "CMU","ocut2": 4, "onebarrel": 0},
+
+                #SX
+                {"minDr": 0, "maxDr": 24, "mult": 2, "otype1" : "CMU","ocut1": 4,  "olist" : "ab", "otype2" : "",   "ocut2": 4, "onebarrel": 0}, #0DR24-2CMU4ab
+                {"minDr": 0, "maxDr": 24, "mult": 1, "otype1" : "CMU","ocut1": 4,  "olist" : "ab", "otype2" : "MU","ocut2": 4, "onebarrel": 0}, #0DR24-CMU4ab-MU4ab  
+            ]
+
+        for x in algolist : 
+            for k in x:
+                exec("%s = x[k]" % k)
+
+            obj1 = "%s%s%s%s" % ((str(mult) if mult>1 else ""), otype1, str(ocut1), olist)
+            obj2 = "-%s%s%s" % (otype2, str(ocut2), olist)
+            toponame = "%iDR%i-%s%s%s"  % (minDr, maxDr, "ONEBARREL-" if onebarrel==1 else "", obj1, "" if mult>1 else obj2)
+
+            log.info("Define %s" % toponame)
+
+            inputList = [otype1 + olist] if (mult>1 or otype1==otype2) else [otype1 + olist, otype2 + olist]
+            algoname = AlgConf.DeltaRSqrIncl1 if (mult>1 or otype1==otype2) else AlgConf.DeltaRSqrIncl2
+            alg = algoname( name = toponame,  inputs = inputList, outputs = [ toponame ], algoId = currentAlgoId); currentAlgoId += 1
+            if (mult>1 or otype1==otype2):
+                alg.addgeneric('InputWidth', HW.OutputWidthSelectMU)
+                alg.addgeneric('MaxTob', HW.OutputWidthSelectMU)
+                alg.addgeneric('RequireOneBarrel', onebarrel)
+            else:
+                alg.addgeneric('InputWidth1', HW.OutputWidthSelectMU)
+                alg.addgeneric('InputWidth2', HW.OutputWidthSelectMU) 
+                alg.addgeneric('MaxTob1', HW.OutputWidthSelectMU)
+                alg.addgeneric('MaxTob2', HW.OutputWidthSelectMU)
+
+
+            alg.addgeneric('NumResultBits', 1)
+            alg.addvariable('MinET1', ocut1)
+            alg.addvariable('MinET2', ocut2)
+            alg.addvariable('DeltaRMin', minDr*minDr)
+            alg.addvariable('DeltaRMax', maxDr*maxDr)
+            tm.registerAlgo(alg)
+
+
+        # deta-dphi with ab+ab
+        if usev7:
+            algoList = [
+               {"minDeta": 0, "maxDeta": 20, "minDphi": 0, "maxDphi": 20, "mult": 1, "otype1" : "TAU", "ocut1": 20, "olist1" : "abi", "nleading1": HW.OutputWidthSelectTAU, "otype2" : "TAU", "ocut2": 12, "olist2": "abi", "nleading2": HW.OutputWidthSelectTAU},
+            ]
+        else:
+            algoList = [
+               {"minDeta": 0, "maxDeta": "04", "minDphi": 0, "maxDphi": "03", "mult": 1, "otype1" : "EM", "ocut1": 8, "olist1" : "abi", "nleading1": HW.OutputWidthSelectEM, "otype2" : "MU", "ocut2": 10, "olist2": "ab", "nleading2": HW.OutputWidthSelectMU},
+               {"minDeta": 0, "maxDeta": "04", "minDphi": 0, "maxDphi": "03", "mult": 1, "otype1" : "EM", "ocut1": 15, "olist1" : "abi", "nleading1": HW.OutputWidthSelectEM, "otype2" : "MU", "ocut2": 0, "olist2": "ab", "nleading2": HW.OutputWidthSelectMU},
+               {"minDeta": 0, "maxDeta": 20, "minDphi": 0, "maxDphi": 20, "mult": 1, "otype1" : "TAU", "ocut1": 20, "olist1" : "abi", "nleading1": HW.OutputWidthSelectTAU, "otype2" : "TAU", "ocut2": 12, "olist2": "abi", "nleading2": HW.OutputWidthSelectTAU},
+            ]
+
+        for x in algoList:                 
+            for k in x:
+                exec("%s = x[k]" % k)
+
+            obj1 = "%s%s%s%s" % ((str(mult) if mult>1 else ""), otype1, str(ocut1), olist1)
+            obj2 = "-%s%s%s" % (otype2, str(ocut2) if ocut2>0 else "", olist2)
+            toponame = "%sDETA%s-%sDPHI%s-%s%s"  % (minDeta, maxDeta, minDphi, maxDphi, obj1, "" if mult>1 else obj2)
+            
+            log.info("Define %s" % toponame)
+            
+            inputList = [otype1 + olist1] if (mult>1 or otype1==otype2) else [otype1 + olist1, otype2 + olist2]
+            algoname = AlgConf.DeltaEtaPhiIncl1 if (mult>1 or otype1==otype2) else AlgConf.DeltaEtaPhiIncl2
+            
+            alg = algoname( name = toponame, inputs = inputList, outputs = [ toponame ], algoId = currentAlgoId); currentAlgoId += 1
+            alg.addgeneric('NumResultBits', 1)                        
+            
+            if (mult>1 or otype1==otype2):
+                alg.addgeneric('InputWidth', nleading1)
+                alg.addgeneric('MaxTob', nleading1)
+                alg.addvariable('MinET1', ocut1, 0)
+                alg.addvariable('MinET2', ocut2, 0)
+                alg.addvariable('MinDeltaEta', minDeta, 0)
+                alg.addvariable('MaxDeltaEta', maxDeta, 0)
+                alg.addvariable('MinDeltaPhi', minDphi, 0)
+                alg.addvariable('MaxDeltaPhi', maxDphi, 0)
+            else:
+                alg.addgeneric('InputWidth1', nleading1)
+                alg.addgeneric('InputWidth2', nleading2)
+                alg.addgeneric('MaxTob1', nleading1)
+                alg.addgeneric('MaxTob2', nleading2)
+                alg.addvariable('MinET1', ocut1, 0)
+                alg.addvariable('MinET2', ocut2, 0)
+                alg.addvariable('DeltaEtaMin', minDeta, 0)
+                alg.addvariable('DeltaEtaMax', maxDeta, 0)
+                alg.addvariable('DeltaPhiMin', minDphi, 0)
+                alg.addvariable('DeltaPhiMax', maxDphi, 0)
+
+            
+            tm.registerAlgo(alg)
+
+        # LFV DETA ATR-14282
+        if usev7:
+            algoList = [
+                {"minDeta": 0, "maxDeta": "04", "mult": 1, "otype1" : "EM", "ocut1": 8, "olist1" : "abi", "nleading1": HW.OutputWidthSelectEM, "otype2" : "MU", "ocut2": 10, "olist2": "ab", "nleading2": HW.OutputWidthSelectMU},
+                {"minDeta": 0, "maxDeta": "04", "mult": 1, "otype1" : "EM", "ocut1": 15, "olist1" : "abi", "nleading1": HW.OutputWidthSelectEM, "otype2" : "MU", "ocut2": 0, "olist2": "ab", "nleading2": HW.OutputWidthSelectMU},
+                ]
+        else:
+            algoList = []
+
+        for x in algoList:
+
+            for k in x:
+                exec("%s = x[k]" % k)
+
+            toponame = "%sDETA%s-%s%s%s-%s%s%s"  % (minDeta, maxDeta, otype1, str(ocut1), olist1, otype2, str(ocut2) if ocut2>0 else "", olist2)
+ 
+            log.info("Define %s" % toponame)
+
+            inputList = [otype1 + olist1, otype2 + olist2]
+            alg = AlgConf.DeltaEtaIncl2( name = toponame, inputs = inputList, outputs = [ toponame ], algoId = currentAlgoId); currentAlgoId += 1
+            alg.addgeneric('NumResultBits', 1)
+
+            alg.addgeneric('InputWidth1', nleading1)
+            alg.addgeneric('InputWidth2', nleading2)
+            alg.addgeneric('MaxTob1', nleading1)
+            alg.addgeneric('MaxTob2', nleading2)
+            alg.addvariable('MinET1', ocut1, 0)
+            alg.addvariable('MinET2', ocut2, 0)
+            alg.addvariable('MinDeltaEta', minDeta, 0)
+            alg.addvariable('MaxDeltaEta', maxDeta, 0)
+
+            tm.registerAlgo(alg)
+
+        if usev7:
+            algoList = [
+                {"minDphi": 0, "maxDphi": "03", "mult": 1, "otype1" : "EM", "ocut1": 8, "olist1" : "abi", "nleading1": HW.OutputWidthSelectEM, "otype2" : "MU", "ocut2": 10, "olist2": "ab", "nleading2": HW.OutputWidthSelectMU},
+                {"minDphi": 0, "maxDphi": "03", "mult": 1, "otype1" : "EM", "ocut1": 15, "olist1" : "abi", "nleading1": HW.OutputWidthSelectEM, "otype2" : "MU", "ocut2": 0, "olist2": "ab", "nleading2": HW.OutputWidthSelectMU},
+                ]
+        else:
+            algoList = []
+
+        for x in algoList:
+
+            for k in x:
+                exec("%s = x[k]" % k)
+            
+            toponame = "%sDPHI%s-%s%s%s-%s%s%s"  % (minDphi, maxDphi, otype1, str(ocut1), olist1, otype2, str(ocut2) if ocut2>0 else "", olist2)
+ 
+            log.info("Define %s" % toponame)
+
+            inputList = [otype1 + olist1, otype2 + olist2]
+            alg = AlgConf.DeltaPhiIncl2( name = toponame, inputs = inputList, outputs = [ toponame ], algoId = currentAlgoId); currentAlgoId += 1
+            alg.addgeneric('NumResultBits', 1)
+            
+            alg.addgeneric('InputWidth1', nleading1)
+            alg.addgeneric('InputWidth2', nleading2)
+            alg.addgeneric('MaxTob1', nleading1)
+            alg.addgeneric('MaxTob2', nleading2)
+            alg.addvariable('MinET1', ocut1, 0)
+            alg.addvariable('MinET2', ocut2, 0)
+            alg.addvariable('MinDeltaPhi', minDphi, 0)
+            alg.addvariable('MaxDeltaPhi', maxDphi, 0)
+
+            tm.registerAlgo(alg)
+
+            
+        # JetMatch
+        toponame = "0MATCH-4AJ20.ETA31-4AJj15.ETA31"
+        alg = AlgConf.MultiplicityCustom( name = toponame, inputs = [ 'AJMatchall' ], outputs = [ toponame ], algoId = currentAlgoId ); currentAlgoId += 1
+        alg.addgeneric('InputWidth', HW.InputWidthJET)
+        alg.addgeneric('NumResultBits', 1)
+        alg.addvariable('MinET', 0)
+        alg.addvariable('MinEta', 0)
+        alg.addvariable('MaxEta', 31)
+        alg.addvariable('MinMultiplicity', 4)
+        tm.registerAlgo(alg)
+        
+        # NoMatch for W T&P
+        toponame = "NOT-02MATCH-EM10s1-AJj15all.ETA49"
+        alg = AlgConf.NotMatch( name = toponame, inputs = [ 'EMs', 'AJjall'], outputs = [ toponame ], algoId = currentAlgoId ); currentAlgoId += 1
+        alg.addgeneric('InputWidth1', HW.OutputWidthSortEM)
+        alg.addgeneric('InputWidth2', HW.InputWidthJET)
+        alg.addgeneric('MaxTob1', 1)
+        alg.addgeneric('MaxTob2', HW.InputWidthJET)
+        alg.addgeneric('NumResultBits', 1)
+        alg.addvariable('MinET1', 10)
+        alg.addvariable('MinET2', 15)
+        alg.addvariable('EtaMin1', 0)
+        alg.addvariable('EtaMax1', 49)
+        alg.addvariable('EtaMin2', 0)
+        alg.addvariable('EtaMax2', 49)
+        alg.addvariable('DRCut', 4)
+        tm.registerAlgo(alg)
+
+        # RATIO SUM for W T&P 
+        #toponame = "05RATIO-XE0-SUM0-EM10s1-HT0-AJj15all.ETA49"
+        #alg = AlgConf.RatioSum( name = toponame, inputs = ['XE', 'AJjall', 'EMs'], outputs = [ toponame ], algoId = currentAlgoId ); currentAlgoId += 1
+        #alg.addgeneric('InputWidth1', 1)
+        #alg.addgeneric('InputWidth2', HW.InputWidthJET) 
+        #alg.addgeneric('InputWidth3', HW.OutputWidthSortEM) 
+        #alg.addgeneric('MaxTob1', 1)
+        #alg.addgeneric('MaxTob2', HW.InputWidthJET)
+        #alg.addgeneric('MaxTob3', 1)
+        #alg.addgeneric('NumResultBits', 1)
+        #alg.addgeneric('UseCluster05Granularity', 1)
+        #alg.addvariable('MinET2', 15)
+        #alg.addvariable('EtaMin2', 0)
+        #alg.addvariable('EtaMax2', 49)
+        #alg.addvariable('MinET3', 10)
+        #alg.addvariable('EtaMin3', 0)
+        #alg.addvariable('EtaMax3', 49)
+        #alg.addvariable('MinMET', 0)
+        #alg.addvariable('HT', 0)
+        #alg.addvariable('SUM', 0)
+        #alg.addvariable('Ratio', 5, 0)
+        #tm.registerAlgo(alg)
+
+        # RATIO for W T&P
+        for x in [
+            {"minRatio": 5, "ocut" : 15, "Ratio": "RATIO"},
+            #{"minRatio": 8, "ocut" : 15, "Ratio": "RATIO"},
+            {"minRatio": 90, "ocut" : 15, "Ratio": "RATIO2"},
+            {"minRatio": 250, "ocut" : 15, "Ratio": "RATIO2"},
+            ]:
+            
+            for k in x:
+                exec("%s = x[k]" % k)
+                
+            toponame = "%02d%s-XE0-HT0-AJj%sall.ETA49"  % (minRatio, Ratio, str(ocut))
+            log.info("Define %s" % toponame)
+            
+            alg = AlgConf.Ratio( name = toponame, inputs = ['XE', 'AJjall'], outputs = [ toponame ], algoId = currentAlgoId ) 
+            currentAlgoId += 1
+            alg.addgeneric('InputWidth1', 1) 
+            alg.addgeneric('InputWidth2', HW.InputWidthJET) 
+            alg.addgeneric('MaxTob1', 1)
+            alg.addgeneric('MaxTob2', HW.InputWidthJET)
+            alg.addgeneric('NumResultBits', 1)
+            alg.addgeneric('isXE2', 1 if Ratio=="RATIO2" else 0)
+            alg.addvariable('MinET2', str(ocut))
+            alg.addvariable('EtaMin', 0)
+            alg.addvariable('EtaMax', 49)
+            alg.addvariable('MinET1', 0)                        
+            alg.addvariable('HT', 0)
+            alg.addvariable('Ratio', str(minRatio))
+            tm.registerAlgo(alg)
+
+            
+        # RATIO MATCH dedicated to Exotic 
+        toponame = '100RATIO-0MATCH-TAU30si2-EMall'
+        alg = AlgConf.RatioMatch( name = toponame, inputs = [ 'TAUsi', 'EMall'], outputs = [ toponame ], algoId = currentAlgoId ); currentAlgoId += 1
+        alg.addgeneric('InputWidth1', HW.OutputWidthSortTAU)
+        alg.addgeneric('InputWidth2', HW.InputWidthEM)      
+        alg.addgeneric('MaxTob1', 2)
+        alg.addgeneric('MaxTob2', HW.InputWidthEM)
+        alg.addgeneric('NumResultBits', 1)
+        alg.addvariable('MinET1', 30)
+        alg.addvariable('MinET2',  0)
+        alg.addvariable('Ratio', 100, 0)
+        tm.registerAlgo(alg)        
+
+
+        # NOT MATCH dedicated to Exotic
+        toponame = 'NOT-0MATCH-TAU30si2-EMall'
+        alg = AlgConf.NotMatch( name = toponame, inputs = [ 'TAUsi', 'EMall'], outputs = [ toponame ], algoId = currentAlgoId ); currentAlgoId += 1
+        alg.addgeneric('InputWidth1', HW.OutputWidthSortTAU)
+        alg.addgeneric('InputWidth2', HW.InputWidthEM)
+        alg.addgeneric('MaxTob1', 2)
+        alg.addgeneric('MaxTob2', HW.InputWidthEM)
+        alg.addgeneric('NumResultBits', 1)
+        alg.addvariable('MinET1', 30)
+        alg.addvariable('MinET2', 0)
+        alg.addvariable('EtaMin1', 0)
+        alg.addvariable('EtaMax1', 49)
+        alg.addvariable('EtaMin2', 0)
+        alg.addvariable('EtaMax2', 49)
+        alg.addvariable('DRCut', 0)
+        tm.registerAlgo(alg)        
+
+        # MULT-BIT
+        for x in [
+            {"otype1" : "CMU" ,"ocut1": 4, "olist1" : "ab", "nleading1": HW.OutputWidthSelectMU, "inputwidth1": HW.OutputWidthSelectMU},
+            {"otype1" : "CMU" ,"ocut1": 6, "olist1" : "ab", "nleading1": HW.OutputWidthSelectMU, "inputwidth1": HW.OutputWidthSelectMU},
+            ]:
+            for k in x:
+                exec("%s = x[k]" % k)
+                
+            toponame = "MULT-%s%s%s" % (otype1, str(ocut1), olist1)
+            toponames = [toponame+"[0]", toponame+"[1]"]
+            log.info("Define %s" % toponames)
+            
+            inputList = [otype1 + olist1] 
+            alg = AlgConf.Multiplicity( name = toponame,  inputs = inputList, outputs = toponames, algoId = currentAlgoId); currentAlgoId += 1
+            
+            alg.addgeneric('InputWidth', inputwidth1)
+            alg.addgeneric('NumResultBits', 2)
+            alg.addvariable('MinET', ocut1-1) # for MU threshold -1 
+            tm.registerAlgo(alg)        
+            
+        
+        # DISAMB 2 lists
+        for x in [     
+            {"disamb": 1, "otype1" : "TAU", "ocut1": 12, "olist1" : "abi", "nleading1": HW.OutputWidthSelectTAU, "otype2" : "J", "ocut2": 25, "olist2": "ab", "nleading2": HW.OutputWidthSelectJET},
+            #{"disamb": 0, "otype1" : "EM",  "ocut1": 15, "olist1" : "abhi", "nleading1": HW.OutputWidthSelectEM, "otype2" : "TAU", "ocut2": 40, "olist2": "ab", "nleading2": HW.OutputWidthSelectTAU},
+            #{"disamb": 1, "otype1" : "TAU", "ocut1": 20, "olist1" : "ab", "nleading1": HW.OutputWidthSelectTAU,  "otype2" : "J", "ocut2": 20, "olist2": "ab", "nleading2": HW.OutputWidthSelectJET},
+            #{"disamb": 0, "otype1" : "EM",  "ocut1": 15, "olist1" : "abhi", "nleading1": HW.OutputWidthSelectEM, "otype2" : "TAU", "ocut2": 12, "olist2": "abi", "nleading2": HW.OutputWidthSelectTAU},
+            ]:
+            
+            for k in x:
+                exec("%s = x[k]" % k)
+
+            obj1 = "%s%s%s"  % (otype1, str(ocut1), olist1)
+            obj2 = "-%s%s%s" % (otype2, str(ocut2), olist2)
+            toponame = "%sDISAMB-%s%s"  % ( disamb if disamb>0 else "", obj1, obj2)
+            
+            log.info("Define %s" % toponame)
+            
+            inputList = [otype1 + olist1, otype2 + olist2]
+            alg = AlgConf.DisambiguationIncl2( name = toponame, inputs = inputList, outputs = [ toponame ], algoId = currentAlgoId); currentAlgoId += 1
+            alg.addgeneric('InputWidth1', nleading1 if olist1.find("ab")>=0 else -1000)
+            alg.addgeneric('InputWidth2', nleading2 if olist2.find("ab")>=0 else -1000) 
+            alg.addgeneric('MaxTob1', nleading1)
+            alg.addgeneric('MaxTob2', nleading2)
+            alg.addgeneric('NumResultBits', 1)
+            alg.addgeneric('ClusterOnly', 1 if (otype1=="EM" and otype2=="TAU") or (otype1=="TAU" and otype2=="EM") else 0 )
+            alg.addgeneric('ApplyDR', 0)
+            alg.addvariable('MinET1', ocut1)
+            alg.addvariable('MinET2', ocut2)
+            alg.addvariable('DisambDRSqrMin', disamb*disamb)
+            tm.registerAlgo(alg)
+        
+        # DISAMB 3 lists
+        for x in [     
+            {"disamb": 1, "otype1" : "EM",  "ocut1": 15, "olist1": "shi","nleading1": 2, "inputwidth1": HW.OutputWidthSortEM, "otype2" : "TAU", "ocut2": 12, "olist2": "abi", "nleading2": HW.OutputWidthSelectTAU, "inputwidth2": HW.OutputWidthSelectTAU, "otype3" : "J", "ocut3": 25, "olist3": "ab", "nleading3": HW.OutputWidthSelectJET, "inputwidth3": HW.OutputWidthSelectJET},
+            {"disamb": 1, "otype1" : "TAU", "ocut1": 20, "olist1": "abi","nleading1": HW.OutputWidthSelectTAU, "inputwidth1": HW.OutputWidthSelectTAU, "otype2" : "TAU", "ocut2": 12, "olist2": "abi", "nleading2": HW.OutputWidthSelectTAU, "otype3" : "J", "ocut3": 25, "olist3": "ab", "nleading3": HW.OutputWidthSelectTAU}, 
+            ]:
+            
+            for k in x:
+                exec("%s = x[k]" % k)
+
+            obj1 = "%s%s%s"  % (otype1, str(ocut1), olist1.replace('shi','his') + (str(nleading1) if olist1.find('s')>=0 else ""))
+            obj2 = "-%s%s%s" % (otype2, str(ocut2), olist2.replace('shi','his') + (str(nleading2) if olist2.find('s')>=0 else ""))
+            obj3 = "-%s%s%s" % (otype3, str(ocut3), olist3)
+            toponame = "%sDISAMB-%s%s%s"  % ( disamb if disamb>0 else "", obj1, obj2, obj3)
+            
+            log.info("Define %s" % toponame)
+            
+            inputList = [otype1 + olist1, otype2 + olist2, otype3 + olist3]
+            alg = AlgConf.DisambiguationIncl3( name = toponame, inputs = inputList, outputs = [ toponame ], algoId = currentAlgoId); currentAlgoId += 1
+            alg.addgeneric('InputWidth1', inputwidth1)
+            alg.addgeneric('InputWidth2', inputwidth2)
+            alg.addgeneric('InputWidth3', inputwidth3)
+            alg.addgeneric('MaxTob1', nleading1)
+            alg.addgeneric('MaxTob2', nleading2)
+            alg.addgeneric('MaxTob3', nleading3)
+            alg.addgeneric('NumResultBits', 1)
+            alg.addgeneric('ApplyDR', 0)
+            alg.addvariable('MinET1', ocut1, 0)
+            alg.addvariable('MinET2', ocut2, 0)
+            alg.addvariable('MinET3', ocut3, 0)
+            alg.addvariable('DisambDRSqr', disamb*disamb, 0) # DisambDR
+            tm.registerAlgo(alg)         
+
+        # DISAMB 3 lists with DR cut to 2nd and 3rd lists
+
+        algolist=[
+               {"disamb": 1, "otype1" : "EM",  "ocut1": 15, "olist1": "shi","nleading1": 2, "inputwidth1": HW.OutputWidthSortEM, "otype2" : "TAU", "ocut2": 12, "olist2": "abi", "nleading2": HW.OutputWidthSelectTAU, "inputwidth2": HW.OutputWidthSelectTAU, "otype3" : "J", "ocut3": 25, "olist3": "ab", "nleading3": HW.OutputWidthSelectJET, "inputwidth3": HW.OutputWidthSelectJET, "drcutmin": 0, "drcutmax": 28}, 
+               {"disamb": 1, "otype1" : "TAU",  "ocut1": 20, "olist1": "abi","nleading1": HW.OutputWidthSelectTAU, "inputwidth1": HW.OutputWidthSelectTAU, "otype2" : "TAU", "ocut2": 12, "olist2": "abi", "nleading2": HW.OutputWidthSelectTAU, "inputwidth2": HW.OutputWidthSelectTAU, "otype3" : "J", "ocut3": 25, "olist3": "ab", "nleading3": HW.OutputWidthSelectJET, "inputwidth3": HW.OutputWidthSelectJET, "drcutmin": 0, "drcutmax": 28}, # 1DISAMB-J25ab-0DR28-TAU20abi-TAU12abi
+               {"disamb": 1, "otype1" : "TAU",  "ocut1": 20, "olist1": "abi","nleading1": HW.OutputWidthSelectTAU, "inputwidth1": HW.OutputWidthSelectTAU, "otype2" : "TAU", "ocut2": 12, "olist2": "abi", "nleading2": HW.OutputWidthSelectTAU, "inputwidth2": HW.OutputWidthSelectTAU, "otype3" : "J", "ocut3": 25, "olist3": "ab", "nleading3": HW.OutputWidthSelectJET, "inputwidth3": HW.OutputWidthSelectJET, "drcutmin": 0, "drcutmax": 25}, # 1DISAMB-J25ab-0DR25-TAU20abi-TAU12abi
+            ]
+
+        for x in algolist:
+
+            for k in x:
+                exec("%s = x[k]" % k)
+
+            obj1 = "-%s%s%s"  % (otype1, str(ocut1), olist1.replace('shi','his') + (str(nleading1) if olist1.find('s')>=0 else ""))
+            obj2 = "-%s%s%s" % (otype2, str(ocut2), olist2.replace('shi','his') + (str(nleading2) if olist2.find('s')>=0 else ""))
+            obj3 = "%s%s%s" % (otype3, str(ocut3), olist3)
+            toponame = "%sDISAMB-%s-%dDR%d%s%s"  % ( str(disamb) if disamb>0 else "", obj3, drcutmin, drcutmax, obj1, obj2)
+
+            log.info("Define %s" % toponame)
+            
+            inputList = [otype1 + olist1, otype2 + olist2, otype3 + olist3]
+            alg = AlgConf.DisambiguationDRIncl3( name = toponame, inputs = inputList, outputs = [ toponame ], algoId = currentAlgoId); currentAlgoId += 1
+            alg.addgeneric('InputWidth1', inputwidth1)
+            alg.addgeneric('InputWidth2', inputwidth2)
+            alg.addgeneric('InputWidth3', inputwidth3)
+            alg.addgeneric('MaxTob1', nleading1)
+            alg.addgeneric('MaxTob2', nleading2)
+            alg.addgeneric('MaxTob3', nleading3)
+            alg.addgeneric('NumResultBits', 1)
+            alg.addvariable('MinET1', ocut1, 0)
+            alg.addvariable('MinET2', ocut2, 0)
+            alg.addvariable('MinET3', ocut3, 0)
+            alg.addvariable('DisambDRSqrMin', drcutmin*drcutmin, 0)
+            alg.addvariable('DisambDRSqrMax', drcutmax*drcutmax, 0)
+            alg.addvariable('DisambDRSqr', disamb*disamb, 0)
+            tm.registerAlgo(alg)            
+
+
+        # LAR  0<eta<1.4 and 9/16pi<phi<11/16pi for FE crate IO6 
+        for x in [     
+            {"minEta": 0, "maxEta": 15, "minPhi": 16, "maxPhi": 23, "otype" : "EM", "ocut" : 20, "inputwidth": HW.OutputWidthSortEM},
+            {"minEta": 0, "maxEta": 14, "minPhi": 16, "maxPhi": 23, "otype" : "J", "ocut" : 100, "inputwidth": HW.OutputWidthSortJET}, 
+            ]:
+
+            for k in x:
+                exec("%s = x[k]" % k)
+
+            toponame = "LAR-%s%ss1"  % ( otype, str(ocut) if not otype=="EM" else "50" )
+            
+            log.info("Define %s" % toponame)
+            
+            inputList = otype + 's'
+            
+            alg = AlgConf.LAr( name = toponame, inputs = inputList, outputs = toponame, algoId = currentAlgoId ); currentAlgoId += 1
+            alg.addgeneric('InputWidth', inputwidth) 
+            alg.addgeneric('MaxTob', 1)
+            alg.addgeneric('NumResultBits', 1)
+            alg.addvariable('MinET', str(ocut))
+            alg.addvariable('EtaMin', minEta)
+            alg.addvariable('EtaMax', maxEta)
+            alg.addvariable('PhiMin', minPhi)
+            alg.addvariable('PhiMax', maxPhi)
+            tm.registerAlgo(alg)
+
+
+
+
+        xemap = {"etcut": 0, "Threlist": [ 40, 50, 55, 60, 65, 75 ]}
+        for x in [ 
+            xemap,
+            ]:
+                
+            for k in x:
+                exec("%s = x[k]" % k)
+            
+            log.info("Define %s" % toponame)
+            
+            inputList = ['XENoSort', 'AJall']
+            toponames=[]
+
+            for minxe in Threlist:
+                toponames.append("KF-XE%s-AJall"  % (minxe))
+            
+            alg = AlgConf.KalmanMETCorrection( name = "KF-XE-AJall", inputs = inputList, outputs = toponames, algoId = currentAlgoId ); currentAlgoId += 1
+            alg.addgeneric('InputWidth', HW.InputWidthJET)
+            alg.addgeneric('NumResultBits', len(toponames))
+            alg.addvariable('MinET', 0)
+            for bitid,minxe in enumerate(Threlist):
+                alg.addvariable('KFXE', str(minxe), bitid)
+            
+            tm.registerAlgo(alg)
+
+        # W T&P: MINDPHI(J, XE0), (EM, XE0)
+
+        alglist = [
+            {"minDPhi": 15, "otype" : "EM",  "ocut" : 12, "olist" : "s", "nleading" : 6, "inputwidth": HW.OutputWidthSortEM},
+            {"minDPhi": 15, "otype" : "EM",  "ocut" : 15, "olist" : "s", "nleading" : 6, "inputwidth": HW.OutputWidthSortEM},
+            ]
+
+        for x in alglist:
+            
+            for k in x:
+                exec("%s = x[k]" % k)
+                
+            toponame = "%02dMINDPHI-%s%s%s%s-XE0"  % (minDPhi, otype, str(ocut) if ocut > 0 else "", olist, str(nleading) if olist=="s" else "")
+            log.info("Define %s" % toponame)
+
+            inputList = otype + olist
+
+            alg = AlgConf.MinDeltaPhiIncl2( name = toponame, inputs = [ inputList, 'XE'], outputs = [ toponame ], algoId = currentAlgoId ); currentAlgoId += 1
+
+
+            alg.addgeneric('InputWidth1', inputwidth)
+            alg.addgeneric('InputWidth2', 1) 
+            alg.addgeneric('MaxTob1', nleading)
+            alg.addgeneric('MaxTob2', 1)
+            alg.addgeneric('NumResultBits', 1)
+            alg.addvariable('MinET1', ocut)
+            alg.addvariable('MinET2', 0)
+            alg.addvariable('DeltaPhiMin', minDPhi, 0)
+            tm.registerAlgo(alg)
+
+            
+        # W T&P MT
+
+        alglistmt = [
+            {"minMT": 35, "otype" : "EM", "ocut" : "12", "olist" : "s", "nleading" : 6, "inputwidth": HW.OutputWidthSortEM},
+            ]
+        for x in alglistmt:
+            for k in x:
+                exec("%s = x[k]" % k)
+
+            toponame = "%iMT-%s%s%s%s-XE0"  % (minMT, otype, str(ocut) if ocut > 0 else "", olist, str(nleading) if olist=="s" else "")
+            log.info("Define %s" % toponame)
+
+            inputList = otype + olist
+            
+            alg = AlgConf.TransverseMassInclusive1( name = toponame, inputs = [ inputList, 'XE'], outputs = [ toponame ], algoId = currentAlgoId ); currentAlgoId += 1
+
+
+
+            alg.addgeneric('InputWidth', HW.OutputWidthSortEM)
+            alg.addgeneric('MaxTob', str(nleading))
+            alg.addgeneric('NumResultBits', 1)
+            alg.addvariable('MinET1', str(ocut))
+            alg.addvariable('MinET2', 0)
+            alg.addvariable('MinMTSqr', minMT*minMT)                        
+            tm.registerAlgo(alg)
+            
+        # DISAMB 2 lists with DR cut between objects in two lists
+
+        for x in [     
+            {"disamb": 0, "otype1" : "EM",  "ocut1": 15, "olist1": "shi","nleading1": 2, "inputwidth1": HW.OutputWidthSortEM, "otype2" : "TAU", "ocut2": 12, "olist2": "abi", "nleading2": HW.OutputWidthSelectTAU, "inputwidth2": HW.OutputWidthSelectTAU, "drcutmin": 0, "drcutmax": 28},
+            ]:
+
+            for k in x:
+                exec("%s = x[k]" % k)
+
+            obj1 = "-%s%s%s"  % (otype1, str(ocut1), olist1.replace('shi','his') + (str(nleading1) if olist1.find('s')>=0 else ""))
+            obj2 = "-%s%s%s" % (otype2, str(ocut2), olist2.replace('shi','his') + (str(nleading2) if olist2.find('s')>=0 else ""))
+            toponame = "%sDISAMB-%dDR%d%s%s"  % ( str(disamb) if disamb>0 else "", drcutmin, drcutmax, obj1, obj2)
+
+            log.info("Define %s" % toponame)
+
+            inputList = [otype1 + olist1, otype2 + olist2]
+            alg = AlgConf.DisambiguationDRIncl2( name = toponame, inputs = inputList, outputs = [ toponame ], algoId = currentAlgoId); currentAlgoId += 1
+            alg.addgeneric('InputWidth1', inputwidth1)
+            alg.addgeneric('InputWidth2', inputwidth2)
+            alg.addgeneric('MaxTob1', nleading1)
+            alg.addgeneric('MaxTob2', nleading2)
+            alg.addgeneric('NumResultBits', 1)
+            alg.addvariable('MinET1', ocut1, 0)
+            alg.addvariable('MinET2', ocut2, 0)
+            alg.addvariable('DisambDRSqrMin', drcutmin*drcutmin, 0)
+            alg.addvariable('DisambDRSqrMax', drcutmax*drcutmax, 0)
+            tm.registerAlgo(alg)   
+
+        # ZH Trigger
+
+        supportedalgolist = [
+            {"minDPhi": 10, "otype" : "AJ", "ocut" : 20,  "olist" : "s", "nleading" : 2, "inputwidth": HW.OutputWidthSortJET},
+        ]            
+        for x in supportedalgolist:
+            
+            for k in x:
+                exec("%s = x[k]" % k)
+                
+            toponame = "%iMINDPHI-%s%s%s%s-XE50"  % (minDPhi, otype, str(ocut) if ocut > 0 else "", olist, str(nleading) if olist=="s" else "")
+            log.info("Define %s" % toponame)
+            
+            inputList = otype + olist
+
+            alg = AlgConf.MinDeltaPhiIncl2( name = toponame, inputs = [inputList, 'XE'], outputs = [ toponame ], algoId = currentAlgoId ); currentAlgoId += 1
+
+            alg.addgeneric('InputWidth1', inputwidth)
+            alg.addgeneric('InputWidth2', 1)  
+            alg.addgeneric('MaxTob1', nleading)
+            alg.addgeneric('MaxTob2', 1)
+            alg.addgeneric('NumResultBits', 1)
+            alg.addvariable('MinET1', ocut)
+            alg.addvariable('MinET2', 50)
+            alg.addvariable('DeltaPhiMin', minDPhi, 0)
+            tm.registerAlgo(alg)
+                
+        # LATE MUON
+        for x in [     
+            #{"otype" : "LATE-MU", "ocut" : 10, "inputwidth": HW.OutputWidthSortMU},
+            {"otype" : "LATE-MU", "ocut" : 10, "inputwidth": HW.NumberOfDelayedMuons},
+            ]:
+
+            for k in x:
+                exec("%s = x[k]" % k)
+
+            toponame = "%s%ss1"  % ( otype, str(ocut) )
+
+            log.info("Define %s" % toponame)
+
+            inputList = 'LMUs'
+
+            alg = AlgConf.EtCut( name = toponame, inputs = inputList, outputs = toponame, algoId = currentAlgoId ); currentAlgoId += 1
+            alg.addgeneric('InputWidth', inputwidth) 
+            alg.addgeneric('MaxTob', 1)
+            alg.addgeneric('NumResultBits', 1)
+            alg.addvariable('MinET', str(ocut))
+            tm.registerAlgo(alg)
+            
+
+        # (ATR-12748) fat jet trigger with Simple Cone algo
+        for x in [            
+            {"minHT": 111, "otype" : "CJ", "ocut" : 15, "olist" : "ab", "nleading" : HW.OutputWidthSelectJET, "inputwidth": HW.OutputWidthSelectJET, "oeta" : 26},
+            {"minHT": 85, "otype" : "CJ", "ocut" : 15, "olist" : "ab", "nleading" : HW.OutputWidthSelectJET, "inputwidth": HW.OutputWidthSelectJET, "oeta" : 26},                
+            ]:
+
+            for k in x:
+                exec("%s = x[k]" % k)
+
+            toponame = "SC%d-%s%s%s%s.ETA%s" % (minHT, otype, str(ocut), olist, str(nleading) if olist=="s" else "", str(oeta))
+
+            log.info("Define %s" % toponame)
+
+            inputList = otype + olist
+
+            alg = AlgConf.SimpleCone( name = toponame, inputs = inputList, outputs = [toponame], algoId = currentAlgoId ); currentAlgoId += 1
+
+
+            alg.addgeneric('InputWidth', inputwidth)
+            alg.addvariable('MinET', ocut)                        
+            alg.addvariable('MinSumET', minHT)
+            alg.addvariable('MaxRSqr', 10*10)                        
+            tm.registerAlgo(alg)  
+
+        # DISAMB-INVM
+
+        for x in [
+                {"disamb": 0, "minInvm": 30, "maxInvm": 9999,"otype1" : "EM",  "ocut1": 20, "olist1": "shi","nleading1": 2, "inputwidth1": HW.OutputWidthSortEM, "otype2" : "TAU", "ocut2": 12, "olist2": "ab", "nleading2": HW.OutputWidthSelectTAU, "inputwidth2": HW.OutputWidthSelectTAU}, # DISAMB-30INVM-EM20his2-TAU12ab
+                ]:
+            
+                for k in x:
+                    exec("%s = x[k]" % k)
+
+                obj1 = "%s%s%s"  % (otype1, str(ocut1), olist1.replace('shi','his') + (str(nleading1) if olist1.find('s')>=0 else ""))
+                obj2 = "-%s%s%s" % (otype2, str(ocut2), olist2)
+                toponame = "%sDISAMB-%iINVM%s-%s%s"  % ( disamb if disamb>0 else "", minInvm, str(maxInvm) if maxInvm<9999 else "", obj1, obj2)          
+
+                log.info("Define %s" % toponame)
+                inputList = [otype1 + olist1, otype2 + olist2]               
+                #alg = AlgConf.DisambiguationInvariantMass2( name = toponame, inputs = inputList, outputs = toponame, algoId = currentAlgoId); currentAlgoId += 1
+                alg = AlgConf.DisambiguationInvmIncl2( name = toponame, inputs = inputList, outputs = toponame, algoId = currentAlgoId); currentAlgoId += 1
+
+                alg.addgeneric('InputWidth1', inputwidth1)
+                alg.addgeneric('InputWidth2', inputwidth2)
+                alg.addgeneric('MaxTob1', nleading1)
+                alg.addgeneric('MaxTob2', nleading2)
+                alg.addgeneric('NumResultBits', 1)
+            
+                alg.addvariable('MinET1', ocut1)
+                alg.addvariable('MinET2', ocut2)
+                alg.addvariable('MinMSqr', minInvm * minInvm)
+                alg.addvariable('MaxMSqr', maxInvm * maxInvm)
+                
+                tm.registerAlgo(alg)
+
+
+        for x in [
+                {  "minInvm": 400, "maxInvm": 9999, "otype1" : "AJ", "ocut1": 30, "olist1" : "s", "nleading1" : 6, "inputwidth1": HW.OutputWidthSortJET, "otype2" : "AJ", "ocut2": 20, "olist2" : "s", "nleading2" : 6, "inputwidth2": HW.OutputWidthSortJET, "applyEtaCut":1, "minEta1": 0 ,"maxEta1": 31 , "minEta2": 31 ,"maxEta2": 49 , }, #400INVM9999-AJ30s6.ETA31-AJ20s6.31ETA49
+                ]:
+            
+                for k in x:
+                    exec("%s = x[k]" % k)
+
+                obj1 = "%s%s%s.%sETA%i"  % (otype1, str(ocut1), olist1 + (str(nleading1) if olist1.find('s')>=0 else ""),str(minEta1) if minEta1>0 else "", maxEta1)
+                obj2 = "-%s%s%s.%sETA%i"  % (otype2, str(ocut2), olist2 + (str(nleading2) if olist2.find('s')>=0 else ""),str(minEta2) if minEta2>0 else "", maxEta2)
+            
+                inputList = [otype1 + olist1, otype2 + olist2]
+                        
+                toponame = "%iINVM%i-%s%s"   % (minInvm, maxInvm, obj1, obj2)
+                alg = AlgConf.InvariantMassInclusive2( name = toponame, inputs = inputList, outputs = toponame, algoId = currentAlgoId); currentAlgoId += 1    
+
+
+                alg.addgeneric('InputWidth1', inputwidth1)
+                alg.addgeneric('InputWidth2', inputwidth2)
+                alg.addgeneric('MaxTob1', nleading1)
+                alg.addgeneric('MaxTob2', nleading2)
+                alg.addgeneric('NumResultBits', 1)
+                if (applyEtaCut>0):
+                    alg.addgeneric('ApplyEtaCut', applyEtaCut)
+
+                alg.addvariable('MinET1', ocut1)
+                alg.addvariable('MinET2', ocut2)
+                alg.addvariable('MinMSqr', minInvm * minInvm )
+                alg.addvariable('MaxMSqr', maxInvm * maxInvm )
+                if (applyEtaCut>0):
+                    alg.addvariable('MinEta1', minEta1)
+                    alg.addvariable('MaxEta1', maxEta1)
+                    alg.addvariable('MinEta2', minEta2)
+                    alg.addvariable('MaxEta2', maxEta2)
+
+                tm.registerAlgo(alg)
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/LVL1/BunchGroupSet.py b/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/LVL1/BunchGroupSet.py
new file mode 100644
index 0000000000000000000000000000000000000000..2836d05cd649888e2e5d50fdcd97f5154b07db1a
--- /dev/null
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/LVL1/BunchGroupSet.py
@@ -0,0 +1,111 @@
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+from copy import deepcopy
+
+from Limits import Limits
+from Lvl1Flags import Lvl1Flags
+
+from AthenaCommon.Logging import logging
+log = logging.getLogger("TriggerMenu.l1.BunchGroupSet")
+
+def setDefaultBunchGroupDefinition(bgs):
+    """
+    sets default bunchgroups for all menus, needed for simulation.
+    """
+    from TriggerJobOpts.TriggerFlags import TriggerFlags
+
+    bgs.bunchGroups = Limits.NumBunchgroups * [None]
+
+    # BGS and BG names
+    bgs.name = TriggerFlags.triggerMenuSetup().partition('_')[0]
+    bunchgroupnames = Lvl1Flags.BunchGroupNames()[:Limits.NumBunchgroups]
+    bunchgroupnames += ['BG_%i' % i for i in range( len(bunchgroupnames), Limits.NumBunchgroups)]
+
+    for i,bgname in enumerate(bunchgroupnames):
+        bgs.addBunchGroup( bgname, i, [] )
+
+    # this bunchgroups need to be filled for MC simulation
+    #    if 'MC_' in TriggerFlags.triggerMenuSetup():
+    bgs.bunchGroups[0].bunches = [1]
+    bgs.bunchGroups[1].bunches = [1]
+    bgs.bunchGroups[7].bunches = [1]
+
+class BunchGroupSet:
+
+    class BunchGroup:
+        def __init__(self, name='', internalNumber=0, partition=0, bunches=[]):
+            self.name           = name
+            self.internalNumber = internalNumber
+            self.menuPartition  = partition
+            self.bunches        = bunches
+
+        def xml(self, ind=1, step=2):
+            #s  = ind * step * ' ' + '<BunchGroup menuPartition="%i" internalNumber="%i" name="%s"' % (self.menuPartition, self.internalNumber, self.name)
+            s  = ind * step * ' ' + '<BunchGroup internalNumber="%i" name="%s"' % (self.internalNumber, self.name)
+            if not self.bunches:
+                s += '/>\n'
+            else:
+                s += '>\n'
+                for b in self.bunches:
+                    s += (ind+1) * step * ' ' + '<Bunch bunchNumber="%i"/>\n' % b
+                s += ind * step * ' ' + '</BunchGroup>\n'
+            return s
+        
+
+    def __init__(self, name='', menuPartition=0, bunchGroups = None):
+        self.name          = name
+        self.menuPartition = menuPartition
+        self.bunchGroups   = bunchGroups
+
+    def __len__(self):
+        return len(self.bunchGroups)
+
+
+    @classmethod
+    def partitioning(cls):
+        from Lvl1Flags import Lvl1Flags
+        first = Lvl1Flags.BunchGroupPartitioning()
+        last = first[1:] + [ Limits.NumBunchgroups ]
+        partitioning = dict( zip([1,2,3],zip(first,last)) )
+        return partitioning
+
+    def setDefaultBunchGroupDefinition(self):
+        setDefaultBunchGroupDefinition(self)
+
+
+    def resize(self, newsize):
+        if type(self.bunchGroups) != list:
+            self.bunchGroups = []
+        self.bunchGroups += newsize * [None]
+        self.bunchGroups = self.bunchGroups[:newsize]
+
+
+    def addBunchGroup(self, name, internalNumber, bunches):
+        # check if internalNumber is within limits
+        if internalNumber<0 or internalNumber >= Limits.NumBunchgroups:
+            log.error('Warning: tried to add bunchgroup %i, which is not between 0 and %i' % (internalNumber, Limits.NumBunchgroups-1))
+            return self
+
+        # check if one already exists with this number
+        if self.bunchGroups[internalNumber] != None:
+            log.error('Warning: tried to add bunchgroup %i, but one with that number already exists' % internalNumber)
+            return self
+
+        partition=0
+        from Lvl1Flags import Lvl1Flags
+        for lowestBG in Lvl1Flags.BunchGroupPartitioning():
+            if internalNumber >= lowestBG:
+                partition += 1
+
+        self.bunchGroups[internalNumber] = BunchGroupSet.BunchGroup(name, internalNumber, partition, bunches)
+        return self
+
+
+
+    def xml(self, ind=1, step=2):
+        s  = ind * step * ' ' + '<BunchGroupSet name="%s" menuPartition="%i">\n' % (self.name, self.menuPartition)
+        for bg in self.bunchGroups:
+            if bg:
+                s += bg.xml(ind+1,step)
+        s += ind * step * ' ' + '</BunchGroupSet>\n'
+        return s
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/LVL1/CTPInfo.py b/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/LVL1/CTPInfo.py
new file mode 100644
index 0000000000000000000000000000000000000000..c19cb82c9330e77c9b17ef53d6ddb5cb2607989a
--- /dev/null
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/LVL1/CTPInfo.py
@@ -0,0 +1,54 @@
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+from BunchGroupSet import BunchGroupSet
+from Lvl1MenuUtil import oldStyle
+
+class CTPInfo:
+
+    class Random:
+        def __init__(self, names, cuts):
+            self.names = names
+            self.cuts  = cuts
+
+        def xml(self, ind=1, step=2):
+            if self.cuts[3] != 1:
+                raise RuntimeError("Random generator 3 has to run at 40MHz, so Random.cut3 must be set to 1")
+            
+            a = []
+            for idx, (name,cut) in enumerate( zip(self.names,self.cuts) ):
+                a += ['name%i="%s" cut%i="%i"' % (idx, name, idx, cut)]
+            return ind * step * ' ' + '<Random %s/>\n' % ' '.join(a)
+
+
+    class PrescaledClock:
+        def __init__(self, name = '', clock1 = 0, clock2 = 0):
+            self.name = name
+            self.clock1 = clock1
+            self.clock2 = clock2
+        def xml(self, ind=1, step=2):
+            return ind * step * ' ' + '<PrescaledClock clock1="%i" clock2="%i" name="%s"/>\n' % (self.clock1, self.clock2, self.name)
+
+
+    # Members of CTPInfo
+    def __init__(self):
+        self.random         = CTPInfo.Random( names = ['Random0', 'Random1', 'Random2', 'Random3'], cuts = [1, 1, 1, 1] )
+        self.prescaledClock = CTPInfo.PrescaledClock('psc01', 10, 100)
+        self.bunchGroupSet  = BunchGroupSet()
+
+    def setBunchGroupSetName(self, name):
+        self.bunchGroupSet.name = name
+        return self.bunchGroupSet
+
+    def addBunchGroup(self, name, internalNumber, bunches):
+        self.bunchGroupSet.addBunchGroup(name, internalNumber, bunches)
+
+    def xml(self, ind=1, step=2):
+        s = ''
+        if oldStyle(): # just to make sure the triggertool can still read old files for a while
+            s += ind * step * ' ' + '<Random name="rand01" rate1="0" rate2="0" seed1="1" seed2="1"/>\n'
+            s += ind * step * ' ' + '<Deadtime complex1_level="7" complex1_rate="415" complex2_level="7" complex2_rate="415" name="Physics" simple="5" version="1"/>\n'
+        else:            
+            s += self.random.xml(ind,step)
+        s += self.bunchGroupSet.xml(ind,step)
+        s += self.prescaledClock.xml(ind,step)
+        return s
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/LVL1/Cabling.py b/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/LVL1/Cabling.py
new file mode 100644
index 0000000000000000000000000000000000000000..282e615f20b9bc7b81ebbcbabf592f79c1b7bad8
--- /dev/null
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/LVL1/Cabling.py
@@ -0,0 +1,281 @@
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+from Limits import Limits
+from AthenaCommon.Logging import logging
+log = logging.getLogger("Cabling")
+log.setLevel(logging.INFO)
+
+"""
+Thilo's proposal in the CTP meeting Oct 13
+
+* Run2 Cable to slot assignments:
+
+CTPIN-slot7
+-----------
+EM1  : 8x3b EM - mapping 0-7
+EM2  : 8x3b EM - mapping 8-15
+TAU1 : 8x3b TAU - mapping 0-7
+TAU2 : 8x3b TAU - mapping 8-15
+
+CTPIN-slot8
+-----------
+JET1 : 10x3b JET - mapping 0-9
+JET2 : 15x2b JET - mapping 10-24
+EN1  : 8x1b TE [0..7] (SumET)
+       8x1b XE [8..15] (missing ET)
+       8x1b XS [16..23] (missing ET significance)
+EN2  : 8x1b weighted SumET (restricted range TE)
+       8x1b restricted range MissET
+
+
+CTPIN-slot9
+-----------
+MUCTPI : first bit unused,
+         6x3b MU [1..18] - mapping 0-5
+CTPCAL : 6x1b BCM [0..5] - mapping 0-5
+         8x1b DBM [6..13] - mapping 0-7
+         2x1b BPTX [14..15] - mapping 0-1
+         6x1b LUCID [16..21] - mapping 0-5 (A,C,COMM,?,?,?)
+         3x1b ZDC [22..24] - mapping 0-2
+         3x1b CALREQ [28..30] last 3 bits! - mapping 0-2
+NIM1   : 12x1b MBTSSI [0..11] - mapping 0-11 A-side
+         4x1b NO [12..15] unused
+         1x3b MBTS [16..18]  A-side multiplicity
+         1x1b NIM [19] L1A  - mapping 0
+         1x1b NIM [20] LHCf - mapping 1
+         10x1b NIM [21..30] - mapping 2-11
+NIM2   : 12x1b MBTSSI [0..11]  - mapping 12-23 C-side 
+         4x1b NO [12..15] unused
+         1x3b MBTS [16..18] C-side multiplicity
+         1x1b NIM TGC-burst [19] - mapping 12
+         1x1b NIM RPC-burst [20] - mapping 13
+         1x1b NIM TRT-FastOR [21] - mapping 14
+         9x1b NIM [22..30] - mapping 15-23
+
+CTPCORE-slot10
+--------------
+ALFA    : 64x1b ALFA mapping 0-63
+L1Topo0 : 64x1b TOPO mapping 0-63
+L1Topo1 : 64x1b TOPO mapping 64-127
+
+* Notes:
+- JET1: 8x3b will occupy all CTPIN LUTs, leaving only 2b per LUT.
+        This means that 2x3b cannot be counted properly.
+
+- Define where delayed minimum bias trigger is done, e.g. 1 bit in JET1
+"""
+
+
+def getLutInput(connector):
+    """
+    maps the direct input to the LUT number and LUT input
+    -- this is needed so that the multiplicity topo lines end up on the 
+    """
+
+
+
+class Cabling:
+    @staticmethod
+    def getInputCable(threshold):
+        return InputCable( threshold )
+
+
+
+    @staticmethod
+    def getCableName(thrtype,mapping):
+
+        from TriggerMenu.l1.Lvl1Flags import Lvl1Flags
+        run1 = Lvl1Flags.CTPVersion()<=3
+        
+        if run1:
+            type2cablename  = { 'MUON'   : [(0,6,'MUCTPI')],
+                                'EM'     : [(0,8,'EM1'), (8,16,'EM2')],
+                                'TAU'    : [(0,8,'TAU1'), (8,16,'TAU2')],
+                                'JET'    : [(0,10,'JET1'), (10,25,'JET2')],
+                                'TE'     : [(0,8,'EN1')],
+                                'XE'     : [(0,8,'EN1')],
+                                'XS'     : [(0,8,'EN1')],
+                                'MBTSSI' : [(0,16,'NIM1'),(16,32,'NIM2')],
+                                'MBTS'   : [(0,1,'NIM1'), (1,2,'NIM2')],
+                                'LUCID'  : [(0,6,'CTPCAL')],
+                                'ZDC'    : [(0,3,'CTPCAL')],
+                                'CALREQ' : [(0,3,'CTPCAL')],
+                                'TOPO'   : [(0,64,'TOPO1'), (64,128,'TOPO2')],
+                                'ALFA'   : [(0,64,'ALFA')],
+                                'BCM'    : [(0,3,'CTPCAL')],
+                                'BCMCMB' : [(0,3,'CTPCAL')],
+                                'NIM'    : [(0,30,'NIM1'), (30,60,'NIM2')],
+                                'JF'     : [(0,4,'JET1')],
+                                'JB'     : [(0,4,'JET1')],
+                                'JE'     : [(0,4,'JET2')],
+                                }
+        else:
+            type2cablename  = { 'MUON'   : [(0,6,'MUCTPI')],
+                                'EM'     : [(0,8,'EM1'), (8,16,'EM2')],
+                                'TAU'    : [(0,8,'TAU1'), (8,16,'TAU2')],
+                                'JET'    : [(0,10,'JET1'), (10,25,'JET2')],
+                                'TE'     : [(0,8,'EN1'),(8,16,'EN2')],
+                                'XE'     : [(0,8,'EN1'),(8,16,'EN2')],
+                                'XS'     : [(0,8,'EN1')],
+                                'MBTSSI' : [(0,12,'NIM1'),(12,24,'NIM2')],
+                                'MBTS'   : [(0,1,'NIM1'), (1,2,'NIM2')],
+                                'LUCID'  : [(0,6,'CTPCAL')],
+                                'ZDC'    : [(0,3,'CTPCAL')],
+                                'CALREQ' : [(0,3,'CTPCAL')],
+                                'TOPO'   : [(0,64,'TOPO1'), (64,128,'TOPO2')],
+                                'ALFA'   : [(0,64,'ALFA')],
+                                'BCM'    : [(0,3,'CTPCAL')],
+                                'BCMCMB' : [(0,1,'CTPCAL')],
+                                'BPTX'   : [(0,2,'CTPCAL')],
+                                'DBM'    : [(0,8,'CTPCAL')],
+                                'NIM'    : [(0,12,'NIM1'), (12,24,'NIM2')],
+                                'JF'     : [(0,4,'JET1')],
+                                'JB'     : [(0,4,'JET1')],
+                                'JE'     : [(0,4,'JET2')],
+                                }
+
+        x = type2cablename[thrtype]
+        for (minthr, maxthr, name) in x:
+            #print "BETTA ",mapping, minthr, maxthr, name
+            if mapping>=minthr and mapping<maxthr:
+                return name
+
+        raise RuntimeError("Threshold type %s has no cable for mapping '%i'" % (thrtype,mapping))
+
+
+    @staticmethod
+    def calcBitnum(thrtype):
+        # get the widths for the threshold types is defined in L1Common
+        exec("nbits = Limits.%s_bitnum" % thrtype)
+        return nbits
+
+
+
+class InputCable:
+        
+    def __fillTopoInputs(self, threshold):
+        # CTPCORE
+        self.isDirectIn  = True
+        connector = threshold.cable + 1
+        self.name        = "TOPO%i" % connector
+        self.connector   = "CON%i" % connector
+        self.bitnum      = threshold.bitnum
+        self.clock       = threshold.clock
+        self.range_begin = threshold.bitOnCable
+        self.range_end   = threshold.bitOnCable+self.bitnum-1
+        
+        log.debug( 'Threshold type %s (mapping=%i) comes in on CTPCore on cable %s, bit %s, clock %i' % ( self.thrtype, self.mapping, self.connector,
+                                                                                                          ("%i" % self.range_begin) if self.bitnum==1
+                                                                                                          else ("%i-%i" % (self.range_begin, self.range_end)), self.clock ) )
+
+    def __fillAlfaInputs(self, threshold):
+        # CTPCORE
+        self.isDirectIn = True
+        self.name = Cabling.getCableName(self.thrtype,self.mapping)
+        self.connector = "CON0"
+        self.bitnum = 1
+        self.clock = self.mapping / 32
+        self.range_begin = self.mapping % 32
+        self.range_end   = self.range_begin
+           
+        log.debug( 'Threshold type %s (mapping=%i) comes in on CTPCore on cable %s, bit %s, clock %i' % ( self.thrtype, self.mapping, self.connector,
+                                                                                                          ("%i" % self.range_begin) if self.bitnum==1
+                                                                                                          else ("%i-%i" % (self.range_begin, self.range_end)), self.clock ) )
+
+    def __fillCTPIn(self):
+        self.name = Cabling.getCableName(self.thrtype,self.mapping)
+
+        self.calcSlotAndConnector()
+        log.debug( 'Threshold type %s (mapping=%i) comes in on CTPIN on cable %s/%s and bits %s' % ( self.thrtype, self.mapping, self.slot, self.connector,
+                                                                                                     ("%i" % self.range_begin) if self.bitnum==1
+                                                                                                     else ("%i-%i" % (self.range_begin, self.range_end)) ) )
+
+
+
+    def __init__(self, threshold ):
+
+        if threshold.ttype == 'ZB':
+            self.thrtype = threshold.seed_ttype
+        else:
+            self.thrtype = threshold.ttype
+        self.mapping = int(threshold.mapping)
+
+        self.isDirectIn  = False # True for TOPO and ALFA which go into CTPCore
+        self.slot        = None  # input cable slot, possible values 7..9
+        self.connector   = None  # input cable connector, possible values 0..3
+        self.clock       = 0     # for direct inputs this can be 0 or 1 since they are overclocked x2
+        self.bitnum      = 0     # number of bits for multiplicity transmittion, possible values 1..3 
+        self.range_begin = 0     # first bit of range, possible values 0..30
+        self.range_end   = 0     # last bit of range, possible values 0..30 (should be first bit + bitnum - 1)
+
+        if self.thrtype=='TOPO':
+            self.__fillTopoInputs( threshold )
+        elif self.thrtype=='ALFA':
+            self.__fillAlfaInputs( threshold )
+        else:
+            self.__fillCTPIn()
+
+        if not self.connector:
+            raise RuntimeError("No cable has been assigned to threshold type '%s' with mapping %i" % (self.thrtype,self.mapping))
+
+
+    def __str__(self):
+        return "%s %r  (%s/%s) with %i bits [%i-%i] clock=%i" % (self.thrtype, self.mapping, self.slot, self.connector, self.bitnum, self.range_begin, self.range_end, self.clock)
+
+
+
+    def calcSlotAndConnector(self):
+
+        cableAssign = self.getCTPINCableAssignment(self.thrtype)
+
+        from TriggerMenu.l1.Lvl1Flags import Lvl1Flags
+        run1 = Lvl1Flags.CTPVersion()<=3
+        if run1 and self.thrtype=="EM":
+            cableAssign += self.getCTPINCableAssignment("TAU")
+
+        offset = self.mapping
+        for (slot, connector, start, stop, bitnum) in cableAssign:
+
+            self.bitnum = bitnum
+
+            delta = (stop - start + 1) / self.bitnum
+            log.debug( 'Cable SLOT%i / CON%i has room for %i thresholds of type %s' % (slot, connector, delta, self.thrtype) )
+
+            if offset >= delta: # does not fit on this connector (only 0 to offset-1 will fit)
+                offset -= delta # move to the next cable for checking
+                continue
+
+            self.slot        = "SLOT%i" % slot
+            self.connector   = "CON%i" % connector
+            self.range_begin = start + offset * self.bitnum
+            self.range_end   = self.range_begin + self.bitnum-1
+            break
+
+        if not self.connector:
+            print "Cable mapping ERROR ",cableAssign
+            raise RuntimeError("No cable has been assigned to threshold type '%s' with mapping %i" % (self.thrtype,self.mapping))
+
+
+
+
+
+
+    def getCTPINCableAssignment(self,thrtype):
+        """
+        Gets the cable assignment from L1Common
+        """
+        exec("cable = Limits.%s_cable" % thrtype)
+        
+        # we change the format for run 2, the tuple now contains also the bit multiplicity, as it is not constant per type
+        infosize = (len(cable)-1)/cable[0]
+
+        if infosize==5:
+            cableAssign = [tuple(cable[x:x+5]) for x in range(1,len(cable),5)]
+        else:
+            #print "Cabling for threshold type %s is not yet defined for Run 2" % thrtype
+            bitnum = Cabling.calcBitnum(thrtype)
+            cableAssign = [tuple(cable[x:x+4] + [bitnum]) for x in range(1,len(cable),4)]
+
+        return cableAssign
+
+
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/LVL1/CaloInfo.py b/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/LVL1/CaloInfo.py
new file mode 100644
index 0000000000000000000000000000000000000000..c2735dafb478d2871e6fb87c102ac06d9cef8f82
--- /dev/null
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/LVL1/CaloInfo.py
@@ -0,0 +1,208 @@
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+from Lvl1MenuUtil import log
+from Lvl1MenuUtil import oldStyle
+from Limits import CaloLimits
+
+class Isolation:
+
+    class Parametrization:
+        def __init__(self, isobit, offset, slope, mincut, upperlimit, etamin, etamax, priority):
+            self.isobit     = int(isobit)
+            self.offset     = int(offset)
+            self.slope      = int(slope)
+            self.upperlimit = int(upperlimit)
+            self.etamin     = int(etamin)
+            self.etamax     = int(etamax)
+            self.priority   = int(priority)
+            self.mincut     = int(mincut)  # minimum value for the isolation cut
+            if self.isobit not in range(1,6):
+                raise RuntimeError("Isolation bit is '%i' must be between 1 and 5" % self.isobit)
+
+        def xml(self, ind=1, step=2):
+            s = ind * step * ' ' + '<Parametrization isobit="%i" offset="%i" slope="%i" mincut="%i" upperlimit="%i" etamin="%i" etamax="%i" priority="%i"/>\n' % \
+                ( self.isobit, self.offset, self.slope, self.mincut, self.upperlimit, self.etamin, self.etamax, self.priority )
+            return s
+
+    class IsoGroup:
+        def __init__(self):
+            self.parameterizations = []
+
+        def __iter__(self):
+            for x in self.parameterizations:
+                yield x
+
+        def addIsolation(self, isobit, offset, slope, mincut=0, upperlimit=CaloLimits.ClusterOff, etamin=-49, etamax=49, priority=0):
+            self.parameterizations += [ Isolation.Parametrization(isobit=isobit, offset=offset, slope=slope, mincut=mincut, upperlimit=upperlimit, etamin=etamin, etamax=etamax, priority=priority) ]
+            return self
+
+
+    def __init__(self):
+        self.isolation = {'EMIsoForEMthr': Isolation.IsoGroup(), 'HAIsoForEMthr': Isolation.IsoGroup(), 'EMIsoForTAUthr': Isolation.IsoGroup()}
+
+    def __getitem__(self,k):
+        if not k in self.isolation:
+            raise RuntimeError("Isolation group %s doesn't exist. Should be one of %s" % (k, ','.join(self.isolation.keys())) )
+        return self.isolation[k]
+        
+    def xml(self, ind=1, step=2):
+        s=""
+        for thrtype in self.isolation.keys():
+            s += ind * step * ' ' + '<Isolation thrtype="%s">\n' % thrtype
+            for p in self.isolation[thrtype]:
+                s += p.xml(ind+1,step)
+            s += ind * step * ' ' + '</Isolation>\n'
+        return s
+
+
+
+class MinimumTOBPt(object):
+    def __init__(self, thrtype, ptmin, window=8, etamin=-49, etamax=49, priority=0):
+        self.thrtype    = str(thrtype).upper()
+        self.ptmin      = int(ptmin)
+        self.etamin     = int(etamin)
+        self.etamax     = int(etamax)
+        self.priority   = int(priority)
+        self.window     = int(window)
+        if not self.thrtype in [ "JETS", "JETL", "EM", "TAU"]:
+            raise RuntimeError("Unknown type %s for Minimum TOB PT, must be JETS, JETL, EM, or TAU")
+        
+
+    def xml(self, ind=1, step=2):
+        window = ' window="%i"' % self.window if self.thrtype.startswith("JET") else ""
+        s = ind * step * ' ' + '<MinimumTOBPt thrtype="%s"%s ptmin="%i" etamin="%i" etamax="%i" priority="%i"/>\n' % \
+             ( self.thrtype, window, self.ptmin, self.etamin, self.etamax, self.priority )
+        return s
+
+class CaloInfo:
+            
+    AverageOfThr = 1
+    LowerThr = 2
+    HigherThr = 3
+    def __init__(self, name='standard', globalEmScale=2, globalJetScale=1, jetWeights=[0]*12):
+        self.name        = name
+        self.globalEmScale  = globalEmScale
+        self.globalJetScale = globalJetScale
+        self.jetWeights  = jetWeights
+        self.xsParams    = { 'xsSigmaScale' : 0,
+                             'xsSigmaOffset': 0,
+                             'xeMin'        : 0,
+                             'xeMax'        : 0,
+                             'teSqrtMin'    : 0,
+                             'teSqrtMax'    : 0 }
+        self.isolation = Isolation()
+        self.minTOBPt = []
+
+    def setName(self, name):
+        self.name = name
+
+    def setGlobalEmScale(self, x):
+        self.globalEmScale = x
+
+    def setGlobalJetScale(self, x):
+        self.globalJetScale = x
+
+    def setJetWeights(self, weights):
+        self.jetWeights = weights
+
+    def setXsParams( self, **args ):
+        for k in args:
+            if not k in self.xsParams:
+                raise RuntimeError, "'%s' is not a MET significance parameter" %  k
+            self.xsParams[k]  = args[k]
+
+    def xml(self, ind=1, step=2):
+        s = ind * step * ' ' + '<CaloInfo name="CaloInfo" global_em_scale="%g" global_jet_scale="%g">\n' % (self.globalEmScale, self.globalJetScale)
+        if oldStyle():
+            for i, jw in enumerate(self.jetWeights):
+                s += (ind+1) * step * ' ' + '<JetWeight num="%i" weight="%i">%i</JetWeight>\n' % (i+1, jw, jw)
+        s += (ind+1) * step * ' ' + '<METSignificance xeMin="11" xeMax="63" teSqrtMin="4" teSqrtMax="63" xsSigmaScale="1150" xsSigmaOffset="1640"/>\n'
+        if not oldStyle():
+            s += self.isolation.xml(ind+1)
+            for minObjPt in self.minTOBPt:
+                s += minObjPt.xml(ind+1)
+
+        s += ind * step * ' ' + '</CaloInfo>\n'
+        return s
+
+
+
+    @staticmethod
+    def calcJetWeightsFromThresholds(triggerConfigLvl1, use_fj=False):
+
+        def thr2weights(thrs, factor=1.25):
+            # thrs = [10.0, 15.0, 1023.0, 20.0, 30.0, 50.0, 75.0, 350.0]
+
+            # allow for thresholds being out of order
+            # need to skip any turned-off thresholds (thr=1023)
+            sthrs = sorted( filter(lambda x: x<1023, thrs)) + [0]
+            
+            # k = [(10.0, 15.0), (15.0, 20.0), (20.0, 30.0), (30.0, 50.0), (50.0, 75.0), (75.0, 350.0), (350.0, 0)]
+            k = zip(sthrs,sthrs[1:])
+
+            # compute weights
+            # TODO: this formula description, copied from LVL1.py doesn't seem to match the implementation (need to check with L1Calo - Joerg
+            # -------------------------------------------------------------------
+            # Jet thresholds: [5, 10, 18, 23, 35, 42, 70, 100 ][10, 18, 26, 65 ]
+            # Jet weights(w):  [ 7, 14, 20, 29, 38, 56, 85, 100 ][9, 6, 23, 19]
+            # Jet weights(W):[ 5,  6, 6, 8, 9, 17, 29, 15 ][9, 6, 23, 19]
+            # W_i=0.5*(thr_{i+1}-thr_{i-1}),
+            #     thr_{0}=0 and thr_{n+1}=thr_{n}+(thr_{n}-thr_{n-1})
+            # --------------------------------------------------------------------
+            sum = 0
+            weights = dict([(t,0) for t in thrs])
+            for thr,thrNext in k:
+                if thrNext != 0:
+                    w = int( (thr + thrNext + 1)/2.0) - sum
+                else:  
+                    w = int( thr * factor - sum)
+                weights[ thr ] = w
+                sum += w
+
+            return [ weights[thr] for thr in thrs ]
+
+    
+        l1_thrs = triggerConfigLvl1.menu.thresholds
+        jet_thresholds  = l1_thrs.allThresholdsOf('JET')
+        fjet_thresholds = l1_thrs.allThresholdsOf('JF')
+        log.debug('N jet thresholds: %d (8 expected)' % len(jet_thresholds))
+        log.debug('N fjet thresholds: %d (4 expected)' % len(fjet_thresholds))
+
+        jthr, fjthr           = [1023]*8, [1023]*4
+        jet_names, fjet_names = ['---']*8, ['---']*4
+
+        for j in jet_thresholds:
+            log.debug('jet threshold %s: %d' % (j.name, j.thresholdInGeV()))
+            jthr[j.mapping] = j.thresholdInGeV()
+            jet_names[j.mapping] = j.name
+
+        for j in fjet_thresholds:
+            tvalues = j.thresholdValues
+            priority = 0
+            threshold_value = 0
+            for tv in tvalues:
+                if tv.priority > priority:
+                    threshold_value = tv.value
+            log.debug('fjet threshold %s: %d' % (j.name, threshold_value))
+            fjthr.append(threshold_value)
+            fjthr[j.mapping] = threshold_value
+            fjet_names[j.mapping] = j.name
+        #
+
+        log.debug('Jet thresholds: %s' % ' '.join(jet_names))
+        log.debug('Fjet thresholds: %s' % ' '.join(fjet_names))
+
+        if len(jthr) <= 8:
+            w = thr2weights(jthr)
+            jw = w
+        else:
+            jw = [0]*8
+
+        w = 4 * [0]
+
+        if use_fj and len(fjthr) <= 4:
+            w = thr2weights(fjthr)
+        jw.extend(w)
+        return jw
+
+
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/LVL1/Limits.py b/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/LVL1/Limits.py
new file mode 100644
index 0000000000000000000000000000000000000000..38da63573d2789d490952cdca9c2255c59989878
--- /dev/null
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/LVL1/Limits.py
@@ -0,0 +1,83 @@
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+"""
+This temporarily holds CTP sizes
+"""
+
+class Access(type):
+    """Metaclass to implement __getattr__ for class variables"""
+    def __getattr__(cls, key):
+        if cls.ctpDataFormat is None:
+            raise RuntimeError("CTP version has not been set, you need to call Limits.setLimits(ctpversion) before you can use the limits")
+
+        if hasattr(cls.ctpDataFormat, key):
+            return getattr( cls.ctpDataFormat, key)
+        elif hasattr(cls.l1common, key):
+            return getattr( cls.l1common, key)
+        else:
+            raise AttributeError("Neither class 'CTPdataformat' nor class 'L1Common' have an attribute '%s'" % key)
+    
+    def __str__(cls):
+        if cls.ctpDataFormat == None:
+            return "None"
+
+        s = "CTP DataFormat version %i\n" % cls.CTPVersion
+        varnames = ['MaxTrigItems', 'NumBunchgroups', 'NumRndmTriggers']
+        for varname in varnames:
+            s += "     %s = %r\n" % (varname, getattr( cls.ctpDataFormat, varname)) 
+        s += "L1Common version %i\n" % cls.L1CommonVersion
+        varnames = ['MUON_bitnum','EM_bitnum', 'TAU_bitnum', 'JET_bitnum', 'JE_bitnum', 'JB_bitnum', 'JF_bitnum', 'TE_bitnum', 'XE_bitnum', 'XS_bitnum',
+                    'MBTS_bitnum', 'MBTSSI_bitnum', 'NIM_bitnum', 'ZDC_bitnum', 'TRT_bitnum', 'BCM_bitnum', 'BCMCMB_bitnum', 'LUCID_bitnum', 'CALREQ_bitnum',
+                    'MUON_cable', 'EM_cable', 'TAU_cable', 'JET_cable', 'JE_cable', 'JB_cable', 'JF_cable', 'TE_cable', 'XE_cable', 'XS_cable', 'MBTS_cable', 
+                    'MBTSSI_cable', 'NIM_cable', 'ZDC_cable', 'TRT_cable', 'BCM_cable', 'BCMCMB_cable', 'LUCID_cable', 'CALREQ_cable']
+        for varname in varnames:
+            s += "     %s = %r\n" % (varname, getattr( cls.l1common, varname)) 
+        return s
+
+
+
+
+class Limits:
+
+    __metaclass__ = Access
+
+    CTPVersion      = None
+    L1CommonVersion = None
+
+    ctpDataFormat = None
+    l1common      = None
+    
+    @staticmethod
+    def getCTPdataformat(version):
+        module = __import__('CTPfragment.CTPdataformat_v%i' % version, globals(), locals(), ['CTPdataformat_v%i' % version], -1)
+        exec("CTPdataformat = module.CTPdataformat_v%i" % version)
+        return CTPdataformat
+
+    @staticmethod
+    def getL1Common(version):
+        module = __import__('L1Common.L1Common_v%i' % version, globals(), locals(), ['L1Common_v%i' % version], -1)
+        exec("L1Common = module.L1Common_v%i" % version)
+        return L1Common
+
+    @staticmethod
+    def setLimits(CTPVersion, verbose = False):
+        Limits.CTPVersion = CTPVersion
+        Limits.L1CommonVersion = 0 if CTPVersion <= 3 else 1
+        #print "Setting limits for CTP version %i and L1Common Version %i" % (Limits.CTPVersion, Limits.L1CommonVersion)
+        Limits.ctpDataFormat = Limits.getCTPdataformat( Limits.CTPVersion )
+        Limits.l1common = Limits.getL1Common( Limits.L1CommonVersion )
+        if verbose:
+            print Limits
+
+    
+
+
+class CaloLimits:
+    # Maximum values for calo thresholds to disable that threshold
+    ClusterOff   = 255
+    IsolationOff = 63
+    JetOff       = 1023
+    EtSumOff     = 32767
+    EtMissOff    = 32767 
+    JetEtOff     = 13286
+
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/LVL1/Logic.py b/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/LVL1/Logic.py
new file mode 100644
index 0000000000000000000000000000000000000000..ce8e6f034e606b675223d11764d2a769c0c2979d
--- /dev/null
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/LVL1/Logic.py
@@ -0,0 +1,201 @@
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+__all__ = ['Logic', 'Not']
+
+from copy import copy,deepcopy
+
+from Lvl1MenuUtil import log
+
+
+class Logic(object):
+    NONE = ''
+    AND = '&'
+    OR = '|'
+    NOT = '!'
+
+    @staticmethod
+    def symbolToString(x):
+        if x==Logic.AND:
+            return 'AND'
+        elif x==Logic.OR:
+            return 'OR'
+        elif x==Logic.NOT:
+            return 'NOT'
+        else:
+            return ''
+
+    @staticmethod
+    def Not(x):
+        a = Logic()
+        a.logic = Logic.NOT
+        a.subConditions.append(x)
+        return a
+
+
+
+
+    def __init__(self, condition=None):
+        self.condition = condition # hold a Lvl1Condition instance
+        self.logic = Logic.NONE
+        self.subConditions = [] # holds Logic instances
+
+
+    def __or__(self, x):
+        #print self, "OR", x
+        newLogic = Logic()
+        newLogic.logic = Logic.OR
+
+        if self.logic == Logic.OR:
+            newLogic.subConditions += copy(self.subConditions)
+        else:
+            newLogic.subConditions += [copy(self)]
+
+        if x.logic == Logic.OR:
+            newLogic.subConditions += copy(x.subConditions)
+        else:
+            newLogic.subConditions += [copy(x)]
+
+        return newLogic
+
+    
+    def __and__(self, x):
+        #print self, "AND", x
+        newLogic = Logic()
+        newLogic.logic = Logic.AND
+
+        if self.logic == Logic.AND:
+            newLogic.subConditions += copy(self.subConditions)
+        else:
+            newLogic.subConditions += [copy(self)]
+
+        if x.logic == Logic.AND:
+            newLogic.subConditions += copy(x.subConditions)
+        else:
+            newLogic.subConditions += [copy(x)]
+
+        return newLogic
+
+    def __not__(self, x):
+        log.debug('checking NOT')
+        a = self
+        if a.logic==Logic.NONE:
+            a.logic = Logic.NOT
+        if a.logic==Logic.NOT:
+            if len(a.subConditions) == 1:
+                log.debug('not is a unary operator, ignore it')
+            else:
+                a.subConditions.append(x)
+        return a
+
+
+    def __str__(self):
+        s = ''
+        if self.logic == Logic.NONE:
+            if len(self.subConditions)==0 and self.condition!=None:
+                return str(self.condition)
+            if len(self.subConditions)==1:
+                return str(self.subConditions[0])
+            if len(self.subConditions)>=1:
+                log.error('Logic NONE has more than one element')
+                return ''
+
+        if self.logic == Logic.NOT:
+            if len(self.subConditions)==1:
+                if self.subConditions[0].logic == Logic.NONE:
+                    return '!'+str(self.subConditions[0])
+                else:
+                    return '!('+str(self.subConditions[0]) + ')'
+            log.error('Logic NOT must have exactly one element but has %i' % len(self.subConditions))
+            return ''
+
+        if self.logic == Logic.AND or self.logic == Logic.OR:
+            s = ''
+            if len(self.subConditions)<=1:
+                log.error('Logic AND/OR must have more than one sub element but has %i: %r' % (len(self.subConditions), self.subConditions))
+                return ''
+            else:
+                for (i, a) in enumerate(self.subConditions):
+                    if i > 0: s += self.logic
+                    if(a.logic == Logic.NONE or a.logic == Logic.NOT):
+                        s += str(a)
+                    else:
+                        s += '(' + str(a) + ')'
+        return s
+
+
+    def thresholdNames(self, include_bgrp=False):
+        names = set([])
+        if self.condition!=None:
+            from Lvl1Condition import Lvl1InternalTrigger
+            if isinstance(self.condition, Lvl1InternalTrigger):
+                if include_bgrp:
+                    names.add(self.condition.name())
+            else:
+                names.add( self.condition.threshold.name )
+        else:
+            for sc in self.subConditions:
+                names.update( sc.thresholdNames(include_bgrp) )
+        return sorted(list(names))
+
+
+    def conditions(self, include_internal=False):
+        cond = set([])
+        if self.condition!=None:
+            from Lvl1Condition import Lvl1InternalTrigger
+            if isinstance(self.condition, Lvl1InternalTrigger):
+                if include_internal:
+                    cond.add(self.condition)
+            else:
+                cond.add( self.condition )
+        else:
+            for sc in self.subConditions:
+                cond.update( sc.conditions(include_internal) )
+        return sorted(list(cond))
+
+
+    def normalize(self):
+        if self.logic in (Logic.AND, Logic.OR):
+            mylogic = self.logic
+            newconditions = []
+            for c in self.subConditions:
+                if c.logic == mylogic: # X&(A&B) or X|(A|B) 
+                    # expand it to X&A&B or X|A|B
+                    c.normalize()
+                    newconditions.extend(c.subConditions)
+                else:
+                    newconditions.append(c)
+            self.subConditions = newconditions
+        else:
+            pass
+        pass
+
+
+    def xml(self, ind, step=2):
+        if self.logic==Logic.NONE:
+            return self.condition.xml(ind,step)
+
+        elif self.logic==Logic.AND or self.logic==Logic.OR or self.logic==Logic.NOT:
+            logic = Logic.symbolToString(self.logic)
+            s = ind * step * ' ' + '<%s>\n' % logic
+            for c in self.subConditions:
+                s += c.xml(ind+1, step) + "\n"
+            s += ind * step * ' ' + '</%s>' % logic
+            return s
+
+        else:
+            log.error('Unknown node in LVL1 item logic')
+            log.error('  ==> sublogic = %s' % self.logic)
+            log.error('  ==> # subConditions = %i' % len(self.subConditions))
+
+
+    def printIt(self):
+        for a in self.subConditions:
+            if a.logic==a.NONE and a.condition!=None:
+                log.info('subCondition :', str(a.condition))
+            else:
+                log.info('subCondition :', a.printIt())
+        return ''
+
+
+def Not(x):
+    return Logic.Not(x)
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/LVL1/Lvl1Condition.py b/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/LVL1/Lvl1Condition.py
new file mode 100644
index 0000000000000000000000000000000000000000..882a5f470ec5d7ae47e05e2c274db746a33dedfa
--- /dev/null
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/LVL1/Lvl1Condition.py
@@ -0,0 +1,46 @@
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+
+from Logic import Logic
+
+
+class Lvl1Condition(Logic):
+    def __init__(self):
+        super(Lvl1Condition, self).__init__(condition = self)
+
+
+
+class ThrCondition(Lvl1Condition):
+    def __init__(self, threshold, multiplicity=1):
+        super(ThrCondition, self).__init__()
+        self.threshold = threshold
+        self.multiplicity = multiplicity
+
+    def __str__(self):
+        return str(self.threshold) + '[x' + str(self.multiplicity)+']'
+
+    def x(self, multiplicity):
+        return ThrCondition(self.threshold, multiplicity) # provide a copy
+
+    def name(self):
+        return "%s_x%i" % (self.threshold.name, self.multiplicity)
+
+    def xml(self, ind, step=2):
+        return ind * step * ' ' + '<TriggerCondition multi="%i" name="%s" triggerthreshold="%s"/>' % \
+               (self.multiplicity, self.name(), self.threshold.name)
+
+
+
+class Lvl1InternalTrigger(Lvl1Condition):
+    def __init__(self, name):
+        super(Lvl1InternalTrigger, self).__init__()
+        self._name = name
+        
+    def __str__(self):
+        return str(self._name)
+
+    def name(self):
+        return self._name
+
+    def xml(self, ind, step=2):
+        return ind * step * ' ' + '<InternalTrigger name="%s"/>' % self.name()
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/LVL1/Lvl1Flags.py b/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/LVL1/Lvl1Flags.py
new file mode 100644
index 0000000000000000000000000000000000000000..80fdc158b1a2a214c8d73c63028e73491a31a656
--- /dev/null
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/LVL1/Lvl1Flags.py
@@ -0,0 +1,147 @@
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+"""
+Lvl1 specific flags
+"""
+
+from AthenaCommon.JobProperties import JobProperty, JobPropertyContainer, jobproperties
+from TriggerMenu.menu.CommonSliceHelper import AllowedList
+from AthenaCommon.Logging import logging
+from Limits import Limits
+
+__author__  = 'J.Stelzer'
+__version__="$Revision: 1.78 $"
+__doc__="Level 1 specific flags for Run 2"
+
+log = logging.getLogger('TriggerMenu.L1Flags.py')
+
+_flags = [] 
+class CTPVersion(JobProperty):
+    """Version of the CTP configuration"""
+
+    statusOn = True
+    allowedTypes = [int]
+    allowedValues = [0,1,2,3,4,5]
+    StoredValue = 4
+    
+    Limits.setLimits(3)
+
+    def _do_action(self):
+        """Load the limits"""
+        from Limits import Limits
+        Limits.setLimits(self.get_Value())
+
+
+_flags.append(CTPVersion)
+
+class items(JobProperty):
+    """Names of items enabled in the selected L1 menu"""
+    statusOn=True
+    allowedTypes=['list']
+    StoredValue=[]
+
+_flags.append(items)
+
+class thresholds(JobProperty):
+    """Names of thresholds enabled in selected L1 menu """
+    statusOn=True
+    allowedTypes=['list']
+    StoredValue   = []
+
+_flags.append(thresholds)
+
+class prescales(JobProperty):
+    """Maps prescales to items that are different from 1"""
+    statusOn=True
+    allowedTypes=['dict']
+    StoredValue   = {}
+
+_flags.append(prescales)
+
+class RemapThresholdsAsListed(JobProperty):
+    statusOn = True
+    allowedTypes = ['bool']
+    StoredValue = False
+
+_flags.append(RemapThresholdsAsListed)
+
+class CtpIdMap(JobProperty):
+    statusOn = True
+    allowedTypes = ['dict']
+    StoredValue = {}
+
+_flags.append(CtpIdMap)
+
+class BunchGroupPartitioning(JobProperty):
+    statusOn = True
+    allowedTypes = ['list']
+    StoredValue = []
+
+_flags.append(BunchGroupPartitioning)
+
+class BunchGroupNames(JobProperty):
+    statusOn = True
+    allowedTypes = ['list']
+    StoredValue = []
+
+_flags.append(BunchGroupNames)
+
+class MenuPartitioning(JobProperty):
+    statusOn = True
+    allowedTypes = ['list']
+    StoredValue = []
+
+_flags.append(MenuPartitioning)
+
+class OldStylePrescales(JobProperty):
+    statusOn = True
+    allowedTypes = ['bool']
+    StoredValue = False
+
+class ThresholdMap(JobProperty):
+    statusOn = True
+    allowedTypes = ['dict']
+    StoredValue = {}
+
+_flags.append(ThresholdMap)
+
+
+class ItemMap(JobProperty):
+    statusOn = True
+    allowedTypes = ['dict']
+    StoredValue = {}
+
+_flags.append(ItemMap)
+
+
+
+_flags.append(OldStylePrescales)
+
+
+
+class Lvl1(JobPropertyContainer):
+    """ Lvl1 flags used in menu generation """
+
+
+
+
+# execute
+
+from TriggerJobOpts.TriggerFlags import TriggerFlags
+TriggerFlags.add_Container(Lvl1)
+
+for flag in _flags:
+    TriggerFlags.Lvl1.add_JobProperty(flag)
+del _flags
+
+
+
+# make an alias
+Lvl1Flags = TriggerFlags.Lvl1
+
+
+
+#  LocalWords:  AllowedList
+
+
+            
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/LVL1/Lvl1Menu.py b/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/LVL1/Lvl1Menu.py
new file mode 100644
index 0000000000000000000000000000000000000000..22361ed88a3a8efce62825001b66a438bdff2a6f
--- /dev/null
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/LVL1/Lvl1Menu.py
@@ -0,0 +1,246 @@
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+from Lvl1Thresholds import LVL1Thresholds, LVL1Threshold, ThresholdValue
+from Lvl1MenuItems import LVL1MenuItems, LVL1MenuItem
+from Lvl1MonCounters import Lvl1MonCounters
+from CaloInfo import CaloInfo
+from MuctpiInfo import MuctpiInfo
+from CTPInfo import CTPInfo
+from Limits import Limits
+from TriggerJobOpts.TriggerFlags import TriggerFlags
+
+from AthenaCommon.Logging import logging
+log = logging.getLogger("TriggerMenu.l1.Lvl1Menu")
+
+class Lvl1Menu:
+
+    def __init__(self, menuName):
+        self.menuName = menuName
+
+        # items in menu
+        self.items = LVL1MenuItems()
+        
+        # thresholds in menu
+        self.thresholds = LVL1Thresholds()
+
+        # thresholds in menu
+        self.counters = Lvl1MonCounters()
+
+        # CTP Info in the menu
+        self.CTPInfo = CTPInfo()
+        
+        # Muon Info in the menu
+        self.MuctpiInfo = MuctpiInfo(low_pt=1, high_pt=1, max_cand=13)
+
+        # Calo Info in the menu
+        em_scale=2
+        if hasattr(TriggerFlags, 'useRun1CaloEnergyScale'):
+            if TriggerFlags.useRun1CaloEnergyScale :
+                em_scale=1
+                
+        self.CaloInfo = CaloInfo(name='standard', globalEmScale=em_scale, globalJetScale=1)
+
+        if self.menuName:
+            from Lvl1MenuUtil import get_smk_psk_Name
+            smk_psk_Name = get_smk_psk_Name(self.menuName)
+            self.items.menuName = smk_psk_Name["smkName"]
+            self.items.pssName  = smk_psk_Name["pskName"]
+
+
+    @staticmethod
+    def partitioning():
+        from Lvl1Flags import Lvl1Flags
+        first = Lvl1Flags.MenuPartitioning()
+        last = first[1:] + [ Limits.MaxTrigItems ]
+        partitioning = dict( zip([1,2,3],zip(first,last)) )
+        return partitioning
+
+    def addThreshold(self, threshold):
+        self.thresholds += threshold
+
+
+    def addItem(self, item):
+        self.items += item
+
+
+    def getItem(self,name):
+        return self.items.findItemByName(name)
+
+
+    def addCounters(self):
+        from TriggerMenu.l1menu.MonitorDef import MonitorDef
+        # add the CTPIN counters
+        for counter in MonitorDef.ctpinCounters( self.thresholds ):
+            self.counters.addCounter( counter )
+
+        # add the CTPMon counters
+        for counter in MonitorDef.ctpmonCounters( self.thresholds ):
+            self.counters.addCounter( counter )
+
+        # mark the L1 Items that they should be monitored
+        MonitorDef.applyItemCounter( self.items )
+        
+
+
+
+
+    def xml(self, ind=1, step=2):
+        s  = '<?xml version="1.0"?>\n'
+        s += '<!DOCTYPE LVL1Config SYSTEM "LVL1config.dtd">\n'
+        s += '<LVL1Config name="%s" ctpVersion="%i" l1Version="%i">\n' % (self.menuName, Limits.CTPVersion, Limits.L1CommonVersion)
+        s += '  <!--File is generated by TriggerMenu-->\n'
+        s += '  <!--No. L1 thresholds defined: %i-->\n' % len(self.thresholds)
+        s += '  <!--No. L1 items defined: %i-->\n' % len(self.items)
+        s += self.items.xml()
+        s += self.counters.xml()
+        s += self.thresholds.xml()
+        s += self.CTPInfo.xml()
+        s += self.CaloInfo.xml()
+        s += self.MuctpiInfo.xml()
+        s += '</LVL1Config>\n'
+        return s
+
+
+    def readMenuFromXML(self,inputFile):
+        from XMLMenuReader import readMenuFromXML
+        readMenuFromXML(self, inputFile)
+
+    def printCabling(self):
+        cablemap = []
+        for thr in self.thresholds:
+            if thr.ttype=='TOPO': continue
+            cabling = thr.cableinfo
+            cablemap += [(cabling.slot, cabling.connector, thr.ttype, cabling.range_begin, cabling.range_end, str(thr))]
+
+        cablemap.sort()
+
+        cable = None
+        for c in cablemap:
+            k = (c[0],c[1])
+            if k != cable:
+                cable = k
+                print "\nCable %s, %s" % cable
+                print "================="
+            print "%s  bit %i-%i (%s)" % (c[2],c[3],c[4],c[5])
+
+    def checkL1(self):
+        """
+        All other checks should be implemented in TrigConfStorage/src/CheckConsistency.cxx
+        This method is only for quick solutions but should be intermediate
+        """
+        from Lvl1Flags import Lvl1Flags
+
+        success = True
+        
+        # Checks if all needed thresholds are in the menu
+        for item in self.items:
+            allThrNames = self.thresholds.thresholdNames()
+            itemThrNames = item.thresholdNames(include_bgrp=False)
+            for thrName in itemThrNames:
+                if thrName not in allThrNames:
+                    log.error('Menu item %s contains threshold %s which is not part of the menu!' % (item.name,thrName))
+                    success = False
+
+        if not success:
+            raise RuntimeError("There is a problem in the menu that needs fixing")
+
+        # Check that the threshold multiplicities don't exceed the number of encodable values give the available bits
+        for item in self.items:
+            conditions = item.conditions()
+            for c in conditions:
+                log.debug("Item %s has threshold %s on cable %s with multiplicity %i" % (item, c.threshold, c.threshold.cableinfo, c.multiplicity) )
+                maxAllowMult = {1 : 1, 2 : 3, 3 : 7} [c.threshold.cableinfo.bitnum]
+                if c.multiplicity > maxAllowMult:
+                    log.error("Item %s has condition %s. Threshold %s is on cable %s which allows maximum multiplicity %i" %
+                              (item.name, c, c.threshold.name, c.threshold.cableinfo.name, maxAllowMult) )
+                    success = False
+                    
+        if not success:
+            raise RuntimeError("There is a problem in the menu that needs fixing")
+
+        # # Check all items are in the correct partition
+        # for item in self.items:
+        #     partitionRange = Lvl1Menu.partitioning()[item.partition]
+        #     if not (item.ctpid>=partitionRange[0] and item.ctpid<partitionRange[1]):
+        #         log.error('Item %s (ctpid %i, partition %i) outside allowed range for partition %r!' % (item.name, item.ctpid, item.partition, partitionRange))
+        #         success = False
+
+        # if not success:
+        #     raise RuntimeError("There is a problem in the menu that needs fixing")
+        
+
+        # Check for all items that their bunchgroups are in the same partition
+        bgpart = dict( [("BGRP%i" % bg.internalNumber, bg.menuPartition) for bg in self.CTPInfo.bunchGroupSet.bunchGroups] )
+        for item in self.items:
+            bgs = [t for t in item.thresholdNames(include_bgrp=True) if t.startswith('BGRP')]
+            if not 'BGRP0' in bgs:
+                log.error('Item %s (partition %i) is not using BGRP0 which is mandatory!' % (item.name,item.partition))
+            else:
+                bgs.remove('BGRP0')
+            for bg in bgs:
+                if bgpart[bg] != item.partition:
+                    log.error('Item %s (partition %i) uses BG %s which is in partition %i!' % (item.name,item.partition,bg,bgpart[bg]))
+                    success = False
+
+        if not success:
+            raise RuntimeError("There is a problem in the menu that needs fixing")
+
+
+        # check that L1 CalReq are the last 3 items of the menu (509,510,511) - check with Thilo/Ralf
+        caldef = { "L1_CALREQ0" : 509, "L1_CALREQ1" : 510, "L1_CALREQ2" : 511 }
+        for name, ctpid in caldef.items():
+            calitem = self.getItem(name)
+            if calitem and calitem.ctpid != ctpid:
+                log.error('Item %s is not on CTPID %i' % (name,ctpid))
+                success = False
+        if not success:
+            raise RuntimeError("There is a problem in the menu that needs fixing")
+
+        
+        # check that the number of monitored items doesn't exceed the limit
+        (TBP, TAP, TAV) = (1, 2, 4)
+        items_LF = { TBP : set(), TAP : set(), TAV : set() }
+        items_HF = { TBP : set(), TAP : set(), TAV : set() }
+
+        for item in self.items:
+            for k in (TBP, TAP, TAV):
+                if item.monitorsLF & k:
+                    items_LF[k].add( item.name )
+                if item.monitorsHF & k:
+                    items_HF[k].add( item.name )
+
+        counts_LF = dict( map(lambda (x,y) : (x,len(y)), items_LF.items() ) )
+        counts_HF = dict( map(lambda (x,y) : (x,len(y)), items_HF.items() ) )
+
+        lutsLF = ( max(counts_LF.values() ) -1 ) / 8 + 1
+        lutsHF = ( max(counts_HF.values() ) -1 ) / 8 + 1
+
+        
+        if lutsLF + lutsHF <= 8:
+            log.info("LVL1 monitoring with %i LF groups (%i items) and %i HF groups (%i items)" % (lutsLF, max(counts_LF.values()), lutsHF, max(counts_HF.values())) )
+        else:
+            log.error("WARNING: too many monitoring items are defined")
+            print "   low frequency  TBP: %i" % counts_LF[TBP]
+            print "                  TAP: %i" % counts_LF[TAP]
+            print "                  TAV: %i" % counts_LF[TAV]
+            print "   required LUTs: %i" % lutsLF
+            print "   high frequency TBP: %i" % counts_HF[TBP]
+            print "                  TAP: %i" % counts_HF[TAP]
+            print "                  TAV: %i" % counts_HF[TAV]
+            print "   required LUTs: %i" % lutsHF
+            print "   this menu requires %i monitoring LUTs while only 8 are available" % (lutsLF + lutsHF)
+            print "   LF TBP:\n     %r" % sorted(items_LF[TBP])
+            print "   LF TAP:\n     %r" % sorted(items_LF[TAP])
+            print "   LF TAV:\n     %r" % sorted(items_LF[TAV])
+            print "   HF TBP:\n     %r" % sorted(items_HF[TBP])
+            print "   HF TAP:\n     %r" % sorted(items_HF[TAP])
+            print "   HF TAV:\n     %r" % sorted(items_HF[TAV])
+            success = False
+        if not success:
+            raise RuntimeError("There is a problem in the menu that needs fixing")
+
+
+
+
+        return success
+
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/LVL1/Lvl1MenuItems.py b/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/LVL1/Lvl1MenuItems.py
new file mode 100644
index 0000000000000000000000000000000000000000..1678d4c0c0493352e4d2e97d5dd19f28524932c1
--- /dev/null
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/LVL1/Lvl1MenuItems.py
@@ -0,0 +1,199 @@
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+from PrescaleHelper import getCutFromPrescale, getPrescaleFromCut, maxPrescaleCut
+from Lvl1MenuUtil import oldStyle
+
+from AthenaCommon.Logging import logging
+log = logging.getLogger("LVL1MenuItem")
+
+
+class LVL1MenuItem(object):
+
+    # global variable for item registration, if set, new items will be registered with l1configForRegistration (type TriggerConfigL1)
+    l1configForRegistration = None
+
+    # New items will be assigned to this partition
+    currentPartition = 0
+    
+    __slots__ = ['name', 'group', 'ctpid', 'psCut', 'complex_deadtime', 'trigger_type', 'partition', 'logic', 'monitorsLF', 'monitorsHF', 'verbose']
+    def __init__(self, name, ctpid=-1, group='1', prescale=1, complex_deadtime=0, psCut=None, verbose=False):
+        self.name             = name
+        self.group            = group
+        self.ctpid            = int(ctpid)
+        self.psCut            = psCut if psCut!=None else getCutFromPrescale(prescale)
+        self.complex_deadtime = complex_deadtime
+        self.trigger_type     = 0
+        self.partition        = LVL1MenuItem.currentPartition
+        self.logic            = None
+        self.monitorsLF       = 0
+        self.monitorsHF       = 0
+        self.verbose          = verbose
+
+        if self.verbose:
+            print "Created",name
+
+        if LVL1MenuItem.l1configForRegistration:
+            LVL1MenuItem.l1configForRegistration.registerItem(self.name, self)
+
+
+    def __str__(self):
+        s = "Item %s (ctp id=%i) [%s]" % (self.name, self.ctpid, self.logic)
+        return s
+    
+    @property
+    def prescale(self):
+        return getPrescaleFromCut(self.psCut)
+
+    @prescale.setter
+    def prescale(self, prescale):
+        self.psCut = getCutFromPrescale(prescale)
+        return self
+
+    @property
+    def priority(self):
+        print "Item priority not used anymore, replaced by complex_deadtime"
+        return self.complex_deadtime
+
+    @priority.setter
+    def priority(self,priority):
+        print "Setter: item priority not used anymore, replaced by complex_deadtime"
+        
+
+    def addMonitor(self, flag, frequency):
+        from TriggerMenu.l1menu.MonitorDef import MonitorDef
+        if frequency == MonitorDef.LOW_FREQ:
+            self.monitorsLF |= flag
+        if frequency == MonitorDef.HIGH_FREQ:
+            self.monitorsHF |= flag
+    
+    def setLogic(self, logic):
+        self.logic = logic
+        if self.verbose:
+            print self
+        return self
+
+    def setCtpid(self, x):
+        self.ctpid = int(x)
+        return self
+
+    def thresholdNames(self, include_bgrp=False):
+        if self.logic!=None:
+            return self.logic.thresholdNames(include_bgrp)
+        else:
+            return []
+
+    def conditions(self, include_internal=False):
+        if self.logic!=None:
+            return self.logic.conditions(include_internal)
+        else:
+            return []
+
+    def setTriggerType(self, ttype):
+        self.trigger_type = int(ttype) & 0xff
+        return self
+
+
+    def binary_trigger_type(self, width=8):
+        from Lvl1MenuUtil import binstr
+        return binstr(self.trigger_type, width=width)
+
+
+    def xml(self, ind, step=2):
+        monitor= ' monitor="LF:{0:03b}|HF:{1:03b}"'.format(self.monitorsLF,self.monitorsHF)
+        s = ind * step * ' ' + '<TriggerItem ctpid="%i" partition="%i" name="%s" complex_deadtime="%i" definition="(%s)" trigger_type="%s"%s>\n' % \
+            (self.ctpid, self.partition, self.name, self.complex_deadtime, str(self.logic).replace('&','&amp;'), self.binary_trigger_type(8 if self.partition==1 else 4), monitor)
+        if self.logic:
+            self.logic.normalize()
+            s += self.logic.xml(ind+1, step) + "\n"
+        s += ind * step * ' ' + '</TriggerItem>'
+        return s
+
+
+class LVL1MenuItems:
+    def __init__(self):
+        self.menuName = ''
+        self.pssName = ''
+        self.pssType = 'Physics'
+        self.items = []
+
+    def __iter__(self):
+        return self.items.__iter__()
+
+    def itemNames(self):
+        return [x.name for x in self.items]
+
+    def findItemByName(self, name):
+        return ([x for x in self.items if x.name==name] + [None])[0]
+
+    def __iadd__(self, item):
+        if item is None: return self
+        if item.name in [x.name for x in self.items]:
+            log.warning("LVL1 item %s is already in the menu, will not add it again" % item.name)
+            return self
+        if item.ctpid in [x.ctpid for x in self.items]:
+            log.warning("LVL1 item with ctpid %i is already in the menu, will not add %s" % (item.ctpid, item.name) )
+            return self
+        self.items += [ item ]
+        return self
+    
+    def __contains__(self, itemname):
+        return itemname in [x.name for x in self.items] 
+
+    def __len__(self):
+        return len(self.items)
+
+    def xml(self, ind=1, step=2):
+
+        self.items.sort( lambda x,y: cmp(x.ctpid,y.ctpid) )
+
+        s = ind * step * ' ' + '<TriggerMenu name="%s" phase="lumi">\n' % self.menuName
+        for i in self.items:
+            s += i.xml(ind+1,step)+"\n"
+        s += ind * step * ' '+'</TriggerMenu>\n'
+
+        pshandler = PrescaleHandler(self.pssName, self.pssType, self.items)
+        s += pshandler.xml()
+
+        # write priorities
+        if oldStyle():
+            s += ind * step * ' ' + '<PrioritySet name="standard" version="1">\n'
+            for item in self.items:
+                s += (ind+1) * step * ' ' + '<Priority ctpid="%i" priority="%s"/>\n'  % (item.ctpid, "HIGH" if item.complex_deadtime==0 else "LOW")
+            s += ind * step * ' ' + '</PrioritySet>\n'
+
+        return s
+
+
+class PrescaleHandler(object):
+    def __init__(self, name, psType, menuitems):
+        self.name = name
+        self.psType = psType
+        self.items = menuitems
+        self.itemsByPartition = {}
+
+        from Lvl1Flags import Lvl1Flags
+        for item in menuitems:
+            self.itemsByPartition.setdefault(item.partition,[]).append(item)
+
+        for itemList in self.itemsByPartition.values():
+            itemList.sort(lambda x,y: cmp(x.ctpid,y.ctpid))
+
+    def xml(self, ind=1, step=2):
+        # write prescales (only prescales for which an item is defined)
+        # write one set per defined partition
+        s = ind * step * ' ' + '<PrescaleSet name="%s" type="%s" menuPartition="0">\n' % (self.name, self.psType)
+
+        from Limits import Limits
+        cuts = [ getCutFromPrescale(-1) ] * Limits.MaxTrigItems
+        
+        for item in self.items:
+            cuts[item.ctpid] = item.psCut
+
+        for ctpid, pscut in enumerate(cuts):
+            psvalue = getPrescaleFromCut(pscut)
+            if oldStyle():
+                s += (ind+1) * step * ' ' + '<Prescale ctpid="%i" ps="%g"/>\n'  % (ctpid, psvalue)
+            else:
+                s += (ind+1) * step * ' ' + '<Prescale ctpid="%i" cut="%s%06x" value="%g"/>\n'  % (ctpid, '-' if pscut<0 else '', abs(pscut), psvalue)
+        s += ind * step * ' ' + '</PrescaleSet>\n'
+        return s
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/LVL1/Lvl1MenuUtil.py b/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/LVL1/Lvl1MenuUtil.py
new file mode 100644
index 0000000000000000000000000000000000000000..857b4a7b32a4fe0fdbc3803cce0959d7b47f7996
--- /dev/null
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/LVL1/Lvl1MenuUtil.py
@@ -0,0 +1,148 @@
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+__all__ = ['log', 'idgen', 'binstr', 'get_smk_psk_Name', 'applyLVL1Prescale', 'oldStyle']
+
+from AthenaCommon.Logging import logging
+log = logging.getLogger("TriggerConfigL1")
+
+# Old CTP = Old CTP
+def oldStyle():
+    from TriggerJobOpts.TriggerFlags import TriggerFlags
+    oldStylePrescales = 'pp_v4' in TriggerFlags.triggerMenuSetup() or \
+                        'HI_v2' in TriggerFlags.triggerMenuSetup() or \
+                        'alfa_v2' in TriggerFlags.triggerMenuSetup() or \
+                        'DC14' in TriggerFlags.triggerMenuSetup()
+    return oldStylePrescales
+
+
+
+# unique id generator
+class idgen:
+    from collections import defaultdict
+    a =  defaultdict(int)
+    def get(self, kind):
+        self.a[kind] += 1
+        return str(self.a[kind])
+    def reset(self, kind=None):
+        if kind:
+            self.a[kind] = 0
+        else:
+            for kind in self.a: self.a[kind] = 0
+            
+idgen = idgen()
+
+
+# turns an integer into a binary representation string of given width ( for the reverse just use int('10011',2) )
+def binstr(value, width):
+    return ''.join([str( value >> i & 1 ) for i in range( width-1, -1, -1 ) ])
+
+def get_smk_psk_Name(menuName):
+    import re
+    smk_psk_Name = {}
+    if "mc_prescale" in menuName:
+        form = "(.*)_(.*)_mc_prescale"
+        m = re.match(form, menuName)
+        (smkName, pskName) = m.groups()
+        pskName = pskName+"_mc" 
+    elif "prescale" in menuName:
+        #eg lumi1e31_simpleL1Calib_no_prescale
+        form = "(.*)_(.*)_prescale"
+        m = re.match(form,menuName)
+        (smkName, pskName) = m.groups()
+    else:
+        #eg lumi1e31 ps set name can be "default"
+        smkName = menuName
+        pskName = "default"
+    smk_psk_Name["smkName"] = str(smkName)
+    smk_psk_Name["pskName"] = str(smkName+"_"+pskName+"_prescale")
+
+    return smk_psk_Name
+
+def getJetWeights(triggerPythonConfig, use_fj=False):
+    jw = []
+    jthr, fjthr = [], []
+    def thr2weights(thrs, factor=1.25):
+        n = len(thrs)
+        # need to skip any turned-off thresholds
+        use = []
+        for i in range(n):
+            if thrs[i]<1023:
+               use.append(1)
+            else:
+               use.append(0)
+        # allow for thresholds being out of order
+        index = order(thrs)
+        # compute weights
+        sum = 0
+        weights = [0]*n
+        for j in range(n):
+            w = 0
+            if use[index[j]]>0:
+                jnext = j + 1
+                while (jnext < n and use[index[jnext]]==0):
+                    jnext = jnext + 1
+                if (jnext < n):
+                    w = int( (thrs[index[j]]+thrs[index[jnext]]+1)/2.0) - sum
+                else:  
+                    w = int(thrs[index[j]]*factor - sum)
+            weights[index[j]]=w
+            sum += w
+        return weights
+#
+    def order(thrs): 
+        n = len(thrs)
+        thr1 = list(thrs)
+        thr2 = sorted(thrs)
+        index = []
+        for i in range(n):
+            val = thr2[i]
+            pos = thr1.index(val)
+            index.append(pos)
+            if (thr1.count(val)>1):
+                thr1[pos] = -thr1[pos]
+        return index
+#
+    l1_thrs = triggerPythonConfig.Lvl1Thresholds()
+    jet_thresholds = l1_thrs.allThresholdsOf('JET')
+    fjet_thresholds = l1_thrs.allThresholdsOf('JF')
+    log.debug('N jet thresholds: %d (8 expected)' % len(jet_thresholds))
+    log.debug('N fjet thresholds: %d (4 expected)' % len(fjet_thresholds))
+    jthr = [1023]*8
+    fjthr = [1023]*4
+    jet_names, fjet_names = ['---']*8, ['---']*4
+    for j in jet_thresholds:
+        log.debug('jet threshold %s: %d' % (j.name, j.thresholdInGeV()))
+        # jthr.append(j.thresholdInGeV())
+        jthr[j.mapping] = j.thresholdInGeV()
+        jet_names[j.mapping] = j.name
+    for j in fjet_thresholds:
+        tvalues = j.thresholdValues
+        priority = 0
+        threshold_value = 0
+        for tv in tvalues:
+            if tv.priority > priority:
+                threshold_value = tv.value
+        log.debug('fjet threshold %s: %d' % (j.name, threshold_value))
+        fjthr.append(threshold_value)
+        fjthr[j.mapping] = threshold_value
+        fjet_names[j.mapping] = j.name
+    #
+    s = ''
+    for j in jet_names:
+        s += '%s ' % j
+    log.debug('Jet thresholds: %s' % s)
+    s = ''
+    for j in fjet_names:
+        s += '%s ' % j
+    log.debug('Fjet thresholds: %s' % s)
+    if len(jthr) <= 8:
+        w = thr2weights(jthr)
+        jw = w
+    else:
+        jw = [0]*8
+    w = [0]*4
+    if use_fj:
+        if len(fjthr) <= 4:
+            w = thr2weights(fjthr)
+    jw.extend(w)
+    return jw
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/LVL1/Lvl1MonCounters.py b/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/LVL1/Lvl1MonCounters.py
new file mode 100644
index 0000000000000000000000000000000000000000..34e84410ab17dc00372a214da7be4164c250319a
--- /dev/null
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/LVL1/Lvl1MonCounters.py
@@ -0,0 +1,63 @@
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+
+
+class Lvl1MonCounters(object):
+
+    def __init__(self):
+
+        # list of counters
+        self.counters = []
+
+
+    def addCounter(self, c):
+        self.counters += [c]
+
+
+    def xml(self, ind=1, step=2):
+        s  = ind * step * ' ' + '<TriggerCounterList>\n'
+        for c in sorted(self.counters):
+            s  += c.xml(ind+1,step)
+        s += ind * step * ' ' + '</TriggerCounterList>\n'
+        return s
+
+
+class Lvl1MonCounter(object):
+
+    def __init__(self, name, multiplicity, montype):
+        self.name = name
+        self.multiplicity = int(multiplicity)
+        self.montype = montype
+        pass
+
+    def __cmp__(self, o):
+        if(self.name!=o.name):
+            return cmp(self.name,o.name)
+        return cmp(self.multiplicity,o.multiplicity)
+    
+class Lvl1CtpinCounter(Lvl1MonCounter):
+
+    def __init__(self, name, multiplicity):
+        super(Lvl1CtpinCounter, self).__init__(name, multiplicity, 'CTPIN')
+        #print 'Initialize ctpin counter name="%i%s" triggerthreshold="%s" multi="%i"' % (self.multiplicity, self.name, self.name, self.multiplicity)
+
+    def xml(self, ind=1, step=2):
+        s  = ind * step * ' ' + '<TriggerCounter name="%i%s" type="CTPIN">\n' % (self.multiplicity, self.name)
+        s += ind * step * ' ' + '  <TriggerCondition name="%i%s" triggerthreshold="%s" multi="%i"/>\n' % (self.multiplicity, self.name, self.name, self.multiplicity)
+        s += ind * step * ' ' + '</TriggerCounter>\n'
+        return s
+
+
+
+class Lvl1CtpmonCounter(Lvl1MonCounter):
+
+    def __init__(self, name, multiplicity):
+        super(Lvl1CtpmonCounter, self).__init__(name, multiplicity, 'CTPMON')
+        #print 'Initialize ctpmon counter name="%i%s" triggerthreshold="%s" multi="%i"' % (self.multiplicity, self.name, self.name, self.multiplicity)
+
+    def xml(self, ind=1, step=2):
+        s  = ind * step * ' ' + '<TriggerCounter name="%i%s" type="CTPMON">\n' % (self.multiplicity, self.name)
+        s += ind * step * ' ' + '  <TriggerCondition name="%i%s" triggerthreshold="%s" multi="%i"/>\n' % (self.multiplicity, self.name, self.name, self.multiplicity)
+        s += ind * step * ' ' + '</TriggerCounter>\n'
+        return s
+
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/LVL1/Lvl1Thresholds.py b/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/LVL1/Lvl1Thresholds.py
new file mode 100644
index 0000000000000000000000000000000000000000..4d0cd678b6acbbf0847c4379a6cb1a6acb530e86
--- /dev/null
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/LVL1/Lvl1Thresholds.py
@@ -0,0 +1,390 @@
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+from Limits import CaloLimits as CL
+IsolationOff = CL.IsolationOff
+
+from Lvl1MenuUtil import log
+from copy import deepcopy
+
+class ThresholdValue:
+
+    defaultThresholdValues = {}
+    
+    @staticmethod
+    def setDefaults(ttype, dic):
+        ThresholdValue.defaultThresholdValues[ttype] = dic
+        
+    @staticmethod
+    def getDefaults(ttype):
+        defaults = {
+            'etamin'  : -49,
+            'etamax'  :  49,
+            'phimin'  :   0,
+            'phimax'  :  64,
+            'priority':   0,
+            }
+        if ttype == 'EM' or ttype == 'TAU':
+            defaults.update({'priority':   1,
+                             'em_isolation' : IsolationOff,
+                             'had_isolation' : IsolationOff,
+                             'had_veto' : IsolationOff,
+                             'isobits' : '00000',
+                             'use_relIso' : False,
+                             })
+        if ttype == 'JET':
+            defaults.update({'window': 8})
+
+        if ttype in ThresholdValue.defaultThresholdValues: # user defined
+            defaults.update( ThresholdValue.defaultThresholdValues[ttype] )
+
+        return defaults
+
+    def __init__(self, thrtype, value, etamin, etamax, phimin, phimax, window=0, priority=1, name=''):
+        self.name   = name
+        self.type   = thrtype
+        self.value  = value
+        self.etamin = etamin
+        self.etamax = etamax
+        self.phimin = phimin
+        self.phimax = phimax
+        self.em_isolation = IsolationOff
+        self.had_isolation = IsolationOff
+        self.had_veto = IsolationOff
+        self.window = window
+        self.priority = priority
+
+
+    def setIsolation(self, em_isolation, had_isolation, had_veto, isobits, use_relIso):
+        self.em_isolation = em_isolation
+        self.had_isolation = had_isolation
+        self.had_veto = had_veto
+        self.isobits = isobits
+        self.use_relIso = use_relIso
+        if self.use_relIso:
+            self.had_veto=99
+            
+    def xml(self, ind=1, step=2):
+        s  = ind * step * ' ' + '<TriggerThresholdValue em_isolation="%i" etamin="%i" etamax="%i" had_isolation="%i" had_veto="%i" ' % (self.em_isolation, self.etamin, self.etamax, self.had_isolation, self.had_veto)
+        if (self.type=='EM' or self.type=='TAU') and self.use_relIso:
+            s += 'isobits="%s" ' % self.isobits
+        s += 'name="%s" phimin="%i" phimax="%i" priority="%i" thresholdval="%g" type="%s" window="%i"' % (self.name, self.phimin, self.phimax, self.priority, self.value, self.type, self.window)
+        if self.type=='JET':
+            s += ' windowSize="%s"' % ( 'LARGE'  if self.window==8 else 'SMALL' ) 
+        s += '/>\n'
+        return s
+
+    def __cmp__(self, o):
+        if(self.priority!=o.priority):
+            return cmp(self.priority,o.priority)
+        if(self.etamin!=o.etamin):
+            return cmp(self.etamin,o.etamin)
+        return cmp(self.name,o.name)
+
+
+    def __str__(self):
+        return "name=%s, value=%s, eta=(%s-%s)" % (self.name, self.value, self.etamin, self.etamax)
+
+
+
+
+class LVL1Threshold(object):
+    __slots__ = ['name','ttype','mapping','active','seed','seed_ttype', 'seed_multi', 'bcdelay', 'cableinfo', 'thresholdValues']
+
+    def __init__(self, name, ttype, mapping = -1, active = 1, seed='', seed_type = '', seed_multi = 0, bcdelay = 0):
+        self.name            = name
+        self.ttype           = ttype
+        self.mapping         = int(mapping)
+        self.active          = int(active)
+        self.seed            = seed
+        self.seed_ttype      = seed_type
+        self.seed_multi      = int(seed_multi)
+        self.bcdelay         = int(bcdelay)
+        self.cableinfo       = None
+        self.thresholdValues = []
+
+    def __str__(self):
+        return self.name
+
+    def getVarName(self):
+        """returns a string that can be used as a varname"""
+        return self.name.replace('.','')
+
+    def setCableInput(self):
+        from Cabling import Cabling
+        self.cableinfo = Cabling.getInputCable(self)
+        return self
+
+
+    def addThrValue(self, value, *args, **kwargs):
+        if self.ttype == 'MUON':
+            return self.addMuonThresholdValue(value, *args, **kwargs)
+        if self.ttype == 'EM' or self.ttype == 'TAU':
+            return self.addEMThresholdValue(value, *args, **kwargs)
+        if self.ttype == 'JET' or self.ttype == 'JF' or self.ttype == 'JB':
+            return self.addJetThresholdValue(value, *args, **kwargs)
+        if self.ttype in ['JE', 'TE', 'XE', 'XS', 'CALREQ', 'MBTSSI', 'TRT', 'ZDC', 'BCM', 'BCMCMB', 'BPTX', 'LUCID', 'NIM']:
+            return self.addEnergyThresholdValue(value, *args, **kwargs)
+        
+
+        raise RuntimeError("addThrValue() not defined for threshold type %s" % self.ttype)
+
+
+    def addMuonThresholdValue(self, value, *args, **kwargs):
+        defargs = ThresholdValue.getDefaults('MUON')
+        # during the transition period we will need to keep supporting
+        # formerly positional arguments, which were etamin, etamax, phimin, and phimax
+        posargs = dict(zip(['etamin', 'etamax', 'phimin', 'phimax'], args))
+        # then we evaluate the arguments: first defaults, then positional arguments, then named arguments
+        p = deepcopy(defargs)
+        p.update(posargs)
+        p.update(kwargs)
+        
+        thrv = ThresholdValue(self.ttype, value, etamin = p['etamin'], etamax=p['etamax'], phimin=p['phimin'], phimax=p['phimax'],
+                              priority = p['priority'], name = self.name+'full')
+
+        self.thresholdValues.append(thrv)
+        return self
+
+
+    def addEMThresholdValue(self, value, *args, **kwargs):
+        # supporting both EM and TAU
+        defargs = ThresholdValue.getDefaults(self.ttype) 
+        
+        posargs = dict(zip(['etamin', 'etamax', 'phimin', 'phimax', 'em_isolation', 'had_isolation', 'had_veto', 'priority', 'isobits', 'use_relIso'], args))
+        
+        # then we evaluate the arguments: first defaults, then positional arguments, then named arguments
+        p = deepcopy(defargs)
+        p.update(posargs)
+        p.update(kwargs)
+
+        thrv = ThresholdValue(self.ttype, value,
+                              etamin = p['etamin'], etamax=p['etamax'], phimin=p['phimin'], phimax=p['phimax'],
+                              priority = p['priority'], name = self.name+'full')
+
+        thrv.setIsolation(em_isolation = p['em_isolation'], had_isolation = p['had_isolation'], had_veto = p['had_veto'], isobits = p['isobits'], use_relIso = p['use_relIso'])
+        
+        self.thresholdValues.append(thrv)
+            
+        return self
+
+
+
+    def addJetThresholdValue(self, value, *args, **kwargs):
+        defargs = ThresholdValue.getDefaults(self.ttype)
+        posargs = dict(zip(['etamin', 'etamax', 'phimin', 'phimax', 'window', 'priority'], args))
+
+        p = deepcopy(defargs)
+        p.update(posargs)
+        p.update(kwargs)
+        
+        thrv = ThresholdValue(self.ttype, value, etamin=p['etamin'], etamax=p['etamax'], phimin=p['phimin'], phimax=p['phimax'],
+                              window=p['window'], priority=p['priority'], name=self.name+'full')
+        self.thresholdValues.append(thrv)
+        return self
+
+
+    def addEnergyThresholdValue(self, value, *args, **kwargs):
+        defargs = ThresholdValue.getDefaults(self.ttype)
+        posargs = dict(zip(['etamin', 'etamax', 'phimin', 'phimax', 'priority'], args))
+
+        p = deepcopy(defargs)
+        p.update(posargs)
+        p.update(kwargs)
+
+        thrv = ThresholdValue(self.ttype, value, etamin=p['etamin'], etamax=p['etamax'], phimin=p['phimin'], phimax=p['phimax'],
+                              priority=p['priority'], name=self.name+'full')
+        self.thresholdValues.append(thrv)
+        return self
+
+    def thresholdInGeV(self):
+        if len(self.thresholdValues)==0:
+            return 0
+        else:
+            return float(self.thresholdValues[0].value)
+
+    def xml(self, ind=1, step=2):
+        """ Returns XML representation of the LVL1 Threshold """
+        from Lvl1MenuUtil import idgen
+        seed       = ' seed="%s"' % self.seed if self.ttype=='ZB' else ''
+        seed_multi = ' seed_multi="%i"' % self.seed_multi if self.ttype=='ZB' else ''
+        bcdelay    = ' bcdelay="%i"' % self.bcdelay if self.ttype=='ZB' else ''
+        inputboard = "ctpcore" if self.cableinfo.isDirectIn else "ctpin"
+        s = ind * step * ' ' + '<TriggerThreshold active="%i" bitnum="%i" id="%i" mapping="%i" name="%s" type="%s" input="%s"%s%s%s version="1">\n' % \
+            (self.active, self.cableinfo.bitnum, int(idgen.get('TriggerThreshold')), self.mapping, self.name, self.ttype, inputboard, seed, seed_multi, bcdelay)
+        for thrv in sorted(self.thresholdValues):
+            s += thrv.xml(ind+1,step)
+        if self.cableinfo.isDirectIn:
+            s += (ind+1) * step * ' ' + '<Cable connector="%s" input="CTPCORE" name="%s">\n' % (self.cableinfo.connector, self.cableinfo.name)
+            s += (ind+2) * step * ' ' + '<Signal range_begin="%i" range_end="%i" clock="%i"/>\n' % (self.cableinfo.range_begin, self.cableinfo.range_end, self.cableinfo.clock)
+        else:
+            s += (ind+1) * step * ' ' + '<Cable connector="%s" input="%s" name="%s">\n' % (self.cableinfo.connector, self.cableinfo.slot, self.cableinfo.name)
+            s += (ind+2) * step * ' ' + '<Signal range_begin="%i" range_end="%i"/>\n' % (self.cableinfo.range_begin, self.cableinfo.range_end)
+        s += (ind+1) * step * ' ' + '</Cable>\n'
+        s += ind * step * ' ' + '</TriggerThreshold>\n'
+        return s
+
+
+
+class LVL1TopoInput(LVL1Threshold):
+    """Class representing a direct input cable to the CTPCORE
+    
+    In the menu it is treated like a threshold, only the naming
+    convention is less strict (allows"-" and can start with a number)
+    """
+
+    import re
+    multibitPattern = re.compile("(?P<line>.*)\[(?P<bit>\d+)\]")
+
+    #<TriggerThreshold active="1" bitnum="1" id="148" mapping="0" name="4INVM9999-AJ0s6-AJ0s6" type="TOPO" input="ctpcore" version="1">
+    #  <Cable connector="CON1" input="CTPCORE" name="TOPO1">
+    #    <Signal range_begin="0" range_end="0" clock="0"/>
+
+
+    def __init__(self, triggerlines = None , thresholdName = None , mapping = None , connector = None , firstbit = None , numberOfBits = None , clock = None , ttype = 'TOPO' ):
+
+        if triggerlines != None :
+            # from triggerline
+            from TriggerMenu.l1topo.TopoOutput import TriggerLine
+            if type(triggerlines)==list:
+                # multibit triggerlines
+                (commonNameOfLines, firstbit, numberOfBits, cable, clock, fpga, ordinal) = TriggerLine.checkMultibitConsistency(triggerlines)
+                super(LVL1TopoInput,self).__init__(name=commonNameOfLines, ttype=ttype, mapping=ordinal)
+
+                self.cable      = cable           # 0 .. 1
+                self.bitnum     = numberOfBits
+                self.bitOnCable = firstbit        # 0 .. 31
+                self.fpga       = fpga
+                self.clock      = clock
+
+            else:
+                triggerline = triggerlines
+                super(LVL1TopoInput,self).__init__(name=triggerline.trigger, ttype=ttype, mapping=triggerline.ordinal)
+                self.cable      = triggerline.cable      # 0 .. 1
+                self.bitnum     = 1
+                self.bitOnCable = triggerline.bit        # 0 .. 31
+                self.fpga       = triggerline.fpga       # 0 .. 1
+                self.clock      = triggerline.clock
+        else:
+            # from XML
+            super(LVL1TopoInput,self).__init__(name=thresholdName, ttype=ttype, mapping=mapping)
+            self.cable      = int(connector[-1]) # 0 .. 1
+            self.bitnum     = numberOfBits
+            self.bitOnCable = firstbit           # 0 .. 31
+            self.fpga       = -1
+            self.clock      = clock
+            
+
+
+    def setCableInput(self):
+        from Cabling import Cabling
+        self.cableinfo = Cabling.getInputCable(self)
+        return self
+
+    def getVarName(self):
+        """returns a string that can be used as a varname"""
+        return ("TOPO_" + self.name).replace('.','').replace('-','_') # we can not have '.' or '-' in the variable name
+
+
+
+
+
+
+
+
+class LVL1Thresholds:
+
+    @staticmethod
+    def cableMapping(type, range_begin):
+        """Calculate the mapping of the input cable of the threshold to the
+        CTP from its (type, range_begin)"""
+        mapping = -1
+        if type == 'MUON':
+            mapping = range_begin/3
+        elif type=='EM':
+            mapping = range_begin/3
+        elif type=='TAU':
+            mapping = range_begin/3
+        elif type=='JET':
+            mapping = range_begin/3
+        elif type=='JE':
+            mapping = range_begin-24
+        elif type=='JB' or type=='FJL':
+            mapping = range_begin/2
+        elif type=='JF' or type=='FJR':
+            mapping = (range_begin-8)/2
+        elif type=='TE':
+            mapping = range_begin
+        elif type=='XE':
+            mapping = range_begin-4
+        return mapping
+
+
+    @staticmethod
+    def compThreshold(thr1, thr2):
+        """
+        Comparison of two LVL1Thresholds for the purpose of sorting
+        """
+        # First sort by type
+        if thr1.ttype!= thr2.ttype:
+            return cmp(thr1.ttype,thr2.ttype)
+
+        # Second sort by mapping if it's not -1
+        if (thr1.mapping >= 0 or thr2.mapping >= 0) and (thr1.mapping != thr2.mapping):
+            return cmp( thr1.mapping, thr2.mapping )
+
+        # If both mappings are -1 sort by threshold value and then threshold name
+        import re
+        thrv1, thrv2 = 0, 0
+        re_thrv = re.compile('(\d+)')
+        mg = re_thrv.search(thr1.name)
+        if mg: thrv1 = int(mg.group(1))
+        mg = re_thrv.search(thr2.name)
+        if mg: thrv2 = int(mg.group(1))
+
+        if thrv1 != thrv2:
+            return cmp(thrv1,thrv2)
+
+        return cmp(thr1.name, thr2.name)
+
+    # LVL1Thresholds constructor
+    def __init__(self):
+        self.thresholds = []
+
+    def __iter__(self):
+        return self.thresholds.__iter__()
+
+    def __call__(self):
+        return self.thresholds
+
+    def __iadd__(self, thr):
+        if thr is None: return self
+        if self.thresholdOfName(thr.name) == None:
+            self.thresholds += [ thr ]
+        return self
+    
+    def __contains__(self, thrname):
+        return thrname in [x.name for x in self.thresholds] 
+    
+    def __len__(self):
+        return len(self.thresholds)
+
+    def thresholdNames(self):
+        return [x.name for x in self.thresholds]
+
+    def allThresholdsOf(self, type):
+        return [thr for thr in self.thresholds if thr.ttype==type]
+
+    def thresholdOfName(self, name):
+        for thr in self.thresholds:
+            if thr.name == name:
+                return thr
+        return None
+
+    def xml(self, ind=1, step=2):
+        self.thresholds.sort(LVL1Thresholds.compThreshold)
+        s = ind * step * ' ' + '<TriggerThresholdList>\n'
+        for thr in self.thresholds:
+            s += thr.xml(ind+1,step)
+        s += ind * step * ' ' + '</TriggerThresholdList>\n'
+        return s
+
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/LVL1/MuctpiInfo.py b/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/LVL1/MuctpiInfo.py
new file mode 100644
index 0000000000000000000000000000000000000000..b50ff1f4da5bee275b06c2770d913bb91efbf65a
--- /dev/null
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/LVL1/MuctpiInfo.py
@@ -0,0 +1,10 @@
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+class MuctpiInfo:
+    def __init__(self, low_pt=0, high_pt=0, max_cand=13):
+        self.low_pt = low_pt
+        self.high_pt = high_pt
+        self.max_cand = max_cand
+
+    def xml(self, ind=1, step=2):
+        return ind * step * ' ' + '<MuctpiInfo name="muctpi" low_pt="%i" high_pt="%i" max_cand="%i"/>\n' % (self.low_pt, self.high_pt, self.max_cand)
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/LVL1/PrescaleHelper.py b/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/LVL1/PrescaleHelper.py
new file mode 100644
index 0000000000000000000000000000000000000000..39dcb8eeb3660f2fd34c96c9e176d07e7c8c39ca
--- /dev/null
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/LVL1/PrescaleHelper.py
@@ -0,0 +1,58 @@
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+"""
+The prescaling uses a pseudo-random binary sequence generator of 24 bit width (31 bit internal)
+
+- Prescales are defined by a cutoff (C).
+- Each time a random number (R) is generated.
+- C, R are between 0 and 2**24-1
+
+- The trigger item is accepted if R>=C. The prescale (PS) corresponding to a cutoff C is PS = (2**24-1)/(2**24-C)
+
+
+In this scheme only number that are powers of 2 can be represented
+exactly. Effective prescales are typically non-integer.  Integer
+numbers can~t be represented exactly but have an error which grows with the
+prescale)
+"""
+
+maxPrescaleCut = 0xFFFFFF  # 2**24 - 1
+
+def getCutFromPrescale(prescale):
+    """
+    C = 2**24-(2**24-1)/PS
+    
+    PS =       1 --> C = 1
+    PS =       2 --> C = 8388609
+    PS =      10 --> C = 15099495
+    PS =    1000 --> C = 16760439
+    PS =   10000 --> C = 16775539
+    PS = 2**24-1 --> C = 2**24-1
+    """
+
+    if prescale==0:
+        raise RuntimeError("L1 Prescale value of 0 is not allowed")
+    
+    sign = -1 if prescale<0 else 1
+    prescale = abs(prescale)
+    cut=sign * ( 0x1000000 - (0xFFFFFF/prescale) )
+    cut = round( cut )
+    if  prescale > 0xFFFFFF:
+        cut=sign * (0x1000000-1)
+
+    return int(cut)
+
+def getPrescaleFromCut(cut):
+    """
+    PS = (2**24-1)/(2**24-C)
+
+    C =       1 --> PS =     1
+    C = 2**24-1 --> PS = 2**24-1
+    """
+    
+    if cut==0:
+        raise RuntimeError("L1 Prescale cut of 0 is not allowed, use cut=1 for a prescale value of 1")
+
+    sign = -1 if cut<0 else 1
+    cut = abs(cut)
+    return (sign * 0xFFFFFF) / ( 0x1000000 - cut )
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/LVL1/TriggerTypeDef.py b/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/LVL1/TriggerTypeDef.py
new file mode 100644
index 0000000000000000000000000000000000000000..8732502202b8502db65119a2306d2d90a65f29d4
--- /dev/null
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/LVL1/TriggerTypeDef.py
@@ -0,0 +1,25 @@
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+
+from TriggerJobOpts.TriggerFlags import TriggerFlags as TF
+
+class TT:
+    """
+    Trigger type logic
+    should also match StreamingDef.py definitions
+    """
+    rand        = 1 << 0
+    zerobs      = 1 << 1  # trigger type for zero bias triggers
+    calo        = 1 << 2        
+    muon        = 1 << 3
+    lardemo     = 1 << 4
+    ftk = minb  = 1 << 5  # min-bias TT is needed for TM internal use (L1Seeds.py) 
+    nim = alfa  = 1 << 6
+    phys        = 1 << 7
+
+    # Calibration requests
+    #  From David B - for calibration events TriggerType
+    #  will be reset by CTP - values below are placeholders
+    calreq0 = 0x30
+    calreq1 = 0x32
+    calreq2 = 0x34
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/LVL1/XMLMenuReader.py b/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/LVL1/XMLMenuReader.py
new file mode 100644
index 0000000000000000000000000000000000000000..0d7e538daac132f7b87f68f7e0c932e862c18304
--- /dev/null
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/LVL1/XMLMenuReader.py
@@ -0,0 +1,258 @@
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+from Lvl1Thresholds import LVL1Threshold, LVL1TopoInput, ThresholdValue
+from Lvl1MenuItems import LVL1MenuItem
+
+from PrescaleHelper import getCutFromPrescale
+
+from Logic import Logic
+from Lvl1Condition import Lvl1InternalTrigger, ThrCondition
+from CaloInfo import MinimumTOBPt
+from Lvl1MonCounters import Lvl1MonCounters, Lvl1CtpinCounter, Lvl1CtpmonCounter
+
+
+from AthenaCommon.Logging import logging
+log = logging.getLogger("TriggerConfigLVL1")
+
+
+def readLogic( logicElement, thresholdMap ):
+
+    if logicElement.tag == 'InternalTrigger':
+        return Lvl1InternalTrigger( logicElement.get('name') )
+
+    if logicElement.tag == 'TriggerCondition':
+        thr = thresholdMap[ logicElement.get('triggerthreshold') ]
+        return ThrCondition(thr, int(logicElement.get('multi')) )
+    
+    L = Logic()
+    if logicElement.tag == 'AND':
+        L.logic = Logic.AND
+    elif logicElement.tag == 'OR':
+        L.logic = Logic.OR
+    elif logicElement.tag == 'NOT':
+        L.logic = Logic.NOT
+    else:
+        raise RuntimeError("ERROR: don't understand tag %s" % logicElement.tag)
+
+    for c in logicElement.getchildren():
+        L.subConditions += [ readLogic(c, thresholdMap) ]
+
+    return L
+    
+
+
+def readMenuFromXML(l1menu, filename):
+
+    log.info("Reading L1 menu from %s" % filename)
+    l1menu.l1menuFromXML = True
+
+    from XMLReader import L1MenuXMLReader
+    reader = L1MenuXMLReader(filename)
+
+
+    if 'ctpVersion' in reader.LVL1Config:
+        from TriggerMenu.l1.Lvl1Flags import Lvl1Flags
+        Lvl1Flags.CTPVersion = int ( reader.LVL1Config['ctpVersion'] )
+
+
+    l1menu.menuName = reader.LVL1Config['name']
+    l1menu.items.menuName = reader.LVL1Config.TriggerMenu['name']
+    l1menu.items.pssName = reader.LVL1Config.PrescaleSet['name']
+
+    prioMap = {}
+    if hasattr(reader.LVL1Config,"PrioritySet"): # new files have no more PrioritySet
+        for prio in reader.LVL1Config.PrioritySet.Prioritys:
+            prioMap[int(prio['ctpid'])] = 0 if prio.strippedText()=="HIGH" else 1
+            
+
+
+    # Prescales
+    psMap = {}
+    for ps in reader.LVL1Config.PrescaleSet.Prescales:
+        if 'cut' in ps:
+            psMap[int(ps['ctpid'])] = int(ps['cut'], 16)  # new style
+        else:
+            psMap[int(ps['ctpid'])] = getCutFromPrescale(int(ps.strippedText())) # old style
+
+
+    # Thresholds from the TriggerThresholds section
+    for x in reader.getL1Thresholds():
+        seed = seed_type = ''
+        seed_multi = bcdelay = 0
+
+        if x['type']=='ZB':
+            seed       = x['seed']
+            seed_multi = x['seed_multi']
+            bcdelay    = x['bcdelay']
+            
+            seed_type  = [t for t in reader.getL1Thresholds() if t['name']==seed][0]['type']
+            
+        if x['type']=='TOPO' or x['type']=='ALFA':
+            ca = x.Cable
+            si = ca.Signal
+            firstbit = int(si['range_begin'])
+            lastbit = int(si['range_end'])
+
+            thr = LVL1TopoInput( thresholdName = x['name'], ttype = x['type'], mapping = int(x['mapping']), connector = ca['connector'],
+                                 firstbit = firstbit, numberOfBits = lastbit - firstbit + 1, clock = int(si['clock']))
+        else:
+            thr = LVL1Threshold( name=x['name'], ttype=x['type'], mapping = x['mapping'], active = x['active'],
+                                 seed_type = seed_type, seed = seed, seed_multi = seed_multi, bcdelay = bcdelay)
+
+
+        ca = x.Cable
+        thr.setCableInput()
+        #print "x[bitnum]", x['bitnum']
+        #print "type x[bitnum]", type(x['bitnum'])
+        #print "x['type']", x['type']
+
+
+        # overwrite cable info with data from xml file
+        si = ca.Signal
+        thr.cableinfo.bitnum      = int(x['bitnum'])
+        thr.cableinfo.name        = ca['name']
+        thr.cableinfo.slot        = ca['input'] if 'input' in ca else ca['ctpin']
+        thr.cableinfo.connector   = ca['connector']
+        thr.cableinfo.range_begin = int( si['range_begin'] )
+        thr.cableinfo.range_end   = int( si['range_end'] )
+
+        if hasattr(x,'TriggerThresholdValues'):
+            for xV in x.TriggerThresholdValues:
+                try:
+                    value = int(xV['thresholdval'])
+                except:
+                    value = float(xV['thresholdval'])
+
+                thrVal = ThresholdValue(thrtype = xV['type'], value = value,
+                                        etamin = int(xV['etamin']), etamax = int(xV['etamax']), phimin = int(xV['phimin']), phimax = int(xV['phimax']),
+                                        window = int(xV['window']), priority = int(xV['priority']), name = xV['name'])
+
+                if xV['type']=='EM' or xV['type']=='TAU':
+                    em_isolation = int(xV['em_isolation'])
+                    had_isolation = int(xV['had_isolation'])
+                    had_veto = int(xV['had_veto'])
+                    isobits = xV['isobits'] if 'isobits' in xV else '00000'
+                    use_relIso = xV['use_relIso'] if 'use_relIso' in xV else True
+                    thrVal.setIsolation(em_isolation, had_isolation, had_veto, isobits, use_relIso)
+                
+                thr.thresholdValues.append(thrVal)
+
+        l1menu.thresholds.thresholds += [ thr ]
+
+    # for faster lookup, needed when building the items
+    thresholdMap = {}
+    for thr in l1menu.thresholds:
+        thresholdMap[thr.name] = thr
+
+    # Items
+    for itemelem in reader.getL1Items():
+        ctpid            = int(itemelem['ctpid'])
+        partition        = int(itemelem['partition'])
+        complex_deadtime = int(itemelem['complex_deadtime'] if 'complex_deadtime' in itemelem else prioMap[ctpid])
+        psCut            = psMap[ctpid]
+        triggerType      = int( itemelem['trigger_type'], 2 )
+
+        item = LVL1MenuItem( itemelem['name'], ctpid = ctpid, complex_deadtime = complex_deadtime, psCut = psCut).setTriggerType( triggerType )
+        item.partition = partition
+        
+        # read the thresholds for each item
+        if hasattr(itemelem,'AND'):
+            topLevelLogic = readLogic( itemelem.AND.element, thresholdMap )
+        else:
+            # L1_BGRP0 has no AND around, it is a single InternalTrigger
+            topLevelLogic = readLogic( itemelem.InternalTrigger.element, thresholdMap )
+        item.setLogic(topLevelLogic)
+
+        if 'monitor' in itemelem and itemelem['monitor'].startswith('LF'):
+            lf,hf = [ int(m[-3:],2) for m in itemelem['monitor'].split('|') ]
+            from TriggerMenu.l1menu.MonitorDef import MonitorDef
+            item.addMonitor(lf, MonitorDef.LOW_FREQ)
+            item.addMonitor(hf, MonitorDef.HIGH_FREQ)
+
+        l1menu.addItem( item )
+
+
+
+    # Bunch group set
+    bgs = reader.LVL1Config.BunchGroupSet
+    l1menu.CTPInfo.setBunchGroupSetName(bgs['name'])
+    lastBGNumber = max([int(bg['internalNumber']) for bg in reader.LVL1Config.BunchGroupSet.BunchGroups])
+    l1menu.CTPInfo.bunchGroupSet.resize(1+lastBGNumber)
+    for bg in reader.LVL1Config.BunchGroupSet.BunchGroups:
+        bunches = []
+        if hasattr(bg,'Bunch'):
+            for b in bg.Bunchs:
+                bunches.append( int(b['bunchNumber']) )
+        l1menu.CTPInfo.addBunchGroup( bg['name'], int(bg['internalNumber']), bunches )
+
+
+    # Random
+    rndm = reader.LVL1Config.Random
+    if 'name' in rndm:
+        # old style
+        l1menu.CTPInfo.random.name  = rndm['name']
+        l1menu.CTPInfo.random.rate1 = int( rndm['rate1'] )
+        l1menu.CTPInfo.random.rate2 = int( rndm['rate2'] )
+        l1menu.CTPInfo.random.seed1 = int( rndm['seed1'] )
+        l1menu.CTPInfo.random.seed2 = int( rndm['seed2'] )
+    else:
+        # new style
+        for i in range(4):
+            l1menu.CTPInfo.random.names[i] = rndm['name%i' % i]
+            l1menu.CTPInfo.random.cuts[i]  = int( rndm['cut%i' % i] )
+
+
+    # Deadtime
+    # has been removed
+
+    # CaloInfo
+    ci = reader.LVL1Config.CaloInfo
+    l1menu.CaloInfo.name = ci['name']
+    try:
+        l1menu.CaloInfo.setGlobalEmScale(float(ci['global_em_scale']))
+        l1menu.CaloInfo.setGlobalJetScale(float(ci['global_jet_scale']))
+    except:
+        pass # will resolve itself once we have the em and jet scales in all XML
+
+    if hasattr(reader.LVL1Config.CaloInfo,"JetWeights"): # new CaloInfo have no more JetWeights
+        # jet weights
+        jw = [x[1] for x in sorted([ ( int(jw['num']),int(jw.strippedText())) for jw in reader.LVL1Config.CaloInfo.JetWeights])]
+        l1menu.CaloInfo.setJetWeights(jw)
+
+
+
+    for iso in reader.LVL1Config.CaloInfo.Isolations:
+        isoGroupName = iso['thrtype']
+        for p in iso.Parametrizations:
+            l1menu.CaloInfo.isolation[isoGroupName].addIsolation( isobit=p['isobit'],
+                                                                  offset=p['offset'],
+                                                                  slope=p['slope'],
+                                                                  mincut=p['mincut'],
+                                                                  upperlimit=p['upperlimit'],
+                                                                  etamin=p['etamin'],
+                                                                  etamax=p['etamax'],
+                                                                  priority=p['priority'])
+
+
+    for mintobpt in reader.LVL1Config.CaloInfo.MinimumTOBPts:
+        l1menu.CaloInfo.minTOBPt += [ MinimumTOBPt( thrtype = mintobpt['thrtype'],
+                                                    ptmin = mintobpt['ptmin'],
+                                                    window = mintobpt['window'] if 'window' in mintobpt else 0,
+                                                    etamin  = mintobpt['etamin'],
+                                                    etamax = mintobpt['etamax'],
+                                                    priority = mintobpt['priority']) ]
+
+
+    # Trigger counters for monitoring
+    for triggercounter in reader.LVL1Config.TriggerCounterList.TriggerCounters:
+        counterType = triggercounter['type']
+
+        triggerCondition = triggercounter.TriggerCondition
+
+        if counterType=='CTPIN':
+            l1menu.counters.addCounter( Lvl1CtpinCounter(  triggerCondition['triggerthreshold'], triggerCondition['multi']) )
+        elif counterType=='CTPMON':
+            l1menu.counters.addCounter( Lvl1CtpmonCounter(  triggerCondition['triggerthreshold'], triggerCondition['multi']) )
+        else:
+            raise RuntimeError("Monitoring counter of unknown type '%s'" % counterType)
+
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/LVL1/XMLReader.py b/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/LVL1/XMLReader.py
new file mode 100755
index 0000000000000000000000000000000000000000..85d90a28916eaea4fd79145f2e8ee9a50e4753ad
--- /dev/null
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/LVL1/XMLReader.py
@@ -0,0 +1,59 @@
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+
+import xml.etree.cElementTree as ET
+
+class TrigXMLElement:
+    def __init__(self,element):
+        self.element = element
+        self.tag = element.tag
+        self.items = element.items()
+        self.children = element.getchildren()
+        self.readchildren()
+    def __str__(self):
+        s = "<%s %s>" % (self.tag, " ".join(['%s="%s"' % x for x in self.items]))
+        return s
+    def __repr__(self):
+        return self.tag
+
+    def __contains__(self,k):
+        return k in dict(self.items)
+
+    def __getitem__(self,k):
+        return dict(self.items)[k]
+
+    def strippedText(self):
+        return self.element.text.strip()
+
+    def readchildren(self):
+        self.childtags = []
+        self._childtagdict = {}
+        for c in self.children:
+            self._childtagdict.setdefault(c.tag,[]).append(TrigXMLElement(c))
+            if not c.tag in self.childtags: self.childtags += [c.tag]
+        for t in self.childtags:
+            self.__dict__['%ss'%t] = self._childtagdict[t]
+            if len(self._childtagdict[t])==1:
+                self.__dict__['%s'%t] = self._childtagdict[t][0]
+
+class TrigXMLDocumentReader(object):
+    def __init__(self,filename):
+        self.filename=filename
+        from TrigConfigSvc.TrigConfigSvcConfig import findFileInXMLPATH
+        self.read(findFileInXMLPATH(filename))
+    def read(self,filename):
+        self.doc = ET.parse(filename)
+        root = TrigXMLElement(self.doc.getroot())
+        self.__dict__[root.tag] = root
+
+
+class L1MenuXMLReader(TrigXMLDocumentReader):
+    def __init__(self,filename):
+        super(L1MenuXMLReader,self).__init__(filename)
+    def getL1Items(self):
+        return self.LVL1Config.TriggerMenu.TriggerItems
+    def getL1Thresholds(self):
+        return self.LVL1Config.TriggerThresholdList.TriggerThresholds
+
+if __name__ == "__main__":
+    l1menu = L1MenuXMLReader("TriggerMenuXML/LVL1config_Cosmic2009_v1_7-bit_trigger_types.xml")
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/LVL1Menu/CaloDef.py b/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/LVL1Menu/CaloDef.py
new file mode 100644
index 0000000000000000000000000000000000000000..c90f1556d817d02b4715a70d8fd19c6d63990633
--- /dev/null
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/LVL1Menu/CaloDef.py
@@ -0,0 +1,92 @@
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+from TriggerJobOpts.TriggerFlags import TriggerFlags
+
+class CaloDef:
+
+    @staticmethod
+    def defineGlobalSettings(tc, tag=None):
+
+        
+        from TriggerMenu.l1.CaloInfo import MinimumTOBPt, CaloInfo
+        from TriggerMenu.l1.Limits import CaloLimits, Limits
+        from TriggerMenu.l1.Lvl1Flags import Lvl1Flags
+
+
+        run1 = Lvl1Flags.CTPVersion()<=3
+
+
+        caloInfo = tc.menu.CaloInfo
+        menuName = tc.menuName
+        # global scale
+        em_scale=2
+        if hasattr(TriggerFlags, 'useRun1CaloEnergyScale'):
+            if TriggerFlags.useRun1CaloEnergyScale :
+                em_scale=1
+
+        caloInfo.setGlobalEmScale(em_scale)
+        caloInfo.setGlobalJetScale(1)
+
+        # XS parameterization
+        # updated by ATR-10664
+        caloInfo.setXsParams( xsSigmaScale=1264, xsSigmaOffset=1496, xeMin=11, xeMax=63, teSqrtMin=4, teSqrtMax=63 )
+        #caloInfo.setXsParams( xsSigmaScale=660, xsSigmaOffset=1561, xeMin=11, xeMax=63, teSqrtMin=4, teSqrtMax=63 )
+        #caloInfo.setXsParams( xsSigmaScale=1150, xsSigmaOffset=1640, xeMin=11, xeMax=63, teSqrtMin=4, teSqrtMax=63 )
+
+        # isolation parametrization
+        """
+        (from Alan Watson)
+        Isolation <= ET/m + offset
+        where
+        offset: signed integer 100 MeV precision (offset = 25 means 2.5 GeV)
+        slope: signed integer for a slope of m the isolation cut loosens by 1 GeV for every m GeV increase in the cluster ET
+        
+        E.g: with offset=-52 slope=35 means isolation <= ET/3.5 - 5.2
+
+
+        The following defaults are applied if not specified
+        mincut     : 0,
+        upperlimit : 255,
+        etamin     : -49,
+        etamax     : 49,
+        priority   : 0
+        """
+
+
+        # for unused bits, fill with the loosest existing option (ATR-13892)
+        caloInfo.isolation["EMIsoForEMthr"] .addIsolation( isobit=1, slope=0, offset=0, upperlimit=0)\
+                                            .addIsolation( isobit=2, slope=80, offset=-18, mincut=20, upperlimit=50)\
+                                            .addIsolation( isobit=3, slope=80, offset=-18, mincut=20, upperlimit=50)\
+                                            .addIsolation( isobit=4, slope=80, offset=-18, mincut=20, upperlimit=50)\
+                                            .addIsolation( isobit=5, slope=80, offset=-18, mincut=20, upperlimit=50)
+
+        caloInfo.isolation["HAIsoForEMthr"] .addIsolation( isobit=1, slope=230, offset=-2, mincut=10, upperlimit=50)\
+                                            .addIsolation( isobit=2, slope=0, offset=0, upperlimit=0)\
+                                            .addIsolation( isobit=3, slope=230, offset=-2, mincut=10, upperlimit=50)\
+                                            .addIsolation( isobit=4, slope=230, offset=-2, mincut=10, upperlimit=50)\
+                                            .addIsolation( isobit=5, slope=230, offset=-2, mincut=10, upperlimit=50)
+
+        caloInfo.isolation["EMIsoForTAUthr"] .addIsolation( isobit=1, slope=100, offset=30, upperlimit=60 )\
+                                             .addIsolation( isobit=2, slope=100, offset=20, upperlimit=60 )\
+                                             .addIsolation( isobit=3, slope=100, offset=15, upperlimit=60 )\
+                                             .addIsolation( isobit=4, slope=0, offset=40, upperlimit=124 )\
+                                             .addIsolation( isobit=5, slope=100, offset=30, upperlimit=60 )
+
+
+
+        # min PT for TOBs
+        if "HI_" in menuName:
+            caloInfo.minTOBPt += [ MinimumTOBPt(thrtype="EM", ptmin=7) ]
+            caloInfo.minTOBPt += [ MinimumTOBPt(thrtype="TAU", ptmin=12) ]
+            caloInfo.minTOBPt += [ MinimumTOBPt(thrtype="JETS", ptmin=10, window=4) ]
+            caloInfo.minTOBPt += [ MinimumTOBPt(thrtype="JETL", ptmin=10, window=8) ]
+        else:
+            caloInfo.minTOBPt += [ MinimumTOBPt(thrtype="EM", ptmin=3) ]
+            caloInfo.minTOBPt += [ MinimumTOBPt(thrtype="TAU", ptmin=8) ]
+            caloInfo.minTOBPt += [ MinimumTOBPt(thrtype="JETS", ptmin=12, window=4) ]
+            caloInfo.minTOBPt += [ MinimumTOBPt(thrtype="JETL", ptmin=12, window=8) ]
+            
+        # jet weights
+        if len( tc.menu.thresholds.allThresholdsOf('JET') ) <= 8:
+            caloInfo.setJetWeights( CaloInfo.calcJetWeightsFromThresholds(tc) )  # no more jet weights in the new menu
+
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/LVL1Menu/ItemDef.py b/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/LVL1Menu/ItemDef.py
new file mode 100755
index 0000000000000000000000000000000000000000..c59e22a0e8566f29698a7a727e73e7e18f957929
--- /dev/null
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/LVL1Menu/ItemDef.py
@@ -0,0 +1,1629 @@
+#!/usr/bin/env python
+
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+
+from TriggerJobOpts.TriggerFlags import TriggerFlags
+import re
+
+from AthenaCommon.Logging import logging
+log = logging.getLogger('TriggerMenu.Lvl1.py')
+
+# The trigger types
+from TriggerMenu.l1.TriggerTypeDef import TT
+from TriggerMenu.l1.Limits import Limits
+from TriggerMenu.l1.Logic import Logic,Not
+from TriggerMenu.l1.Lvl1MenuItems import LVL1MenuItem
+from TriggerMenu.l1.Lvl1Condition import ThrCondition, Lvl1InternalTrigger
+
+
+class ItemDef:
+    """
+    Defines any items that might be needed in Run2
+    """
+
+    @staticmethod
+    def registerItems(tm):
+        """Register LVL1 thresholds for further use"""
+
+        # register all thresholds ...
+        from ThresholdDef import ThresholdDef
+        ThresholdDef.registerThresholds(tm)
+
+        # ... and make them accessible by their name
+        for thr in tm.registeredThresholds.values():
+            exec("%s = ThrCondition(thr)" % thr.getVarName())
+            
+        # InternalTriggers
+        for i in range( Limits.NumBunchgroups ):
+            exec("BGRP%i = Logic(Lvl1InternalTrigger('BGRP%i'))" % (i,i))
+
+        for i in range( Limits.NumRndmTriggers ):
+            exec("RNDM%i = Logic(Lvl1InternalTrigger('RNDM%i'))" % (i,i))
+
+
+        LVL1MenuItem.l1configForRegistration = tm  # from now on all new LVL1MenuItems are registered to tm
+
+        # Setting up bunch group and BPTX conditions
+        physcond            = BGRP0 & BGRP1
+        calibcond           = BGRP0 & BGRP2
+        cosmiccond          = BGRP0 & BGRP3
+        unpaired_isocond    = BGRP0 & BGRP4 # unpaired isolated (satellite bunches)
+        unpaired_nonisocond = BGRP0 & BGRP5 # unpaired non-isolated (parasitic bunches)
+        firstempty          = BGRP0 & BGRP6
+        unpairedRcond       = BGRP0 & BGRP7 # unpaired beams 1 oR beam 2
+        bgrp7cond           = BGRP0 & BGRP7 # No unpaired anymore
+        bgrp9cond           = BGRP0 & BGRP9 
+        bgrp11cond          = BGRP0 & BGRP11 
+        bgrp12cond          = BGRP0 & BGRP12
+        alfacalib           = BGRP0 & BGRP10
+        abortgap            = BGRP0 & BGRP8
+        
+        # partition 1
+        bgrpcond1           = BGRP0 & BGRP11
+        calibcond1          = BGRP0 & BGRP12
+
+        # partition 2
+        bgrpcond2           = BGRP0 & BGRP14
+
+
+        LVL1MenuItem.currentPartition = 1
+
+
+        # E/gamma ctpid=[0:0x1f]
+        LVL1MenuItem('L1_EM3'       ).setLogic( EM3        & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_EM3HI'     ).setLogic( EM3HI      & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_EM4'       ).setLogic( EM4        & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_EM5'       ).setLogic( EM5        & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_EM7'       ).setLogic( EM7        & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_EM10'      ).setLogic( EM10       & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_EM24VHI'   ).setLogic( EM24VHI    & physcond).setTriggerType( TT.calo)
+        LVL1MenuItem('L1_EM8'       ).setLogic( EM8        & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_EM8I'      ).setLogic( EM8I       & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_EM12'      ).setLogic( EM12       & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_EM14'      ).setLogic( EM14       & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_EM15'      ).setLogic( EM15       & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_EM15_BGRP7').setLogic( EM15       & bgrp7cond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_EM15I'     ).setLogic( EM15 & EM8I      & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_EM15HI'    ).setLogic( EM15HI      & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_EM26VHI'   ).setLogic( EM26VHI    & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_EM16'      ).setLogic( EM16       & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_EM8VH'     ).setLogic( EM8VH      & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_EM10VH'    ).setLogic( EM10VH     & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_EM20A'     ).setLogic( EM20A      & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_EM20C'     ).setLogic( EM20C      & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_EM13VH'    ).setLogic( EM13VH     & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_EM15VH'    ).setLogic( EM15VH     & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_EM18'      ).setLogic( EM18       & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_EM18VH'    ).setLogic( EM18VH     & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_EM20'      ).setLogic( EM20       & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_EM20VH'    ).setLogic( EM20VH     & physcond).setTriggerType( TT.calo )  
+        LVL1MenuItem('L1_EM20VHI'   ).setLogic( EM20VHI    & physcond).setTriggerType( TT.calo )  # isolation not yet defined
+        LVL1MenuItem('L1_EM22'      ).setLogic( EM22       & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_EM22VHI'   ).setLogic( EM22VHI    & physcond).setTriggerType( TT.calo )  # isolation not yet defined
+        LVL1MenuItem('L1_EM50V'     ).setLogic( EM50V      & physcond).setTriggerType( TT.calo )
+
+
+
+        # 2xEM, 3xEM
+        LVL1MenuItem('L1_2EM3'           ).setLogic( EM3.x(2)             & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_2EM5'           ).setLogic( EM5.x(2)             & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_2EM7'           ).setLogic( EM7.x(2)             & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_2EM10'          ).setLogic( EM10.x(2)            & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_2EM10VH'        ).setLogic( EM10VH.x(2)          & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_2EM13VH'        ).setLogic( EM13VH.x(2)          & physcond).setTriggerType( TT.calo )                
+        LVL1MenuItem('L1_2EM15'          ).setLogic( EM15.x(2)            & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_2EM15VH'        ).setLogic( EM15VH.x(2)          & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_2EM18VH'        ).setLogic( EM18VH.x(2)          & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_2EM20VH'        ).setLogic( EM20VH.x(2)          & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_EM7_2EM3'       ).setLogic( EM7 & EM3.x(2)       & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_EM12_2EM3'      ).setLogic( EM12 & EM3.x(2)      & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_EM20VH_2EM7'    ).setLogic( EM20VH & EM7.x(2)    & physcond).setTriggerType( TT.calo )        
+
+        LVL1MenuItem('L1_EM20VH_3EM10VH' ).setLogic( EM20VH & EM10VH.x(3)    & physcond).setTriggerType( TT.calo )        
+        LVL1MenuItem('L1_EM20VH_2EM10VH_3EM8VH' ).setLogic( EM20VH & EM10VH.x(2) & EM8VH.x(3)    & physcond).setTriggerType( TT.calo )        
+
+        # 4xEM
+        LVL1MenuItem('L1_EM15VH_3EM7'         ).setLogic( EM15VH & EM7.x(3)    & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_EM15VH_3EM8VH'       ).setLogic( EM15VH & EM8VH.x(3)    & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_EM15VH_3EM10VH'      ).setLogic( EM15VH & EM10VH.x(3)    & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_EM15VH_2EM10VH_3EM7' ).setLogic( EM15VH & EM10VH.x(2) & EM7.x(3)     & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_EM18VH_3EM8VH'       ).setLogic( EM18VH & EM8VH.x(3)    & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_EM18VH_2EM10VH_3EM7' ).setLogic( EM18VH & EM10VH.x(2) & EM7.x(3)     & physcond).setTriggerType( TT.calo )
+
+        # EM and jet
+        LVL1MenuItem('L1_JJ15.23ETA49' ).setLogic( JJ1523ETA49 & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_J15.23ETA49' ).setLogic( J1523ETA49 & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_J15.24ETA49' ).setLogic( J1524ETA49 & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_J15.31ETA49' ).setLogic( J1531ETA49 & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_J20.28ETA31' ).setLogic( J2028ETA31 & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_J20.31ETA49' ).setLogic( J2031ETA49 & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_J30.31ETA49' ).setLogic( J3031ETA49 & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_J40.0ETA25' ).setLogic( J400ETA25 & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_J50.31ETA49' ).setLogic( J5031ETA49 & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_J70.31ETA49' ).setLogic( J7031ETA49 & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_J100.31ETA49' ).setLogic( J10031ETA49 & physcond).setTriggerType(TT.calo)
+
+        LVL1MenuItem('L1_J15.0ETA25'  ).setLogic( J150ETA25 & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_J20.0ETA28'  ).setLogic( J200ETA28 & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_J25.0ETA23'  ).setLogic( J250ETA23 & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_J35.0ETA23'  ).setLogic( J350ETA23 & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_J20.0ETA49'  ).setLogic( J200ETA49 & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_J30.0ETA49'  ).setLogic( J300ETA49 & physcond).setTriggerType(TT.calo)
+        
+
+
+
+
+
+
+
+
+
+        # HI
+        LVL1MenuItem('L1_EM3_NZ'         ).setLogic( EM3      & Not(ZDC_AND) & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_2EM3_NZ'        ).setLogic( EM3.x(2) & Not(ZDC_AND) & physcond).setTriggerType( TT.calo )   
+
+        LVL1MenuItem('L1_EM3_NL'         ).setLogic( EM3      & Not(LUCID_A) & Not(LUCID_C) & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_2EM3_NL'        ).setLogic( EM3.x(2) & Not(LUCID_A) & Not(LUCID_C) & physcond).setTriggerType( TT.calo )
+
+        LVL1MenuItem('L1_EM3_MV'         ).setLogic( EM3      & Not(MBTS_A & MBTS_C) & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_EM3_MV_VTE50'   ).setLogic( EM3      & Not(MBTS_A & MBTS_C) & Not(TE50) & physcond).setTriggerType( TT.calo ) 
+
+        LVL1MenuItem('L1_EM3_TE50'       ).setLogic( EM3      & TE50 & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_EM3_VTE50'      ).setLogic( EM3      & Not(TE50) & physcond).setTriggerType( TT.calo )
+
+        LVL1MenuItem('L1_EM3_UNPAIRED_ISO'   ).setLogic(EM3 & unpaired_isocond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_EM3_UNPAIRED_NONISO').setLogic(EM3 & unpaired_nonisocond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_EM3_EMPTY'          ).setLogic(EM3 & cosmiccond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_EM3_FIRSTEMPTY'     ).setLogic(EM3 & firstempty).setTriggerType( TT.calo )
+
+        LVL1MenuItem('L1_EM5_EMPTY'          ).setLogic(EM5 & cosmiccond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_EM5_UNPAIRED_ISO'   ).setLogic(EM5 & unpaired_isocond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_EM5_UNPAIRED_NONISO').setLogic(EM5 & unpaired_nonisocond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_EM5_FIRSTEMPTY'     ).setLogic(EM5 & firstempty).setTriggerType( TT.calo )
+
+        LVL1MenuItem('L1_EM7_EMPTY'          ).setLogic(EM7 & cosmiccond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_EM7_UNPAIRED_ISO'   ).setLogic(EM7 & unpaired_isocond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_EM7_UNPAIRED_NONISO').setLogic(EM7 & unpaired_nonisocond).setTriggerType( TT.calo ) 
+        LVL1MenuItem('L1_EM7_FIRSTEMPTY'     ).setLogic(EM7 & firstempty).setTriggerType( TT.calo )
+
+        LVL1MenuItem('L1_EM20VH_FIRSTEMPTY'    ).setLogic( EM20VH & firstempty).setTriggerType( TT.calo )  
+        LVL1MenuItem('L1_EM22VHI_FIRSTEMPTY'    ).setLogic( EM22VHI & firstempty).setTriggerType( TT.calo )
+
+        LVL1MenuItem('L1_J10_VTE100'      ).setLogic( J10      & Not(TE100) & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_J10_VTE200'      ).setLogic( J10      & Not(TE200) & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_J10_VTE300'      ).setLogic( J10      & Not(TE300) & physcond).setTriggerType( TT.calo )
+
+        LVL1MenuItem('L1_TE5_VTE200'      ).setLogic( TE5      & Not(TE200) & physcond).setTriggerType( TT.calo )
+
+
+        # MUON ctpid=[0x20;0x2f]
+        LVL1MenuItem('L1_MU0'  ).setLogic( MU0  & physcond).setTriggerType(TT.muon)
+        LVL1MenuItem('L1_MU4'  ).setLogic( MU4  & physcond).setTriggerType(TT.muon)
+        LVL1MenuItem('L1_MU6'  ).setLogic( MU6  & physcond).setTriggerType(TT.muon)
+        LVL1MenuItem('L1_MU10' ).setLogic( MU10 & physcond).setTriggerType(TT.muon)
+        LVL1MenuItem('L1_MU11' ).setLogic( MU11 & physcond).setTriggerType(TT.muon)
+        LVL1MenuItem('L1_MU15' ).setLogic( MU15 & physcond).setTriggerType(TT.muon)
+        LVL1MenuItem('L1_MU20' ).setLogic( MU20 & physcond).setTriggerType(TT.muon)
+
+        # 2xMU, 3xMU, 4xMU
+        LVL1MenuItem('L1_2MU0'     ).setLogic( MU0.x(2)        & physcond).setTriggerType(TT.muon)
+        LVL1MenuItem('L1_2MU4'     ).setLogic( MU4.x(2)        & physcond).setTriggerType(TT.muon)
+        LVL1MenuItem('L1_2MU6'     ).setLogic( MU6.x(2)        & physcond).setTriggerType(TT.muon)
+        LVL1MenuItem('L1_2MU10'    ).setLogic( MU10.x(2)       & physcond).setTriggerType(TT.muon)
+        LVL1MenuItem('L1_2MU11'    ).setLogic( MU11.x(2)       & physcond).setTriggerType(TT.muon)
+        LVL1MenuItem('L1_2MU20'    ).setLogic( MU20.x(2)       & physcond).setTriggerType(TT.muon)
+        LVL1MenuItem('L1_MU4_MU10' ).setLogic( MU4 & MU10      & physcond).setTriggerType(TT.muon)
+        LVL1MenuItem('L1_MU6_MU4' ).setLogic( MU6 & MU4      & physcond).setTriggerType(TT.muon)
+        LVL1MenuItem('L1_MU10_2MU6').setLogic( MU10 & MU6.x(2) & physcond).setTriggerType(TT.muon)
+        LVL1MenuItem('L1_MU11_2MU6').setLogic( MU11 & MU6.x(2) & physcond).setTriggerType(TT.muon)
+        LVL1MenuItem('L1_MU10_2MU4').setLogic( MU10 & MU4.x(2) & physcond).setTriggerType(TT.muon)
+        LVL1MenuItem('L1_3MU4'     ).setLogic( MU4.x(3)        & physcond).setTriggerType(TT.muon)
+        LVL1MenuItem('L1_4MU4'     ).setLogic( MU4.x(4)        & physcond).setTriggerType(TT.muon)
+        LVL1MenuItem('L1_MU6_2MU4' ).setLogic( MU6 & MU4.x(2)  & physcond).setTriggerType(TT.muon)
+        LVL1MenuItem('L1_MU6_3MU4' ).setLogic( MU6 & MU4.x(3)  & physcond).setTriggerType(TT.muon)
+        LVL1MenuItem('L1_2MU6_3MU4' ).setLogic( MU6.x(2) & MU4.x(3)  & physcond).setTriggerType(TT.muon)
+        LVL1MenuItem('L1_3MU6'     ).setLogic( MU6.x(3)        & physcond).setTriggerType(TT.muon)
+        LVL1MenuItem('L1_2MU0_MU6' ).setLogic( MU0.x(2) & MU6  & physcond).setTriggerType(TT.muon)
+
+        LVL1MenuItem('L1_2MU20_OVERLAY').setLogic( MU20.x(2)   & physcond).setTriggerType(TT.zerobs)
+
+        # HI
+        LVL1MenuItem('L1_MU0_NZ'   ).setLogic( MU0      & Not(ZDC_AND) & physcond).setTriggerType(TT.muon)
+        LVL1MenuItem('L1_2MU0_NZ'  ).setLogic( MU0.x(2) & Not(ZDC_AND) & physcond).setTriggerType(TT.muon)   
+
+        LVL1MenuItem('L1_MU0_NL'   ).setLogic( MU0      & Not(LUCID_A) & Not(LUCID_C) & physcond).setTriggerType(TT.muon)
+        LVL1MenuItem('L1_2MU0_NL'  ).setLogic( MU0.x(2) & Not(LUCID_A) & Not(LUCID_C) & physcond).setTriggerType(TT.muon)                  
+                            
+        LVL1MenuItem('L1_MU0_MV'   ).setLogic( MU0      & Not(MBTS_A & MBTS_C) & physcond).setTriggerType(TT.muon)
+        LVL1MenuItem('L1_2MU0_MV'  ).setLogic( MU0.x(2) & Not(MBTS_A & MBTS_C) & physcond).setTriggerType(TT.muon)
+        
+        LVL1MenuItem('L1_MU4_VTE10').setLogic( MU4      & Not(TE10) & physcond).setTriggerType(TT.muon)
+        LVL1MenuItem('L1_2MU4_VTE10').setLogic( MU4.x(2)      & Not(TE10) & physcond).setTriggerType(TT.muon)
+        
+        LVL1MenuItem('L1_MU0_TE50' ).setLogic( MU0      & TE50 & physcond).setTriggerType(TT.muon)
+
+
+        LVL1MenuItem('L1_MU4_TE50' ).setLogic( MU4      & TE50 & physcond).setTriggerType(TT.muon)
+        LVL1MenuItem('L1_MU4_TE70' ).setLogic( MU4      & TE70 & physcond).setTriggerType(TT.muon)
+        LVL1MenuItem('L1_MU4_TE90' ).setLogic( MU4      & TE90 & physcond).setTriggerType(TT.muon)
+        LVL1MenuItem('L1_MU4_TE120' ).setLogic( MU4     & TE120 & physcond).setTriggerType(TT.muon)
+        LVL1MenuItem('L1_MU4_TE160' ).setLogic( MU4     & TE160 & physcond).setTriggerType(TT.muon)
+        
+        LVL1MenuItem('L1_MU4_TE10.0ETA24' ).setLogic( MU4      & TE100ETA24 & physcond).setTriggerType(TT.muon)
+        LVL1MenuItem('L1_MU4_TE15.0ETA24' ).setLogic( MU4      & TE150ETA24 & physcond).setTriggerType(TT.muon)
+        LVL1MenuItem('L1_MU4_TE20.0ETA24' ).setLogic( MU4      & TE200ETA24 & physcond).setTriggerType(TT.muon)
+        LVL1MenuItem('L1_MU4_TE25.0ETA24' ).setLogic( MU4      & TE250ETA24 & physcond).setTriggerType(TT.muon)
+        LVL1MenuItem('L1_MU4_TE30.0ETA24' ).setLogic( MU4     & TE300ETA24 & physcond).setTriggerType(TT.muon)
+        LVL1MenuItem('L1_MU4_TE35.0ETA24' ).setLogic( MU4      & TE350ETA24 & physcond).setTriggerType(TT.muon)
+        LVL1MenuItem('L1_MU4_TE40.0ETA24' ).setLogic( MU4      & TE400ETA24 & physcond).setTriggerType(TT.muon)
+        
+        LVL1MenuItem('L1_MU0_VTE50').setLogic( MU0      & Not(TE50) & physcond).setTriggerType(TT.muon)
+        LVL1MenuItem('L1_MU4_VTE50').setLogic( MU4      & Not(TE50) & physcond).setTriggerType(TT.muon)
+
+        LVL1MenuItem('L1_MU0_MV_VTE50').setLogic( MU0 & Not(MBTS_A & MBTS_C) & Not(TE50) & physcond).setTriggerType(TT.muon)
+        LVL1MenuItem('L1_MU4_MV_VTE50').setLogic( MU4 & Not(MBTS_A & MBTS_C) & Not(TE50) & physcond).setTriggerType(TT.muon)
+
+        LVL1MenuItem('L1_MU0_UNPAIRED_ISO'   ).setLogic(MU0 & unpaired_isocond   ).setTriggerType( TT.muon )
+        LVL1MenuItem('L1_MU0_UNPAIRED_NONISO').setLogic(MU0 & unpaired_nonisocond).setTriggerType( TT.muon )
+        LVL1MenuItem('L1_MU0_EMPTY'          ).setLogic(MU0 & cosmiccond).setTriggerType( TT.muon )
+        LVL1MenuItem('L1_MU0_FIRSTEMPTY'     ).setLogic(MU0 & firstempty).setTriggerType( TT.muon )
+
+        LVL1MenuItem('L1_MU4_UNPAIRED_ISO'   ).setLogic(MU4 & unpaired_isocond   ).setTriggerType( TT.muon )
+        LVL1MenuItem('L1_MU4_UNPAIRED_NONISO').setLogic(MU4 & unpaired_nonisocond).setTriggerType( TT.muon )
+        LVL1MenuItem('L1_MU4_EMPTY'          ).setLogic(MU4 & cosmiccond).setTriggerType( TT.muon )
+        LVL1MenuItem('L1_MU6_EMPTY'          ).setLogic(MU6 & cosmiccond).setTriggerType( TT.muon )
+        LVL1MenuItem('L1_MU4_FIRSTEMPTY'     ).setLogic(MU4 & firstempty).setTriggerType( TT.muon )
+
+        LVL1MenuItem('L1_MU6_FIRSTEMPTY'     ).setLogic(MU4  & firstempty).setTriggerType( TT.muon ) 
+        LVL1MenuItem('L1_MU10_EMPTY'         ).setLogic(MU10 & cosmiccond).setTriggerType( TT.muon ) 
+        LVL1MenuItem('L1_MU11_EMPTY'         ).setLogic(MU11 & cosmiccond).setTriggerType( TT.muon ) 
+        
+        LVL1MenuItem('L1_2MU0_EMPTY'         ).setLogic(MU0.x(2) & cosmiccond).setTriggerType( TT.muon )
+        LVL1MenuItem('L1_2MU4_EMPTY'         ).setLogic(MU4.x(2) & cosmiccond).setTriggerType( TT.muon ) 
+        LVL1MenuItem('L1_2MU6_UNPAIRED_ISO'  ).setLogic(MU6.x(2) & unpaired_isocond).setTriggerType( TT.muon )
+        LVL1MenuItem('L1_2MU6_UNPAIRED_NONISO').setLogic(MU6.x(2) & unpaired_nonisocond).setTriggerType( TT.muon )
+        LVL1MenuItem('L1_2MU6_EMPTY'         ).setLogic(MU6.x(2) & cosmiccond).setTriggerType( TT.muon )
+        LVL1MenuItem('L1_2MU6_FIRSTEMPTY'    ).setLogic(MU6.x(2) & firstempty).setTriggerType( TT.muon )
+
+        LVL1MenuItem('L1_MU20_FIRSTEMPTY' ).setLogic( MU20 & firstempty).setTriggerType(TT.muon)
+
+        #FTK items
+        LVL1MenuItem('L1_MU6_FTK').setLogic( MU6  & physcond).setTriggerType(TT.ftk)
+        LVL1MenuItem('L1_MU15_FTK').setLogic( MU15  & physcond).setTriggerType(TT.ftk)
+        LVL1MenuItem('L1_MU20_FTK').setLogic( MU20  & physcond).setTriggerType(TT.ftk)
+            
+        # EM and MU
+        LVL1MenuItem('L1_EM6_MU10'   ).setLogic( EM6        & MU10     & physcond).setTriggerType(TT.muon)
+        LVL1MenuItem('L1_EM7_MU10'   ).setLogic( EM7        & MU10     & physcond).setTriggerType(TT.muon)
+        LVL1MenuItem('L1_EM7_MU15'   ).setLogic( EM7        & MU15     & physcond).setTriggerType(TT.muon)
+        LVL1MenuItem('L1_EM8VH_MU15' ).setLogic( EM8VH      & MU15     & physcond).setTriggerType(TT.muon)
+        LVL1MenuItem('L1_EM8_MU10'   ).setLogic( EM8        & MU10     & physcond).setTriggerType(TT.muon)
+        LVL1MenuItem('L1_EM8I_MU10'  ).setLogic( EM8I       & MU10     & physcond).setTriggerType(TT.muon)
+        LVL1MenuItem('L1_EM15I_MU4'   ).setLogic( EM15  & EM8I     & MU4      & physcond).setTriggerType(TT.muon)
+        LVL1MenuItem('L1_EM15VH_MU10').setLogic( EM15VH     & MU10     & physcond).setTriggerType(TT.muon)
+        LVL1MenuItem('L1_EM3_MU20'   ).setLogic( EM3        & MU20     & physcond).setTriggerType(TT.muon)
+        LVL1MenuItem('L1_2EM8VH_MU10').setLogic( EM8VH.x(2) & MU10     & physcond).setTriggerType(TT.muon)
+        LVL1MenuItem('L1_EM15VH_2EM8VH_MU6').setLogic( EM15VH & EM8VH.x(2) &  MU6 & physcond).setTriggerType(TT.muon)
+
+        # TAU ctpid=[0x40:0x4f]
+        LVL1MenuItem('L1_TAU6'  ).setLogic( HA6   & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_TAU8'  ).setLogic( HA8   & physcond).setTriggerType( TT.calo )
+
+        #LVL1MenuItem('L1_TAU10IM').setLogic( HA10IM  & physcond).setTriggerType( TT.calo )
+
+        LVL1MenuItem('L1_TAU12' ).setLogic( HA12  & physcond).setTriggerType( TT.calo )
+
+        LVL1MenuItem('L1_TAU12IL').setLogic( HA12IL & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_TAU12IM').setLogic( HA12IM & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_TAU12IT').setLogic( HA12IT & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_TAU12I').setLogic( HA12I & physcond).setTriggerType( TT.calo )
+
+        LVL1MenuItem('L1_TAU15' ).setLogic( HA15  & physcond).setTriggerType( TT.calo )
+
+        LVL1MenuItem('L1_TAU20' ).setLogic( HA20  & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_TAU20IL' ).setLogic( HA20IL  & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_TAU20IM' ).setLogic( HA20IM  & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_TAU20IT' ).setLogic( HA20IT  & physcond).setTriggerType( TT.calo )
+        
+        LVL1MenuItem('L1_TAU20A' ).setLogic( HA20A  & physcond).setTriggerType( TT.calo ) 
+        LVL1MenuItem('L1_TAU20C' ).setLogic( HA20C  & physcond).setTriggerType( TT.calo ) 
+
+        LVL1MenuItem('L1_TAU25' ).setLogic( HA25  & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_TAU25IT' ).setLogic( HA25IT  & physcond).setTriggerType( TT.calo )
+
+        LVL1MenuItem('L1_TAU30' ).setLogic( HA30  & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_TAU40' ).setLogic( HA40  & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_TAU60' ).setLogic( HA60  & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_TAU100' ).setLogic( HA100  & physcond).setTriggerType( TT.calo )
+
+        LVL1MenuItem('L1_TAU8_UNPAIRED_ISO'   ).setLogic( HA8   & unpaired_isocond ).setTriggerType( TT.calo ) 
+
+        LVL1MenuItem('L1_TAU8_UNPAIRED_NONISO').setLogic( HA8   & unpaired_nonisocond ).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_TAU8_EMPTY'          ).setLogic( HA8   & cosmiccond ).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_TAU8_FIRSTEMPTY'     ).setLogic( HA8   & firstempty ).setTriggerType( TT.calo )
+
+        LVL1MenuItem('L1_TAU12_UNPAIRED_ISO').setLogic( HA12   & unpaired_isocond ).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_TAU12_UNPAIRED_NONISO').setLogic( HA12   & unpaired_nonisocond ).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_TAU12_EMPTY'          ).setLogic( HA12  & cosmiccond ).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_TAU12_FIRSTEMPTY'     ).setLogic( HA12   & firstempty ).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_TAU30_EMPTY'          ).setLogic( HA30   & cosmiccond ).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_TAU30_UNPAIRED_ISO').setLogic( HA30  & unpaired_isocond ).setTriggerType( TT.calo )
+
+
+        # 3xTAU
+        LVL1MenuItem('L1_TAU20_2TAU12'  ).setLogic( HA20 & HA12.x(2)  & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_TAU20_2TAU12I' ).setLogic( HA20 & HA12I.x(2) &  physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_TAU40_2TAU20IM' ).setLogic( HA40 & HA20IM.x(2) &  physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_TAU20IM_2TAU12IM' ).setLogic( HA20IM & HA12IM.x(2) &  physcond).setTriggerType( TT.calo )
+
+        # mixed tau
+        LVL1MenuItem('L1_EM15VH_2TAU12'                ).setLogic( EM15VH  & HA12.x(2)          & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_EM15VH_2TAU12IL'              ).setLogic( EM15VH  & HA12IL.x(2)        & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_EM15HI_2TAU12'                ).setLogic( EM15HI  & HA12.x(2)          & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_EM15HI_2TAU12IL'              ).setLogic( EM15HI  & HA12IL.x(2)        & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_EM15HI_2TAU12IM'              ).setLogic( EM15HI  & HA12IM.x(2)        & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_EM15_2TAU12'                  ).setLogic( EM15    & HA12.x(2)          & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_EM15_2TAU20'                  ).setLogic( EM15    & HA20.x(2)          & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_EM15VH_2TAU20'                ).setLogic( EM15VH  & HA20.x(2)          & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_EM15_TAU40_2TAU15'            ).setLogic( EM15    & HA40 & HA15.x(2)   & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_EM15HI_TAU40_2TAU15'          ).setLogic( EM15HI  & HA40 & HA15.x(2)   & physcond).setTriggerType( TT.calo )
+
+        LVL1MenuItem('L1_EM15_2TAU12_J25_2J15_3J12'    ).setLogic( EM15  & HA12.x(2)  & J25 & J15.x(2) & J12.x(3) & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_EM15HI_2TAU12I_J25_2J15_3J12'  ).setLogic( EM15HI  & HA12I.x(2)  & J25 & J15.x(2) & J12.x(3) & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_EM15HI_2TAU12IM_J25_3J12'  ).setLogic( EM15HI  & HA12IM.x(2)  & J25 & J12.x(3) & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_EM15HI_2TAU12IL_J25_3J12'  ).setLogic( EM15HI  & HA12IL.x(2)  & J25 & J12.x(3) & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_EM15HI_2TAU12_J25_3J12'  ).setLogic( EM15HI  & HA12.x(2)  & J25 & J12.x(3) & physcond).setTriggerType( TT.calo )
+
+        LVL1MenuItem('L1_MU10_TAU12'       ).setLogic( MU10  & HA12          & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_MU10_TAU12I'      ).setLogic( MU10  & HA12I         & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_MU10_TAU12IM'     ).setLogic( MU10  & HA12IM        & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_MU10_TAU20'       ).setLogic( MU10  & HA20          & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_MU10_TAU20IM'     ).setLogic( MU10  & HA20IM        & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_MU11_TAU20IM'     ).setLogic( MU11  & HA20IM        & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_MU10_TAU20IM_J25_2J20'     ).setLogic( MU10  & HA20IM   & J25 & J20.x(2) & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_MU10_TAU20I'       ).setLogic( MU10  & HA20I        & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_MU20_TAU12IM').setLogic( MU20 & HA12IM & physcond).setTriggerType( TT.calo)        
+        LVL1MenuItem('L1_TAU12I_MU10_J25'  ).setLogic( HA12I & MU10 & J25    & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_TAU12I_MU10_J25_2J12'  ).setLogic( HA12I & MU10 & J25 & J12.x(2)  & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_MU10_TAU12_J25_2J12' ).setLogic( MU10 & HA12 & J25 & J12.x(2)     & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_MU10_TAU12IM_J25_2J12' ).setLogic( MU10 & HA12IM & J25 & J12.x(2)    & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_MU10_TAU12IL_J25_2J12' ).setLogic( MU10 & HA12IL & J25 & J12.x(2)    & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_TAU12I_MU10_J20.31ETA49' ).setLogic( HA12I & MU10 & J2031ETA49    & physcond).setTriggerType( TT.calo )
+
+        LVL1MenuItem('L1_TAU20_2TAU12I_J25_2J15_3J12'   ).setLogic( HA20 & HA12I.x(2)     & J25 & J15.x(2) & J12.x(3) & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_TAU20_2TAU12_J25_2J20_3J12'   ).setLogic( HA20 & HA12.x(2)     & J25 & J20.x(2) & J12.x(3) & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_TAU20IM_2TAU12IM_J25_2J20_3J12').setLogic( HA20IM & HA12IM.x(2)     & J25 & J20.x(2) & J12.x(3) & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_TAU20IL_2TAU12IL_J25_2J20_3J12').setLogic( HA20IL & HA12IL.x(2)     & J25 & J20.x(2) & J12.x(3) & physcond).setTriggerType( TT.calo )
+
+        LVL1MenuItem('L1_TAU25IT_2TAU12IT_2J25_3J12').setLogic( HA25IT & HA12IT.x(2)     & J25.x(2)  & J12.x(3) & physcond).setTriggerType( TT.calo )
+
+        LVL1MenuItem('L1_2TAU12I_TAU20_J25_2J15_3J12'  ).setLogic( HA12I.x(2)   & HA20  & J25 & J15.x(2) & J12.x(3) & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_TAU20_2J20_XE45'              ).setLogic( HA20    & J20.x(2)   & XE45 & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_TAU20IM_2J20_XE50'            ).setLogic( HA20IM   & J20.x(2)   & XE50 & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_TAU20IM_2J20_XE45'            ).setLogic( HA20IM    & J20.x(2)   & XE45 & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_TAU25_2J20_XE45'              ).setLogic( HA25      & J20.x(2)   & XE45 & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_TAU20_2TAU12_XE35'            ).setLogic( HA20    & HA12.x(2)  & XE35 & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_TAU20IM_2TAU12IM_XE35'        ).setLogic( HA20IM  & HA12IM.x(2)  & XE35 & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_TAU20IL_2TAU12IL_XE35'        ).setLogic( HA20IL  & HA12IL.x(2)  & XE35 & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_TAU20IT_2TAU12IT_XE35'        ).setLogic( HA20IT  & HA12IT.x(2)  & XE35 & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_TAU20IM_2TAU12IM_XE40'        ).setLogic( HA20IM  & HA12IM.x(2)  & XE40 & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_TAU40_2TAU12IM_XE40'        ).setLogic( HA40  & HA12IM.x(2)  & XE40 & physcond).setTriggerType( TT.calo )   
+        LVL1MenuItem('L1_EM15HI_TAU20IM_2TAU15_J25_2J20_3J15'          ).setLogic( EM15HI  &  HA20IM  &  HA15.x(2) &  J25  & J20.x(2) & J15.x(3) & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_EM20VHI_TAU20IM_2TAU20_J25_3J20'          ).setLogic( EM20VHI  &  HA20IM  &  HA20.x(2) &  J25  & J20.x(3) & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_EM15HI_2TAU12I_XE35'          ).setLogic( EM15HI  & HA12I.x(2) & XE35 & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_EM15HI_2TAU12IM_XE35'         ).setLogic( EM15HI  & HA12IM.x(2) & XE35 & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_EM15HI_2TAU12IL_XE35'         ).setLogic( EM15HI  & HA12IL.x(2) & XE35 & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_EM15HI_2TAU12_XE35'         ).setLogic( EM15HI  & HA12.x(2) & XE35 & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_MU10_TAU12I_XE35'             ).setLogic( MU10    & HA12I      & XE35 & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_MU10_TAU12_XE35'              ).setLogic( MU10    & HA12       & XE35 & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_MU10_TAU12IL_XE35'            ).setLogic( MU10    & HA12IL     & XE35 & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_MU10_TAU12IM_XE35'            ).setLogic( MU10    & HA12IM     & XE35 & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_MU10_TAU12IT_XE35'            ).setLogic( MU10    & HA12IT     & XE35 & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_MU10_TAU12IM_XE40'            ).setLogic( MU10    & HA12IM     & XE40 & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_TAU20I_2TAU12I_XE35'          ).setLogic( HA20I   & HA12I.x(2) & XE35 & physcond).setTriggerType( TT.calo )
+
+        #FTK items
+        LVL1MenuItem('L1_TAU12IM_FTK').setLogic( HA12IM & physcond).setTriggerType( TT.ftk)
+        LVL1MenuItem('L1_TAU20IM_FTK').setLogic( HA20IM & physcond).setTriggerType( TT.ftk)
+        LVL1MenuItem('L1_MU20_TAU12IM_FTK').setLogic( MU20 & HA12IM & physcond).setTriggerType( TT.ftk)
+        LVL1MenuItem('L1_TAU20IM_2TAU12IM_J25_2J20_3J12_FTK').setLogic( HA20IM & HA12IM.x(2)     & J25 & J20.x(2) & J12.x(3) & physcond).setTriggerType( TT.ftk )
+        LVL1MenuItem('L1_DR-TAU20ITAU12I-J25_FTK').setLogic( TOPO_1DISAMB_J25ab_0DR28_TAU20abi_TAU12abi & physcond).setTriggerType(TT.ftk)
+
+
+
+
+        # JET ctpid=[0x60:0x7f]
+        LVL1MenuItem('L1_J5'   ).setLogic( J5   & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_J10'   ).setLogic( J10  & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_J12'   ).setLogic( J12  & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_J15'   ).setLogic( J15  & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_J20'   ).setLogic( J20  & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_J25'   ).setLogic( J25  & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_J30'   ).setLogic( J30  & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_J35'   ).setLogic( J35  & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_J40'   ).setLogic( J40  & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_J50'   ).setLogic( J50  & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_J60'   ).setLogic( J60  & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_J75'   ).setLogic( J75  & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_J75A'  ).setLogic( J75A & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_J75C'  ).setLogic( J75C & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_J85'   ).setLogic( J85  & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_J100'  ).setLogic( J100 & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_J120'  ).setLogic( J120 & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_J150'  ).setLogic( J150 & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_J175'  ).setLogic( J175 & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_J250'  ).setLogic( J250 & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_J400'  ).setLogic( J400 & physcond).setTriggerType(TT.calo)
+
+        LVL1MenuItem('L1_J10.31ETA49').setLogic( J1031ETA49 & physcond).setTriggerType(TT.calo)
+        #LVL1MenuItem('L1_J20.31ETA49').setLogic( J2031ETA49 & physcond).setTriggerType(TT.calo)
+        #LVL1MenuItem('L1_J30.31ETA49').setLogic( J3031ETA49 & physcond).setTriggerType(TT.calo)
+        #LVL1MenuItem('L1_J50.31ETA49').setLogic( J5031ETA49 & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_J75.31ETA49').setLogic( J7531ETA49 & physcond).setTriggerType(TT.calo)
+        #LVL1MenuItem('L1_J100.31ETA49').setLogic( J10031ETA49 & physcond).setTriggerType(TT.calo)
+
+
+        LVL1MenuItem('L1_J10_UNPAIRED_ISO'   ).setLogic( J10 & unpaired_isocond   ).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_J10_UNPAIRED_NONISO').setLogic( J10 & unpaired_nonisocond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_J10_EMPTY').setLogic( J10 & cosmiccond ).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_J10_FIRSTEMPTY').setLogic( J10 & firstempty ).setTriggerType(TT.calo)
+
+        LVL1MenuItem('L1_J12_UNPAIRED_ISO'   ).setLogic( J12 & unpaired_isocond   ).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_J12_UNPAIRED_NONISO').setLogic( J12 & unpaired_nonisocond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_J12_EMPTY').setLogic( J12 & cosmiccond ).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_J12_FIRSTEMPTY').setLogic( J12 & firstempty ).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_J12_ABORTGAPNOTCALIB').setLogic( J12 & abortgap ).setTriggerType(TT.calo)
+
+        LVL1MenuItem('L1_J50_UNPAIRED_ISO'   ).setLogic( J50 & unpaired_isocond   ).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_J50_UNPAIRED_NONISO').setLogic( J50 & unpaired_nonisocond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_J50_ABORTGAPNOTCALIB').setLogic( J50 & abortgap ).setTriggerType(TT.calo)
+
+        LVL1MenuItem('L1_J12_BGRP12').setLogic( J12 & bgrp12cond ).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_J30.31ETA49_BGRP12').setLogic( J3031ETA49 & bgrp12cond ).setTriggerType(TT.calo)
+
+        LVL1MenuItem('L1_J30_EMPTY').setLogic( J30 & cosmiccond ).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_J30_UNPAIRED').setLogic( J30 & unpairedRcond ).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_J30_FIRSTEMPTY').setLogic( J30 & firstempty ).setTriggerType(TT.calo)
+
+        LVL1MenuItem('L1_J10.31ETA49_EMPTY').setLogic( J1031ETA49 & cosmiccond ).setTriggerType(TT.calo)
+
+        LVL1MenuItem('L1_J15.31ETA49_UNPAIRED_ISO' ).setLogic( J1531ETA49 & unpaired_isocond).setTriggerType(TT.calo)
+
+        LVL1MenuItem('L1_J30.31ETA49_EMPTY').setLogic( J3031ETA49 & cosmiccond ).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_J30.31ETA49_FIRSTEMPTY').setLogic( J3031ETA49 & firstempty ).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_J30.31ETA49_UNPAIRED_ISO'   ).setLogic( J3031ETA49 & unpaired_isocond   ).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_J30.31ETA49_UNPAIRED_NONISO'   ).setLogic( J3031ETA49 & unpaired_nonisocond   ).setTriggerType(TT.calo)
+
+        
+        LVL1MenuItem('L1_J100_FIRSTEMPTY').setLogic( J100 & firstempty ).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_J100.31ETA49_FIRSTEMPTY' ).setLogic( J10031ETA49 & firstempty ).setTriggerType(TT.calo)
+
+        # multi jet
+        LVL1MenuItem('L1_2J25.31ETA49'  ).setLogic( J2531ETA49 & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_2J15'   ).setLogic( J15.x(2)    & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_J15_J15.31ETA49' ).setLogic( J15 & J1531ETA49 & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_J20_J20.31ETA49' ).setLogic( J20 & J2031ETA49 & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_3J10'   ).setLogic( J10.x(3)    & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_3J15'   ).setLogic( J15.x(3)    & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_3J20'   ).setLogic( J20.x(3)    & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_3J40'   ).setLogic( J40.x(3)    & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_3J50'   ).setLogic( J50.x(3)    & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_3J75'   ).setLogic( J75.x(3)    & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_4J10'   ).setLogic( J10.x(4)    & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_4J15'   ).setLogic( J15.x(4)    & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_4J20'   ).setLogic( J20.x(4)    & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_4J20.0ETA49').setLogic( J200ETA49.x(4) & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_4J30'   ).setLogic( J30.x(4)    & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_6J15'   ).setLogic( J15.x(6)    & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_J75_3J20' ).setLogic( J75 & J20.x(3)    & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_J85_3J30' ).setLogic( J85 & J30.x(3)    & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_J30.0ETA49_2J20.0ETA49' ).setLogic( J300ETA49 & J200ETA49.x(2)    & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_J15.0ETA25_2J15.31ETA49' ).setLogic( J150ETA25 & J1531ETA49.x(2)    & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_J40.0ETA25_2J15.31ETA49' ).setLogic( J400ETA25 & J1531ETA49.x(2)    & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_J40.0ETA25_2J25_J20.31ETA49' ).setLogic( J400ETA25 & J25.x(2) & J2031ETA49   & physcond).setTriggerType(TT.calo) 
+        LVL1MenuItem('L1_J40.0ETA25_2J30_J20.31ETA49' ).setLogic( J400ETA25 & J30.x(2) & J2031ETA49   & physcond).setTriggerType(TT.calo)
+
+        LVL1MenuItem('L1_4J17.0ETA22' ).setLogic( J170ETA22.x(4) & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_3J25.0ETA23' ).setLogic( J250ETA23.x(3) & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_3J35.0ETA23' ).setLogic( J350ETA23.x(3) & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_3J15.0ETA25' ).setLogic( J150ETA25.x(3) & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_4J15.0ETA25' ).setLogic( J150ETA25.x(4) & physcond).setTriggerType(TT.calo) 
+        LVL1MenuItem('L1_5J15.0ETA25' ).setLogic( J150ETA25.x(5) & physcond).setTriggerType(TT.calo)
+
+        #FTK items
+        LVL1MenuItem('L1_4J15_FTK'   ).setLogic( J15.x(4)    & physcond).setTriggerType(TT.ftk)
+        LVL1MenuItem('L1_4J15.0ETA25_FTK' ).setLogic( J150ETA25.x(4) & physcond).setTriggerType(TT.ftk) 
+        LVL1MenuItem('L1_J100_FTK'  ).setLogic( J100 & physcond).setTriggerType(TT.ftk)
+        LVL1MenuItem('L1_J15_FTK'   ).setLogic( J15  & physcond).setTriggerType(TT.ftk)
+        LVL1MenuItem('L1_J40_FTK'   ).setLogic( J40  & physcond).setTriggerType(TT.ftk)
+
+#        LVL1MenuItem('L1_ZB_J20').setLogic(ZB_EM15 & J20 & physcond).setTriggerType(TT.zerobs)
+        if (('Physics_HI_v3' in TriggerFlags.triggerMenuSetup()) or ('MC_HI_v3' in TriggerFlags.triggerMenuSetup()) or ('Physics_HI_v4' in TriggerFlags.triggerMenuSetup()) or ('MC_HI_v4' in TriggerFlags.triggerMenuSetup())):
+            LVL1MenuItem('L1_ZB', ctpid=240).setLogic(ZB_J75 & physcond).setTriggerType(TT.zerobs)
+        else:
+            LVL1MenuItem('L1_ZB', ctpid=240).setLogic(ZB_EM15 & physcond).setTriggerType(TT.zerobs)
+
+
+        # combined jet - xe
+        #LVL1MenuItem('L1_J40_XE50').setLogic( J75 & XE40 & physcond).setTriggerType(TT.calo)#CB ERROR???
+        LVL1MenuItem('L1_J40_XE50').setLogic( J40 & XE50 & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_J40.0ETA25_XE50').setLogic( J400ETA25 & XE50 & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_J75_XE40').setLogic( J75 & XE40 & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_J75_XE50').setLogic( J75 & XE50 & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_2J15_XE55').setLogic( J15.x(2) & XE55 & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_2J40_XE45').setLogic( J40.x(2) & XE45 & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_2J50_XE40').setLogic( J50.x(2) & XE50 & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_J40_XE60').setLogic( J40 & XE60 & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_J30.0ETA49_XE50').setLogic( J300ETA49 & XE50 & physcond).setTriggerType(TT.calo)
+
+        LVL1MenuItem('L1_3J15.0ETA25_XE40').setLogic( J150ETA25.x(3) & XE40 & physcond).setTriggerType(TT.calo)
+        
+        # combined em - jet
+        LVL1MenuItem('L1_EM15VH_JJ15.23ETA49' ).setLogic( EM15VH  & JJ1523ETA49  & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_EM13VH_3J20' ).setLogic( EM13VH  & J20.x(3)  & physcond).setTriggerType(TT.calo)
+        ### ATR-15524
+        LVL1MenuItem('L1_EM18VH_3J20' ).setLogic( EM18VH  & J20.x(3)  & physcond).setTriggerType(TT.calo)
+
+        # combined mu - jet
+        LVL1MenuItem('L1_MU4_J12'   ).setLogic( MU4 & J12    & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_MU6_J20'   ).setLogic( MU6 & J20    & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_MU6_J30.0ETA49_2J20.0ETA49').setLogic( MU6 & J300ETA49 & J200ETA49.x(2) & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_MU6_J40'   ).setLogic( MU6 & J40    & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_MU6_J75'   ).setLogic( MU6 & J75    & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_MU4_3J15'  ).setLogic( MU4 & J15.x(3)  & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_MU4_3J20'  ).setLogic( MU4 & J20.x(3)  & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_MU4_J30'   ).setLogic( MU4 & J30    & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_MU4_J50'   ).setLogic( MU4 & J50    & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_MU10_3J20'  ).setLogic( MU10 & J20.x(3)  & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_MU10_2J20'  ).setLogic( MU10 & J20.x(2)  & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_MU10_2J15_J20'  ).setLogic( MU10 & J15.x(2) & J20  & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_MU4_J50_XE40'   ).setLogic( MU4 & J50 & XE40  & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_2MU4_J40_XE20'  ).setLogic( MU4.x(2) & J40 & XE20  & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_MU20_J40'  ).setLogic( MU20 & J40 & physcond).setTriggerType(TT.calo) ## ATR-14377
+        LVL1MenuItem('L1_MU20_XE30' ).setLogic( MU20 & XE30 & physcond) ## ATR-14377
+        # HI
+        LVL1MenuItem('L1_J15_NZ' ).setLogic( J15      & Not(ZDC_AND) & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_2J15_NZ').setLogic( J15.x(2) & Not(ZDC_AND) & physcond).setTriggerType(TT.calo)   
+
+        LVL1MenuItem('L1_J15_NL' ).setLogic( J15      & Not(LUCID_A) & Not(LUCID_C) & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_2J15_NL').setLogic( J15.x(2) & Not(LUCID_A) & Not(LUCID_C) & physcond).setTriggerType(TT.calo)
+        
+        # XE
+        LVL1MenuItem('L1_XE35').setLogic( XE35 & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_XE40').setLogic( XE40 & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_XE45').setLogic( XE45 & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_XE50').setLogic( XE50 & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_XE55').setLogic( XE55 & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_XE60').setLogic( XE60 & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_XE70').setLogic( XE70 & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_XE80').setLogic( XE80 & physcond).setTriggerType(TT.calo)
+
+
+        LVL1MenuItem('L1_XE10').setLogic( XE10 & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_XE20').setLogic( XE20 & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_XE25').setLogic( XE25 & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_XE30').setLogic( XE30 & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_XE65').setLogic( XE65 & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_XE75').setLogic( XE75 & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_XE150').setLogic( XE150 & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_XE300').setLogic( XE300 & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_XE35_BGRP7').setLogic( XE35 & bgrp7cond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_XE40_BGRP7').setLogic( XE40 & bgrp7cond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_XE45_BGRP7').setLogic( XE45 & bgrp7cond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_XE50_BGRP7').setLogic( XE50 & bgrp7cond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_XE55_BGRP7').setLogic( XE55 & bgrp7cond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_XE60_BGRP7').setLogic( XE60 & bgrp7cond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_XE70_BGRP7').setLogic( XE70 & bgrp7cond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_XE80_BGRP7').setLogic( XE80 & bgrp7cond).setTriggerType(TT.calo)
+        # XS
+        LVL1MenuItem('L1_XS20').setLogic( XS20.x(1) & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_XS30').setLogic( XS30.x(1) & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_XS40').setLogic( XS40.x(1) & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_XS45').setLogic( XS45.x(1) & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_XS50').setLogic( XS50.x(1) & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_XS55').setLogic( XS55.x(1) & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_XS60').setLogic( XS60.x(1) & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_XS65').setLogic( XS65.x(1) & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_EM10_XS20').setLogic( EM10 & XS20.x(1) & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_EM12_XS20').setLogic( EM12 & XS20.x(1) & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_EM15_XS30').setLogic( EM15 & XS30.x(1) & physcond).setTriggerType(TT.calo)
+        
+        # TE
+        LVL1MenuItem('L1_TE0' ).setLogic( TE0  & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_TE3' ).setLogic( TE3  & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_TE5' ).setLogic( TE5  & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_TE10').setLogic( TE10 & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_TE15').setLogic( TE15 & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_TE20').setLogic( TE20 & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_TE25').setLogic( TE25 & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_TE30').setLogic( TE30 & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_TE40').setLogic( TE40 & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_TE45').setLogic( TE45 & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_TE50').setLogic( TE50 & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_TE55').setLogic( TE55 & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_TE60').setLogic( TE60 & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_TE65').setLogic( TE65 & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_TE70').setLogic( TE70 & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_TE90').setLogic( TE90 & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_TE100').setLogic( TE100 & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_TE120').setLogic( TE120 & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_TE140').setLogic( TE140 & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_TE160').setLogic( TE160 & physcond).setTriggerType(TT.calo)        
+        LVL1MenuItem('L1_TE200').setLogic( TE200 & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_TE280').setLogic( TE280 & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_TE300').setLogic( TE300 & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_TE360').setLogic( TE360 & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_TE2000').setLogic( TE2000 & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_TE4000').setLogic( TE4000 & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_TE10000').setLogic( TE10000 & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_TE12000').setLogic( TE12000 & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_TE14000').setLogic( TE14000 & physcond).setTriggerType(TT.calo)
+
+        LVL1MenuItem('L1_TE0.0ETA24').setLogic( TE00ETA24 & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_TE3.0ETA24').setLogic( TE30ETA24 & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_TE5.0ETA24').setLogic( TE50ETA24 & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_TE10.0ETA24').setLogic( TE100ETA24 & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_TE15.0ETA24').setLogic( TE150ETA24 & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_TE20.0ETA24').setLogic( TE200ETA24 & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_TE25.0ETA24').setLogic( TE250ETA24 & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_TE30.0ETA24').setLogic( TE300ETA24 & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_TE35.0ETA24').setLogic( TE350ETA24 & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_TE40.0ETA24').setLogic( TE400ETA24 & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_TE45.0ETA24').setLogic( TE450ETA24 & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_TE50.0ETA24').setLogic( TE500ETA24 & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_TE55.0ETA24').setLogic( TE550ETA24 & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_TE60.0ETA24').setLogic( TE600ETA24 & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_TE65.0ETA24').setLogic( TE650ETA24 & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_TE70.0ETA24').setLogic( TE700ETA24 & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_TE80.0ETA24').setLogic( TE800ETA24 & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_TE110.0ETA24').setLogic( TE1100ETA24 & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_TE150.0ETA24').setLogic( TE1500ETA24 & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_TE180.0ETA24').setLogic( TE1800ETA24 & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_TE2000.0ETA24').setLogic( TE20000ETA24 & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_TE5000.0ETA24').setLogic( TE20000ETA24 & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_TE6500.0ETA24').setLogic( TE20000ETA24 & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_TE8000.0ETA24').setLogic( TE20000ETA24 & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_TE9000.0ETA24').setLogic( TE20000ETA24 & physcond).setTriggerType(TT.calo)
+
+  # HI items
+        LVL1MenuItem('L1_TE500.0ETA49').setLogic( TE5000ETA49 & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_TE1500.0ETA49').setLogic( TE15000ETA49 & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_TE3000.0ETA49').setLogic( TE30000ETA49 & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_TE3500.0ETA49').setLogic( TE35000ETA49 & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_TE5000.0ETA49').setLogic( TE50000ETA49 & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_TE6500.0ETA49').setLogic( TE65000ETA49 & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_TE8000.0ETA49').setLogic( TE80000ETA49 & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_TE9000.0ETA49').setLogic( TE90000ETA49 & physcond).setTriggerType(TT.calo)
+
+        LVL1MenuItem('L1_TE500.0ETA49_OVERLAY').setLogic( TE5000ETA49 & physcond).setTriggerType(TT.zerobs)
+        LVL1MenuItem('L1_TE1500.0ETA49_OVERLAY').setLogic( TE15000ETA49 & physcond).setTriggerType(TT.zerobs)
+        LVL1MenuItem('L1_TE3000.0ETA49_OVERLAY').setLogic( TE30000ETA49 & physcond).setTriggerType(TT.zerobs)
+        LVL1MenuItem('L1_TE3500.0ETA49_OVERLAY').setLogic( TE35000ETA49 & physcond).setTriggerType(TT.zerobs)
+        LVL1MenuItem('L1_TE5000.0ETA49_OVERLAY').setLogic( TE50000ETA49 & physcond).setTriggerType(TT.zerobs)
+        LVL1MenuItem('L1_TE6500.0ETA49_OVERLAY').setLogic( TE65000ETA49 & physcond).setTriggerType(TT.zerobs)
+        LVL1MenuItem('L1_TE8000.0ETA49_OVERLAY').setLogic( TE80000ETA49 & physcond).setTriggerType(TT.zerobs)
+        LVL1MenuItem('L1_TE9000.0ETA49_OVERLAY').setLogic( TE90000ETA49 & physcond).setTriggerType(TT.zerobs)
+
+        LVL1MenuItem('L1_TE5_NZ').setLogic( TE5 & Not(ZDC_AND) & physcond).setTriggerType(TT.calo) 
+        
+        # MBTS
+        MBTS_1   = MBTS_A | MBTS_C
+        MBTS_2   = (MBTS_A.x(2) | MBTS_C.x(2) | MBTS_A) & (MBTS_A.x(2) | MBTS_C.x(2) | MBTS_C)
+        MBTS_1_1 = MBTS_A & MBTS_C
+        MBTS_2_2 = MBTS_A.x(2) & MBTS_C.x(2)
+        MBTS_2_A = MBTS_A.x(2)
+        MBTS_2_C = MBTS_C.x(2)
+        MBTS_3_3 = MBTS_A.x(3) & MBTS_C.x(3)
+        MBTS_4_4 = MBTS_A.x(4) & MBTS_C.x(4)
+        MBTS_4_A = MBTS_A.x(4)
+        MBTS_4_C = MBTS_C.x(4)
+
+
+        LVL1MenuItem('L1_MBTS_1'             ).setLogic( MBTS_1   & physcond ).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_MBTS_1_OVERLAY'     ).setLogic( MBTS_1   & physcond ).setTriggerType(TT.zerobs)
+        LVL1MenuItem('L1_MBTS_2'             ).setLogic( MBTS_2   & physcond ).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_MBTS_1_1'           ).setLogic( MBTS_1_1 & physcond ).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_MBTS_1_1_OVERLAY'     ).setLogic( MBTS_1_1   & physcond ).setTriggerType(TT.zerobs)
+        LVL1MenuItem('L1_MBTS_2_2'           ).setLogic( MBTS_2_2 & physcond ).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_MBTS_2_A'           ).setLogic( MBTS_2_A & physcond ).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_MBTS_2_C'           ).setLogic( MBTS_2_C & physcond ).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_MBTS_3_3'           ).setLogic( MBTS_3_3 & physcond ).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_MBTS_4_4'           ).setLogic( MBTS_4_4 & physcond ).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_MBTS_4_A'           ).setLogic( MBTS_4_A & physcond ).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_MBTS_4_C'           ).setLogic( MBTS_4_C & physcond ).setTriggerType(TT.minb)
+
+
+        LVL1MenuItem('L1_MBTS_1_UNPAIRED_ISO'  ).setLogic( MBTS_1   & unpaired_isocond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_MBTS_2_UNPAIRED_ISO'  ).setLogic( MBTS_2   & unpaired_isocond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_MBTS_1_1_UNPAIRED_ISO').setLogic( MBTS_1_1 & unpaired_isocond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_MBTS_2_2_UNPAIRED_ISO').setLogic( MBTS_2_2 & unpaired_isocond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_MBTS_3_3_UNPAIRED_ISO').setLogic( MBTS_3_3 & unpaired_isocond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_MBTS_4_4_UNPAIRED_ISO').setLogic( MBTS_3_3 & unpaired_isocond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_MBTS_1_UNPAIRED_NONISO').setLogic( MBTS_1 & unpaired_nonisocond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_MBTS_2_UNPAIRED_NONISO').setLogic( MBTS_2 & unpaired_nonisocond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_MBTS_4_A_UNPAIRED_ISO' ).setLogic( MBTS_4_A & unpaired_isocond ).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_MBTS_4_C_UNPAIRED_ISO' ).setLogic( MBTS_4_C & unpaired_isocond ).setTriggerType(TT.minb)
+
+        LVL1MenuItem('L1_MBTS_1_EMPTY'       ).setLogic( MBTS_1   & cosmiccond ).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_MBTS_2_EMPTY'       ).setLogic( MBTS_2   & cosmiccond ).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_MBTS_1_1_EMPTY'     ).setLogic( MBTS_1_1 & cosmiccond ).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_MBTS_2_2_EMPTY'     ).setLogic( MBTS_2_2 & cosmiccond ).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_MBTS_3_3_EMPTY'     ).setLogic( MBTS_3_3 & cosmiccond ).setTriggerType(TT.minb)
+
+        LVL1MenuItem('L1_MBTS_1_1_VTE50'     ).setLogic( MBTS_1_1  & Not(TE50) & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_MBTS_2_2_VTE50'     ).setLogic( MBTS_2_2  & Not(TE50) & physcond).setTriggerType(TT.minb)
+
+        LVL1MenuItem('L1_MBTSA0' ).setLogic( MBTS_A0 & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_MBTSA1' ).setLogic( MBTS_A1 & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_MBTSA2' ).setLogic( MBTS_A2 & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_MBTSA3' ).setLogic( MBTS_A3 & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_MBTSA4' ).setLogic( MBTS_A4 & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_MBTSA5' ).setLogic( MBTS_A5 & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_MBTSA6' ).setLogic( MBTS_A6 & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_MBTSA7' ).setLogic( MBTS_A7 & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_MBTSA8' ).setLogic( MBTS_A8 & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_MBTSA10').setLogic( MBTS_A10 & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_MBTSA12').setLogic( MBTS_A12 & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_MBTSA14').setLogic( MBTS_A14 & physcond).setTriggerType(TT.minb)
+        # L1_MBTSA/C 9, 11, 13, 15 are removed in Run 2
+
+        LVL1MenuItem('L1_MBTSC0' ).setLogic( MBTS_C0 & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_MBTSC1' ).setLogic( MBTS_C1 & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_MBTSC2' ).setLogic( MBTS_C2 & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_MBTSC3' ).setLogic( MBTS_C3 & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_MBTSC4' ).setLogic( MBTS_C4 & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_MBTSC5' ).setLogic( MBTS_C5 & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_MBTSC6' ).setLogic( MBTS_C6 & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_MBTSC7' ).setLogic( MBTS_C7 & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_MBTSC8' ).setLogic( MBTS_C8 & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_MBTSC10').setLogic( MBTS_C10 & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_MBTSC12').setLogic( MBTS_C12 & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_MBTSC14').setLogic( MBTS_C14 & physcond).setTriggerType(TT.minb)
+        
+        LVL1MenuItem('L1_MBTS_1_BGRP9'    ).setLogic( MBTS_1 & bgrp9cond ).setTriggerType(TT.minb) 
+        LVL1MenuItem('L1_MBTS_1_1_BGRP9'  ).setLogic( MBTS_1_1 & bgrp9cond ).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_MBTS_2_BGRP9'    ).setLogic( MBTS_2 & bgrp9cond ).setTriggerType(TT.minb)
+        
+        LVL1MenuItem('L1_MBTS_1_BGRP11'   ).setLogic( MBTS_1 & bgrp11cond ).setTriggerType(TT.minb) 
+        LVL1MenuItem('L1_MBTS_1_1_BGRP11' ).setLogic( MBTS_1_1 & bgrp11cond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_MBTS_2_BGRP11'   ).setLogic( MBTS_2 & bgrp11cond ).setTriggerType(TT.minb) 
+
+
+        # ZDC
+        ZDC_A_C = ZDC_A & ZDC_C
+        VZDC_A_C = Not(ZDC_A) & Not(ZDC_C)
+        LVL1MenuItem('L1_ZDC'               ).setLogic((ZDC_A | ZDC_C) & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_ZDC_A'             ).setLogic( ZDC_A & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_ZDC_C'             ).setLogic( ZDC_C & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_ZDC_AND'           ).setLogic( ZDC_AND & physcond).setTriggerType(TT.minb) 
+        LVL1MenuItem('L1_ZDC_A_C'           ).setLogic( ZDC_A_C & physcond).setTriggerType(TT.minb)
+
+        LVL1MenuItem('L1_ZDC_A_C_OVERLAY'   ).setLogic( ZDC_A_C & physcond).setTriggerType(TT.zerobs)
+        LVL1MenuItem('L1_ZDC_A_OVERLAY'   ).setLogic( ZDC_A & physcond).setTriggerType(TT.zerobs)
+        LVL1MenuItem('L1_ZDC_C_OVERLAY'   ).setLogic( ZDC_C & physcond).setTriggerType(TT.zerobs)
+        LVL1MenuItem('L1_ZDC_A_C_VTE50_OVERLAY'     ).setLogic( ZDC_A_C & Not(TE50) & physcond).setTriggerType(TT.zerobs)     
+        LVL1MenuItem('L1_TE5_OVERLAY'   ).setLogic( TE5 & physcond).setTriggerType(TT.zerobs)
+        LVL1MenuItem('L1_TE10_OVERLAY'   ).setLogic( TE10 & physcond).setTriggerType(TT.zerobs)
+        LVL1MenuItem('L1_TE20_OVERLAY'   ).setLogic( TE20 & physcond).setTriggerType(TT.zerobs)
+        LVL1MenuItem('L1_TE50_OVERLAY'   ).setLogic( TE50 & physcond).setTriggerType(TT.zerobs)
+
+        LVL1MenuItem('L1_ZDC_VTE200'        ).setLogic((ZDC_A | ZDC_C) & Not(TE200) & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_ZDC_AND_VTE50'     ).setLogic( ZDC_AND & Not(TE50) & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_ZDC_A_C_VTE50'     ).setLogic( ZDC_A_C & Not(TE50) & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_ZDC_A_C_TE50'      ).setLogic( ZDC_A_C & TE50 & physcond).setTriggerType(TT.minb)
+        
+        LVL1MenuItem('L1_ZDC_A_VTE20'      ).setLogic( ZDC_A & Not(TE20) & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_ZDC_C_VTE20'      ).setLogic( ZDC_C & Not(TE20) & physcond).setTriggerType(TT.minb)
+
+        LVL1MenuItem('L1_ZDC_A_C_VTE200'           ).setLogic( ZDC_A_C & Not(TE200) & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_ZDC_A_C_TE5_VTE200'       ).setLogic( ZDC_A_C & TE5 & Not(TE200) & physcond).setTriggerType(TT.minb)
+
+        LVL1MenuItem('L1_ZDC_MBTS_1'        ).setLogic((ZDC_A | ZDC_C) & MBTS_1 & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_ZDC_MBTS_2'        ).setLogic((ZDC_A | ZDC_C) & MBTS_2 & physcond).setTriggerType(TT.minb)
+
+        LVL1MenuItem('L1_ZDC_MBTS_1_1'      ).setLogic((ZDC_A | ZDC_C) & MBTS_1_1 & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_ZDC_MBTS_2_2'      ).setLogic((ZDC_A | ZDC_C) & MBTS_2_2 & physcond).setTriggerType(TT.minb)
+
+        LVL1MenuItem('L1_ZDC_EMPTY'           ).setLogic( (ZDC_A | ZDC_C) & cosmiccond ).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_ZDC_A_EMPTY'           ).setLogic( ZDC_A & cosmiccond ).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_ZDC_C_EMPTY'           ).setLogic( ZDC_C & cosmiccond ).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_ZDC_UNPAIRED_ISO'    ).setLogic( (ZDC_A | ZDC_C) & unpaired_isocond ).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_ZDC_UNPAIRED_NONISO' ).setLogic( (ZDC_A | ZDC_C) & unpaired_nonisocond ).setTriggerType(TT.minb)
+
+        LVL1MenuItem('L1_ZDC_AND_EMPTY'           ).setLogic( ZDC_AND & cosmiccond ).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_ZDC_AND_UNPAIRED_ISO'    ).setLogic( ZDC_AND & unpaired_isocond ).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_ZDC_AND_UNPAIRED_NONISO' ).setLogic( ZDC_AND & unpaired_nonisocond ).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_ZDC_A_UNPAIRED_NONISO' ).setLogic( ZDC_A & unpaired_nonisocond ).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_ZDC_C_UNPAIRED_NONISO' ).setLogic( ZDC_C & unpaired_nonisocond ).setTriggerType(TT.minb)
+
+        LVL1MenuItem('L1_ZDC_A_C_EMPTY'           ).setLogic( ZDC_A_C & cosmiccond ).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_ZDC_A_C_UNPAIRED_ISO'    ).setLogic( ZDC_A_C & unpaired_isocond ).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_ZDC_A_C_UNPAIRED_NONISO' ).setLogic( ZDC_A_C & unpaired_nonisocond ).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_ZDC_A_UNPAIRED_ISO'    ).setLogic( ZDC_A & unpaired_isocond ).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_ZDC_C_UNPAIRED_ISO'    ).setLogic( ZDC_C & unpaired_isocond ).setTriggerType(TT.minb)
+
+        LVL1MenuItem('L1_ZDC_A_C_BGRP9'      ).setLogic( ZDC_A_C & bgrp9cond & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_ZDC_A_BGRP9'      ).setLogic( ZDC_A & bgrp9cond & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_ZDC_C_BGRP9'      ).setLogic( ZDC_C & bgrp9cond & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_ZDC_A_C_BGRP11'     ).setLogic( ZDC_A_C & bgrp11cond & physcond).setTriggerType(TT.minb)
+
+  # ATR-12470
+        ZDC_XOR = (ZDC_A & Not(ZDC_C)) | (ZDC_C & Not(ZDC_A))        
+        LVL1MenuItem('L1_ZDC_A_VZDC_C'      ).setLogic(ZDC_A & Not(ZDC_C) & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_ZDC_C_VZDC_A'      ).setLogic(ZDC_C & Not(ZDC_A) & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_ZDC_A_VZDC_C_VTE200'      ).setLogic(ZDC_A & Not(ZDC_C) & Not(TE200) & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_ZDC_C_VZDC_A_VTE200'      ).setLogic(ZDC_C & Not(ZDC_A) & Not(TE200) & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_ZDC_XOR'           ).setLogic(ZDC_XOR  & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_ZDC_XOR_TE5_VTE200'           ).setLogic(ZDC_XOR  & TE5 & Not(TE200) & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_ZDC_XOR_TRT_VTE200'           ).setLogic(ZDC_XOR  & NIMTRT & Not(TE200) & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_ZDC_XOR_VTE200'               ).setLogic(ZDC_XOR  & Not(TE200) & physcond).setTriggerType(TT.minb)
+
+        # ATR-14967
+        LVL1MenuItem('L1_EM3_VZDC_A'               ).setLogic( EM3 & Not(ZDC_A) & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_EM3_VZDC_C'               ).setLogic( EM3 & Not(ZDC_C) & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_2EM3_VZDC_A'               ).setLogic( EM3.x(2) & Not(ZDC_A) & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_2EM3_VZDC_C'               ).setLogic( EM3.x(2) & Not(ZDC_C) & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_EM5_VZDC_A'               ).setLogic( EM5 & Not(ZDC_A) & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_EM5_VZDC_C'               ).setLogic( EM5 & Not(ZDC_C) & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_TE5_VZDC_A'               ).setLogic( TE5 & Not(ZDC_A) & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_TE5_VZDC_C'               ).setLogic( TE5 & Not(ZDC_C) & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_TE10_VZDC_A'               ).setLogic( TE10 & Not(ZDC_A) & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_TE10_VZDC_C'               ).setLogic( TE10 & Not(ZDC_C) & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_TE20_VZDC_A'               ).setLogic( TE20 & Not(ZDC_A) & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_TE20_VZDC_C'               ).setLogic( TE20 & Not(ZDC_C) & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_VTE10_VZDC_A'               ).setLogic( Not(TE10) & Not(ZDC_A) & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_VTE10_VZDC_C'               ).setLogic( Not(TE10) & Not(ZDC_C) & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_J5_VZDC_A'               ).setLogic( J5 & Not(ZDC_A) & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_J5_VZDC_C'               ).setLogic( J5 & Not(ZDC_C) & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_J10_VZDC_A'               ).setLogic( J10 & Not(ZDC_A) & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_J10_VZDC_C'               ).setLogic( J10 & Not(ZDC_C) & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_J15_VZDC_A'               ).setLogic( J15 & Not(ZDC_A) & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_J15_VZDC_C'               ).setLogic( J15 & Not(ZDC_C) & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_J20_VZDC_A'               ).setLogic( J20 & Not(ZDC_A) & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_J20_VZDC_C'               ).setLogic( J20 & Not(ZDC_C) & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_MU4_VZDC_A'               ).setLogic( MU4 & Not(ZDC_A) & physcond).setTriggerType(TT.muon)
+        LVL1MenuItem('L1_MU4_VZDC_C'               ).setLogic( MU4 & Not(ZDC_C) & physcond).setTriggerType(TT.muon)
+        LVL1MenuItem('L1_2MU4_VZDC_A'               ).setLogic( MU4.x(2) & Not(ZDC_A) & physcond).setTriggerType(TT.muon)
+        LVL1MenuItem('L1_2MU4_VZDC_C'               ).setLogic( MU4.x(2) & Not(ZDC_C) & physcond).setTriggerType(TT.muon)
+
+        LVL1MenuItem('L1_MU4_VTE10_VZDC_A').setLogic( MU4      & Not(TE10) & Not(ZDC_A) & physcond).setTriggerType(TT.muon)
+        LVL1MenuItem('L1_MU4_VTE10_VZDC_C').setLogic( MU4      & Not(TE10) & Not(ZDC_C) & physcond).setTriggerType(TT.muon)
+        LVL1MenuItem('L1_2MU4_VTE10_VZDC_A').setLogic( MU4.x(2)      & Not(TE10) & Not(ZDC_A) & physcond).setTriggerType(TT.muon)
+        LVL1MenuItem('L1_2MU4_VTE10_VZDC_C').setLogic( MU4.x(2)      & Not(TE10) & Not(ZDC_C) & physcond).setTriggerType(TT.muon)
+
+        LVL1MenuItem('L1_MU4_VZDC_A_C'               ).setLogic( MU4 & VZDC_A_C & physcond).setTriggerType(TT.muon)
+        LVL1MenuItem('L1_MU6_VZDC_A'               ).setLogic( MU6 & Not(ZDC_A) & physcond).setTriggerType(TT.muon)
+        LVL1MenuItem('L1_MU6_VZDC_C'               ).setLogic( MU6 & Not(ZDC_C) & physcond).setTriggerType(TT.muon)
+        LVL1MenuItem('L1_MU6_VTE10_VZDC_A').setLogic( MU6      & Not(TE10) & Not(ZDC_A) & physcond).setTriggerType(TT.muon)
+        LVL1MenuItem('L1_MU6_VTE10_VZDC_C').setLogic( MU6      & Not(TE10) & Not(ZDC_C) & physcond).setTriggerType(TT.muon)
+        LVL1MenuItem('L1_MU6_VZDC_A_C'               ).setLogic( MU6 & VZDC_A_C & physcond).setTriggerType(TT.muon)
+        LVL1MenuItem('L1_RD0_FILLED_VZDC_A'               ).setLogic( RNDM0 & Not(ZDC_A) & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_RD0_FILLED_VZDC_C'               ).setLogic( RNDM0 & Not(ZDC_C) & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_MBTS_4_C_VZDC_A'               ).setLogic( MBTS_4_C & Not(ZDC_A) & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_MBTS_4_A_VZDC_C'               ).setLogic( MBTS_4_A & Not(ZDC_C) & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_MBTS_2_C_VZDC_A'               ).setLogic( MBTS_2_C & Not(ZDC_A) & physcond).setTriggerType(TT.minb)	
+        LVL1MenuItem('L1_MBTS_2_A_VZDC_C'               ).setLogic( MBTS_2_A & Not(ZDC_C) & physcond).setTriggerType(TT.minb)
+
+
+
+
+        # VDM
+        LVL1MenuItem('L1_ZDC_A_C_BGRP7'     ).setLogic( ZDC_A_C & bgrp7cond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_LUCID_BGRP7'       ).setLogic( (LUCID_A | LUCID_C) & bgrp7cond).setTriggerType(TT.minb)
+        
+        # LUCID
+        #LVL1MenuItem('L1_LUCID_COMM'      ).setLogic( LUCID_COMM        & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_LUCID_A'           ).setLogic( LUCID_A             & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_LUCID_C'           ).setLogic( LUCID_C             & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_LUCID_A_C',        ).setLogic( LUCID_A & LUCID_C   & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_LUCID'             ).setLogic((LUCID_A | LUCID_C)  & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_LUCID_COMM'        ).setLogic( LUCID_COMM          & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_LUCID_COMM_EMPTY'  ).setLogic( LUCID_COMM          & cosmiccond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_LUCID_EMPTY'       ).setLogic((LUCID_A | LUCID_C)  & cosmiccond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_LUCID_A_C_EMPTY'   ).setLogic( LUCID_A & LUCID_C   & cosmiccond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_LUCID_UNPAIRED_ISO').setLogic((LUCID_A | LUCID_C)  & unpaired_isocond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_LUCID_COMM_UNPAIRED_ISO' ).setLogic( LUCID_COMM        & unpaired_isocond ).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_LUCID_A_C_UNPAIRED_ISO'  ).setLogic( LUCID_A & LUCID_C & unpaired_isocond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_LUCID_A_C_UNPAIRED_NONISO').setLogic(LUCID_A & LUCID_C & unpaired_nonisocond).setTriggerType(TT.minb)
+        
+        # BCM
+        LVL1MenuItem('L1_BCM_Wide'                   ).setLogic( BCM_Wide & physcond ).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_BCM_Wide_BGRP0'             ).setLogic( BCM_Wide & BGRP0 ).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_BCM_Wide_EMPTY'             ).setLogic( BCM_Wide & cosmiccond ).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_BCM_Wide_UNPAIRED_ISO'      ).setLogic( BCM_Wide & unpaired_isocond ).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_BCM_Wide_UNPAIRED_NONISO'   ).setLogic( BCM_Wide & unpaired_nonisocond ).setTriggerType(TT.minb)
+
+        LVL1MenuItem('L1_BCM_HT_BGRP0'               ).setLogic( BCM_Comb.x(7) & BGRP0).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_BCM_AC_CA_BGRP0'            ).setLogic((BCM_AtoC|BCM_CtoA) & BGRP0).setTriggerType(TT.minb) 
+        LVL1MenuItem('L1_BCM_AC_CA_UNPAIRED_ISO'     ).setLogic((BCM_AtoC|BCM_CtoA)&unpaired_isocond).setTriggerType(TT.minb)
+
+        LVL1MenuItem('L1_BCM_AC_UNPAIRED_ISO'     ).setLogic( BCM_AtoC & unpaired_isocond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_BCM_CA_UNPAIRED_ISO'     ).setLogic( BCM_CtoA & unpaired_isocond).setTriggerType(TT.minb)
+        
+        LVL1MenuItem('L1_BCM_AC_UNPAIRED_NONISO'     ).setLogic( BCM_AtoC & unpaired_nonisocond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_BCM_CA_UNPAIRED_NONISO'     ).setLogic( BCM_CtoA & unpaired_nonisocond).setTriggerType(TT.minb)
+        
+        LVL1MenuItem('L1_BCM_AC_ABORTGAPNOTCALIB'     ).setLogic( BCM_AtoC & abortgap).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_BCM_CA_ABORTGAPNOTCALIB'     ).setLogic( BCM_CtoA & abortgap).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_BCM_Wide_ABORTGAPNOTCALIB'   ).setLogic( BCM_Wide & abortgap).setTriggerType(TT.minb)        
+
+        LVL1MenuItem('L1_BCM_AC_CALIB'     ).setLogic( BCM_AtoC & calibcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_BCM_CA_CALIB'     ).setLogic( BCM_CtoA & calibcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_BCM_Wide_CALIB'   ).setLogic( BCM_Wide & calibcond).setTriggerType(TT.minb)        
+
+        #AFP
+        LVL1MenuItem('L1_AFP_NSC').setLogic( AFP_NSC & physcond )
+        LVL1MenuItem('L1_AFP_FSC').setLogic( AFP_FSC & physcond )
+        LVL1MenuItem('L1_AFP_C_ANY').setLogic( (AFP_FSC | AFP_NSC) & physcond )
+        LVL1MenuItem('L1_AFP_C_ANY_UNPAIRED_ISO').setLogic( (AFP_FSC | AFP_NSC) & unpaired_isocond)
+        LVL1MenuItem('L1_AFP_C_ANY_UNPAIRED_NONISO').setLogic( (AFP_FSC | AFP_NSC) & unpaired_nonisocond)
+        LVL1MenuItem('L1_AFP_C_ANY_EMPTY').setLogic( (AFP_FSC | AFP_NSC) & cosmiccond)
+        LVL1MenuItem('L1_AFP_C_ANY_FIRSTEMPTY').setLogic( (AFP_FSC | AFP_NSC) & firstempty)
+        LVL1MenuItem('L1_AFP_C_AND').setLogic( (AFP_FSC & AFP_NSC) & physcond )
+
+
+        # RANDOM
+        LVL1MenuItem('L1_RD0_FILLED'         ).setLogic( RNDM0 & physcond           ).setTriggerType(TT.rand)
+        LVL1MenuItem('L1_RD0_FILLED_OVERLAY' ).setLogic( RNDM0 & physcond           ).setTriggerType(TT.zerobs)
+        LVL1MenuItem('L1_RD0_EMPTY'          ).setLogic( RNDM0 & cosmiccond         ).setTriggerType(TT.rand)
+        LVL1MenuItem('L1_RD0_UNPAIRED_ISO'   ).setLogic( RNDM0 & unpaired_isocond   ).setTriggerType(TT.rand)
+        LVL1MenuItem('L1_RD0_FIRSTEMPTY'     ).setLogic( RNDM0 & firstempty         ).setTriggerType(TT.rand)
+        LVL1MenuItem('L1_RD0_BGRP9'          ).setLogic( RNDM0 & bgrp9cond          ).setTriggerType(TT.rand) 
+        LVL1MenuItem('L1_RD0_BGRP11'         ).setLogic( RNDM0 & bgrp11cond         ).setTriggerType(TT.rand)
+        LVL1MenuItem('L1_RD0_ABORTGAPNOTCALIB').setLogic( RNDM0 & abortgap          ).setTriggerType(TT.rand)
+
+        
+
+        LVL1MenuItem('L1_RD1_FILLED'         ).setLogic( RNDM1 & physcond           ).setTriggerType(TT.rand)
+        LVL1MenuItem('L1_RD1_EMPTY'          ).setLogic( RNDM1 & cosmiccond         ).setTriggerType(TT.zerobs)
+        LVL1MenuItem('L1_RD1_BGRP10'         ).setLogic( RNDM1 & alfacalib          ).setTriggerType(TT.zerobs)
+
+        LVL1MenuItem('L1_RD2_FILLED'         ).setLogic( RNDM2 & physcond           ).setTriggerType(TT.rand)
+        LVL1MenuItem('L1_RD2_EMPTY'          ).setLogic( RNDM2 & cosmiccond         ).setTriggerType(TT.rand)
+        LVL1MenuItem('L1_RD2_BGRP11'         ).setLogic( RNDM2 & bgrp11cond         ).setTriggerType(TT.rand)
+        LVL1MenuItem('L1_RD2_BGRP12'         ).setLogic( RNDM2 & bgrp12cond         ).setTriggerType(TT.rand)
+
+        LVL1MenuItem('L1_RD3_FILLED'         ).setLogic( RNDM3 & physcond           ).setTriggerType(TT.rand)
+        LVL1MenuItem('L1_RD3_EMPTY'          ).setLogic( RNDM3 & cosmiccond         ).setTriggerType(TT.rand)
+
+        # BGRP
+        LVL1MenuItem('L1_BGRP0').setLogic( RNDM0 & BGRP0 ).setTriggerType(TT.rand)
+        LVL1MenuItem('L1_BGRP1').setLogic( RNDM0 & BGRP0 & BGRP1 ).setTriggerType(TT.rand)
+        LVL1MenuItem('L1_BGRP7').setLogic( RNDM0 & BGRP0 & BGRP7 ).setTriggerType(TT.rand)
+        LVL1MenuItem('L1_BGRP9').setLogic( RNDM0 & BGRP0 & BGRP9 ).setTriggerType(TT.rand)  #fixed in ATR-14201
+
+        LVL1MenuItem('L1_BPTX0_BGRP0', ctpid=0xf1).setLogic(BPTX0 & BGRP0).setTriggerType(TT.rand)
+        LVL1MenuItem('L1_BPTX1_BGRP0', ctpid=0xf2).setLogic(BPTX1 & BGRP0).setTriggerType(TT.rand)   
+        
+        # lumi measurements
+        LVL1MenuItem('L1_MLZ_A').setLogic( (MBTS_A|ZDC_A|LUCID_A) & physcond).setTriggerType(TT.minb) 
+        LVL1MenuItem('L1_MLZ_C').setLogic( (MBTS_C|ZDC_C|LUCID_C) & physcond).setTriggerType(TT.minb) 
+        LVL1MenuItem('L1_MBLZ' ).setLogic( ( (MBTS_A|ZDC_A|LUCID_A) & (MBTS_C|ZDC_C|LUCID_C) | BCM_Wide) & physcond ).setTriggerType(TT.minb)  
+
+        LVL1MenuItem('L1_CALREQ0', ctpid=0x1fd).setLogic( CAL0 & calibcond).setTriggerType(TT.calreq0) 
+        LVL1MenuItem('L1_CALREQ1', ctpid=0x1fe).setLogic( CAL1 & calibcond).setTriggerType(TT.calreq1)
+        LVL1MenuItem('L1_CALREQ2', ctpid=0x1ff).setLogic( CAL2 & calibcond).setTriggerType(TT.calreq2)   
+
+        # TRT
+        LVL1MenuItem('L1_TRT'       , ctpid=0x4e).setLogic(NIMTRT & BGRP0).setTriggerType(TT.nim)
+        LVL1MenuItem('L1_TRT_FILLED').setLogic(NIMTRT & physcond).setTriggerType(TT.nim)
+        LVL1MenuItem('L1_TRT_EMPTY' ).setLogic(NIMTRT & cosmiccond).setTriggerType(TT.nim)
+
+        # TGC
+        LVL1MenuItem('L1_TGC_BURST').setLogic(NIMTGC & BGRP0).setTriggerType(TT.nim)
+        # LVL1MenuItem('L1_TGC_BURST_EMPTY').setLogic(NIMTGC & cosmiccond).setTriggerType(TT.nim)
+
+
+        # LHCF
+        LVL1MenuItem('L1_LHCF').setLogic( NIMLHCF & physcond).setTriggerType(TT.nim)
+        LVL1MenuItem('L1_LHCF_UNPAIRED_ISO').setLogic( NIMLHCF & unpaired_isocond).setTriggerType(TT.nim)
+        LVL1MenuItem('L1_LHCF_EMPTY').setLogic( NIMLHCF & cosmiccond).setTriggerType(TT.nim)
+        
+        # ALFA 
+
+        # LUT 22 (12 Outputs)
+        # ALFA LUT output #1-8 are the single thresholds
+        ALFA_ANY_A    = ALFA_B7L1U | ALFA_B7L1L | ALFA_A7L1U | ALFA_A7L1L  #  9
+        ALFA_ANY_C    = ALFA_A7R1U | ALFA_A7R1L | ALFA_B7R1U | ALFA_B7R1L  # 10
+        ALFA_ANY_U    = ALFA_B7L1U | ALFA_A7L1U | ALFA_A7R1U | ALFA_B7R1U  # 11
+        ALFA_ANY_L    = ALFA_A7R1L | ALFA_B7R1L | ALFA_B7L1L | ALFA_A7L1L  # 12
+
+        # LUT 23 (12 Outputs)
+        ALFA_LU       = ALFA2_A7L1U | ALFA2_B7L1U #  0
+        ALFA_RL       = ALFA2_A7R1L | ALFA2_B7R1L #  1
+        ALFA_LL       = ALFA2_B7L1L | ALFA2_A7L1L #  2
+        ALFA_RU       = ALFA2_A7R1U | ALFA2_B7R1U #  3
+
+        ALFA_A_UL_AA  = ALFA2_A7L1L | ALFA2_A7L1U #  4
+        ALFA_A_UL_AB  = ALFA2_A7L1U | ALFA2_B7L1L #  5
+        ALFA_A_UL_BA  = ALFA2_A7L1L | ALFA2_B7L1U #  6
+        ALFA_A_UL_BB  = ALFA2_B7L1L | ALFA2_B7L1U #  7
+
+        ALFA_C_UL_AA  = ALFA2_A7R1L | ALFA2_A7R1U #  8
+        ALFA_C_UL_AB  = ALFA2_A7R1U | ALFA2_B7R1L #  9
+        ALFA_C_UL_BA  = ALFA2_A7R1L | ALFA2_B7R1U # 10
+        ALFA_C_UL_BB  = ALFA2_B7R1L | ALFA2_B7R1U # 11
+
+        # LUT 24 (9 Outputs)
+        ALFA_ANY          = ALFA3_B7L1U | ALFA3_B7L1L | ALFA3_A7L1U | ALFA3_A7L1L | ALFA3_A7R1U | ALFA3_A7R1L | ALFA3_B7R1U | ALFA3_B7R1L # 0
+        NOT_ALFA_ANY_A    = Not(ALFA3_B7L1U | ALFA3_B7L1L | ALFA3_A7L1U | ALFA3_A7L1L)  #  1-4
+        NOT_ALFA_ANY_C    = Not(ALFA3_A7R1U | ALFA3_A7R1L | ALFA3_B7R1U | ALFA3_B7R1L)  #  5-8
+
+        # LUT 25 (4 outputs)
+        ALFA_AE1          = ALFA4_B7L1U | ALFA4_A7L1U | ALFA4_B7L1L | ALFA4_A7L1L
+        ALFA_AE2          = ALFA4_B7L1U | ALFA4_A7L1U | ALFA4_A7R1L | ALFA4_B7R1L
+        ALFA_AE3          = ALFA4_A7R1U | ALFA4_B7R1U | ALFA4_B7L1L | ALFA4_A7L1L
+        ALFA_AE4          = ALFA4_A7R1U | ALFA4_B7R1U | ALFA4_A7R1L | ALFA4_B7R1L
+
+
+        # further simplification (in CAM)
+        ALFA_A            = ALFA_A_UL_AA & ALFA_A_UL_AB & ALFA_A_UL_BA & ALFA_A_UL_BB
+        ALFA_C            = ALFA_C_UL_AA & ALFA_C_UL_AB & ALFA_C_UL_BA & ALFA_C_UL_BB
+        ALFA_ELASTIC      = ALFA_ANY_A & ALFA_ANY_C & ALFA_ANY_U & ALFA_ANY_L
+        ALFA_EINE         = ALFA_ANY_A & ALFA_ANY_C
+        ALFA_ANTI_ELASTIC = ALFA_AE1 & ALFA_AE2 & ALFA_AE3 & ALFA_AE4
+
+
+        MBTS_INNER = (MBTS_A0 | MBTS_A1 |  MBTS_A2 | MBTS_A3 | MBTS_A4 | MBTS_A5 | MBTS_A6 | MBTS_A7 | MBTS_C0 | MBTS_C1 | MBTS_C2 | MBTS_C3 | MBTS_C4 | MBTS_C5 | MBTS_C6 | MBTS_C7)         
+
+        ## AFP and ALFA
+        # AFP_C =  ((AFP_FSC | AFP_NSC) |  (AFP_FSC & AFP_NSC ))
+        # LVL1MenuItem('L1_AFP_C_MBTS_A').setLogic( AFP_C & MBTS_A & physcond )
+        # LVL1MenuItem('L1_AFP_C_ZDC_C').setLogic( AFP_C & ZDC_C & physcond )
+        # LVL1MenuItem('L1_AFP_C_J12').setLogic( AFP_C & J12 & physcond )# available lowest J threshold in the current v6 menu: J12 
+        # LVL1MenuItem('L1_AFP_C_EM3').setLogic( AFP_C & EM3 & physcond )
+        # LVL1MenuItem('L1_AFP_C_TE5').setLogic( AFP_C & TE5 & physcond )
+        # LVL1MenuItem('L1_AFP_C_ALFA_C').setLogic( AFP_C &  ALFA_C & physcond )
+        # LVL1MenuItem('L1_AFP_C_ALFA_A').setLogic( AFP_C &  ALFA_A & physcond )
+
+        AFP_C =  (AFP_FSC & AFP_NSC)
+        LVL1MenuItem('L1_AFP_C_MBTS_A').setLogic( AFP_C & MBTS_A & physcond )
+        LVL1MenuItem('L1_AFP_C_ZDC_C').setLogic( AFP_C & ZDC_C & physcond )
+        LVL1MenuItem('L1_AFP_C_J12').setLogic( AFP_C & J12 & physcond )
+        LVL1MenuItem('L1_AFP_C_EM3').setLogic( AFP_C & EM3 & physcond )
+        LVL1MenuItem('L1_AFP_C_MU4').setLogic( AFP_C & MU4 & physcond )
+        LVL1MenuItem('L1_AFP_C_TE5').setLogic( AFP_C & TE5 & physcond )
+        LVL1MenuItem('L1_AFP_C_ALFA_C').setLogic( AFP_C &  ALFA_C & physcond )
+        LVL1MenuItem('L1_AFP_C_ALFA_A').setLogic( AFP_C &  ALFA_A & physcond )
+        LVL1MenuItem('L1_AFP_C_ANY_MBTS_A').setLogic( (AFP_FSC | AFP_NSC) & MBTS_A & physcond )
+
+        ## ALFA Single items
+        LVL1MenuItem('L1_ALFA_B7L1U').setLogic(ALFA_B7L1U & BGRP0).setTriggerType(TT.alfa)
+        LVL1MenuItem('L1_ALFA_B7L1L').setLogic(ALFA_B7L1L & BGRP0).setTriggerType(TT.alfa)
+        LVL1MenuItem('L1_ALFA_A7L1U').setLogic(ALFA_A7L1U & BGRP0).setTriggerType(TT.alfa)
+        LVL1MenuItem('L1_ALFA_A7L1L').setLogic(ALFA_A7L1L & BGRP0).setTriggerType(TT.alfa)
+        LVL1MenuItem('L1_ALFA_A7R1U').setLogic(ALFA_A7R1U & BGRP0).setTriggerType(TT.alfa)
+        LVL1MenuItem('L1_ALFA_A7R1L').setLogic(ALFA_A7R1L & BGRP0).setTriggerType(TT.alfa)
+        LVL1MenuItem('L1_ALFA_B7R1U').setLogic(ALFA_B7R1U & BGRP0).setTriggerType(TT.alfa)
+        LVL1MenuItem('L1_ALFA_B7R1L').setLogic(ALFA_B7R1L & BGRP0).setTriggerType(TT.alfa)
+
+
+        LVL1MenuItem('L1_ALFA_ELAST1').setLogic( ALFA_B7L1U & ALFA_A7L1U & ALFA_A7R1L & ALFA_B7R1L &
+                                                 Not(ALFA3_B7L1L | ALFA3_A7L1L | ALFA3_A7R1U | ALFA3_B7R1U)
+                                                 & physcond).setTriggerType(TT.alfa)
+        
+        LVL1MenuItem('L1_ALFA_ELAST2').setLogic( ALFA_B7L1L & ALFA_A7L1L & ALFA_A7R1U & ALFA_B7R1U &
+                                                 Not(ALFA3_B7L1U | ALFA3_A7L1U | ALFA3_A7R1L | ALFA3_B7R1L)
+                                                 & physcond).setTriggerType(TT.alfa)
+        
+        LVL1MenuItem('L1_ALFA_ELAST11').setLogic( ALFA_B7L1U & ALFA_A7L1U & ALFA_A7R1L & ALFA_B7R1L    & physcond).setTriggerType(TT.alfa)
+        LVL1MenuItem('L1_ALFA_ELAST12').setLogic( ALFA_B7L1L & ALFA_A7L1L & ALFA_A7R1U & ALFA_B7R1U    & physcond).setTriggerType(TT.alfa)
+        LVL1MenuItem('L1_ALFA_ELAST13').setLogic( ALFA_LU & (ALFA_A7R1L & ALFA_B7R1L)                  & physcond).setTriggerType(TT.alfa)
+        LVL1MenuItem('L1_ALFA_ELAST14').setLogic( (ALFA_B7L1U & ALFA_A7L1U) & ALFA_RL & physcond).setTriggerType(TT.alfa)
+        LVL1MenuItem('L1_ALFA_ELAST15').setLogic( ALFA_LU & ALFA_RL & physcond).setTriggerType(TT.alfa)
+        LVL1MenuItem('L1_ALFA_ELAST15_Calib').setLogic( ALFA_LU & ALFA_RL &  alfacalib).setTriggerType(TT.alfa) ## CHECK
+        LVL1MenuItem('L1_ALFA_ELAST16').setLogic( ALFA_LL & (ALFA_A7R1U & ALFA_B7R1U) & physcond).setTriggerType(TT.alfa)
+        LVL1MenuItem('L1_ALFA_ELAST17').setLogic((ALFA_B7L1L & ALFA_A7L1L) & ALFA_RU & physcond).setTriggerType(TT.alfa)
+        LVL1MenuItem('L1_ALFA_ELAST18').setLogic( ALFA_LL & ALFA_RU & physcond).setTriggerType(TT.alfa)
+        LVL1MenuItem('L1_ALFA_ELAST18_Calib').setLogic( ALFA_LL & ALFA_RU & alfacalib).setTriggerType(TT.alfa)
+
+
+        LVL1MenuItem('L1_ALFA_SDIFF1').setLogic( ALFA_B7L1U & ALFA_A7L1U &
+                                                 Not(ALFA3_B7L1L | ALFA3_A7L1L | ALFA3_A7R1U | ALFA3_A7R1L | ALFA3_B7R1U | ALFA3_B7R1L)
+                                                 & physcond).setTriggerType(TT.alfa)
+        
+        LVL1MenuItem('L1_ALFA_SDIFF2').setLogic( ALFA_A7R1L & ALFA_B7R1L &
+                                                 Not(ALFA3_B7L1U | ALFA3_B7L1L | ALFA3_A7L1U | ALFA3_A7L1L | ALFA3_A7R1U | ALFA3_B7R1U)
+                                                 & physcond).setTriggerType(TT.alfa)
+         
+        LVL1MenuItem('L1_ALFA_SDIFF3').setLogic( ALFA_B7L1L & ALFA_A7L1L &
+                                                 Not(ALFA3_B7L1U | ALFA3_A7L1U | ALFA3_A7R1U | ALFA3_A7R1L | ALFA3_B7R1U | ALFA3_B7R1L)
+                                                 & physcond).setTriggerType(TT.alfa)
+         
+        LVL1MenuItem('L1_ALFA_SDIFF4').setLogic( ALFA_A7R1U & ALFA_B7R1U &
+                                                 Not(ALFA3_B7L1U | ALFA3_B7L1L | ALFA3_A7L1U | ALFA3_A7L1L | ALFA3_A7R1L | ALFA3_B7R1L)
+                                                 & physcond).setTriggerType(TT.alfa)
+
+        LVL1MenuItem('L1_ALFA_SDIFF5').setLogic( ALFA_B7L1U & ALFA_A7L1U &  physcond).setTriggerType(TT.alfa) 
+        LVL1MenuItem('L1_ALFA_SDIFF6').setLogic( ALFA_A7R1L & ALFA_B7R1L &  physcond).setTriggerType(TT.alfa) 
+        LVL1MenuItem('L1_ALFA_SDIFF7').setLogic( ALFA_B7L1L & ALFA_A7L1L &  physcond).setTriggerType(TT.alfa) 
+        LVL1MenuItem('L1_ALFA_SDIFF8').setLogic( ALFA_A7R1U & ALFA_B7R1U &  physcond).setTriggerType(TT.alfa) 
+                                                           
+        LVL1MenuItem('L1_MBTS_1_A_ALFA_C').setLogic( MBTS_A & ALFA_C  & physcond).setTriggerType(TT.alfa) 
+        LVL1MenuItem('L1_MBTS_1_C_ALFA_A').setLogic( MBTS_C & ALFA_A & physcond).setTriggerType(TT.alfa)        
+        LVL1MenuItem('L1_MBTS_1_A_ALFA_C_UNPAIRED_ISO').setLogic( MBTS_A & ALFA_C & unpaired_isocond).setTriggerType(TT.alfa) 
+        LVL1MenuItem('L1_MBTS_1_C_ALFA_A_UNPAIRED_ISO').setLogic( MBTS_C & ALFA_A & unpaired_isocond).setTriggerType(TT.alfa)        
+        LVL1MenuItem('L1_MBTS_1_ALFA_ANY').setLogic( MBTS_1 & ALFA_ANY  & physcond).setTriggerType(TT.alfa) ##should be called L1_MBTS_1_ALFA_ANY                          
+
+        ## check definition of MBTS_2
+        LVL1MenuItem('L1_MBTS_2_A_ALFA_C').setLogic( MBTS_A.x(2) & ALFA_C & physcond).setTriggerType(TT.alfa) 
+        LVL1MenuItem('L1_MBTS_2_C_ALFA_A').setLogic( MBTS_C.x(2) & ALFA_A & physcond).setTriggerType(TT.alfa)        
+        LVL1MenuItem('L1_MBTS_2_A_ALFA_C_UNPAIRED_ISO').setLogic( MBTS_A.x(2) & ALFA_C & unpaired_isocond).setTriggerType(TT.alfa) 
+        LVL1MenuItem('L1_MBTS_2_C_ALFA_A_UNPAIRED_ISO').setLogic( MBTS_C.x(2) & ALFA_A & unpaired_isocond).setTriggerType(TT.alfa)        
+        LVL1MenuItem('L1_MBTS_2_ALFA').setLogic( MBTS_2 & ALFA_ANY & physcond).setTriggerType(TT.alfa)              
+        
+        LVL1MenuItem('L1_LUCID_A_ALFA_C').setLogic( LUCID_A & ALFA_C & physcond).setTriggerType(TT.alfa) 
+        LVL1MenuItem('L1_LUCID_C_ALFA_A').setLogic( LUCID_C & ALFA_A & physcond).setTriggerType(TT.alfa)     
+        LVL1MenuItem('L1_LUCID_A_ALFA_C_UNPAIRED_ISO').setLogic( LUCID_A & ALFA_C & unpaired_isocond).setTriggerType(TT.alfa) 
+        LVL1MenuItem('L1_LUCID_C_ALFA_A_UNPAIRED_ISO').setLogic( LUCID_C & ALFA_A & unpaired_isocond).setTriggerType(TT.alfa) 
+        LVL1MenuItem('L1_LUCID_ALFA').setLogic( (LUCID_A | LUCID_C) & ALFA_ANY & physcond).setTriggerType(TT.alfa) 
+        
+        #LVL1MenuItem('L1_ZDC_A_ALFA_C').setLogic( ZDC_A  & ALFA_C & physcond).setTriggerType(TT.alfa) 
+        #LVL1MenuItem('L1_ZDC_C_ALFA_A').setLogic( ZDC_C  & ALFA_A & physcond).setTriggerType(TT.alfa)     
+        #LVL1MenuItem('L1_ZDC_ALFA').setLogic( (ZDC_A | ZDC_C) & ALFA_ANY & physcond).setTriggerType(TT.alfa) 
+        
+        LVL1MenuItem('L1_EM3_ALFA_ANY'             ).setLogic( EM3 & ALFA_ANY & physcond).setTriggerType(TT.alfa)
+        LVL1MenuItem('L1_EM3_ALFA_ANY_UNPAIRED_ISO').setLogic( EM3 & ALFA_ANY & unpaired_isocond).setTriggerType(TT.alfa)
+        LVL1MenuItem('L1_EM3_ALFA_ANY_VETO_MBTS' ).setLogic( EM3 & ALFA_ANY  & Not(MBTS_INNER) & physcond).setTriggerType(TT.alfa)
+        LVL1MenuItem('L1_EM3_ALFA_EINE'          ).setLogic( EM3 & ALFA_EINE & physcond).setTriggerType(TT.alfa)
+        LVL1MenuItem('L1_EM3_ALFA_EINE_VETO_MBTS').setLogic( EM3 & ALFA_EINE & Not(MBTS_INNER) & physcond).setTriggerType(TT.alfa)
+        LVL1MenuItem('L1_EM3_ALFA_MBTS_A'             ).setLogic( EM3 & MBTS_A & ALFA_ANY_A & physcond).setTriggerType(TT.alfa)
+        LVL1MenuItem('L1_EM3_ALFA_MBTS_C'             ).setLogic( EM3 & MBTS_C & ALFA_ANY_C & physcond).setTriggerType(TT.alfa)
+        LVL1MenuItem('L1_EM3_ALFA_MBTS_A_UNPAIRED_ISO').setLogic( EM3 & MBTS_A & ALFA_ANY_A & unpaired_isocond).setTriggerType(TT.alfa)
+        LVL1MenuItem('L1_EM3_ALFA_MBTS_C_UNPAIRED_ISO').setLogic( EM3 & MBTS_A & ALFA_ANY_C & unpaired_isocond).setTriggerType(TT.alfa)
+        
+        LVL1MenuItem('L1_J12_ALFA_ANY'             ).setLogic( J12 & ALFA_ANY & physcond).setTriggerType(TT.alfa)
+        LVL1MenuItem('L1_J12_ALFA_ANY_UNPAIRED_ISO').setLogic( J12 & ALFA_ANY & unpaired_isocond).setTriggerType(TT.alfa)
+
+        LVL1MenuItem('L1_TE5_ALFA_ANY'             ).setLogic( TE5 & ALFA_ANY  & physcond).setTriggerType(TT.alfa)
+        LVL1MenuItem('L1_TE5_ALFA_ANY_UNPAIRED_ISO').setLogic( TE5 & ALFA_ANY  & unpaired_isocond).setTriggerType(TT.alfa)
+        LVL1MenuItem('L1_TE5_ALFA_EINE'            ).setLogic( TE5 & ALFA_EINE & physcond).setTriggerType(TT.alfa)
+        
+        LVL1MenuItem('L1_TRT_ALFA_ANY'             ).setLogic( NIMTRT & ALFA_ANY & physcond).setTriggerType(TT.alfa)
+        LVL1MenuItem('L1_TRT_ALFA_ANY_UNPAIRED_ISO').setLogic( NIMTRT & ALFA_ANY & unpaired_isocond).setTriggerType(TT.alfa)
+                   
+        LVL1MenuItem('L1_TRT_ALFA_ANY_VETO_MBTS'           ).setLogic( NIMTRT & Not(MBTS_INNER) & ALFA_ANY & physcond).setTriggerType(TT.alfa)
+
+        LVL1MenuItem('L1_TRT_ALFA_EINE'                    ).setLogic( NIMTRT & ALFA_EINE & physcond).setTriggerType(TT.alfa)
+        LVL1MenuItem('L1_TRT_ALFA_EINE_VETO_MBTS'          ).setLogic( NIMTRT & Not(MBTS_INNER) & ALFA_EINE & physcond).setTriggerType(TT.alfa)
+        
+        LVL1MenuItem('L1_ALFA_ELASTIC_VETO_MBTS'                  ).setLogic( Not(MBTS_INNER) & ALFA_ELASTIC & physcond).setTriggerType(TT.alfa)
+        LVL1MenuItem('L1_ALFA_ELASTIC_UNPAIRED_ISO'               ).setLogic( ALFA_ELASTIC & unpaired_isocond).setTriggerType(TT.alfa)
+
+        LVL1MenuItem('L1_ALFA_ANTI_ELASTIC_VETO_MBTS'             ).setLogic( Not(MBTS_INNER) & ALFA_ANTI_ELASTIC & physcond).setTriggerType(TT.alfa)
+        LVL1MenuItem('L1_ALFA_ANTI_ELASTIC_UNPAIRED_ISO').setLogic( ALFA_ANTI_ELASTIC & unpaired_isocond).setTriggerType(TT.alfa)
+
+        LVL1MenuItem('L1_ALFA_ANY_VETO_MBTS'                      ).setLogic( Not(MBTS_INNER) & ALFA_ANY & physcond).setTriggerType(TT.alfa)
+        LVL1MenuItem('L1_ALFA_ANY_VETO_MBTS_UNPAIRED_ISO'         ).setLogic( Not(MBTS_INNER) & ALFA_ANY & unpaired_isocond).setTriggerType(TT.alfa)
+                
+        LVL1MenuItem('L1_LHCF_ALFA_ANY_A'             ).setLogic( NIMLHCF & ALFA_ANY_A & physcond).setTriggerType(TT.alfa)
+        LVL1MenuItem('L1_LHCF_ALFA_ANY_C'             ).setLogic( NIMLHCF & ALFA_ANY_C & physcond).setTriggerType(TT.alfa)
+        LVL1MenuItem('L1_LHCF_ALFA_ANY_A_UNPAIRED_ISO').setLogic( NIMLHCF & ALFA_ANY_A & unpaired_isocond).setTriggerType(TT.alfa)
+        LVL1MenuItem('L1_LHCF_ALFA_ANY_C_UNPAIRED_ISO').setLogic( NIMLHCF & ALFA_ANY_C & unpaired_isocond).setTriggerType(TT.alfa)
+        
+        LVL1MenuItem('L1_ALFA_BGT' ).setLogic(RNDM3 & physcond).setTriggerType(TT.alfa)
+        LVL1MenuItem('L1_ALFA_BGT_UNPAIRED_ISO' ).setLogic(RNDM3 & unpaired_isocond).setTriggerType(TT.alfa)
+        LVL1MenuItem('L1_ALFA_BGT_BGRP10').setLogic(RNDM3 & alfacalib).setTriggerType(TT.alfa)
+
+        LVL1MenuItem('L1_ALFA_SHOWSYST5').setLogic( (ALFA_ANY_A & ALFA_ANY_C) & physcond).setTriggerType(TT.alfa)
+
+        LVL1MenuItem('L1_ALFA_SYST9' ).setLogic( ALFA_B7L1U & ALFA_A7L1U & ALFA_A7R1U & ALFA_B7R1U & Not(ALFA3_B7L1L | ALFA3_A7L1L | ALFA3_A7R1L | ALFA3_B7R1L) & physcond).setTriggerType(TT.alfa)
+        LVL1MenuItem('L1_ALFA_SYST10').setLogic( ALFA_B7L1L & ALFA_A7L1L & ALFA_A7R1L & ALFA_B7R1L & Not(ALFA3_B7L1U | ALFA3_A7L1U | ALFA3_A7R1U | ALFA3_B7R1U) & physcond).setTriggerType(TT.alfa)
+        LVL1MenuItem('L1_ALFA_SYST11').setLogic( ALFA_B7L1U & ALFA_A7L1U & ALFA_A7R1U & ALFA_B7R1U & physcond).setTriggerType(TT.alfa)
+        LVL1MenuItem('L1_ALFA_SYST12').setLogic( ALFA_B7L1L & ALFA_A7L1L & ALFA_A7R1L & ALFA_B7R1L & physcond).setTriggerType(TT.alfa)
+        LVL1MenuItem('L1_ALFA_SYST17').setLogic( ALFA_LU & ALFA_RU & physcond).setTriggerType(TT.alfa)
+        LVL1MenuItem('L1_ALFA_SYST18').setLogic( ALFA_LL & ALFA_RL & physcond).setTriggerType(TT.alfa)
+       
+        LVL1MenuItem('L1_ALFA_ANY').setLogic(ALFA_ANY & physcond).setTriggerType(TT.alfa)
+        
+        LVL1MenuItem('L1_ALFA_ANY_EMPTY').setLogic(ALFA_ANY & cosmiccond).setTriggerType(TT.alfa)
+        LVL1MenuItem('L1_ALFA_ANY_FIRSTEMPTY').setLogic(ALFA_ANY & firstempty).setTriggerType(TT.alfa)
+        LVL1MenuItem('L1_ALFA_ANY_UNPAIRED_ISO').setLogic(ALFA_ANY & unpaired_isocond).setTriggerType(TT.alfa)
+        LVL1MenuItem('L1_ALFA_ANY_UNPAIRED_NONISO').setLogic(ALFA_ANY & unpaired_nonisocond).setTriggerType(TT.alfa)
+        LVL1MenuItem('L1_ALFA_ANY_BGRP10').setLogic(ALFA_ANY & alfacalib).setTriggerType(TT.alfa)
+        LVL1MenuItem('L1_ALFA_ANY_ABORTGAPNOTCALIB').setLogic( ALFA_ANY & abortgap).setTriggerType(TT.alfa)
+        LVL1MenuItem('L1_ALFA_ANY_CALIB').setLogic( ALFA_ANY & calibcond).setTriggerType(TT.alfa)
+
+        LVL1MenuItem('L1_ALFA_ANY_A_EMPTY').setLogic(ALFA_ANY_A & cosmiccond).setTriggerType(TT.alfa)
+        LVL1MenuItem('L1_ALFA_ANY_C_EMPTY').setLogic(ALFA_ANY_C & cosmiccond).setTriggerType(TT.alfa)
+
+        ## ALFA _OD items (LUT 26, 12 Outputs)
+        LVL1MenuItem('L1_ALFA_B7L1U_OD').setLogic(ALFA_B7L1U_OD & BGRP0).setTriggerType(TT.alfa)
+        LVL1MenuItem('L1_ALFA_B7L1L_OD').setLogic(ALFA_B7L1L_OD & BGRP0).setTriggerType(TT.alfa)
+        LVL1MenuItem('L1_ALFA_A7L1U_OD').setLogic(ALFA_A7L1U_OD & BGRP0).setTriggerType(TT.alfa)
+        LVL1MenuItem('L1_ALFA_A7L1L_OD').setLogic(ALFA_A7L1L_OD & BGRP0).setTriggerType(TT.alfa)
+        LVL1MenuItem('L1_ALFA_A7R1U_OD').setLogic(ALFA_A7R1U_OD & BGRP0).setTriggerType(TT.alfa)
+        LVL1MenuItem('L1_ALFA_A7R1L_OD').setLogic(ALFA_A7R1L_OD & BGRP0).setTriggerType(TT.alfa)
+        LVL1MenuItem('L1_ALFA_B7R1U_OD').setLogic(ALFA_B7R1U_OD & BGRP0).setTriggerType(TT.alfa)
+        LVL1MenuItem('L1_ALFA_B7R1L_OD').setLogic(ALFA_B7R1L_OD & BGRP0).setTriggerType(TT.alfa)
+
+        LVL1MenuItem('L1_ALFA_B7L1_OD').setLogic( (ALFA_B7L1U_OD & ALFA_B7L1L_OD) & BGRP0).setTriggerType(TT.alfa)
+        LVL1MenuItem('L1_ALFA_A7L1_OD').setLogic( (ALFA_A7L1U_OD & ALFA_A7L1L_OD) & BGRP0).setTriggerType(TT.alfa)
+        LVL1MenuItem('L1_ALFA_B7R1_OD').setLogic( (ALFA_B7R1U_OD & ALFA_B7R1L_OD) & BGRP0).setTriggerType(TT.alfa)
+        LVL1MenuItem('L1_ALFA_A7R1_OD').setLogic( (ALFA_A7R1U_OD & ALFA_A7R1L_OD) & BGRP0).setTriggerType(TT.alfa)
+
+        #if (('Physics_HI_v3' not in TriggerFlags.triggerMenuSetup()) and ('MC_HI_v3' not in TriggerFlags.triggerMenuSetup())):
+            # Topo items (keep them all together)
+        #if not 'HI' in TriggerFlags.triggerMenuSetup():
+        #now also HI jets
+        if 1:
+            try:
+
+                    # M8 menu
+                    #LVL1MenuItem('L1_MJJ-4').setLogic( TOPO_4INVM9999_AJ0s6_AJ0s6 & physcond)
+                    #LVL1MenuItem('L1_MJJ-3').setLogic( TOPO_3INVM9999_AJ0s6_AJ0s6 & physcond)
+                    #LVL1MenuItem('L1_MJJ-2').setLogic( TOPO_2INVM9999_AJ0s6_AJ0s6 & physcond)
+                    #LVL1MenuItem('L1_MJJ-1').setLogic( TOPO_1INVM9999_AJ0s6_AJ0s6 & physcond)
+
+                    #LVL1MenuItem('L1_HT200-J20s5.ETA49').setLogic( TOPO_HT200_AJ20s5ETA49 & physcond)
+                    #LVL1MenuItem('L1_HT190-J20s5.ETA49').setLogic( TOPO_HT190_AJ20s5ETA49 & physcond)
+                    #LVL1MenuItem('L1_HT1-J0.ETA49').setLogic( TOPO_HT1_AJ0allETA49 & physcond)
+
+                    # LVL1MenuItem('L1_JPSI-1M5-EM6').setLogic( TOPO_1INVM5_EM6s2_EMall & physcond)
+                    #LVL1MenuItem('L1_JPSI-1M5-EMs').setLogic( TOPO_1INVM5_EMs2_EMs & physcond)
+                    #LVL1MenuItem('L1_JPSI-1M5-EM6s').setLogic( TOPO_1INVM5_EM6s2_EMs & physcond)
+                    #LVL1MenuItem('L1_JPSI-1M5-EM12s').setLogic( TOPO_1INVM5_EM12s2_EMs & physcond)
+
+                    ### NOT WORKING due to acceptaed number of bits in TOPO1
+                    LVL1MenuItem("L1_2MU4-BO"     ).setLogic( TOPO_MULT_CMU4ab.x(2) & physcond)
+                    LVL1MenuItem("L1_2MU6-BO"     ).setLogic( TOPO_MULT_CMU6ab.x(2) & physcond)
+                    LVL1MenuItem("L1_MU6MU4-BO").setLogic( TOPO_MULT_CMU4ab.x(2) & TOPO_MULT_CMU6ab & physcond)
+
+                    # B-jet
+                    LVL1MenuItem('L1_BTAG-MU4J15').setLogic( TOPO_0DR04_MU4ab_CJ15ab & physcond)
+                    LVL1MenuItem('L1_BTAG-MU4J30').setLogic( TOPO_0DR04_MU4ab_CJ30ab & physcond)
+                    LVL1MenuItem('L1_BTAG-MU6J20').setLogic( TOPO_0DR04_MU6ab_CJ20ab & physcond)
+                    LVL1MenuItem('L1_BTAG-MU6J25').setLogic( TOPO_0DR04_MU6ab_CJ25ab & physcond)
+                    LVL1MenuItem('L1_BTAG-MU4J20').setLogic( TOPO_0DR04_MU4ab_CJ20ab & physcond)
+                    LVL1MenuItem('L1_3J15_BTAG-MU4J15').setLogic( J15.x(3) & TOPO_0DR04_MU4ab_CJ15ab & physcond)
+                    LVL1MenuItem('L1_3J15_BTAG-MU4J30').setLogic( J15.x(3) & TOPO_0DR04_MU4ab_CJ30ab & physcond)
+                    LVL1MenuItem('L1_3J15_BTAG-MU6J25').setLogic( J15.x(3) & TOPO_0DR04_MU6ab_CJ25ab & physcond)
+                    LVL1MenuItem('L1_3J20_BTAG-MU4J20').setLogic( J20.x(3) & TOPO_0DR04_MU4ab_CJ20ab & physcond)
+                    #LVL1MenuItem('L1_3J20_BTAG-MU4J30').setLogic( J20.x(3) & TOPO_0DR04_MU4ab_CJ30ab & physcond)
+                    #LVL1MenuItem('L1_3J20_BTAG-MU6J25').setLogic( J20.x(3) & TOPO_0DR04_MU6ab_CJ25ab & physcond)
+
+                    # ZH
+                    LVL1MenuItem('L1_DPHI-AJ20s2XE50'  ).setLogic( TOPO_10MINDPHI_AJ20s2_XE50    & physcond)
+
+                    #LVL1MenuItem('L1_J40_DPHI-Js2XE50'  ).setLogic( J40 & TOPO_10MINDPHI_Js2_XE50    & physcond) 
+                    LVL1MenuItem('L1_J40_DPHI-J20s2XE50').setLogic( J40 & TOPO_10MINDPHI_J20s2_XE50  & physcond) 
+                    LVL1MenuItem('L1_J40_DPHI-J20s2XE30').setLogic( J40 & TOPO_10MINDPHI_J20s2_XE30  & physcond)
+                    LVL1MenuItem('L1_MU4_J20_XE30_DPHI-J20s2XE30').setLogic( MU4 & J20 & XE30 & TOPO_10MINDPHI_J20s2_XE30  & physcond)
+                    LVL1MenuItem('L1_2MU4_J20_XE30_DPHI-J20s2XE30').setLogic( MU4.x(2) & J20 & XE30 & TOPO_10MINDPHI_J20s2_XE30  & physcond)
+                    LVL1MenuItem('L1_MU4_2EM3_J20_XE30_DPHI-J20s2XE30').setLogic( MU4 & EM3.x(2) & J20 & XE30 & TOPO_10MINDPHI_J20s2_XE30  & physcond)
+                    LVL1MenuItem('L1_3EM3_J40_XE50_DPHI-J20s2XE50').setLogic( EM3.x(3) & J40 & XE50 & TOPO_10MINDPHI_J20s2_XE50  & physcond)
+
+
+                    LVL1MenuItem('L1_J40_XE50_DPHI-J20s2XE50').setLogic( J40 & XE50 & TOPO_10MINDPHI_J20s2_XE50  & physcond) 
+                    LVL1MenuItem('L1_J40_DPHI-J20XE50'  ).setLogic( J40 & TOPO_10MINDPHI_J20ab_XE50  & physcond) 
+                    LVL1MenuItem('L1_J40_DPHI-CJ20XE50' ).setLogic( J40 & TOPO_10MINDPHI_CJ20ab_XE50 & physcond) 
+
+                    # HT
+                    #LVL1MenuItem('L1_HT0-J0.ETA49'     ).setLogic( TOPO_HT0_AJ0allETA49    & physcond)
+                    LVL1MenuItem('L1_HT190-J15.ETA21'  ).setLogic( TOPO_HT190_AJ15allETA21 & physcond)
+                    LVL1MenuItem('L1_HT190-J15s5.ETA21').setLogic( TOPO_HT190_J15s5ETA21   & physcond)
+                    LVL1MenuItem('L1_HT150-J20.ETA31'  ).setLogic( TOPO_HT150_AJ20allETA31 & physcond)
+                    LVL1MenuItem('L1_HT150-J20s5.ETA31').setLogic( TOPO_HT150_J20s5ETA31   & physcond)
+
+
+                    LVL1MenuItem('L1_HT150-J20s5.ETA31_MJJ-400').setLogic( TOPO_HT150_J20s5ETA31 & TOPO_400INVM9999_AJ30s6_AJ20s6 & physcond)# new
+                    LVL1MenuItem('L1_HT150-J20s5.ETA31_MJJ-400-CF').setLogic( TOPO_HT150_J20s5ETA31 & TOPO_400INVM9999_AJ30s6ETA31_AJ20s631ETA49 & physcond) #new 
+                    # Jpsi T&P
+                    LVL1MenuItem("L1_JPSI-1M5"     ).setLogic( TOPO_1INVM5_EMs1_EMs6   & physcond)
+                    LVL1MenuItem("L1_JPSI-1M5-EM7" ).setLogic( TOPO_1INVM5_EM7s1_EMs6  & physcond)
+                    LVL1MenuItem("L1_JPSI-1M5-EM12").setLogic( TOPO_1INVM5_EM12s1_EMs6 & physcond)
+
+                    # # W T&P
+                    # if not '_v6' in TriggerFlags.triggerMenuSetup():
+                    #     LVL1MenuItem("L1_W-05DPHI-JXE-0"   ).setLogic( TOPO_05MINDPHI_AJj20s6_XE0 & physcond)
+                    #     LVL1MenuItem("L1_W-10DPHI-JXE-0"   ).setLogic( TOPO_10MINDPHI_AJj20s6_XE0 & physcond)
+                    #     LVL1MenuItem("L1_W-15DPHI-JXE-0"   ).setLogic( TOPO_15MINDPHI_AJj20s6_XE0 & physcond)
+                    #     LVL1MenuItem("L1_W-10DPHI-EMXE-0"  ).setLogic( TOPO_10MINDPHI_EM10s6_XE0  & physcond)
+                    #     LVL1MenuItem("L1_W-15DPHI-EMXE-0"  ).setLogic( TOPO_15MINDPHI_EM10s6_XE0  & physcond)
+                    #     LVL1MenuItem("L1_W-05DPHI-EMXE-1"  ).setLogic( TOPO_05MINDPHI_EM15s6_XE0  & physcond)
+                    #     LVL1MenuItem("L1_W-05RO-XEHT-0"    ).setLogic( TOPO_05RATIO_XE0_HT0_AJj15allETA49   & physcond)
+                    #     LVL1MenuItem("L1_W-08RO-XEHT-0"    ).setLogic( TOPO_08RATIO_XE0_HT0_AJj15allETA49   & physcond)
+                    #     LVL1MenuItem("L1_W-90RO2-XEHT-0"   ).setLogic( TOPO_90RATIO2_XE0_HT0_AJj15allETA49  & physcond)
+                    #     LVL1MenuItem("L1_W-250RO2-XEHT-0"  ).setLogic( TOPO_250RATIO2_XE0_HT0_AJj15allETA49 & physcond)
+                    #     LVL1MenuItem("L1_W-HT20-JJ15.ETA49").setLogic( TOPO_HT20_AJj15allETA49 & physcond)
+                    #     LVL1MenuItem("L1_W-NOMATCH"        ).setLogic( TOPO_NOT_02MATCH_EM10s1_AJj15allETA49 & physcond)
+                    #     LVL1MenuItem("L1_EM10_W-MT25").setLogic( TOPO_25MT_EM10s6_XE0 & EM10 & physcond)
+                    #     LVL1MenuItem("L1_EM10_W-MT30").setLogic( TOPO_30MT_EM10s6_XE0 & EM10 & physcond)
+                    #     LVL1MenuItem("L1_EM15_W-MT35").setLogic( TOPO_35MT_EM15s6_XE0 & EM15 & physcond)
+                    #     LVL1MenuItem("L1_EM10_W-MT25_W-15DPHI-JXE-0_W-15DPHI-EMXE_W-90RO2-XEHT-0" ).setLogic( TOPO_25MT_EM10s6_XE0 & EM10 & TOPO_15MINDPHI_AJj20s6_XE0 & TOPO_15MINDPHI_EM10s6_XE0 & TOPO_90RATIO2_XE0_HT0_AJj15allETA49 & physcond)
+                    #     LVL1MenuItem("L1_EM10_W-MT25_W-15DPHI-JXE-0_W-15DPHI-EMXE_XS30"           ).setLogic( TOPO_25MT_EM10s6_XE0 & EM10 & TOPO_15MINDPHI_AJj20s6_XE0 & TOPO_15MINDPHI_EM10s6_XE0 & XS30 & physcond)
+                    #     LVL1MenuItem("L1_EM10_W-MT25_W-15DPHI-JXE-0_W-15DPHI-EMXE_XS20"           ).setLogic( TOPO_25MT_EM10s6_XE0 & EM10 & TOPO_15MINDPHI_AJj20s6_XE0 & TOPO_15MINDPHI_EM10s6_XE0 & XS20 & physcond)
+                    #     LVL1MenuItem("L1_EM10_W-MT25_W-15DPHI-JXE-0_W-15DPHI-EMXE"                ).setLogic( TOPO_25MT_EM10s6_XE0 & EM10 & TOPO_15MINDPHI_AJj20s6_XE0 & TOPO_15MINDPHI_EM10s6_XE0 & physcond)
+                    #     LVL1MenuItem("L1_EM15_W-MT35_W-05DPHI-JXE-0_W-05DPHI-EMXE_W-250RO2-XEHT-0").setLogic( TOPO_35MT_EM15s6_XE0 & EM15 & TOPO_05MINDPHI_AJj20s6_XE0 & TOPO_05MINDPHI_EM15s6_XE0 & TOPO_250RATIO2_XE0_HT0_AJj15allETA49 & physcond)
+                    #     LVL1MenuItem("L1_EM15_W-MT35_W-05DPHI-JXE-0_W-05DPHI-EMXE_XS60"           ).setLogic( TOPO_35MT_EM15s6_XE0 & EM15 & TOPO_05MINDPHI_AJj20s6_XE0 & TOPO_05MINDPHI_EM15s6_XE0 & XS60 & physcond)
+                    #     LVL1MenuItem("L1_EM15_W-MT35_W-05DPHI-JXE-0_W-05DPHI-EMXE_XS30"           ).setLogic( TOPO_35MT_EM15s6_XE0 & EM15 & TOPO_05MINDPHI_AJj20s6_XE0 & TOPO_05MINDPHI_EM15s6_XE0 & XS30 & physcond)
+                    #     LVL1MenuItem("L1_EM15_W-MT35_W-05DPHI-JXE-0_W-05DPHI-EMXE"                ).setLogic( TOPO_35MT_EM15s6_XE0 & EM15 & TOPO_05MINDPHI_AJj20s6_XE0 & TOPO_05MINDPHI_EM15s6_XE0 & physcond)
+                    #else:
+                    LVL1MenuItem("L1_W-05DPHI-JXE-0"   ).setLogic( TOPO_05MINDPHI_AJj10s6_XE0 & physcond)
+                    LVL1MenuItem("L1_W-10DPHI-JXE-0"   ).setLogic( TOPO_10MINDPHI_AJj10s6_XE0 & physcond)
+                    LVL1MenuItem("L1_W-15DPHI-JXE-0"   ).setLogic( TOPO_15MINDPHI_AJj10s6_XE0 & physcond)
+                    LVL1MenuItem("L1_W-05DPHI-EMXE-1"  ).setLogic( TOPO_05MINDPHI_EM12s6_XE0  & physcond)
+
+                    LVL1MenuItem("L1_W-05DPHI-EM15XE-1"  ).setLogic( TOPO_05MINDPHI_EM15s6_XE0  & physcond)
+
+                    LVL1MenuItem("L1_W-15DPHI-EM15XE-1"  ).setLogic( TOPO_15MINDPHI_EM15s6_XE0  & physcond)
+                    LVL1MenuItem("L1_W-15DPHI-EMXE-1"  ).setLogic( TOPO_15MINDPHI_EM12s6_XE0  & physcond)
+                    LVL1MenuItem("L1_W-05RO-XEHT-0"    ).setLogic( TOPO_05RATIO_XE0_HT0_AJj15allETA49   & physcond)
+                    LVL1MenuItem("L1_W-90RO2-XEHT-0"   ).setLogic( TOPO_90RATIO2_XE0_HT0_AJj15allETA49  & physcond)
+                    LVL1MenuItem("L1_W-250RO2-XEHT-0"  ).setLogic( TOPO_250RATIO2_XE0_HT0_AJj15allETA49 & physcond)
+                    LVL1MenuItem("L1_W-HT20-JJ15.ETA49").setLogic( TOPO_HT20_AJj15allETA49 & physcond)
+                    LVL1MenuItem("L1_W-NOMATCH"        ).setLogic( TOPO_NOT_02MATCH_EM10s1_AJj15allETA49 & physcond)
+                    #LVL1MenuItem("L1_W-NOMATCH_W-05RO-XEEMHT").setLogic( TOPO_NOT_02MATCH_EM10s1_AJj15allETA49 & TOPO_05RATIO_XE0_SUM0_EM10s1_HT0_AJj15allETA49 & physcond)
+                    LVL1MenuItem("L1_EM12_W-MT25").setLogic( TOPO_25MT_EM12s6_XE0 & EM12 & physcond)
+                    #LVL1MenuItem("L1_EM12_W-MT30").setLogic( TOPO_30MT_EM12s6_XE0 & EM12 & physcond)
+                    LVL1MenuItem("L1_EM15_W-MT35").setLogic( TOPO_35MT_EM15s6_XE0 & EM15 & physcond)
+
+                    LVL1MenuItem("L1_EM15_W-MT35_W-250RO2-XEHT-0_W-05DPHI-JXE-0_W-05DPHI-EM15XE" ).setLogic( TOPO_35MT_EM15s6_XE0 & EM15 & TOPO_250RATIO2_XE0_HT0_AJj15allETA49 & TOPO_05MINDPHI_AJj10s6_XE0 & TOPO_05MINDPHI_EM15s6_XE0 & physcond)
+                    LVL1MenuItem("L1_EM15_W-MT35_XS60_W-05DPHI-JXE-0_W-05DPHI-EM15XE"            ).setLogic( TOPO_35MT_EM15s6_XE0 & EM15 & XS60 & TOPO_05MINDPHI_AJj10s6_XE0 & TOPO_05MINDPHI_EM15s6_XE0 & physcond)
+                    LVL1MenuItem("L1_EM15_W-MT35_XS40_W-05DPHI-JXE-0_W-05DPHI-EM15XE"            ).setLogic( TOPO_35MT_EM15s6_XE0 & EM15 & XS40 & TOPO_05MINDPHI_AJj10s6_XE0 & TOPO_05MINDPHI_EM15s6_XE0 & physcond)
+                    LVL1MenuItem("L1_EM15_W-MT35_XS60").setLogic( TOPO_35MT_EM15s6_XE0 & EM15 & XS60 & physcond)
+
+                    LVL1MenuItem("L1_EM15VH_W-MT35_XS60").setLogic( TOPO_35MT_EM15s6_XE0 & EM15VH & XS60 & physcond)
+                    LVL1MenuItem("L1_EM20VH_W-MT35_XS60").setLogic( TOPO_35MT_EM15s6_XE0 & EM20VH & XS60 & physcond)
+                    LVL1MenuItem("L1_EM22VHI_W-MT35_XS40").setLogic( TOPO_35MT_EM15s6_XE0 & EM22VHI & XS40 & physcond)
+
+
+                    
+                    LVL1MenuItem("L1_EM12_W-MT35_XS40_W-05DPHI-JXE-0_W-05DPHI-EMXE"            ).setLogic( TOPO_35MT_EM12s6_XE0 & EM12 & XS40 & TOPO_05MINDPHI_AJj10s6_XE0 & TOPO_05MINDPHI_EM12s6_XE0 & physcond)
+                    LVL1MenuItem("L1_EM12_W-MT35").setLogic( TOPO_35MT_EM12s6_XE0 & EM12 & physcond)                    
+                    LVL1MenuItem("L1_EM12_W-MT35_W-250RO2-XEHT-0_W-05DPHI-JXE-0_W-05DPHI-EMXE" ).setLogic( TOPO_35MT_EM12s6_XE0 & EM12 & TOPO_250RATIO2_XE0_HT0_AJj15allETA49 & TOPO_05MINDPHI_AJj10s6_XE0 & TOPO_05MINDPHI_EM12s6_XE0 & physcond)
+                    LVL1MenuItem("L1_EM12_W-MT35_XS50").setLogic( TOPO_35MT_EM12s6_XE0 & EM12 & XS50 & physcond)
+                    LVL1MenuItem("L1_EM10VH_W-MT35_XS50").setLogic( TOPO_35MT_EM12s6_XE0 & EM10VH & XS50 & physcond)
+                    LVL1MenuItem("L1_W-15DPHI-EM15XE-0"  ).setLogic( TOPO_15MINDPHI_EM15s6_XE0  & physcond)
+                    LVL1MenuItem("L1_EM15_W-MT35_W-250RO2-XEHT-0_W-15DPHI-JXE-0_W-15DPHI-EM15XE" ).setLogic( TOPO_35MT_EM15s6_XE0 & EM15 & TOPO_250RATIO2_XE0_HT0_AJj15allETA49 & TOPO_15MINDPHI_AJj10s6_XE0 & TOPO_15MINDPHI_EM15s6_XE0 & physcond)
+                    LVL1MenuItem("L1_EM15_W-MT35_XS60_W-15DPHI-JXE-0_W-15DPHI-EM15XE"            ).setLogic( TOPO_35MT_EM15s6_XE0 & EM15 & XS60 & TOPO_15MINDPHI_AJj10s6_XE0 & TOPO_15MINDPHI_EM15s6_XE0 & physcond)
+                    LVL1MenuItem("L1_EM15_W-MT35_XS40_W-15DPHI-JXE-0_W-15DPHI-EM15XE"            ).setLogic( TOPO_35MT_EM15s6_XE0 & EM15 & XS40 & TOPO_15MINDPHI_AJj10s6_XE0 & TOPO_15MINDPHI_EM15s6_XE0 & physcond)
+                    LVL1MenuItem("L1_W-15DPHI-EMXE-0"  ).setLogic( TOPO_15MINDPHI_EM12s6_XE0  & physcond)
+                    LVL1MenuItem("L1_EM12_W-MT35_XS30_W-15DPHI-JXE-0_W-15DPHI-EMXE"            ).setLogic( TOPO_35MT_EM12s6_XE0 & EM12 & XS30 & TOPO_15MINDPHI_AJj10s6_XE0 & TOPO_15MINDPHI_EM12s6_XE0 & physcond)
+                    LVL1MenuItem("L1_EM12_W-MT35_W-90RO2-XEHT-0_W-15DPHI-JXE-0_W-15DPHI-EMXE"  ).setLogic( TOPO_35MT_EM12s6_XE0 & EM12 & TOPO_90RATIO2_XE0_HT0_AJj15allETA49 & TOPO_15MINDPHI_AJj10s6_XE0 & TOPO_15MINDPHI_EM12s6_XE0 & physcond)
+                    # Old
+                    LVL1MenuItem("L1_EM12_W-MT25_W-15DPHI-JXE-0_W-15DPHI-EMXE_W-90RO2-XEHT-0"   ).setLogic( TOPO_25MT_EM12s6_XE0 & EM12 & TOPO_15MINDPHI_AJj10s6_XE0 & TOPO_15MINDPHI_EM12s6_XE0 & TOPO_90RATIO2_XE0_HT0_AJj15allETA49 & physcond)
+                    LVL1MenuItem("L1_EM12_W-MT25_W-15DPHI-JXE-0_W-15DPHI-EMXE_XS30"           ).setLogic( TOPO_25MT_EM12s6_XE0 & EM12 & TOPO_15MINDPHI_AJj10s6_XE0 & TOPO_15MINDPHI_EM12s6_XE0 & XS30 & physcond)
+                    LVL1MenuItem("L1_EM12_W-MT25_W-15DPHI-JXE-0_W-15DPHI-EMXE_XS20"           ).setLogic( TOPO_25MT_EM12s6_XE0 & EM12 & TOPO_15MINDPHI_AJj10s6_XE0 & TOPO_15MINDPHI_EM12s6_XE0 & XS20 & physcond)
+                    LVL1MenuItem("L1_EM12_W-MT25_W-15DPHI-JXE-0_W-15DPHI-EMXE"                ).setLogic( TOPO_25MT_EM12s6_XE0 & EM12 & TOPO_15MINDPHI_AJj10s6_XE0 & TOPO_15MINDPHI_EM12s6_XE0 & physcond)
+
+
+                    LVL1MenuItem("L1_EM15_W-MT35_W-05DPHI-JXE-0_W-05DPHI-EM15XE_XS30"         ).setLogic( TOPO_35MT_EM15s6_XE0 & EM15 & TOPO_05MINDPHI_AJj10s6_XE0 & TOPO_05MINDPHI_EM15s6_XE0 & XS30 & physcond)
+                    LVL1MenuItem("L1_EM15_W-MT35_W-05DPHI-JXE-0_W-05DPHI-EM15XE"              ).setLogic( TOPO_35MT_EM15s6_XE0 & EM15 & TOPO_05MINDPHI_AJj10s6_XE0 & TOPO_05MINDPHI_EM15s6_XE0 & physcond)
+
+                    #LVL1MenuItem("L1_W-10DPHI-JXE-0").setLogic( TOPO_10MINDPHI_AJj15s2_XE0 & physcond)
+                    #LVL1MenuItem("L1_W-20DPHI-JXE-1").setLogic( TOPO_20MINDPHI_AJjs6_XE0 & physcond)
+                    #LVL1MenuItem("L1_W-20DPHI-JXE-0").setLogic( TOPO_20MINDPHI_AJj15s2_XE0 & physcond)
+                    #LVL1MenuItem("L1_W-10DPHI-EMXE-0").setLogic( TOPO_10MINDPHI_EM6s1_XE0 & physcond)
+                    #LVL1MenuItem("L1_W-20DPHI-EMXE-1").setLogic( TOPO_20MINDPHI_EM9s6_XE0 & physcond)
+                    #LVL1MenuItem("L1_W-20DPHI-EMXE-0").setLogic( TOPO_20MINDPHI_EM6s1_XE0 & physcond)
+                    #LVL1MenuItem("L1_W-05RO-XEHT-0").setLogic( TOPO_05RATIO_XE0_HT0_AJj15allETA49 & physcond)
+                    #LVL1MenuItem("L1_W-08RO-XEHT-1").setLogic( TOPO_08RATIO_XE0_HT0_AJj0allETA49 & physcond)
+                    #LVL1MenuItem("L1_W-40RO2-XEHT-0").setLogic( TOPO_40RATIO2_XE0_HT0_AJj15allETA49 & physcond)
+                    #LVL1MenuItem("L1_W-90RO2-XEHT-1").setLogic( TOPO_90RATIO2_XE0_HT0_AJj0allETA49 & physcond)
+                    #LVL1MenuItem("L1_W-HT20-JJ0.ETA49").setLogic( TOPO_HT20_AJj0allETA49 & physcond)
+                    #LVL1MenuItem("L1_W-NOMATCH").setLogic( TOPO_NOT_02MATCH_EM9s1_AJj15allETA49 & physcond)
+                    #LVL1MenuItem("L1_W-NOMATCH_W-05RO-XEEMHT").setLogic( TOPO_NOT_02MATCH_EM9s1_AJj15allETA49 & TOPO_05RATIO_XE0_SUM0_EM9s1_HT0_AJj15allETA49 & physcond)
+                    #LVL1MenuItem("L1_EM3_W-MT20").setLogic( TOPO_20MT_EM6s6_XE0 & EM3 & physcond)
+                    #LVL1MenuItem("L1_EM3_W-MT30").setLogic( TOPO_30MT_EM6s6_XE0 & EM3 & physcond)
+                    #LVL1MenuItem("L1_EM3_W-MT40").setLogic( TOPO_40MT_EM6s6_XE0 & EM3 & physcond)
+
+                    # Bphysics triggers
+    #                 if not '_v6' in TriggerFlags.triggerMenuSetup():
+    # #SX
+    #                     LVL1MenuItem("L1_BPH-DR-2MU4").setLogic( TOPO_2DR15_2MU4ab & physcond)            
+    #                     LVL1MenuItem("L1_BPH-2M-2MU4").setLogic( TOPO_2INVM999_2MU4ab & physcond)        
+    #                     LVL1MenuItem("L1_BPH-4M8-2MU4").setLogic( TOPO_4INVM8_2MU4ab & physcond)            
+    #                     LVL1MenuItem("L1_BPH-DR-2MU4_BPH-2M-2MU4").setLogic( TOPO_2DR15_2MU4ab & TOPO_2INVM999_2MU4ab & physcond)            
+    #                     LVL1MenuItem("L1_BPH-DR-2MU4_BPH-4M8-2MU4").setLogic( TOPO_2DR15_2MU4ab & TOPO_4INVM8_2MU4ab & physcond)            
+    #                     LVL1MenuItem("L1_BPH-DR-2MU6").setLogic( TOPO_2DR15_2MU6ab & physcond)            
+    #                     LVL1MenuItem("L1_BPH-2M-2MU6").setLogic( TOPO_2INVM999_2MU6ab & physcond)            
+    #                     LVL1MenuItem("L1_BPH-4M8-2MU6").setLogic( TOPO_4INVM8_2MU6ab & physcond)            
+    #                     LVL1MenuItem("L1_BPH-DR-2MU6_BPH-2M-2MU6").setLogic( TOPO_2DR15_2MU6ab & TOPO_2INVM999_2MU6ab & physcond)            
+    #                     LVL1MenuItem("L1_BPH-DR-2MU6_BPH-4M8-2MU6").setLogic( TOPO_2DR15_2MU6ab & TOPO_4INVM8_2MU6ab & physcond)            
+
+                    ##Combined L1Top 
+                    LVL1MenuItem('L1_DR-MU10TAU12I_TAU12I-J25').setLogic( TOPO_0DR28_MU10ab_TAU12abi &  TOPO_1DISAMB_TAU12abi_J25ab & physcond)
+                    LVL1MenuItem('L1_MU10_TAU12I-J25').setLogic( MU10 &  TOPO_1DISAMB_TAU12abi_J25ab & physcond)
+                    #LVL1MenuItem('L1_XE35_EM15-TAU12I').setLogic( XE35 &  TOPO_DISAMB_EM15abhi_TAU12abi & physcond)  
+                    #LVL1MenuItem('L1_XE40_EM15-TAU12I').setLogic( XE40 &  TOPO_DISAMB_EM15abhi_TAU12abiOB & physcond)  
+                    #LVL1MenuItem('L1_XE45_TAU20-J20').setLogic( XE45 & TOPO_1DISAMB_TAU20ab_J20ab & physcond)
+                    LVL1MenuItem('L1_J25_2J20_3J12_DR-TAU20ITAU12I').setLogic( J25 & J20.x(2) & J12.x(3) &  TOPO_0DR28_TAU20abi_TAU12abi & physcond)
+                    #LVL1MenuItem('L1_J25_3J12_EM15-TAU12I').setLogic( J25 & J12.x(3) &  TOPO_DISAMB_EM15abhi_TAU12abi & physcond)  
+                    LVL1MenuItem('L1_J25_2J12_DR-MU10TAU12I').setLogic( J25 & J12.x(2) &  TOPO_0DR28_MU10ab_TAU12abi & physcond)
+                    LVL1MenuItem('L1_J25_2J20_3J12_BOX-TAU20ITAU12I').setLogic( J25 & J20.x(2) & J12.x(3) & TOPO_0DETA20_0DPHI20_TAU20abi_TAU12abi & physcond)
+
+                    LVL1MenuItem('L1_MU6_MJJ-200').setLogic( MU6 & TOPO_200INVM9999_AJ30s6_AJ20s6 & physcond)
+                    LVL1MenuItem('L1_MU6_MJJ-300').setLogic( MU6 & TOPO_300INVM9999_AJ30s6_AJ20s6 & physcond)
+                    LVL1MenuItem('L1_MU6_MJJ-400').setLogic( MU6 & TOPO_400INVM9999_AJ30s6_AJ20s6 & physcond)
+                    LVL1MenuItem('L1_MU6_MJJ-500').setLogic( MU6 & TOPO_500INVM9999_AJ30s6_AJ20s6 & physcond) 
+
+                    LVL1MenuItem('L1_J30_2J20_4J20.0ETA49_MJJ-400').setLogic( J30 & J20.x(2) & J200ETA49.x(4) & TOPO_400INVM9999_AJ30s6_AJ20s6 & physcond)
+                    LVL1MenuItem('L1_J30_2J20_4J20.0ETA49_MJJ-700').setLogic( J30 & J20.x(2) & J200ETA49.x(4) & TOPO_700INVM9999_AJ30s6_AJ20s6 & physcond) 
+                    LVL1MenuItem('L1_J30_2J20_4J20.0ETA49_MJJ-800').setLogic( J30 & J20.x(2) & J200ETA49.x(4) & TOPO_800INVM9999_AJ30s6_AJ20s6 & physcond)
+                    LVL1MenuItem('L1_J30_2J20_4J20.0ETA49_MJJ-900').setLogic( J30 & J20.x(2) & J200ETA49.x(4) & TOPO_900INVM9999_AJ30s6_AJ20s6 & physcond)
+
+                    LVL1MenuItem('L1_3J20_4J20.0ETA49_MJJ-400').setLogic( J20.x(3) & J200ETA49.x(4) & TOPO_400INVM9999_AJ30s6_AJ20s6 & physcond)
+                    LVL1MenuItem('L1_3J20_4J20.0ETA49_MJJ-700').setLogic( J20.x(3) & J200ETA49.x(4) & TOPO_700INVM9999_AJ30s6_AJ20s6 & physcond) 
+                    LVL1MenuItem('L1_3J20_4J20.0ETA49_MJJ-800').setLogic( J20.x(3) & J200ETA49.x(4) & TOPO_800INVM9999_AJ30s6_AJ20s6 & physcond)
+                    LVL1MenuItem('L1_3J20_4J20.0ETA49_MJJ-900').setLogic( J20.x(3) & J200ETA49.x(4) & TOPO_900INVM9999_AJ30s6_AJ20s6 & physcond)
+
+                    LVL1MenuItem('L1_XE35_MJJ-200').setLogic( XE35 & TOPO_200INVM9999_AJ30s6_AJ20s6 & physcond)
+                    
+                    ### ATR-15062
+                    LVL1MenuItem('L1_EM18VH_MJJ-300').setLogic( EM18VH & TOPO_300INVM9999_AJ30s6_AJ20s6 & physcond)
+
+                    # CTP items for L1Topo streamers
+                    #LVL1MenuItem('L1_DPhi_AJsAJs').setLogic( TOPO_DPhi_AJsAJs & physcond)
+                    #LVL1MenuItem('L1_DPhi_EMsTAUs').setLogic( TOPO_DPhi_EMsTAUs & physcond)
+                    #LVL1MenuItem('L1_DEta_AJabAJab').setLogic( TOPO_DEta_AJabAJab & physcond)
+                    #LVL1MenuItem('L1_DEta_EMabTAUab').setLogic( TOPO_DEta_EMabTAUab & physcond)
+    #                 if not '_v6' in TriggerFlags.triggerMenuSetup():
+    # #SX
+    #                     LVL1MenuItem('L1_BPH-2M-2MU4-B').setLogic( TOPO_2INVM999_CMU4ab_MU4ab & physcond)
+    #                     LVL1MenuItem('L1_BPH-2M-2MU4-BO').setLogic( TOPO_2INVM999_2CMU4ab & physcond)
+    #                     LVL1MenuItem('L1_BPH-2M-MU6MU4').setLogic( TOPO_2INVM999_MU6ab_MU4ab & physcond)
+    #                     LVL1MenuItem('L1_BPH-2M-MU6MU4-B').setLogic( TOPO_2INVM999_ONEBARREL_MU6ab_MU4ab & physcond)
+    #                     LVL1MenuItem('L1_BPH-2M-MU6MU4-BO').setLogic( TOPO_2INVM999_CMU6ab_CMU4ab & physcond)
+    #                     LVL1MenuItem('L1_BPH-4M8-2MU4-B').setLogic( TOPO_4INVM8_CMU4ab_MU4ab & physcond)
+    #                     LVL1MenuItem('L1_BPH-4M8-2MU4-BO').setLogic( TOPO_4INVM8_2CMU4ab & physcond)
+    #                     LVL1MenuItem('L1_BPH-4M8-MU6MU4').setLogic( TOPO_4INVM8_MU6ab_MU4ab & physcond)
+    #                     LVL1MenuItem('L1_BPH-4M8-MU6MU4-B').setLogic( TOPO_4INVM8_ONEBARREL_MU6ab_MU4ab & physcond)
+    #                     LVL1MenuItem('L1_BPH-4M8-MU6MU4-BO').setLogic( TOPO_4INVM8_CMU6ab_CMU4ab & physcond)
+
+                    LVL1MenuItem('L1_DY-DR-2MU4').setLogic( TOPO_2DR99_2MU4ab & physcond)
+                    LVL1MenuItem('L1_DY-BOX-MU6MU4').setLogic( TOPO_5DETA99_5DPHI99_MU6ab_MU4ab & physcond)
+                    LVL1MenuItem('L1_DY-BOX-2MU6').setLogic( TOPO_5DETA99_5DPHI99_2MU6ab & physcond)
+     
+                    LVL1MenuItem('L1_LFV-MU6').setLogic( TOPO_0DR15_2MU6ab & physcond)
+                    LVL1MenuItem('L1_LFV-MU').setLogic( TOPO_0DR10_MU10ab_MU6ab & physcond)
+                    if not '_v7' in TriggerFlags.triggerMenuSetup() and not 'LS2_v' in TriggerFlags.triggerMenuSetup():
+                        LVL1MenuItem('L1_LFV-EM8I').setLogic( TOPO_0DETA04_0DPHI03_EM8abi_MU10ab & physcond)
+                    else:
+                        LVL1MenuItem('L1_LFV-EM8I').setLogic( TOPO_0DETA04_EM8abi_MU10ab & TOPO_0DPHI03_EM8abi_MU10ab & physcond) #ATR-14282
+                    if not '_v7' in TriggerFlags.triggerMenuSetup() and not 'LS2_v' in TriggerFlags.triggerMenuSetup():
+                        LVL1MenuItem('L1_LFV-EM15I').setLogic( TOPO_0DETA04_0DPHI03_EM15abi_MUab & physcond)
+                    else:
+                        LVL1MenuItem('L1_LFV-EM15I').setLogic( TOPO_0DETA04_EM15abi_MUab & TOPO_0DPHI03_EM15abi_MUab & physcond) #ATR-14282
+                    LVL1MenuItem('L1_DPHI-J20s2XE50').setLogic( TOPO_10MINDPHI_J20s2_XE50 & physcond)
+                    LVL1MenuItem('L1_DPHI-J20XE50').setLogic( TOPO_10MINDPHI_J20ab_XE50 & physcond)
+                    LVL1MenuItem('L1_DPHI-CJ20XE50').setLogic( TOPO_10MINDPHI_CJ20ab_XE50 & physcond)
+
+                    LVL1MenuItem('L1_MJJ-900').setLogic( TOPO_900INVM9999_AJ30s6_AJ20s6 & physcond)
+                    LVL1MenuItem('L1_MJJ-800').setLogic( TOPO_800INVM9999_AJ30s6_AJ20s6 & physcond)
+                    LVL1MenuItem('L1_MJJ-700').setLogic( TOPO_700INVM9999_AJ30s6_AJ20s6 & physcond)
+                    LVL1MenuItem('L1_MJJ-400').setLogic( TOPO_400INVM9999_AJ30s6_AJ20s6 & physcond)
+                    #LVL1MenuItem('L1_MJJ-350').setLogic( TOPO_350INVM9999_AJ30s6_AJ20s6 & physcond)
+                    LVL1MenuItem('L1_MJJ-300').setLogic( TOPO_300INVM9999_AJ30s6_AJ20s6 & physcond)
+                    LVL1MenuItem('L1_MJJ-200').setLogic( TOPO_200INVM9999_AJ30s6_AJ20s6 & physcond)
+                    LVL1MenuItem('L1_MJJ-100').setLogic( TOPO_100INVM9999_AJ30s6_AJ20s6 & physcond)
+
+                    #LVL1MenuItem('L1_MJJ-350-0').setLogic( TOPO_350INVM9999_J30s6_J20s6 & physcond)
+                    #LVL1MenuItem('L1_MJJ-300-0').setLogic( TOPO_300INVM9999_J30s6_J20s6 & physcond)
+                    #LVL1MenuItem('L1_MJJ-250-0').setLogic( TOPO_250INVM9999_J30s6_J20s6 & physcond)
+                    #LVL1MenuItem('L1_MJJ-200-0').setLogic( TOPO_200INVM9999_J30s6_J20s6 & physcond)
+                    LVL1MenuItem('L1_HT150-JJ15.ETA49').setLogic( TOPO_HT150_AJj15allETA49 & physcond)
+                    LVL1MenuItem('L1_HT150-JJ15.ETA49_MJJ-400').setLogic( TOPO_HT150_AJj15allETA49 & TOPO_400INVM9999_AJ30s6_AJ20s6 & physcond)
+
+                    
+                    LVL1MenuItem('L1_J4-MATCH').setLogic( TOPO_0MATCH_4AJ20ETA31_4AJj15ETA31 & physcond)
+
+                    LVL1MenuItem('L1_LLP-RO').setLogic( TOPO_100RATIO_0MATCH_TAU30si2_EMall & physcond)
+
+                    LVL1MenuItem('L1_LLP-NOMATCH').setLogic( TOPO_NOT_0MATCH_TAU30si2_EMall & physcond)
+                    LVL1MenuItem('L1_DR-MU10TAU12I').setLogic( TOPO_0DR28_MU10ab_TAU12abi & physcond)
+                    LVL1MenuItem('L1_TAU12I-J25').setLogic( TOPO_1DISAMB_TAU12abi_J25ab & physcond)
+                    LVL1MenuItem('L1_EM15TAU12I-J25').setLogic( TOPO_1DISAMB_EM15his2_TAU12abi_J25ab & physcond)
+
+                    LVL1MenuItem('L1_DR-EM15TAU12I').setLogic( TOPO_DISAMB_0DR28_EM15his2_TAU12abi & physcond)
+                    LVL1MenuItem('L1_DR-EM15TAU12I-J25').setLogic( TOPO_1DISAMB_J25ab_0DR28_EM15his2_TAU12abi & physcond)
+                    LVL1MenuItem('L1_TAU20ITAU12I-J25').setLogic( TOPO_1DISAMB_TAU20abi_TAU12abi_J25ab & physcond)
+                    LVL1MenuItem('L1_DR25-TAU20ITAU12I').setLogic( TOPO_0DR25_TAU20abi_TAU12abi & physcond)
+
+                    LVL1MenuItem('L1_30M-EM20ITAU12').setLogic( TOPO_DISAMB_30INVM_EM20his2_TAU12ab & physcond)
+                    LVL1MenuItem('L1_MJJ-400-CF').setLogic( TOPO_400INVM9999_AJ30s6ETA31_AJ20s631ETA49 & physcond)
+                    LVL1MenuItem('L1_DR-TAU20ITAU12I').setLogic( TOPO_0DR28_TAU20abi_TAU12abi & physcond)
+                    LVL1MenuItem('L1_BOX-TAU20ITAU12I').setLogic( TOPO_0DETA20_0DPHI20_TAU20abi_TAU12abi & physcond)
+                    LVL1MenuItem('L1_DR-TAU20ITAU12I-J25').setLogic( TOPO_1DISAMB_J25ab_0DR28_TAU20abi_TAU12abi & physcond)
+
+                    LVL1MenuItem('L1_DR25-TAU20ITAU12I-J25').setLogic( TOPO_1DISAMB_J25ab_0DR25_TAU20abi_TAU12abi & physcond)
+                    LVL1MenuItem('L1_LAR-EM').setLogic( TOPO_LAR_EM50s1 & physcond).setTriggerType( TT.lardemo ) # LAr demo (ATR-11897)
+                    LVL1MenuItem('L1_LAR-J').setLogic( TOPO_LAR_J100s1 & physcond).setTriggerType( TT.lardemo )  # LAr demo (ATR-11897)
+                    # if not '_v6' in TriggerFlags.triggerMenuSetup():
+                    #     LVL1MenuItem('L1_BPH-DR-2MU4-B').setLogic( TOPO_2DR15_CMU4ab_MU4ab & physcond)
+                    #     LVL1MenuItem('L1_BPH-DR-2MU4-BO').setLogic( TOPO_2DR15_2CMU4ab & physcond)
+                    #     LVL1MenuItem('L1_BPH-DR-MU6MU4').setLogic( TOPO_2DR15_MU6ab_MU4ab & physcond)
+                    #     LVL1MenuItem('L1_BPH-DR-MU6MU4-B').setLogic( TOPO_2DR15_ONEBARREL_MU6ab_MU4ab & physcond)
+                    #     LVL1MenuItem('L1_BPH-DR-MU6MU4-BO').setLogic( TOPO_2DR15_CMU6ab_CMU4ab & physcond)
+                    #     LVL1MenuItem("L1_BPH-DR-2MU4-B_BPH-2M-2MU4-B").setLogic( TOPO_2DR15_CMU4ab_MU4ab & TOPO_2INVM999_CMU4ab_MU4ab & physcond)            
+                    #     LVL1MenuItem("L1_BPH-DR-2MU4-B_BPH-4M8-2MU4-B").setLogic( TOPO_2DR15_CMU4ab_MU4ab & TOPO_4INVM8_CMU4ab_MU4ab & physcond)            
+                    #     LVL1MenuItem("L1_BPH-DR-2MU4-BO_BPH-2M-2MU4-BO").setLogic( TOPO_2DR15_2CMU4ab & TOPO_2INVM999_2CMU4ab & physcond)            
+                    #     LVL1MenuItem("L1_BPH-DR-2MU4-BO_BPH-4M8-2MU4-BO").setLogic( TOPO_2DR15_2CMU4ab & TOPO_4INVM8_2CMU4ab & physcond)     
+                        
+                    LVL1MenuItem('L1_KF-XE40').setLogic( TOPO_KF_XE40_AJall & physcond)
+                    LVL1MenuItem('L1_KF-XE50').setLogic( TOPO_KF_XE50_AJall & physcond)
+                    LVL1MenuItem('L1_KF-XE55').setLogic( TOPO_KF_XE55_AJall & physcond)
+                    LVL1MenuItem('L1_KF-XE60').setLogic( TOPO_KF_XE60_AJall & physcond)
+                    LVL1MenuItem('L1_KF-XE65').setLogic( TOPO_KF_XE65_AJall & physcond)
+                    LVL1MenuItem('L1_KF-XE75').setLogic( TOPO_KF_XE75_AJall & physcond)
+    #SX ATR-12789
+
+                   # if  '_v6' in TriggerFlags.triggerMenuSetup():
+    # nominal L1-topo items
+                    #LVL1MenuItem('L1_BPH-1M19-2MU4_BPH-0DR34-2MU4'    ).setLogic( TOPO_1INVM19_2MU4ab & TOPO_0DR34_2MU4ab & physcond)           # 50% for Bs,J/psi,Upsi
+             
+                    LVL1MenuItem('L1_BPH-2M8-2MU4_BPH-0DR15-2MU4'     ).setLogic( TOPO_2INVM8_2MU4ab & TOPO_0DR15_2MU4ab & physcond)            # 78% for Bs,J/psi
+                    LVL1MenuItem('L1_BPH-2M9-2MU4_BPH-0DR15-2MU4'     ).setLogic( TOPO_2INVM9_2MU4ab & TOPO_0DR15_2MU4ab & physcond)            # 78% for Bs,J/psi
+                    LVL1MenuItem('L1_BPH-7M15-2MU4_BPH-0DR24-2MU4'    ).setLogic( TOPO_7INVM15_2MU4ab & TOPO_0DR24_2MU4ab & physcond)           # 78% for Upsi
+                    LVL1MenuItem('L1_BPH-2M8-MU6MU4_BPH-0DR15-MU6MU4' ).setLogic( TOPO_2INVM8_MU6ab_MU4ab & TOPO_0DR15_MU6ab_MU4ab & physcond)  # 86% for Bs,J/psi
+                    LVL1MenuItem('L1_BPH-2M9-MU6MU4_BPH-0DR15-MU6MU4' ).setLogic( TOPO_2INVM9_MU6ab_MU4ab & TOPO_0DR15_MU6ab_MU4ab & physcond)
+  
+                    LVL1MenuItem('L1_BPH-8M15-MU6MU4_BPH-0DR22-MU6MU4').setLogic( TOPO_8INVM15_MU6ab_MU4ab & TOPO_0DR22_MU6ab_MU4ab & physcond) # 86% for Upsi
+                    LVL1MenuItem('L1_BPH-2M9-2MU6_BPH-2DR15-2MU6'     ).setLogic( TOPO_2INVM9_2MU6ab & TOPO_2DR15_2MU6ab & physcond)            # 96% for Bs,J/psi
+     
+                    LVL1MenuItem('L1_BPH-8M15-2MU6_BPH-0DR22-2MU6'    ).setLogic( TOPO_8INVM15_2MU6ab & TOPO_0DR22_2MU6ab & physcond)           # 96% for Upsi
+
+# Barrel and BarrelOnly items w/o topo selection
+#                    LVL1MenuItem('L1_CMU6_2CMU4').setLogic( TOPO_MULT_CMU4ab.x(2) & TOPO_MULT_CMU6ab & physcond) # MU6_2MU4_BarrelOnly
+                    LVL1MenuItem('L1_2MU4-B'    ).setLogic( MU4.x(2) & TOPO_MULT_CMU4ab & physcond)              # 2MU4_Barrel
+                    LVL1MenuItem('L1_2MU6-B'    ).setLogic( MU6.x(2) & TOPO_MULT_CMU6ab & physcond)              # 2MU6_Barrel
+                    LVL1MenuItem('L1_MU6_2MU4-B').setLogic( MU6 & MU4.x(2) & TOPO_MULT_CMU4ab & physcond)        # MU6_2MU4_Barrel,     already in the menu
+
+# Barrel and BarrelOnly variants of L1Topo items
+                    #LVL1MenuItem('L1_BPH-1M19-2MU4-B_BPH-0DR34-2MU4'    ).setLogic( TOPO_1INVM19_CMU4ab_MU4ab & TOPO_0DR34_2MU4ab & physcond)               # 50% for Bs,J/psi,Upsi + OneBarrel
+
+                    LVL1MenuItem('L1_BPH-2M8-2MU4-B_BPH-0DR15-2MU4'     ).setLogic( TOPO_2INVM8_CMU4ab_MU4ab & TOPO_0DR15_2MU4ab & physcond)                # 78% for Bs,J/psi + OneBarrel
+
+                    LVL1MenuItem('L1_BPH-7M15-2MU4_BPH-0DR24-2MU4-B'    ).setLogic( TOPO_7INVM15_2MU4ab & TOPO_0DR24_CMU4ab_MU4ab & physcond)               # 78% for Upsi + OneBarrel
+                    #LVL1MenuItem('L1_BPH-1M19-2MU4-BO_BPH-0DR34-2MU4'   ).setLogic( TOPO_1INVM19_2CMU4ab & TOPO_0DR34_2MU4ab & physcond)                    # 50% for Bs,J/psi,Upsi + BarrelOnly
+
+                        #LVL1MenuItem('L1_BPH-2M8-2MU4-BO_BPH-0DR15-2MU4'    ).setLogic( TOPO_2INVM8_2CMU4ab & TOPO_0DR15_2MU4ab & physcond)                     # 78% for Bs,J/psi + BarrelOnly
+                    LVL1MenuItem('L1_BPH-7M15-2MU4_BPH-0DR24-2MU4-BO'   ).setLogic( TOPO_7INVM15_2MU4ab & TOPO_0DR24_2CMU4ab & physcond)                    # 78% for Upsi + BarrelOnly
+                    LVL1MenuItem('L1_BPH-2M8-MU6MU4-B_BPH-0DR15-MU6MU4' ).setLogic( TOPO_2INVM8_ONEBARREL_MU6ab_MU4ab & TOPO_0DR15_MU6ab_MU4ab & physcond)  # 86% for Bs,J/psi + OneBarrel
+
+                    LVL1MenuItem('L1_BPH-2M8-2MU4'       ).setLogic( TOPO_2INVM8_2MU4ab & physcond)                 # backup 71% for Bs,J/psi
+                    #LVL1MenuItem('L1_BPH-2M9-2MU4'       ).setLogic( TOPO_2INVM9_2MU4ab & physcond)
+                    LVL1MenuItem('L1_BPH-8M15-MU6MU4'    ).setLogic( TOPO_8INVM15_MU6ab_MU4ab & physcond)           # backup 71% for Upsi
+                    LVL1MenuItem('L1_BPH-8M15-2MU6'      ).setLogic( TOPO_8INVM15_2MU6ab & physcond)                # backup 95% for Upsi
+    #SX end ATR-12789
+
+                    LVL1MenuItem('L1_LATE-MU10_XE50').setLogic( TOPO_LATE_MU10s1 & XE50 & physcond) 
+                    LVL1MenuItem('L1_LATE-MU10_J50').setLogic(  TOPO_LATE_MU10s1 & J50 & physcond)  
+                    LVL1MenuItem('L1_SC111').setLogic(  TOPO_SC111_CJ15abETA26 & physcond)
+                    LVL1MenuItem('L1_SC85').setLogic(  TOPO_SC85_CJ15abETA26 & physcond)
+
+                    LVL1MenuItem('L1_TAU60_DR-TAU20ITAU12I' ).setLogic( HA60 & TOPO_0DR28_TAU20abi_TAU12abi & physcond)
+
+            except Exception, ex:
+                    print "Creation of L1Topo item failed, will abort! Exception is : " , ex
+                    raise RuntimeError("Creation of L1Topo item failed, will not continue")
+        
+        
+        # =======================================================
+        #
+        # Here we define the items for the secondary partitions
+        #
+        # =======================================================
+        
+        # Partition 2
+        LVL1MenuItem.currentPartition = 2
+
+        LVL1MenuItem('L1_RD2_BGRP14'         ).setLogic( RNDM2 & BGRP0 & BGRP14             ).setTriggerType(TT.rand)
+
+
+        # Partition 3
+        LVL1MenuItem.currentPartition = 3
+        
+        LVL1MenuItem('L1_RD3_BGRP15'         ).setLogic( RNDM3 & BGRP0 & BGRP15             ).setTriggerType(TT.rand)
+                      
+
+        # reset to partition 1
+        LVL1MenuItem.currentPartition = 1
+
+
+
+
+
+        LVL1MenuItem.l1configForRegistration = None
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/LVL1Menu/ItemDefRun1.py b/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/LVL1Menu/ItemDefRun1.py
new file mode 100755
index 0000000000000000000000000000000000000000..cac1430d237de36a164bd39447a643f3016c6200
--- /dev/null
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/LVL1Menu/ItemDefRun1.py
@@ -0,0 +1,875 @@
+#!/usr/bin/env python
+
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+
+from TriggerJobOpts.TriggerFlags import TriggerFlags
+import re
+
+from AthenaCommon.Logging import logging
+log = logging.getLogger('TriggerMenu.Lvl1.py')
+
+
+# The trigger types
+from TriggerMenu.l1.TriggerTypeDefRun1 import TT
+from TriggerMenu.l1.Limits import Limits
+from TriggerMenu.l1.Logic import Logic,Not
+from TriggerMenu.l1.Lvl1MenuItems import LVL1MenuItem
+from TriggerMenu.l1.Lvl1Condition import ThrCondition, Lvl1InternalTrigger
+
+
+
+
+class ItemDef:
+    def __init__(self):
+        """Constructor"""
+        pass
+    
+    #----------------------------------------------------------------------
+    # LVL1- thresholds and items
+    #----------------------------------------------------------------------
+    @staticmethod
+    def registerItems(tm):
+        """Register LVL1 thresholds for further use"""
+
+        # register all thresholds ...
+        from ThresholdDefRun1 import ThresholdDef
+        ThresholdDef.registerThresholds(tm)
+
+        # ... and make them accessible by their name
+        for thr in tm.registeredThresholds.values():
+            thrvarname = thr.name.replace('.','') # we can not have . in the variable name
+            exec("%s = ThrCondition(thr)" % thrvarname)
+
+        # InternalTriggers
+        for i in range( Limits.NumBunchgroups ):
+            exec("BGRP%i = Logic(Lvl1InternalTrigger('BGRP%i'))" % (i,i))
+
+        for i in range( Limits.NumRndmTriggers ):
+            exec("RNDM%i = Logic(Lvl1InternalTrigger('RNDM%i'))" % (i,i))
+
+        for i in range(2):
+            exec("PCLK%i = Logic(Lvl1InternalTrigger('PCLK%i'))" % (i,i))
+
+
+        LVL1MenuItem.l1configForRegistration = tm  # from now on all new LVL1MenuItems are registered to tm
+
+        # Setting up bunch group and BPTX conditions
+        bgrpcond            = BGRP0 & BGRP1
+        physcond            = BGRP0 & BGRP1
+        calibcond           = BGRP0 & BGRP2
+        cosmiccond          = BGRP0 & BGRP3
+        unpaired_isocond    = BGRP0 & BGRP4 # unpaired isolated (satellite bunches)
+        unpaired_nonisocond = BGRP0 & BGRP5 # unpaired non-isolated (parasitic bunches)
+        firstempty          = BGRP0 & BGRP6
+        unpairedRcond       = BGRP0 & BGRP7 # unpaired beams 1 oR beam 2
+        bgrp7cond           = BGRP0 & BGRP7 # No unpaired anymore
+
+
+        LVL1MenuItem.currentPartition = 1
+
+        # /gamma ctpid=[0:0x1f]
+
+        emTT = TT.calo | TT.caloem
+        
+        LVL1MenuItem('L1_EM3',    ctpid=0x1 ).setLogic( EM3.x(1)    & physcond).setTriggerType( emTT )
+        LVL1MenuItem('L1_EM4',    ctpid=0x54).setLogic( EM4.x(1)    & physcond).setTriggerType( emTT )
+        LVL1MenuItem('L1_EM5',    ctpid=-1  ).setLogic( EM5.x(1)    & physcond).setTriggerType( emTT )
+        LVL1MenuItem('L1_EM6',    ctpid=-1  ).setLogic( EM6.x(1)    & physcond).setTriggerType( emTT )
+        LVL1MenuItem('L1_EM7',    ctpid=0x1 ).setLogic( EM7.x(1)    & physcond).setTriggerType( emTT )
+        LVL1MenuItem('L1_EM7V',   ctpid=-1  ).setLogic( EM7V.x(1)   & physcond).setTriggerType( emTT )
+        LVL1MenuItem('L1_EM8VH',  ctpid=-1  ).setLogic( EM8VH.x(1)  & physcond).setTriggerType( emTT )
+        LVL1MenuItem('L1_EM10',   ctpid=0x2 ).setLogic( EM10.x(1)   & physcond).setTriggerType( emTT )
+        LVL1MenuItem('L1_EM10VH', ctpid=-1  ).setLogic( EM10VH.x(1) & physcond).setTriggerType( emTT )
+        LVL1MenuItem('L1_EM12',   ctpid=0x2 ).setLogic( EM12.x(1)   & physcond).setTriggerType( emTT )
+        LVL1MenuItem('L1_EM14',   ctpid=0x5 ).setLogic( EM14.x(1)   & physcond).setTriggerType( emTT )
+        LVL1MenuItem('L1_EM14VH', ctpid=-1  ).setLogic( EM14VH.x(1) & physcond).setTriggerType( emTT )
+        LVL1MenuItem('L1_EM15V',  ctpid=-1  ).setLogic( EM15V.x(1)  & physcond).setTriggerType( emTT )
+        LVL1MenuItem('L1_EM15VH', ctpid=-1  ).setLogic( EM15VH.x(1) & physcond).setTriggerType( emTT ) 
+        LVL1MenuItem('L1_EM16',   ctpid=0x5 ).setLogic( EM16.x(1)   & physcond).setTriggerType( emTT )
+        LVL1MenuItem('L1_EM16VH', ctpid=-1  ).setLogic( EM16VH.x(1) & physcond).setTriggerType( emTT )
+        LVL1MenuItem('L1_EM16V',  ctpid=-1  ).setLogic( EM16V.x(1)  & physcond).setTriggerType( emTT )
+        LVL1MenuItem('L1_EM18VH', ctpid=-1  ).setLogic( EM18VH.x(1) & physcond).setTriggerType( emTT )
+        LVL1MenuItem('L1_EM20V',  ctpid=-1  ).setLogic( EM20V.x(1)  & physcond).setTriggerType( emTT )
+        LVL1MenuItem('L1_EM24VHI', ctpid=-1  ).setLogic( EM24VHI.x(1) & physcond).setTriggerType( emTT )
+        LVL1MenuItem('L1_EM30',   ctpid=0x8 ).setLogic( EM30.x(1)   & physcond).setTriggerType( emTT )
+        LVL1MenuItem('L1_EM50',   ctpid=0x8 ).setLogic( EM50.x(1)   & physcond).setTriggerType( emTT )
+
+
+        # special bgrp
+        LVL1MenuItem('L1_EM30_BGRP7',  ctpid=-1).setLogic( EM30.x(1) & bgrp7cond ).setTriggerType( emTT )
+        
+        # 2xEM
+        LVL1MenuItem('L1_2EM3',    ctpid=0xa ).setLogic( EM3.x(2)    & physcond).setTriggerType( emTT )
+        LVL1MenuItem('L1_2EM5',    ctpid=0xb ).setLogic( EM5.x(2)    & physcond).setTriggerType( emTT )
+        LVL1MenuItem('L1_2EM6',    ctpid=-1  ).setLogic( EM6.x(2)    & physcond).setTriggerType( emTT )
+        LVL1MenuItem('L1_2EM8VH',  ctpid=-1  ).setLogic( EM8VH.x(2)  & physcond).setTriggerType( emTT )
+        LVL1MenuItem('L1_2EM10VH', ctpid=-1  ).setLogic( EM10VH.x(2) & physcond).setTriggerType( emTT )
+        LVL1MenuItem('L1_2EM12',   ctpid=0xf ).setLogic( EM12.x(2)   & physcond).setTriggerType( emTT )
+        LVL1MenuItem('L1_2EM15V',  ctpid=-1 ).setLogic( EM15V.x(2)  & physcond).setTriggerType( emTT )
+        LVL1MenuItem('L1_2EM15VH', ctpid=0xf ).setLogic( EM15VH.x(2) & physcond).setTriggerType( emTT )
+
+
+
+        # 3xEM
+        LVL1MenuItem('L1_2EM3_EM6'   ).setLogic( EM3.x(2)& EM6.x(1) & physcond).setTriggerType( emTT )
+        LVL1MenuItem('L1_EM7V_2EM3'   ).setLogic(EM7V.x(1)& EM3.x(2) & physcond).setTriggerType( emTT )
+        LVL1MenuItem('L1_2EM3_EM12'  ).setLogic( EM3.x(2)& EM12.x(1) & physcond).setTriggerType( emTT )
+        LVL1MenuItem('L1_2EM6_EM16VH').setLogic( EM6.x(2)& EM16VH.x(1) & physcond).setTriggerType( emTT )
+        LVL1MenuItem('L1_3EM6',  ctpid=-1  ).setLogic( EM6.x(3)  & physcond).setTriggerType(TT.phys).setTriggerType( emTT )
+        LVL1MenuItem('L1_EM15VH_3EM7V'  ).setLogic( EM15VH.x(1) & EM7V.x(3) & physcond).setTriggerType( emTT )
+
+        # 4xEM
+        LVL1MenuItem('L1_3EM6_EM14VH').setLogic( EM6.x(3) & EM14VH.x(1)& physcond).setTriggerType( emTT )
+        LVL1MenuItem('L1_2EM12_EM16V').setLogic( EM12.x(2)& EM16V.x(1) & physcond).setTriggerType( emTT )
+
+        
+        # MUON ctpid=[0x20;0x2f]
+
+        LVL1MenuItem('L1_MU0',  ctpid=0x20).setLogic( MU0.x(1)  & physcond).setTriggerType(TT.rpcin)
+        LVL1MenuItem('L1_MU4',  ctpid=-1  ).setLogic( MU4.x(1)  & physcond).setTriggerType(TT.rpcin)
+        LVL1MenuItem('L1_MU6',  ctpid=0x21).setLogic( MU6.x(1)  & physcond).setTriggerType(TT.rpcin)
+        LVL1MenuItem('L1_MU10', ctpid=0x22).setLogic( MU10.x(1) & physcond).setTriggerType(TT.rpcin)
+        LVL1MenuItem('L1_MU11', ctpid=0x23).setLogic( MU11.x(1) & physcond).setTriggerType(TT.rpcin)
+        LVL1MenuItem('L1_MU15', ctpid=-1  ).setLogic( MU15.x(1) & physcond).setTriggerType(TT.rpcin)
+        LVL1MenuItem('L1_MU20', ctpid=0x24).setLogic( MU20.x(1) & physcond).setTriggerType(TT.rpcin)
+
+        # 2xMU, 3xMU, 4xMU
+        LVL1MenuItem('L1_2MU0',  ctpid=0x26).setLogic( MU0.x(2)  & physcond).setTriggerType(TT.rpcin)
+        LVL1MenuItem('L1_2MU4',  ctpid=-1  ).setLogic( MU4.x(2)  & physcond).setTriggerType(TT.rpcin)
+        LVL1MenuItem('L1_2MU6',  ctpid=0x27).setLogic( MU6.x(2)  & physcond).setTriggerType(TT.rpcin)
+        LVL1MenuItem('L1_2MU10', ctpid=0x28).setLogic( MU10.x(2) & physcond).setTriggerType(TT.rpcin)
+        LVL1MenuItem('L1_2MU11', ctpid=0x28).setLogic( MU11.x(2) & physcond).setTriggerType(TT.rpcin)
+        LVL1MenuItem('L1_2MU20', ctpid=0x2a).setLogic( MU20.x(2) & physcond)
+        LVL1MenuItem('L1_3MU4',  ctpid=-1  ).setLogic( MU4.x(3)  & physcond)
+        LVL1MenuItem('L1_3MU6',  ctpid=0x2b).setLogic( MU6.x(3)  & physcond)
+        LVL1MenuItem('L1_2MU4_MU6'         ).setLogic( MU4.x(2) & MU6.x(1)  & physcond).setTriggerType(TT.rpcin)
+        LVL1MenuItem('L1_2MU6_MU10'        ).setLogic( MU6.x(2) & MU10.x(1) & physcond).setTriggerType(TT.rpcin)
+        LVL1MenuItem('L1_3MU4_MU6'         ).setLogic( MU4.x(3) & MU6.x(1)  & physcond).setTriggerType(TT.rpcin)
+
+        LVL1MenuItem('L1_2MU4_XE40', ctpid=-1  ).setLogic( MU4.x(2) &  XE40.x(1)  & physcond).setTriggerType(TT.calo|TT.rpcin)
+        LVL1MenuItem('L1_2MU4_XE30', ctpid=-1  ).setLogic( MU4.x(2) &  XE30.x(1) & physcond).setTriggerType(TT.calo|TT.rpcin)
+
+        # barrel 
+        LVL1MenuItem('L1_MUB'            ).setLogic( NIM_MUB.x(1) & physcond).setTriggerType(TT.rpcin)
+        LVL1MenuItem('L1_MUE'            ).setLogic( NIM_MUE.x(1) & physcond).setTriggerType(TT.rpcin)
+        LVL1MenuItem('L1_2MU4_BARRELONLY').setLogic( ( MU4.x(2) & Not(NIM_MUE.x(1)) |  MU4.x(3)) & physcond).setTriggerType(TT.rpcin)
+        LVL1MenuItem('L1_2MU4_MU6_BARREL').setLogic( MU4.x(2) & NIM_MUB.x(1) & MU6.x(1) & physcond).setTriggerType(TT.rpcin)
+        LVL1MenuItem('L1_2MU4_BARREL'    ).setLogic( MU4.x(2) & NIM_MUB.x(1) & physcond).setTriggerType(TT.rpcin)
+        LVL1MenuItem('L1_2MU6_BARRELONLY').setLogic( (MU6.x(2)&Not(NIM_MUE.x(1))| MU6.x(3)) & physcond).setTriggerType(TT.rpcin)        
+        LVL1MenuItem('L1_2MU6_BARREL'    ).setLogic( MU6.x(2) & NIM_MUB.x(1) & physcond).setTriggerType(TT.rpcin)
+        
+
+
+        # TAU ctpid=[0x40:0x4f]
+
+        # 1xTAU
+        LVL1MenuItem('L1_TAU3',   ctpid=0x40).setLogic( HA3.x(1)   & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_TAU6',   ctpid=-1  ).setLogic( HA6.x(1)   & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_TAU8',   ctpid=0x43).setLogic( HA8.x(1)   & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_TAU11',  ctpid=0x44).setLogic( HA11.x(1)  & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_TAU11I', ctpid=0x44).setLogic( HA11I.x(1) & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_TAU12',  ctpid=-1  ).setLogic( HA12.x(1)  & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_TAU15',  ctpid=-1  ).setLogic( HA15.x(1)  & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_TAU15I'            ).setLogic( HA15I.x(1) & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_TAU20',  ctpid=0x46).setLogic( HA20.x(1)  & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_TAU40',  ctpid=0x49).setLogic( HA40.x(1)  & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_TAU60',  ctpid=-1  ).setLogic( HA60.x(1)  & physcond).setTriggerType( TT.calo )
+
+        # 2xTAU
+        LVL1MenuItem('L1_2TAU11', ctpid=0x4c ).setLogic( HA11.x(2)  & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_2TAU11I'            ).setLogic( HA11I.x(2) & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_2TAU15'             ).setLogic( HA15.x(2)  & physcond).setTriggerType( TT.calo )
+
+        # mixed tau
+        LVL1MenuItem('L1_EM15VH_TAU40_2TAU15'          ).setLogic( EM15VH  & HA40 & HA15.x(2)   & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_EM15VH_2TAU12_J25_2J15_3J12'  ).setLogic( EM15VH  & HA12.x(2)  & J25 & J15.x(2) & J12.x(3) & physcond).setTriggerType( TT.calo )
+
+        LVL1MenuItem('L1_MU10_TAU20'       ).setLogic( MU10  & HA20          & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_MU10_TAU12_J25_2J12' ).setLogic( MU10 & HA12 & J25 & J12.x(2) & physcond).setTriggerType( TT.calo )
+
+        LVL1MenuItem('L1_TAU20_2TAU12_J25_2J20_3J12'   ).setLogic( HA20 & HA12.x(2)     & J25 & J20.x(2) & J12.x(3) & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_TAU20_2J20_XE45'              ).setLogic( HA20    & J20.x(2)   & XE45 & physcond).setTriggerType( TT.calo )
+        LVL1MenuItem('L1_TAU20_2TAU12_XE35'            ).setLogic( HA20    & HA12.x(2)  & XE35 & physcond).setTriggerType( TT.calo )
+
+        # EMPTY
+        LVL1MenuItem('L1_2TAU20'    ).setLogic( HA20.x(2) & physcond).setTriggerType(TT.calo)
+
+
+        # JET ctpid=[0x60:0x7f]
+
+        LVL1MenuItem('L1_J5',      ctpid=0x60).setLogic( J5.x(1) & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_J5_win6', ctpid=0x60).setLogic( J5_win6.x(1) & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_J10',     ctpid=0x61).setLogic( J10.x(1) & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_J15'                ).setLogic( J15.x(1) & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_J18',     ctpid=0x62).setLogic( J18.x(1) & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_J20',     ctpid=-1  ).setLogic( J20.x(1) & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_J30'                ).setLogic( J30.x(1) & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_J40'                ).setLogic( J40.x(1) & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_J50'                ).setLogic( J50.x(1) & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_J75'                ).setLogic( J75.x(1) & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_J100',    ctpid=-1  ).setLogic( J100.x(1) & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_J350',    ctpid=-1  ).setLogic( J350.x(1) & physcond).setTriggerType(TT.calo)
+
+        LVL1MenuItem('L1_J15.ETA24', ctpid=-1).setLogic(J15ETA24.x(1) & physcond).setTriggerType(TT.calo)
+
+        LVL1MenuItem('L1_J15.23ETA49' ).setLogic( (JF1523ETA49  | JB1523ETA49  ) & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_J20.32ETA49' ).setLogic( (JF2032ETA49  | JB2032ETA49  ) & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_J25.32ETA49' ).setLogic( (JF2532ETA49  | JB2532ETA49  ) & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_J100.32ETA49').setLogic( (JF10032ETA49 | JB10032ETA49 ) & physcond).setTriggerType(TT.calo)
+
+        # pPb
+        LVL1MenuItem('L1_J5_TE90',  ctpid=0x60).setLogic( J5.x(1)& TE90.x(1) & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_2J5_TE90', ctpid=0x60).setLogic( J5.x(2)& TE90.x(1) & physcond).setTriggerType(TT.calo)
+
+        # Multi-jet
+        LVL1MenuItem('L1_2J5', ctpid=0x68 ).setLogic( J5.x(2)  & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_2J10'            ).setLogic( J10.x(2) & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_3J10', ctpid=0x7f).setLogic( J10.x(3) & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_3J15'            ).setLogic( J15.x(3) & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_3J50', ctpid=0x7f).setLogic( J50.x(3) & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_3J75', ctpid=-1  ).setLogic( J75.x(3) & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_3J20', ctpid=-1  ).setLogic( J20.x(3) & physcond).setTriggerType(TT.calo) # new jet threshold
+        LVL1MenuItem('L1_4J10', ctpid=0x6e).setLogic( J10.x(4) & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_4J15'            ).setLogic( J15.x(4) & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_4J20', ctpid=-1  ).setLogic( J20.x(4) & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_5J10', ctpid=-1  ).setLogic( J10.x(5) & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_5J15'            ).setLogic( J15.x(5) & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_5J20', ctpid=-1  ).setLogic( J20.x(5) & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_6J10', ctpid=-1  ).setLogic( J10.x(6) & physcond).setTriggerType(TT.calo)
+        
+        LVL1MenuItem('L1_3J15.ETA24' ).setLogic( J15ETA24.x(3) & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_5J15.ETA24' ).setLogic( J15ETA24.x(5) & physcond).setTriggerType(TT.calo)
+
+
+        #example zero bias seeded by single jet
+        #item_zb_j10  = LVL1MenuItem('L1_ZB_J10',  ctpid=240).setLogic(thr_zb_j10.x(1) & physcond).setTriggerType(TT.calo)
+        #example zero bias seeded by di jet
+        #item_zb_2j10 = LVL1MenuItem('L1_ZB_2J10', ctpid=241).setLogic(thr_zb_2j10.x(1) & physcond).setTriggerType(TT.calo)
+        #zb item for v3 menu, seeded by mbts a
+
+        if ('pp_v4' in TriggerFlags.triggerMenuSetup() or 'LS1_v1' in TriggerFlags.triggerMenuSetup()) :
+            LVL1MenuItem('L1_ZB', ctpid=240).setLogic(ZB_EM12.x(1) & physcond).setTriggerType(TT.zerobs)
+        elif  'DC14' in TriggerFlags.triggerMenuSetup():
+            LVL1MenuItem('L1_ZB', ctpid=240).setLogic(ZB_EM15V.x(1) & physcond).setTriggerType(TT.zerobs)
+        else:
+            LVL1MenuItem('L1_ZB', ctpid=240).setLogic(ZB_EM14.x(1) & physcond).setTriggerType(TT.zerobs)
+
+
+            
+        # - Add/remap new L1 thresholds:
+        #   J20->J15, J40->J30, J70->J55, J100->J75, J130->J95, J150->J115
+        LVL1MenuItem('L1_4J30'    ).setLogic( J30.x(4) & physcond)
+        LVL1MenuItem('L1_3J15_J50').setLogic( J15.x(3) & J50.x(1) & physcond)
+        LVL1MenuItem('L1_J30_FJ30').setLogic( J30.x(1) & ( JF30.x(1) | JB30.x(1) ) & physcond)
+        LVL1MenuItem('L1_J50_FJ50').setLogic( J50.x(1) & ( JF50.x(1) | JB50.x(1) ) & physcond)
+
+
+
+        # FJ
+        #pPb items
+        
+        LVL1MenuItem('L1_FJ0',   ctpid=0x7b).setLogic(( JF0.x(1) | JB0.x(1)) & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_FJ0_A', ctpid=0x7b).setLogic(( JF0.x(1)) & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_FJ0_C', ctpid=0x7b).setLogic(( JB0.x(1)) & physcond).setTriggerType(TT.calo)
+        
+        #pp items
+        LVL1MenuItem('L1_FJ5', ctpid=0x7b).setLogic(( JF5.x(1) |  JB5.x(1)) & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_FJ10').setLogic(( JF10.x(1) |  JB10.x(1)) & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_FJ15').setLogic(( JF15.x(1) |  JB15.x(1)) & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_FJ30').setLogic(( JF30.x(1) |  JB30.x(1)) & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_FJ50').setLogic(( JF50.x(1) |  JB50.x(1)) & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_FJ75').setLogic(( JF75.x(1) |  JB75.x(1)) & physcond).setTriggerType(TT.calo)
+
+        # 2xFJ
+        LVL1MenuItem('L1_2FJ15').setLogic( JF15.x(1) &  JB15.x(1) & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_2FJ30', ctpid=0x7d).setLogic( JF30.x(1) &  JB30.x(1) & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_2FJ50', ctpid=0x7b).setLogic( JF50.x(1) &  JB50.x(1) & physcond).setTriggerType(TT.calo)
+
+        
+        # Diffractive
+
+        LVL1MenuItem('L1_MU0_TE50'    ).setLogic( MU0.x(1) & TE50.x(1) & physcond).setTriggerType(TT.rpcin)
+        LVL1MenuItem('L1_MU4_TE50'    ).setLogic( MU4.x(1) & TE50.x(1) & physcond).setTriggerType(TT.rpcin)
+        LVL1MenuItem('L1_EM3_2J5'     ).setLogic( EM3.x(1) & J5.x(2)   & physcond).setTriggerType(TT.calo)
+
+        LVL1MenuItem('L1_MU0_VTE50'   ).setLogic( MU0.x(1) & Not(TE50.x(1)) & physcond).setTriggerType(TT.rpcin)
+        LVL1MenuItem('L1_MU0_VTE20'   ).setLogic( MU0.x(1) & Not(TE20.x(1)) & physcond).setTriggerType(TT.rpcin)
+        LVL1MenuItem('L1_MU4_VTE50'   ).setLogic( MU4.x(1) & Not(TE50.x(1)) & physcond).setTriggerType(TT.rpcin)
+        LVL1MenuItem('L1_EM3_VTE50'   ).setLogic( EM3.x(1) & Not(TE50.x(1)) & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_EM3_VTE20'   ).setLogic( EM3.x(1) & Not(TE20.x(1)) & physcond).setTriggerType(TT.calo)
+
+        LVL1MenuItem('L1_MU0_MV_VTE50').setLogic( MU0.x(1) & Not(MBTS_A.x(1)& MBTS_C.x(1)) & Not(TE50.x(1)) & physcond).setTriggerType(TT.rpcin)
+        LVL1MenuItem('L1_MU4_MV_VTE50').setLogic( MU4.x(1) & Not(MBTS_A.x(1)& MBTS_C.x(1)) & Not(TE50.x(1)) & physcond).setTriggerType(TT.rpcin)
+        LVL1MenuItem('L1_EM3_MV_VTE50').setLogic( EM3.x(1) & Not(MBTS_A.x(1)& MBTS_C.x(1)) & Not(TE50.x(1)) & physcond).setTriggerType(TT.calo)
+
+
+        # Items for EMPTY
+        # EM
+        LVL1MenuItem('L1_EM3_EMPTY',   ctpid=-1).setLogic( EM3.x(1)   & cosmiccond).setTriggerType( emTT )
+        LVL1MenuItem('L1_EM5_EMPTY',   ctpid=-1).setLogic( EM5.x(1)   & cosmiccond).setTriggerType( emTT )
+        LVL1MenuItem('L1_EM6_EMPTY',   ctpid=-1).setLogic( EM6.x(1)   & cosmiccond).setTriggerType( emTT )
+        # Muon
+        LVL1MenuItem('L1_MU0_EMPTY'      ).setLogic( MU0.x(1)  & cosmiccond).setTriggerType(TT.rpcout)
+        LVL1MenuItem('L1_MU4_EMPTY'      ).setLogic( MU4.x(1)  & cosmiccond).setTriggerType(TT.rpcout)
+        LVL1MenuItem('L1_MU10_EMPTY'     ).setLogic( MU10.x(1) & cosmiccond).setTriggerType(TT.rpcout)
+        LVL1MenuItem('L1_2MU6_EMPTY'     ).setLogic( MU6.x(2)  & cosmiccond).setTriggerType(TT.rpcout)
+        LVL1MenuItem('L1_2MU0_EMPTY'     ).setLogic( MU0.x(2)  & cosmiccond).setTriggerType(TT.rpcout)
+        LVL1MenuItem('L1_2MU4_EMPTY'     ).setLogic( MU4.x(2)  & cosmiccond).setTriggerType(TT.rpcout)
+        LVL1MenuItem('L1_MU11_EMPTY'     ).setLogic( MU11.x(1) & cosmiccond).setTriggerType(TT.rpcout)
+        # Tau
+        LVL1MenuItem('L1_TAU8_EMPTY').setLogic( HA8.x(1) & cosmiccond).setTriggerType(TT.calo)
+        # Jet
+        LVL1MenuItem('L1_J5_EMPTY' ).setLogic( J5.x(1)  & cosmiccond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_J10_EMPTY').setLogic( J10.x(1) & cosmiccond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_J30_EMPTY').setLogic( J30.x(1) & cosmiccond).setTriggerType(TT.calo)
+        # Forward Jet
+        LVL1MenuItem('L1_FJ5_EMPTY' ).setLogic( ( JF5.x(1) |  JB5.x(1)) & cosmiccond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_FJ0_EMPTY' ).setLogic( ( JF0.x(1) |  JB0.x(1)) & cosmiccond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_FJ30_EMPTY').setLogic( (JF30.x(1) | JB30.x(1)) & cosmiccond).setTriggerType(TT.calo)
+        # combined
+        LVL1MenuItem('L1_MU4_J15_EMPTY'  ).setLogic( MU4.x(1)  &  J15.x(1) & cosmiccond).setTriggerType(TT.rpcout)        
+
+
+                
+        
+        # Items for EMPTY, UNPAIRED1, UNPAIRED2 and UNPAIRED
+
+        # Jet
+        LVL1MenuItem('L1_J5_UNPAIRED_ISO'     ).setLogic( J5.x(1)  & unpaired_isocond   ).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_J5_UNPAIRED_NONISO'  ).setLogic( J5.x(1)  & unpaired_nonisocond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_J5_FIRSTEMPTY'       ).setLogic( J5.x(1)  & firstempty         ).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_J10_UNPAIRED_ISO'    ).setLogic( J10.x(1) & unpaired_isocond   ).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_J10_UNPAIRED_NONISO' ).setLogic( J10.x(1) & unpaired_nonisocond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_J10_FIRSTEMPTY'      ).setLogic( J10.x(1) & firstempty         ).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_J30_UNPAIRED'        ).setLogic( J30.x(1) & unpairedRcond      ).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_J30_UNPAIRED_ISO'    ).setLogic( J30.x(1) & unpaired_isocond   ).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_J30_UNPAIRED_NONISO' ).setLogic( J30.x(1) & unpaired_nonisocond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_J30_FIRSTEMPTY'      ).setLogic( J30.x(1) & firstempty         ).setTriggerType(TT.calo)
+        # Forward jet
+        LVL1MenuItem('L1_FJ10_UNPAIRED_NONISO').setLogic( ( JF10.x(1) |  JB10.x(1)) & unpaired_nonisocond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_FJ0_UNPAIRED_ISO'    ).setLogic( ( JF0.x(1)  |  JB0.x(1) ) & unpaired_isocond   ).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_FJ5_UNPAIRED_ISO'    ).setLogic( ( JF5.x(1)  |  JB5.x(1) ) & unpaired_isocond   ).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_FJ30_UNPAIRED_ISO'   ).setLogic( ( JF30.x(1) |  JB30.x(1)) & unpaired_isocond   ).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_FJ30_FIRSTEMPTY'     ).setLogic( ( JF30.x(1) |  JB30.x(1)) & firstempty         ).setTriggerType(TT.calo)
+        # Tau
+        LVL1MenuItem('L1_TAU8_UNPAIRED_ISO'   ).setLogic( HA8.x(1) & unpaired_isocond   ).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_TAU8_UNPAIRED_NONISO').setLogic( HA8.x(1) & unpaired_nonisocond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_TAU8_FIRSTEMPTY'     ).setLogic( HA8.x(1) & firstempty         ).setTriggerType(TT.calo)
+        # EM
+        LVL1MenuItem('L1_EM3_UNPAIRED_ISO'    ).setLogic( EM3.x(1) & unpaired_isocond   ).setTriggerType(TT.calo|TT.caloem)
+        LVL1MenuItem('L1_EM3_UNPAIRED_NONISO' ).setLogic( EM3.x(1) & unpaired_nonisocond).setTriggerType(TT.calo|TT.caloem)
+        LVL1MenuItem('L1_EM3_FIRSTEMPTY'      ).setLogic( EM3.x(1) & firstempty         ).setTriggerType(TT.calo|TT.caloem)
+        # Muon
+        LVL1MenuItem('L1_MU0_UNPAIRED_ISO'    ).setLogic( MU0.x(1)  & unpaired_isocond   ).setTriggerType(TT.rpcin)
+        LVL1MenuItem('L1_MU4_UNPAIRED_ISO'    ).setLogic( MU4.x(1)  & unpaired_isocond   ).setTriggerType(TT.rpcin)
+        LVL1MenuItem('L1_MU10_UNPAIRED_ISO'   ).setLogic( MU10.x(1) & unpaired_isocond   ).setTriggerType(TT.rpcin)
+        LVL1MenuItem('L1_MU0_UNPAIRED_NONISO' ).setLogic( MU0.x(1)  & unpaired_nonisocond).setTriggerType(TT.rpcin)
+        LVL1MenuItem('L1_MU4_UNPAIRED_NONISO' ).setLogic( MU4.x(1)  & unpaired_nonisocond).setTriggerType(TT.rpcin)
+        LVL1MenuItem('L1_MU0_FIRSTEMPTY'      ).setLogic( MU0.x(1)  & firstempty         ).setTriggerType(TT.rpcin)
+        LVL1MenuItem('L1_MU4_FIRSTEMPTY'      ).setLogic( MU4.x(1)  & firstempty         ).setTriggerType(TT.rpcin)
+        LVL1MenuItem('L1_MU6_FIRSTEMPTY'      ).setLogic( MU6.x(1)  & firstempty         ).setTriggerType(TT.rpcin)
+        LVL1MenuItem('L1_MU10_FIRSTEMPTY'     ).setLogic( MU10.x(1) & firstempty         ).setTriggerType(TT.rpcin)
+        LVL1MenuItem('L1_MU20_FIRSTEMPTY'     ).setLogic( MU20.x(1) & firstempty         ).setTriggerType(TT.rpcout)
+        LVL1MenuItem('L1_2MU6_UNPAIRED_ISO'   ).setLogic( MU6.x(2)  & unpaired_isocond   ).setTriggerType(TT.rpcin)
+        LVL1MenuItem('L1_2MU6_UNPAIRED_NONISO').setLogic( MU6.x(2)  & unpaired_nonisocond).setTriggerType(TT.rpcin)
+        LVL1MenuItem('L1_2MU4_FIRSTEMPTY'     ).setLogic( MU4.x(2)  & firstempty         ).setTriggerType(TT.rpcin)
+        LVL1MenuItem('L1_2MU6_FIRSTEMPTY'     ).setLogic( MU6.x(2)  & firstempty         ).setTriggerType(TT.rpcin)        
+        # combined
+        LVL1MenuItem('L1_MU4_J15_UNPAIRED_ISO').setLogic( MU4.x(1) & J15.x(1) & unpaired_isocond).setTriggerType(TT.rpcin)
+
+        #Combined JET+MET
+        LVL1MenuItem('L1_J40_XE50').setLogic( (J40.x(1) & XE50.x(1)) & physcond).setTriggerType(TT.calo)
+        
+        # XE ctpid=[0x80:0x9f]
+        LVL1MenuItem('L1_XE20', ctpid=0x81).setLogic( XE20.x(1) & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_XE25', ctpid=0x82).setLogic( XE25.x(1) & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_XE30', ctpid=0x83).setLogic( XE30.x(1) & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_XE40', ctpid=0x84).setLogic( XE40.x(1) & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_XE50', ctpid=0x85).setLogic( XE50.x(1) & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_XE70', ctpid=0x86).setLogic( XE70.x(1) & physcond).setTriggerType(TT.calo)
+
+        LVL1MenuItem('L1_XE35_BGRP7').setLogic( XE35.x(1)&bgrp7cond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_XE40_BGRP7').setLogic( XE40.x(1)&bgrp7cond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_XE50_BGRP7').setLogic( XE50.x(1)&bgrp7cond).setTriggerType(TT.calo)
+
+        #pPb items        
+        LVL1MenuItem('L1_TE10').setLogic( TE10.x(1) & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_TE20').setLogic( TE20.x(1) & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_TE30').setLogic( TE30.x(1) & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_TE40').setLogic( TE40.x(1) & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_TE35').setLogic( TE35.x(1) & physcond).setTriggerType(TT.calo)
+
+        # Other TE items for L=10^32 and 10^33
+        LVL1MenuItem('L1_TE800', ctpid=0x8f).setLogic( TE800.x(1) & physcond).setTriggerType(TT.calo)
+
+
+        # items for HI p+Pb (forward TE)
+        if 'HI_v2' in TriggerFlags.triggerMenuSetup():
+            LVL1MenuItem('L1_TE0'  ).setLogic( TE0.x(1)   & physcond).setTriggerType(TT.calo)
+            LVL1MenuItem('L1_TE20' ).setLogic( TE20.x(1)  & physcond).setTriggerType(TT.calo)
+            LVL1MenuItem('L1_TE50' ).setLogic( TE50.x(1)  & physcond).setTriggerType(TT.calo)
+            LVL1MenuItem('L1_TE65' ).setLogic( TE65.x(1)  & physcond).setTriggerType(TT.calo)
+            LVL1MenuItem('L1_TE90' ).setLogic( TE90.x(1)  & physcond).setTriggerType(TT.calo)
+            LVL1MenuItem('L1_TE100').setLogic( TE100.x(1) & physcond).setTriggerType(TT.calo)
+        else:
+            LVL1MenuItem('L1_TE0'  ).setLogic( TE0.x(1)   & physcond).setTriggerType(TT.calo)
+            LVL1MenuItem('L1_TE50' ).setLogic( TE50.x(1)  & physcond).setTriggerType(TT.calo)
+            LVL1MenuItem('L1_TE65' ).setLogic( TE65.x(1)  & physcond).setTriggerType(TT.calo)
+            LVL1MenuItem('L1_TE90' ).setLogic( TE90.x(1)  & physcond).setTriggerType(TT.calo)
+            LVL1MenuItem('L1_TE100').setLogic( TE100.x(1) & physcond).setTriggerType(TT.calo)
+            
+
+        LVL1MenuItem('L1_XS30').setLogic( XS30.x(1) & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_XS45').setLogic( XS45.x(1) & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_XS50').setLogic( XS50.x(1) & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_XS55').setLogic( XS55.x(1) & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_XS60').setLogic( XS60.x(1) & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_XS65').setLogic( XS65.x(1) & physcond).setTriggerType(TT.calo)
+        
+        LVL1MenuItem('L1_JE140'            ).setLogic( JE140.x(1) & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_JE200', ctpid=0x92).setLogic( JE200.x(1) & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_JE350', ctpid=0x94).setLogic( JE350.x(1) & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_JE500', ctpid=0x96).setLogic( JE500.x(1) & physcond).setTriggerType(TT.calo)
+
+        # Transient items
+        LVL1MenuItem('L1_XE35').setLogic( XE35.x(1) & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_XE60').setLogic( XE60.x(1) & physcond).setTriggerType(TT.calo)
+
+        LVL1MenuItem('L1_TE300').setLogic( TE300.x(1) & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_TE500').setLogic( TE500.x(1) & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_TE700').setLogic( TE700.x(1) & physcond).setTriggerType(TT.calo)
+        
+        # Combined items [0xa0:0xff], [0x30:0x3f],
+
+        # EM + (XE, MU, TAU)
+        LVL1MenuItem('L1_EM10VH_XE20').setLogic( EM10VH.x(1)& XE20.x(1) & physcond).setTriggerType(TT.calo|TT.caloem)
+        LVL1MenuItem('L1_EM10VH_XE30').setLogic( EM10VH.x(1)& XE30.x(1) & physcond).setTriggerType(TT.calo|TT.caloem)
+        LVL1MenuItem('L1_EM10VH_XE35').setLogic( EM10VH.x(1)& XE35.x(1) & physcond).setTriggerType(TT.calo|TT.caloem)        
+
+
+        LVL1MenuItem('L1_EM3_MU6', ctpid=0xbd).setLogic( MU6.x(1)& EM3.x(1) & physcond).setTriggerType(TT.rpcin|TT.calo|TT.caloem)
+        LVL1MenuItem('L1_EM6_2MU6'   ).setLogic( MU6.x(2)& EM6.x(1) & physcond)
+        LVL1MenuItem('L1_EM10VH_MU6' ).setLogic( EM10VH.x(1)& MU6.x(1) & physcond).setTriggerType(TT.calo|TT.caloem)
+        LVL1MenuItem('L1_EM15VH_MU10').setLogic( EM15VH.x(1)& MU10.x(1)& physcond).setTriggerType(TT.calo|TT.caloem)
+        LVL1MenuItem('L1_EM16VH_MU4' ).setLogic( EM16VH.x(1)& MU4.x(1) & physcond).setTriggerType(TT.calo|TT.caloem)
+        LVL1MenuItem('L1_2EM8VH_MU10' ).setLogic( EM8VH.x(2)& MU10.x(1) & physcond).setTriggerType(TT.calo|TT.caloem)
+        LVL1MenuItem('L1_EM8VH_2MU6' ).setLogic( EM8VH.x(1)& MU6.x(2) & physcond).setTriggerType(TT.calo|TT.caloem)
+
+
+        LVL1MenuItem('L1_2EM6_MU6'   ).setLogic( EM6.x(2)& MU6.x(1) & physcond)
+        LVL1MenuItem('L1_EM6_MU6'    ).setLogic( EM6.x(1)& MU6.x(1) & physcond)
+        LVL1MenuItem('L1_EM6_MU10'   ).setLogic( EM6.x(1)& MU10.x(1) & physcond)
+        LVL1MenuItem('L1_EM12_XE20'  ).setLogic( EM12.x(1)& XE20.x(1) & physcond)
+        LVL1MenuItem('L1_EM16V_XE20' ).setLogic( EM16V.x(1)& XE20.x(1) & physcond)
+        LVL1MenuItem('L1_EM6_XS45'   ).setLogic( EM6.x(1)& XS45.x(1) & physcond)
+        LVL1MenuItem('L1_EM6_XS50'   ).setLogic( EM6.x(1)& XS50.x(1) & physcond)
+        LVL1MenuItem('L1_EM6_XS55'   ).setLogic( EM6.x(1)& XS55.x(1) & physcond)
+        LVL1MenuItem('L1_EM6_XS60'   ).setLogic( EM6.x(1)& XS60.x(1) & physcond)
+        LVL1MenuItem('L1_EM16V_XS45' ).setLogic( EM16V.x(1)& XS45.x(1) & physcond)
+        LVL1MenuItem('L1_EM12_XS45'  ).setLogic( EM12.x(1)& XS45.x(1) & physcond)
+        LVL1MenuItem('L1_EM12_XS30'  ).setLogic( EM12.x(1)& XS30.x(1) & physcond)
+        LVL1MenuItem('L1_EM12_4J10'  ).setLogic( EM12.x(1)& J10.x(4) & physcond)
+        LVL1MenuItem('L1_EM15VH_J15.23ETA49' ).setLogic( EM15VH&  (JF1523ETA49.x(1)  | JB1523ETA49.x(1)  ) & physcond).setTriggerType(TT.calo)
+
+
+        # TAU + EM
+        LVL1MenuItem('L1_2TAU11I_EM14VH').setLogic( HA11I.x(2)& EM14VH.x(1) & physcond).setTriggerType(TT.calo|TT.caloem)
+        LVL1MenuItem('L1_2TAU11_TAU20_EM14VH').setLogic( HA11.x(2)& HA20.x(1)& EM14VH.x(1) & physcond).setTriggerType(TT.calo|TT.caloem)
+        LVL1MenuItem('L1_2TAU11_TAU20_EM10VH').setLogic( HA11.x(2)& HA20.x(1)& EM10VH.x(1) & physcond).setTriggerType(TT.calo|TT.caloem)
+        LVL1MenuItem('L1_2TAU11_TAU15', ctpid=0x0).setLogic( HA11.x(2)& HA15.x(1) & physcond).setTriggerType(TT.calo)          
+        LVL1MenuItem('L1_2TAU11I_TAU15', ctpid=0x0).setLogic( HA11I.x(2)& HA15.x(1) & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_2TAU11_EM10VH').setLogic( HA11.x(2)& EM10VH.x(1) & physcond).setTriggerType(TT.calo|TT.caloem)
+
+        
+        LVL1MenuItem('L1_MU4_J50').setLogic( MU4.x(1)& J50.x(1) & physcond).setTriggerType(TT.rpcin|TT.calo)
+        LVL1MenuItem('L1_MU4_J10').setLogic( MU4.x(1)& J10.x(1) & physcond).setTriggerType(TT.rpcin|TT.calo)
+ 
+        # - Add/remap new L1 thresholds:
+        #   J20->J15, J40->J30, J70->J55, J100->J75, J130->J95, J150->J115
+        LVL1MenuItem('L1_MU4_J15').setLogic( MU4.x(1)& J15.x(1) & physcond).setTriggerType(TT.rpcin|TT.calo)
+        LVL1MenuItem('L1_MU4_J30').setLogic( MU4.x(1)& J30.x(1) & physcond)
+        LVL1MenuItem('L1_MU4_J75').setLogic( MU4.x(1)& J75.x(1) & physcond) 
+
+        LVL1MenuItem('L1_MU4_J20_XE20').setLogic( MU4.x(1)& J20.x(1)& XE20.x(1) & physcond)
+        LVL1MenuItem('L1_MU4_J20_XE35').setLogic( MU4.x(1)& J20.x(1)& XE35.x(1) & physcond)
+
+        LVL1MenuItem('L1_MU6_J15').setLogic( MU6.x(1)& J15.x(1) & physcond).setTriggerType(TT.rpcin|TT.calo)
+        LVL1MenuItem('L1_MU6_2J20').setLogic( MU6.x(1)& J20.x(2) & physcond).setTriggerType(TT.rpcin|TT.calo)
+        LVL1MenuItem('L1_2MU4_EM3', ctpid=0xbd).setLogic( MU4.x(2)& EM3.x(1) & physcond).setTriggerType(TT.rpcin|TT.calo|TT.caloem)
+        LVL1MenuItem('L1_2MU4_2EM3', ctpid=0xbd).setLogic( MU4.x(2)& EM3.x(2) & physcond).setTriggerType(TT.rpcin|TT.calo|TT.caloem)
+
+        LVL1MenuItem('L1_MU10_XE20').setLogic( MU10.x(1)& XE20.x(1) & physcond)
+        LVL1MenuItem('L1_MU10_XE25').setLogic( MU10.x(1)& XE25.x(1) & physcond)
+        LVL1MenuItem('L1_MU10_J20').setLogic( MU10.x(1) & J20.x(1) & physcond) # new jet threshold
+
+        # TAU + MU
+        LVL1MenuItem('L1_TAU8_MU10'             ).setLogic( HA8.x(1)  & MU10.x(1) & physcond)
+        LVL1MenuItem('L1_TAU11_MU10', ctpid=0xc7).setLogic( HA11.x(1) & MU10.x(1) & physcond)
+        LVL1MenuItem('L1_2J30_XE20'             ).setLogic( J30.x(2)  & XE20.x(1) & physcond) # new jet threshold
+
+        # TAU + XE
+        LVL1MenuItem('L1_TAU15_XE35'     ).setLogic( HA15.x(1)  & XE35.x(1) & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_TAU15_XE40'     ).setLogic( HA15.x(1)  & XE40.x(1) & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_TAU15I_XE35'    ).setLogic( HA15I.x(1) & XE35.x(1) & physcond)
+        LVL1MenuItem('L1_TAU15I_XE40'    ).setLogic( HA15I.x(1) & XE40.x(1) & physcond)
+        LVL1MenuItem('L1_TAU20_XE40'     ).setLogic( HA20.x(1)  & XE40.x(1) & physcond)
+        LVL1MenuItem('L1_TAU20_XE35'     ).setLogic( HA20.x(1)  & XE35.x(1) & physcond)
+        LVL1MenuItem('L1_TAU15_XS35'     ).setLogic( HA15.x(1)  & XS35.x(1) & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_TAU15_XE25_3J15').setLogic( HA15.x(1)  & XE25.x(1) & J15.x(3) & physcond).setTriggerType(TT.calo)
+
+        # VBF request
+        
+        LVL1MenuItem('L1_2TAU8_TAU15_FJ15'         ).setLogic( HA8.x(2) & HA15.x(1)  & ( JF15.x(1) | JB15.x(1)) & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_2TAU8_TAU15_J15CF'        ).setLogic( HA8.x(2) & HA15.x(1)  & J15CF.x(1) & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_2TAU8_TAU11I_EM10VH_FJ15' ).setLogic( HA8.x(2) & HA11I.x(1) & EM10VH.x(1)&( JF15.x(1)| JB15.x(1)) & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_2TAU8_TAU11I_EM10VH_J15CF').setLogic( HA8.x(2) & HA11I.x(1) & EM10VH.x(1)& J15CF.x(1) & physcond).setTriggerType(TT.calo)
+
+               
+        LVL1MenuItem('L1_EM14VH_FJ15' ).setLogic( EM14VH.x(1)&( JF15.x(1)| JB15.x(1)) & physcond).setTriggerType(TT.calo|TT.caloem)
+        LVL1MenuItem('L1_EM14VH_J15CF').setLogic( EM14VH.x(1)& J15CF.x(1) & physcond).setTriggerType(TT.calo|TT.caloem)
+
+        LVL1MenuItem('L1_MU10_FJ15').setLogic(  MU10.x(1) & ( JF15.x(1) | JB15.x(1)) & physcond)
+        LVL1MenuItem('L1_MU10_J15CF').setLogic( MU10.x(1)& J15CF.x(1) & physcond)
+
+        LVL1MenuItem('L1_3J15_FJ15').setLogic( J15.x(3)&( JF15.x(1)| JB15.x(1)) & physcond).setTriggerType(TT.calo)
+        LVL1MenuItem('L1_2J15_2FJ15').setLogic( J15.x(2)&( JF15.x(1)& JB15.x(1)) & physcond).setTriggerType(TT.calo)              
+
+        # Transient items
+        # L1_TAU6_2JT4_JT35  (or whatever soft thresholds they have. JT4 must have 
+        # softer cuts than TAU06 and JT35 - please get in touch with us if it is not 
+        # the case - we will need to rethink it then)
+
+        LVL1MenuItem('L1_J50_XE30').setLogic( J50.x(1)&  XE30.x(1) & physcond)
+        LVL1MenuItem('L1_J50_XE35').setLogic( J50.x(1)&  XE35.x(1) & physcond)
+        LVL1MenuItem('L1_J50_XE40').setLogic( J50.x(1)&  XE40.x(1) & physcond)
+        LVL1MenuItem('L1_J30_XE35').setLogic( J30.x(1)& XE35.x(1) & physcond)
+        LVL1MenuItem('L1_J30_XE40').setLogic( J30.x(1)& XE40.x(1) & physcond)
+        LVL1MenuItem('L1_J30_XE50').setLogic( J30.x(1)& XE50.x(1) & physcond)
+        LVL1MenuItem('L1_2J20_XE20').setLogic( J20.x(2)&  XE20.x(1) & physcond)
+        
+
+        # MBTS
+        MBTS_1   = MBTS_A.x(1) | MBTS_C.x(1)
+        MBTS_2   = (MBTS_A.x(2) | MBTS_C.x(2) | MBTS_A.x(1)) & (MBTS_A.x(2) | MBTS_C.x(2) | MBTS_C.x(1))
+        MBTS_1_1 = MBTS_A.x(1) & MBTS_C.x(1)
+        MBTS_2_2 = MBTS_A.x(2) & MBTS_C.x(2)
+        MBTS_3_3 = MBTS_A.x(3) & MBTS_C.x(3)
+        MBTS_4_4 = MBTS_A.x(4) & MBTS_C.x(4)
+
+        LVL1MenuItem('L1_MBTS_1',           ctpid=0xe2).setLogic( MBTS_1   & physcond ).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_MBTS_2',           ctpid=0xe3).setLogic( MBTS_2   & physcond ).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_MBTS_1_1_OVERLAY', ctpid=0xe4).setLogic( MBTS_1_1 & physcond ).setTriggerType(TT.zerobs)
+        LVL1MenuItem('L1_MBTS_1_1',         ctpid=0xe4).setLogic( MBTS_1_1 & physcond ).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_MBTS_2_2'                    ).setLogic( MBTS_2_2 & physcond ).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_MBTS_3_3'                    ).setLogic( MBTS_3_3 & physcond ).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_MBTS_4_4',         ctpid=0xe1).setLogic( MBTS_4_4 & physcond ).setTriggerType(TT.minb)
+
+        LVL1MenuItem('L1_MBTS_1_EMPTY'  ).setLogic( MBTS_1   & cosmiccond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_MBTS_2_EMPTY'  ).setLogic( MBTS_2   & cosmiccond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_MBTS_1_1_EMPTY').setLogic( MBTS_1_1 & cosmiccond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_MBTS_2_2_EMPTY').setLogic( MBTS_2_2 & cosmiccond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_MBTS_3_3_EMPTY').setLogic( MBTS_3_3 & cosmiccond).setTriggerType(TT.minb)
+
+        LVL1MenuItem('L1_MBTS_1_UNPAIRED_ISO'   ).setLogic( MBTS_1 & unpaired_isocond    ).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_MBTS_1_UNPAIRED_NONISO').setLogic( MBTS_1 & unpaired_nonisocond ).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_MBTS_2_UNPAIRED_ISO'   ).setLogic( MBTS_2 & unpaired_isocond ).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_MBTS_2_UNPAIRED_NONISO').setLogic( MBTS_2 & unpaired_nonisocond ).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_MBTS_2_BGRP7'          ).setLogic( MBTS_2 & bgrp7cond           ).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_MBTS_1_1_UNPAIRED_ISO' ).setLogic( MBTS_1_1 & unpaired_isocond ).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_MBTS_2_2_UNPAIRED_ISO' ).setLogic( MBTS_2_2 & unpaired_isocond ).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_MBTS_3_3_UNPAIRED_ISO' ).setLogic( MBTS_3_3 & unpaired_isocond ).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_MBTS_4_4_UNPAIRED_ISO' ).setLogic( MBTS_4_4 & unpaired_isocond ).setTriggerType(TT.minb)
+
+        LVL1MenuItem('L1_MBTSA0' ).setLogic( MBTS_A0.x(1) & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_MBTSA1' ).setLogic( MBTS_A1.x(1) & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_MBTSA2' ).setLogic( MBTS_A2.x(1) & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_MBTSA3' ).setLogic( MBTS_A3.x(1) & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_MBTSA4' ).setLogic( MBTS_A4.x(1) & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_MBTSA5' ).setLogic( MBTS_A5.x(1) & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_MBTSA6' ).setLogic( MBTS_A6.x(1) & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_MBTSA7' ).setLogic( MBTS_A7.x(1) & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_MBTSA8' ).setLogic( MBTS_A8.x(1) & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_MBTSA9' ).setLogic( MBTS_A9.x(1) & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_MBTSA10').setLogic( MBTS_A10.x(1) & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_MBTSA11').setLogic( MBTS_A11.x(1) & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_MBTSA12').setLogic( MBTS_A12.x(1) & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_MBTSA13').setLogic( MBTS_A13.x(1) & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_MBTSA14').setLogic( MBTS_A14.x(1) & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_MBTSA15').setLogic( MBTS_A15.x(1) & physcond).setTriggerType(TT.minb)
+
+        LVL1MenuItem('L1_MBTSC0' ).setLogic( MBTS_C0.x(1) & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_MBTSC1' ).setLogic( MBTS_C1.x(1) & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_MBTSC2' ).setLogic( MBTS_C2.x(1) & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_MBTSC3' ).setLogic( MBTS_C3.x(1) & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_MBTSC4' ).setLogic( MBTS_C4.x(1) & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_MBTSC5' ).setLogic( MBTS_C5.x(1) & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_MBTSC6' ).setLogic( MBTS_C6.x(1) & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_MBTSC7' ).setLogic( MBTS_C7.x(1) & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_MBTSC8' ).setLogic( MBTS_C8.x(1) & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_MBTSC9' ).setLogic( MBTS_C9.x(1) & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_MBTSC10').setLogic( MBTS_C10.x(1) & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_MBTSC11').setLogic( MBTS_C11.x(1) & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_MBTSC12').setLogic( MBTS_C12.x(1) & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_MBTSC13').setLogic( MBTS_C13.x(1) & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_MBTSC14').setLogic( MBTS_C14.x(1) & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_MBTSC15').setLogic( MBTS_C15.x(1) & physcond).setTriggerType(TT.minb)
+        
+
+        # ZDC
+        
+        LVL1MenuItem('L1_ZDC'                     ).setLogic((ZDC_A.x(1)|ZDC_C.x(1)) & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_ZDC_EMPTY'               ).setLogic((ZDC_A.x(1)|ZDC_C.x(1))&cosmiccond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_ZDC_UNPAIRED_ISO'        ).setLogic((ZDC_A.x(1)|ZDC_C.x(1))&unpaired_isocond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_ZDC_UNPAIRED_NONISO'     ).setLogic((ZDC_A.x(1)|ZDC_C.x(1))&unpaired_nonisocond).setTriggerType(TT.minb)                
+        LVL1MenuItem('L1_ZDC_A_C'                 ).setLogic(ZDC_A.x(1)&ZDC_C.x(1) & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_ZDC_A_C_EMPTY'           ).setLogic(ZDC_A.x(1)&ZDC_C.x(1)&cosmiccond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_ZDC_A_C_UNPAIRED_ISO'    ).setLogic(ZDC_A.x(1)&ZDC_C.x(1)&unpaired_isocond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_ZDC_A_C_UNPAIRED_NONISO' ).setLogic(ZDC_A.x(1)&ZDC_C.x(1)&unpaired_nonisocond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_ZDC_A'                   ).setLogic(ZDC_A.x(1) & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_ZDC_C'                   ).setLogic(ZDC_C.x(1) & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_ZDC_AND'                 ).setLogic(ZDC_AND.x(1) & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_ZDC_A_VTE20'             ).setLogic(ZDC_A.x(1)&Not( TE20.x(1)) & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_ZDC_C_VTE20'             ).setLogic(ZDC_C.x(1)&Not( TE20.x(1)) & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_ZDC_A_BGRP7'             ).setLogic(ZDC_A.x(1)&bgrp7cond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_ZDC_C_BGRP7'             ).setLogic(ZDC_C.x(1)&bgrp7cond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_ZDC_MBTS_1'              ).setLogic((ZDC_A.x(1)|ZDC_C.x(1))&( MBTS_A.x(1)| MBTS_C.x(1)) & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_ZDC_MBTS_2'              ).setLogic((ZDC_A.x(1)|ZDC_C.x(1))&\
+                                                             ( MBTS_A.x(2)| MBTS_C.x(2)| MBTS_A.x(1))\
+                                                             &( MBTS_A.x(2)| MBTS_C.x(2)| MBTS_C.x(1)) & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_ZDC_MBTS_1_1'            ).setLogic((ZDC_A.x(1)|ZDC_C.x(1))&( MBTS_A.x(1)& MBTS_C.x(1)) & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_ZDC_MBTS_2_2'            ).setLogic((ZDC_A.x(1)|ZDC_C.x(1))&( MBTS_A.x(2)& MBTS_C.x(2)) & physcond).setTriggerType(TT.minb)
+
+
+        # BCM
+
+        LVL1MenuItem('L1_BCM_AC_CA_BGRP0',ctpid=0xe6 ).setLogic((BCM_AtoC.x(1)|BCM_CtoA.x(1))&BGRP0).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_BCM_AC_CA_UNPAIRED_ISO'     ).setLogic((BCM_AtoC.x(1)|BCM_CtoA.x(1))&unpaired_isocond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_BCM_AC_CA_UNPAIRED_NONISO'  ).setLogic((BCM_AtoC.x(1)|BCM_CtoA.x(1))&unpaired_nonisocond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_BCM_HT_BGRP0',   ctpid=0xf8 ).setLogic( BCM_Comb.x(7)&BGRP0).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_BCM_Wide_BGRP0', ctpid=0xe8 ).setLogic( BCM_Wide.x(1)&BGRP0).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_BCM_Wide_EMPTY'             ).setLogic( BCM_Wide.x(1)&cosmiccond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_BCM_Wide_UNPAIRED_ISO'      ).setLogic( BCM_Wide.x(1)&unpaired_isocond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_BCM_Wide_UNPAIRED_NONISO'   ).setLogic( BCM_Wide.x(1)&unpaired_nonisocond).setTriggerType(TT.minb)
+
+
+        # LUCID
+        
+        LVL1MenuItem('L1_LUCID_C',     ctpid=0xed  ).setLogic( LUCID_C.x(1) & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_LUCID_A',     ctpid=0xec  ).setLogic( LUCID_A.x(1) & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_LUCID_A_C',   ctpid=0xee  ).setLogic( LUCID_A.x(1)&LUCID_C.x(1) & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_LUCID',       ctpid=0xf5  ).setLogic( (LUCID_A.x(1)|LUCID_C.x(1)) & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_LUCID_BGRP7'              ).setLogic( (LUCID_A.x(1)|LUCID_C.x(1))&bgrp7cond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_LUCID_COMM'               ).setLogic( NIMDIR5.x(1) & physcond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_LUCID_A_C_EMPTY'          ).setLogic( LUCID_A.x(1)&LUCID_C.x(1)&cosmiccond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_LUCID_EMPTY'              ).setLogic( (LUCID_A.x(1)|LUCID_C.x(1))&cosmiccond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_LUCID_UNPAIRED_ISO'       ).setLogic( (LUCID_A.x(1)|LUCID_C.x(1))&unpaired_isocond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_LUCID_UNPAIRED_NONISO'    ).setLogic( (LUCID_A.x(1)|LUCID_C.x(1))&unpaired_nonisocond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_LUCID_COMM_EMPTY'         ).setLogic( NIMDIR5.x(1)&cosmiccond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_LUCID_COMM_UNPAIRED_ISO'  ).setLogic( NIMDIR5.x(1)&unpaired_isocond).setTriggerType(TT.minb)        
+        LVL1MenuItem('L1_LUCID_A_C_UNPAIRED_ISO'   ).setLogic( LUCID_A.x(1)&LUCID_C.x(1)&unpaired_isocond).setTriggerType(TT.minb)
+        LVL1MenuItem('L1_LUCID_A_C_UNPAIRED_NONISO').setLogic( LUCID_A.x(1)&LUCID_C.x(1)&unpaired_nonisocond).setTriggerType(TT.minb)
+
+
+        # RANDOM
+
+        LVL1MenuItem('L1_RD0_FILLED'         ).setLogic( RNDM0 & physcond           ).setTriggerType(TT.rand)
+        LVL1MenuItem('L1_RD0_EMPTY'          ).setLogic( RNDM0 & cosmiccond         ).setTriggerType(TT.rand)
+        LVL1MenuItem('L1_RD0_FIRSTEMPTY'     ).setLogic( RNDM0 & firstempty         ).setTriggerType(TT.rand)
+        LVL1MenuItem('L1_RD0_UNPAIRED_ISO'   ).setLogic( RNDM0 & unpaired_isocond   ).setTriggerType(TT.rand)
+        LVL1MenuItem('L1_RD0_UNPAIRED_NONISO').setLogic( RNDM0 & unpaired_nonisocond).setTriggerType(TT.rand)
+        LVL1MenuItem('L1_RD1_FILLED'         ).setLogic( RNDM1 & physcond           ).setTriggerType(TT.rand)
+        LVL1MenuItem('L1_RD1_EMPTY'          ).setLogic( RNDM1 & cosmiccond         ).setTriggerType(TT.zerobs)
+
+        
+        # Bunch groups
+
+        LVL1MenuItem('L1_BGRP1').setLogic(BGRP0 & BGRP1).setTriggerType(TT.rand)
+        LVL1MenuItem('L1_BGRP7').setLogic(BGRP0 & BGRP7).setTriggerType(TT.rand)
+        LVL1MenuItem('L1_BGRP1_ALFA_BGT').setLogic(BGRP0 & BGRP1).setTriggerType(TT.rand)
+        LVL1MenuItem('L1_BGRP4_ALFA_BGT').setLogic(BGRP0 & BGRP4).setTriggerType(TT.rand)
+        LVL1MenuItem('L1_BGRP7_ALFA_BGT').setLogic(BGRP0 & BGRP7).setTriggerType(TT.rand)
+        LVL1MenuItem('L1_BPTX0_BGRP0', ctpid=0xf1).setLogic(BPTX0.x(1)&BGRP0).setTriggerType(TT.rand)
+        LVL1MenuItem('L1_BPTX1_BGRP0', ctpid=0xf2).setLogic(BPTX1.x(1)&BGRP0).setTriggerType(TT.rand)
+        
+
+        # Direct inputs [0x50:0x5f]
+        #LVL1MenuItem('L1_LHCF',  ctpid=-1).setLogic( (NIMDIR36.x(1) & physcond)).setTriggerType(TT.minb)        
+        LVL1MenuItem('L1_LHCF',  ctpid=-1).setLogic( (NIMDIR36.x(1) & physcond))
+
+
+
+        LVL1MenuItem('L1_ALFA_EMPTY').setLogic( NIM_ALFA_LOG.x(1) & cosmiccond).setTriggerType(TT.rpcout)
+        LVL1MenuItem('L1_ALFA_BGRP7').setLogic( NIM_ALFA_LOG.x(1) & bgrp7cond).setTriggerType(TT.rpcout)
+
+        LVL1MenuItem('L1_ALFA_EMPTY_OD', ctpid=-1).setLogic( NIM_ALFA_LOG_OD.x(1)&cosmiccond).setTriggerType(TT.rpcout)
+        LVL1MenuItem('L1_ALFA_BGRP7_OD', ctpid=-1).setLogic( NIM_ALFA_LOG_OD.x(1)&bgrp7cond).setTriggerType(TT.rpcout)
+
+
+        LVL1MenuItem('L1_TRT', ctpid=0x4e).setLogic(NIMDIR25.x(1)&BGRP0).setTriggerType(TT.rpcout)
+
+        LVL1MenuItem('L1_L1A_Mon', ctpid=0x4f).setLogic(NIMDIR26.x(1)&BGRP0).setTriggerType(TT.rpcout)
+        
+        LVL1MenuItem('L1_CALREQ0', ctpid=0xfd).setLogic( NIM28.x(1) & calibcond).setTriggerType(TT.calreq0)
+        LVL1MenuItem('L1_CALREQ1', ctpid=0xfe).setLogic( NIM29.x(1) & calibcond).setTriggerType(TT.calreq1)
+        LVL1MenuItem('L1_CALREQ2', ctpid=0xff).setLogic( NIM30.x(1) & calibcond).setTriggerType(TT.calreq2)
+
+
+        LVL1MenuItem('L1_NIM_S8C2B21').setLogic(NIMDIR6.x(1) & bgrpcond).setTriggerType(TT.rpcout)
+        LVL1MenuItem('L1_NIM_S8C2B22').setLogic(NIMDIR7.x(1) & bgrpcond).setTriggerType(TT.rpcout)
+        LVL1MenuItem('L1_NIM_S8C2B23').setLogic(NIMDIR8.x(1) & bgrpcond).setTriggerType(TT.rpcout)
+
+        
+
+
+        # Alfa items
+        ARL = NIM_A7R1L.x(1)
+        ARU = NIM_A7R1U.x(1)
+        ALL = NIM_A7L1L.x(1)
+        ALU = NIM_A7L1U.x(1)
+        BRL = NIM_B7R1L.x(1)
+        BRU = NIM_B7R1U.x(1)
+        BLL = NIM_B7L1L.x(1)
+        BLU = NIM_B7L1U.x(1)
+
+        # Elastics1 and 2
+        LVL1MenuItem('L1_ALFA_ELAST1').setLogic( BLU & ALU & ARL & BRL & Not( BLL | ALL | ARU | BRU ) & physcond ).setTriggerType(TT.rpcout)
+        LVL1MenuItem('L1_ALFA_ELAST2').setLogic( BLL & ALL & ARU & BRU & Not( BLU | ALU | ARL | BRL ) & physcond ).setTriggerType(TT.rpcout)
+
+        # Elastics 11 - Elastics 18
+        LVL1MenuItem('L1_ALFA_ELAST11').setLogic( BLU & ALU & ARL & BRL & physcond ).setTriggerType(TT.rpcout)
+        LVL1MenuItem('L1_ALFA_ELAST12').setLogic( BLL & ALL & ARU & BRU & physcond ).setTriggerType(TT.rpcout)
+        LVL1MenuItem('L1_ALFA_ELAST13').setLogic( ( BLU | ALU ) & ( ARL & BRL ) & physcond ).setTriggerType(TT.rpcout)
+        LVL1MenuItem('L1_ALFA_ELAST14').setLogic( ( BLU & ALU ) & ( ARL | BRL ) & physcond ).setTriggerType(TT.rpcout)
+        LVL1MenuItem('L1_ALFA_ELAST15').setLogic( ( BLU | ALU ) & ( ARL | BRL ) & physcond ).setTriggerType(TT.rpcout)
+        LVL1MenuItem('L1_ALFA_ELAST16').setLogic( ( BLL | ALL ) & ( ARU & BRU ) & physcond ).setTriggerType(TT.rpcout)
+        LVL1MenuItem('L1_ALFA_ELAST17').setLogic( ( BLL & ALL ) & ( ARU | BRU ) & physcond ).setTriggerType(TT.rpcout)
+        LVL1MenuItem('L1_ALFA_ELAST18').setLogic( ( BLL | ALL ) & ( ARU | BRU ) & physcond ).setTriggerType(TT.rpcout)
+
+        # Single_Diffraction 1 - 8
+        LVL1MenuItem('L1_ALFA_SDIFF1').setLogic( BLU & ALU & Not( BLL | ALL | ARU | ARL | BRU | BRL ) & physcond ).setTriggerType(TT.rpcout)
+        LVL1MenuItem('L1_ALFA_SDIFF2').setLogic( ARL & BRL & Not( BLU | BLL | ALU | ALL | ARU | BRU ) & physcond ).setTriggerType(TT.rpcout)
+        LVL1MenuItem('L1_ALFA_SDIFF3').setLogic( BLL & ALL & Not( BLU | ALU | ARU | ARL | BRU | BRL ) & physcond ).setTriggerType(TT.rpcout)
+        LVL1MenuItem('L1_ALFA_SDIFF4').setLogic( ARU & BRU & Not( BLU | BLL | ALU | ALL | ARL | BRL ) & physcond ).setTriggerType(TT.rpcout)
+
+        LVL1MenuItem('L1_ALFA_SDIFF5').setLogic( BLU & ALU & physcond ).setTriggerType(TT.rpcout)
+        LVL1MenuItem('L1_ALFA_SDIFF6').setLogic( ARL & BRL & physcond ).setTriggerType(TT.rpcout)
+        LVL1MenuItem('L1_ALFA_SDIFF7').setLogic( BLL & ALL & physcond ).setTriggerType(TT.rpcout)
+        LVL1MenuItem('L1_ALFA_SDIFF8').setLogic( ARU & BRU & physcond ).setTriggerType(TT.rpcout)
+
+        # Big_showers 1 - 4
+        LVL1MenuItem('L1_ALFA_SHOW1').setLogic( BLU & BLL & ALU & ALL & Not( ARU | ARL | BRU | BRL ) & physcond ).setTriggerType(TT.rpcout)
+        LVL1MenuItem('L1_ALFA_SHOW2').setLogic( ARU & ARL & BRU & BRL & Not( BLU | BLL | ALU | ALL ) & physcond ).setTriggerType(TT.rpcout)
+        LVL1MenuItem('L1_ALFA_SHOW3').setLogic( BLU & BLL & ALU & ALL & physcond ).setTriggerType(TT.rpcout)
+        LVL1MenuItem('L1_ALFA_SHOW4').setLogic( ARU & ARL & BRU & BRL & physcond ).setTriggerType(TT.rpcout)
+
+        # Systematics 1 - 4
+        LVL1MenuItem('L1_ALFA_SYST1').setLogic( BLU & BLL & Not( ALU | ALL | ARU | ARL | BRU | BRL ) & physcond ).setTriggerType(TT.rpcout)
+        LVL1MenuItem('L1_ALFA_SYST2').setLogic( ALU & ALL & Not( BLU | BLL | ARU | ARL | BRU | BRL ) & physcond ).setTriggerType(TT.rpcout)
+        LVL1MenuItem('L1_ALFA_SYST3').setLogic( ARU & ARL & Not( BLU | BLL | ALU | ALL | BRU | BRL ) & physcond ).setTriggerType(TT.rpcout)
+        LVL1MenuItem('L1_ALFA_SYST4').setLogic( BRU & BRL & Not( BLU | BLL | ALU | ALL | ARU | ARL ) & physcond ).setTriggerType(TT.rpcout)
+
+        # Big_showers_Systematics 1 - 5
+        LVL1MenuItem('L1_ALFA_SHOWSYST1').setLogic( BLU & BLL & physcond ).setTriggerType(TT.rpcout)
+        LVL1MenuItem('L1_ALFA_SHOWSYST2').setLogic( ALU & ALL & physcond ).setTriggerType(TT.rpcout)
+        LVL1MenuItem('L1_ALFA_SHOWSYST3').setLogic( ARU & ARL & physcond ).setTriggerType(TT.rpcout)
+        LVL1MenuItem('L1_ALFA_SHOWSYST4').setLogic( BRU & BRL & physcond ).setTriggerType(TT.rpcout)
+        LVL1MenuItem('L1_ALFA_SHOWSYST5').setLogic( ( BLU | BLL | ALU | ALL ) & ( ARU | ARL | BRU | BRL ) & physcond ).setTriggerType(TT.rpcout)
+
+        # Systematics 9 - 12, 17, 18
+        LVL1MenuItem('L1_ALFA_SYST9' ).setLogic( BLU & ALU & ARU & BRU & Not( BLL | ALL | ARL | BRL ) & physcond ).setTriggerType(TT.rpcout)
+        LVL1MenuItem('L1_ALFA_SYST10').setLogic( BLL & ALL & ARL & BRL & Not( BLU | ALU | ARU | BRU ) & physcond ).setTriggerType(TT.rpcout)
+        LVL1MenuItem('L1_ALFA_SYST11').setLogic( BLU & ALU & ARU & BRU & physcond ).setTriggerType(TT.rpcout)
+        LVL1MenuItem('L1_ALFA_SYST12').setLogic( BLL & ALL & ARL & BRL & physcond ).setTriggerType(TT.rpcout)
+        LVL1MenuItem('L1_ALFA_SYST17').setLogic( ( BLU | ALU ) & ( ARU | BRU ) & physcond ).setTriggerType(TT.rpcout)
+        LVL1MenuItem('L1_ALFA_SYST18').setLogic( ( BLL | ALL ) & ( ARL | BRL ) & physcond ).setTriggerType(TT.rpcout)
+
+        # ANY_ALFA = Minimum_Bias : B7L1U or B7L1L or A7L1U or A7L1L or A7R1U or A7R1L or B7R1U or B7R1L
+        ANY_ALFA = BLU | BLL | ALU | ALL | ARU | ARL | BRU | BRL
+        LVL1MenuItem('L1_ALFA_ANY'                ).setLogic( ANY_ALFA & physcond            ).setTriggerType(TT.rpcout)
+        LVL1MenuItem('L1_ALFA_ANY_EMPTY'          ).setLogic( ANY_ALFA & cosmiccond          ).setTriggerType(TT.rpcout)
+        LVL1MenuItem('L1_ALFA_ANY_FIRSTEMPTY'     ).setLogic( ANY_ALFA & firstempty          ).setTriggerType(TT.rpcout)
+        LVL1MenuItem('L1_ALFA_ANY_UNPAIRED_ISO'   ).setLogic( ANY_ALFA & unpaired_isocond    ).setTriggerType(TT.rpcout)
+        LVL1MenuItem('L1_ALFA_ANY_UNPAIRED_NONISO').setLogic( ANY_ALFA & unpaired_nonisocond ).setTriggerType(TT.rpcout)
+
+        #---------------------------------
+        # new ALFA items for 2012 running:
+        #---------------------------------
+        ARL_OD = NIM_A7R1L_OD.x(1)
+        ARU_OD = NIM_A7R1U_OD.x(1)
+        ALL_OD = NIM_A7L1L_OD.x(1)
+        ALU_OD = NIM_A7L1U_OD.x(1)
+        BRL_OD = NIM_B7R1L_OD.x(1)
+        BRU_OD = NIM_B7R1U_OD.x(1)
+        BLL_OD = NIM_B7L1L_OD.x(1)
+        BLU_OD = NIM_B7L1U_OD.x(1)
+
+        LVL1MenuItem('L1_ALFA_A7L1U').setLogic( ALU & BGRP0 ).setTriggerType(TT.rpcout)
+        LVL1MenuItem('L1_ALFA_A7L1L').setLogic( ALL & BGRP0 ).setTriggerType(TT.rpcout)
+        LVL1MenuItem('L1_ALFA_A7R1U').setLogic( ARU & BGRP0 ).setTriggerType(TT.rpcout)
+        LVL1MenuItem('L1_ALFA_A7R1L').setLogic( ARL & BGRP0 ).setTriggerType(TT.rpcout)
+        LVL1MenuItem('L1_ALFA_B7L1U').setLogic( BLU & BGRP0 ).setTriggerType(TT.rpcout)
+        LVL1MenuItem('L1_ALFA_B7L1L').setLogic( BLL & BGRP0 ).setTriggerType(TT.rpcout)
+        LVL1MenuItem('L1_ALFA_B7R1U').setLogic( BRU & BGRP0 ).setTriggerType(TT.rpcout)
+        LVL1MenuItem('L1_ALFA_B7R1L').setLogic( BRL & BGRP0 ).setTriggerType(TT.rpcout)
+
+        LVL1MenuItem('L1_ALFA_A7L1U_OD').setLogic( ALU_OD & BGRP0 ).setTriggerType(TT.rpcout)
+        LVL1MenuItem('L1_ALFA_A7L1L_OD').setLogic( ALL_OD & BGRP0 ).setTriggerType(TT.rpcout)
+        LVL1MenuItem('L1_ALFA_B7L1U_OD').setLogic( BLU_OD & BGRP0 ).setTriggerType(TT.rpcout)
+        LVL1MenuItem('L1_ALFA_B7L1L_OD').setLogic( BLL_OD & BGRP0 ).setTriggerType(TT.rpcout)
+        LVL1MenuItem('L1_ALFA_A7R1U_OD').setLogic( ARU_OD & BGRP0 ).setTriggerType(TT.rpcout)
+        LVL1MenuItem('L1_ALFA_A7R1L_OD').setLogic( ARL_OD & BGRP0 ).setTriggerType(TT.rpcout)
+        LVL1MenuItem('L1_ALFA_B7R1U_OD').setLogic( BRU_OD & BGRP0 ).setTriggerType(TT.rpcout)
+        LVL1MenuItem('L1_ALFA_B7R1L_OD').setLogic( BRL_OD & BGRP0 ).setTriggerType(TT.rpcout)
+
+        LVL1MenuItem('L1_ALFA_B7L1_OD').setLogic( ( BLU_OD & BLL_OD ) & BGRP0 ).setTriggerType(TT.rpcout)
+        LVL1MenuItem('L1_ALFA_A7L1_OD').setLogic( ( ALU_OD & ALL_OD ) & BGRP0 ).setTriggerType(TT.rpcout)
+        LVL1MenuItem('L1_ALFA_A7R1_OD').setLogic( ( ARU_OD & ARL_OD ) & BGRP0 ).setTriggerType(TT.rpcout)
+        LVL1MenuItem('L1_ALFA_B7R1_OD').setLogic( ( BRU_OD & BRL_OD ) & BGRP0 ).setTriggerType(TT.rpcout)
+        
+        LVL1MenuItem('L1_ALFA_B1_EMPTY').setLogic( ( BLU | BLL | ALU | ALL ) & cosmiccond ).setTriggerType(TT.rpcout)
+        LVL1MenuItem('L1_ALFA_B2_EMPTY').setLogic( ( ARU | ARL | BRU | BRL ) & cosmiccond ).setTriggerType(TT.rpcout)
+
+        # ALFA and MBTS 
+        LVL1MenuItem('L1_MBTS_2_A_ALFA_C').setLogic( MBTS_A.x(2) & (( ARU & BRU ) | ( ARL & BRL )) & bgrpcond ).setTriggerType(TT.rpcout)
+        LVL1MenuItem('L1_MBTS_2_C_ALFA_A').setLogic( MBTS_C.x(2) & (( ALU & BLU ) | ( ALL & BLL )) & bgrpcond ).setTriggerType(TT.rpcout)
+        LVL1MenuItem('L1_MBTS_2_ALFA').setLogic( MBTS_2 & ANY_ALFA & bgrpcond ).setTriggerType(TT.rpcout)
+
+        LVL1MenuItem('L1_MBTS_2_A_ALFA_C_UNPAIRED_ISO').setLogic( MBTS_A.x(2) & ((ARU & BRU) | (ARL & BRL)) & unpaired_isocond ).setTriggerType(TT.rpcout)
+        LVL1MenuItem('L1_MBTS_2_C_ALFA_A_UNPAIRED_ISO').setLogic( MBTS_C.x(2) & ((ALU & BLU) | (ALL & BLL)) & unpaired_isocond ).setTriggerType(TT.rpcout)
+        LVL1MenuItem('L1_MBTS_2_ALFA_UNPAIRED_ISO'    ).setLogic( MBTS_2 & ANY_ALFA & unpaired_isocond ).setTriggerType(TT.rpcout)
+
+        LVL1MenuItem('L1_MBTS_1_A_ALFA_C').setLogic( MBTS_A.x(1) & ((ARU & BRU) | (ARL & BRL)) & bgrpcond ).setTriggerType(TT.rpcout)
+        LVL1MenuItem('L1_MBTS_1_C_ALFA_A').setLogic( MBTS_C.x(1) & ((ALU & BLU) | (ALL & BLL)) & bgrpcond ).setTriggerType(TT.rpcout)
+        LVL1MenuItem('L1_MBTS_1_A_ALFA_C_UNPAIRED_ISO').setLogic( MBTS_A.x(1) & ((ARU & BRU) | (ARL & BRL)) & unpaired_isocond ).setTriggerType(TT.rpcout)
+        LVL1MenuItem('L1_MBTS_1_C_ALFA_A_UNPAIRED_ISO').setLogic( MBTS_C.x(1) & ((ALU & BLU) | (ALL & BLL)) & unpaired_isocond ).setTriggerType(TT.rpcout)
+            
+        # ALFA and LUCID 
+        LVL1MenuItem('L1_LUCID_A_ALFA_C').setLogic( LUCID_A.x(1) & ((ARU & BRU) | (ARL & BRL)) & bgrpcond ).setTriggerType(TT.rpcout)
+        LVL1MenuItem('L1_LUCID_C_ALFA_A').setLogic( LUCID_C.x(1) & ((ALU & BLU) | (ALL & BLL)) & bgrpcond ).setTriggerType(TT.rpcout)
+        LVL1MenuItem('L1_LUCID_A_ALFA_C_UNPAIRED_ISO').setLogic( LUCID_A.x(1) & ((ARU & BRU) | (ARL & BRL)) & unpaired_isocond ).setTriggerType(TT.rpcout)
+        LVL1MenuItem('L1_LUCID_C_ALFA_A_UNPAIRED_ISO').setLogic( LUCID_C.x(1) & ((ALU & BLU) | (ALL & BLL)) & unpaired_isocond ).setTriggerType(TT.rpcout)
+        LVL1MenuItem('L1_LUCID_ALFA').setLogic( (LUCID_A.x(1) | LUCID_C.x(1)) & ANY_ALFA & bgrpcond ).setTriggerType(TT.rpcout)
+
+        # ALFA and ZDC
+        LVL1MenuItem('L1_ZDC_A_ALFA_C').setLogic( ZDC_A.x(1) & ((ARU & BRU) | (ARL & BRL)) & bgrpcond ).setTriggerType(TT.rpcout)
+        LVL1MenuItem('L1_ZDC_C_ALFA_A').setLogic( ZDC_C.x(1) & ((ALU & BLU) | (ALL & BLL)) & bgrpcond ).setTriggerType(TT.rpcout)
+        LVL1MenuItem('L1_ZDC_ALFA').setLogic( (ZDC_A.x(1) | ZDC_C.x(1)) & ANY_ALFA & bgrpcond ).setTriggerType(TT.rpcout)
+
+        # new combined ALFA items for 2012 running
+        LVL1MenuItem('L1_EM3_ALFA_ANY'   ).setLogic( EM3.x(1) & ANY_ALFA & physcond ).setTriggerType( TT.calo | TT.caloem | TT.rpcout)
+        LVL1MenuItem('L1_EM3_ALFA_MBTS_A').setLogic( EM3.x(1) & MBTS_A.x(1) & ((BRU & ARU) | (BRL & ARL)) & physcond).setTriggerType( TT.calo | TT.caloem | TT.minb | TT.rpcout)
+        LVL1MenuItem('L1_EM3_ALFA_MBTS_C').setLogic( EM3.x(1) & MBTS_C.x(1) & ((BLU & ALU) | (BLL & ALL)) & physcond).setTriggerType( TT.calo | TT.caloem | TT.minb | TT.rpcout)
+        
+        LVL1MenuItem('L1_EM3_ALFA_ANY_UNPAIRED_ISO'   ).setLogic( EM3.x(1) & ANY_ALFA & unpaired_isocond).setTriggerType( TT.calo | TT.caloem | TT.rpcout)
+        LVL1MenuItem('L1_EM3_ALFA_MBTS_C_UNPAIRED_ISO').setLogic( EM3.x(1) & MBTS_C.x(1) & ((BLU & ALU) | (BLL & ALL)) & unpaired_isocond).setTriggerType( TT.calo | TT.caloem | TT.minb | TT.rpcout)
+        LVL1MenuItem('L1_EM3_ALFA_MBTS_A_UNPAIRED_ISO').setLogic( EM3.x(1) & MBTS_A.x(1) & ((BRU & ARU) | (BRL & ARL)) & unpaired_isocond).setTriggerType( TT.calo | TT.caloem | TT.minb | TT.rpcout)
+
+
+        LVL1MenuItem('L1_TOPO_DPHI', ctpid=300).setLogic( TOPO_DPHI.x(1) & physcond).setTriggerType( TT.calo )
+
+
+        # =======================================================
+
+        LVL1MenuItem.currentPartition = 1
+        LVL1MenuItem.l1configForRegistration = None
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/LVL1Menu/Menu_L1_alfa_v2.py b/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/LVL1Menu/Menu_L1_alfa_v2.py
new file mode 100644
index 0000000000000000000000000000000000000000..16a6345b6ba058f21b408377dc126bbf595eccd2
--- /dev/null
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/LVL1Menu/Menu_L1_alfa_v2.py
@@ -0,0 +1,175 @@
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+#------------------------------------------------------------------------#
+#------------Just a copy of Physics_pp_v3 with empty HLT-----------------#
+#------------------------------------------------------------------------#
+def defineMenu():
+
+    from TriggerMenu.l1.Lvl1Flags import Lvl1Flags
+
+    Lvl1Flags.CTPVersion = 4 # new CTP
+
+    Lvl1Flags.BunchGroupPartitioning = [1, 11, 14] # partition 1: 1-10, partition 2: 11-13, partition 3: 14-15 (note that BGRP0 is used by all items)
+    Lvl1Flags.BunchGroupNames = ['BCRVeto', 'Filled', 'Calib', 'Empty', 'UnpairedBeam1', 'UnpairedBeam2', 'FirstEmpty', 'InTrain']
+    Lvl1Flags.BunchGroupNames += ['NotUsed'] * len(Lvl1Flags.BunchGroupNames())
+
+    Lvl1Flags.MenuPartitioning = [0, 472, 492] # partition 1: ctpid 0-471, partition 2: ctpid 472-491, partition 3: ctpid 492-511
+
+    Lvl1Flags.RemapThresholdsAsListed = True
+
+    Lvl1Flags.thresholds = [
+        #------------------------------------
+        #------------------------------------
+        #      !!!!!!!IMPORTANT!!!!!!!!!
+        # Please make sure to use the right
+        # order to get the mapping right!!!
+        #------------------------------------
+        #------------------------------------
+        'MU4'      , 'MU6',   'MU10', 'MU11', 'MU15', 'MU20', 
+        'EM3'      , 'EM6', 'EM10VH', 'EM12', 'EM14VH', 'EM16V', 'EM16VH', 'EM18VH','EM30',
+        'HA8'      , 'HA11', 'HA11I', 'HA15','HA15I', 'HA20', 'HA40',
+        'J10'      , 'J15',   'J20', 'J30', 'J50', 'J75', 'J100', 'J350', 
+        'JE140'    , 'JE200', 'JE350','JE500',
+        'JB30'     , 'JB50',  'JB75', 'JB100',
+        'JF30'     , 'JF50',  'JF75', 'JF100',
+        'TE20'     , 'TE300', 'TE500', 'TE700', 'TE800', 'TE1000', 'TE1200', 'TE1400',# --> the last three are left in as a forced threshold.
+        'XS25'     , 'XS30', 'XS35', 'XS40', 'XS45', 'XS50', 'XS60', 'XS65',
+        'XE20', 'XE25', 'XE30', 'XE35', 'XE40', 'XE50', 'XE60', 'XE70',
+        'MBTS_A'   , 'MBTS_C',
+        'BPTX0'    ,'BPTX1',
+        'LUCID_A'  ,'LUCID_C',
+        'BCM_AtoC' , 'BCM_CtoA', 'BCM_Wide', 'BCM_Comb',
+        'ZDC_A'    , 'ZDC_C','ZDC_AND',
+        'NIMDIR5', 'NIMDIR25', 'NIMDIR26',
+        #CALREQ
+        'NIM28','NIM29','NIM30','NIM_MUB', 'NIM_MUE',
+        #ZB
+        'ZB_EM12',
+        ### The following are added in as forced thresholds (MBTSSI).
+        'MBTS_A0'  , 'MBTS_A1', 'MBTS_A2', 'MBTS_A3', 
+        'MBTS_A4'  , 'MBTS_A5', 'MBTS_A6', 'MBTS_A7', 
+        'MBTS_A8'  , 'MBTS_A9', 'MBTS_A10', 'MBTS_A11', 
+        'MBTS_A12' , 'MBTS_A13', 'MBTS_A14', 'MBTS_A15', 
+        'MBTS_C0'  , 'MBTS_C1', 'MBTS_C2', 'MBTS_C3', 
+        'MBTS_C4'  , 'MBTS_C5', 'MBTS_C6', 'MBTS_C7', 
+        'MBTS_C8'  , 'MBTS_C9', 'MBTS_C10', 'MBTS_C11', 
+        'MBTS_C12' , 'MBTS_C13', 'MBTS_C14', 'MBTS_C15',
+        #### Forced for ALFA
+        'NIM_B7R1L','NIM_B7R1U','NIM_B7L1L','NIM_B7L1U',
+        'NIM_A7R1L','NIM_A7R1U','NIM_A7L1L','NIM_A7L1U',
+        'NIM_B7R1L_OD','NIM_B7R1U_OD','NIM_B7L1L_OD','NIM_B7L1U_OD',
+        'NIM_A7R1L_OD','NIM_A7R1U_OD','NIM_A7L1L_OD','NIM_A7L1U_OD',
+        ### For L1_ALFA
+        'NIM_ALFA_LOG', 'NIM_ALFA_LOG_OD'
+        ]
+    Lvl1Flags.items = [
+        #EM thresholds
+        'L1_EM3', 'L1_EM6', 'L1_EM12', 'L1_EM10VH',
+        'L1_EM14VH','L1_EM16VH', 'L1_EM18VH', 'L1_EM30',
+        'L1_EM30_BGRP7',
+        #multi EM thresholds
+        'L1_2EM3', 'L1_2EM6', #'L1_2EM8',
+        'L1_2EM10VH', 'L1_2EM12',
+        'L1_2EM3_EM6', 'L1_2EM6_EM16VH', #'L1_2EM12_EM16V',
+        'L1_3EM6','L1_3EM6_EM14VH',
+        #Jet thresholds
+        'L1_J10','L1_J15', 'L1_J30','L1_J50','L1_J75','L1_J100','L1_J350',
+        #multi jets         
+        'L1_3J10','L1_3J15', 'L1_3J50','L1_3J75','L1_4J10',
+        'L1_4J15','L1_4J20','L1_4J30','L1_5J15','L1_6J10',
+        #forwards jets
+        'L1_FJ30','L1_FJ75','L1_2FJ30','L1_2FJ50',
+        #XS
+        'L1_XS30', 'L1_XS45', 'L1_XS50','L1_XS60','L1_XS65',
+        #XE
+        'L1_XE20','L1_XE30','L1_XE40','L1_XE50','L1_XE60','L1_XE70',
+        #JE
+        'L1_JE140', 'L1_JE350','L1_JE200','L1_JE500',
+        #TE
+        'L1_TE20','L1_TE300','L1_TE500','L1_TE700','L1_TE800',
+        #EMPTY, FIRSTEMPTY, UNPAIRED etc
+        'L1_TAU8_EMPTY', 
+        'L1_MU11_EMPTY',
+        'L1_J10_EMPTY','L1_J10_FIRSTEMPTY','L1_J10_UNPAIRED_ISO','L1_J10_UNPAIRED_NONISO',
+        'L1_J30_EMPTY','L1_J30_FIRSTEMPTY','L1_J30_UNPAIRED_ISO','L1_J30_UNPAIRED_NONISO',
+        'L1_FJ30_EMPTY','L1_FJ30_FIRSTEMPTY','L1_FJ30_UNPAIRED_ISO',
+        'L1_EM3_EMPTY','L1_EM3_FIRSTEMPTY','L1_EM3_UNPAIRED_ISO','L1_EM3_UNPAIRED_NONISO',
+        'L1_EM6_EMPTY'            ,
+        #ALFA 
+        'L1_ALFA_EMPTY','L1_ALFA_EMPTY_OD',        
+        'L1_ALFA_BGRP7', 'L1_ALFA_BGRP7_OD',
+        #"old" ALFA ITEMS
+        'L1_ALFA_ELAST1' ,'L1_ALFA_ELAST2' ,
+        'L1_ALFA_ELAST11','L1_ALFA_ELAST12','L1_ALFA_ELAST13','L1_ALFA_ELAST14',
+        'L1_ALFA_ELAST15','L1_ALFA_ELAST16','L1_ALFA_ELAST17','L1_ALFA_ELAST18',
+        'L1_ALFA_SDIFF1' ,'L1_ALFA_SDIFF2' ,'L1_ALFA_SDIFF3' ,'L1_ALFA_SDIFF4' ,
+        'L1_ALFA_SDIFF5' ,'L1_ALFA_SDIFF6' ,'L1_ALFA_SDIFF7' ,'L1_ALFA_SDIFF8' ,
+        'L1_ALFA_SHOW1','L1_ALFA_SHOW2','L1_ALFA_SHOW3','L1_ALFA_SHOW4',
+        'L1_ALFA_SYST1','L1_ALFA_SYST2','L1_ALFA_SYST3','L1_ALFA_SYST4','L1_ALFA_SYST9',
+        'L1_ALFA_SYST10','L1_ALFA_SYST11','L1_ALFA_SYST12','L1_ALFA_SYST17','L1_ALFA_SYST18',
+        'L1_ALFA_SHOWSYST1','L1_ALFA_SHOWSYST2','L1_ALFA_SHOWSYST3','L1_ALFA_SHOWSYST4','L1_ALFA_SHOWSYST5',
+        'L1_ALFA_ANY','L1_ALFA_ANY_EMPTY','L1_ALFA_ANY_FIRSTEMPTY',
+        'L1_ALFA_ANY_UNPAIRED_ISO','L1_ALFA_ANY_UNPAIRED_NONISO',    
+        #new ALFA itmes
+        'L1_ALFA_A7L1U_OD', 'L1_ALFA_A7L1L_OD','L1_ALFA_A7R1U_OD','L1_ALFA_A7R1L_OD', 
+        'L1_ALFA_B7L1U_OD', 'L1_ALFA_B7L1L_OD','L1_ALFA_B7R1U_OD', 'L1_ALFA_B7R1L_OD',
+        'L1_ALFA_A7L1_OD' ,'L1_ALFA_A7R1_OD' ,'L1_ALFA_B7L1_OD' ,'L1_ALFA_B7R1_OD' ,
+        
+        'L1_ALFA_B7L1U', 'L1_ALFA_B7L1L','L1_ALFA_A7L1U','L1_ALFA_A7L1L',             
+        'L1_ALFA_A7R1U','L1_ALFA_A7R1L','L1_ALFA_B7R1U','L1_ALFA_B7R1L',                 
+        'L1_ALFA_B1_EMPTY','L1_ALFA_B2_EMPTY',     
+        
+        'L1_MBTS_2_A_ALFA_C','L1_MBTS_2_C_ALFA_A','L1_MBTS_2_ALFA',             
+        'L1_MBTS_1_A_ALFA_C','L1_MBTS_1_C_ALFA_A',#'L1_MBTS_1_ALFA',             
+        'L1_MBTS_2_ALFA_UNPAIRED_ISO',
+        'L1_LUCID_A_ALFA_C','L1_LUCID_C_ALFA_A','L1_LUCID_ALFA',  
+        'L1_ZDC_A_ALFA_C','L1_ZDC_C_ALFA_A','L1_ZDC_ALFA',
+        #new combined alfa item
+        'L1_EM3_ALFA_ANY',
+        'L1_EM3_ALFA_MBTS_C',
+        'L1_EM3_ALFA_MBTS_A',
+        'L1_EM3_ALFA_ANY_UNPAIRED_ISO',
+        'L1_EM3_ALFA_MBTS_C_UNPAIRED_ISO',
+        'L1_EM3_ALFA_MBTS_A_UNPAIRED_ISO',        
+        #BGRP, L1A_Mon
+        'L1_BPTX0_BGRP0',  #BPTX, BGRP
+        'L1_BPTX1_BGRP0',
+        'L1_L1A_Mon' ,
+        'L1_BGRP1_ALFA_BGT','L1_BGRP4_ALFA_BGT','L1_BGRP7_ALFA_BGT',
+        'L1_BGRP7',
+        #ZDC
+        'L1_ZDC','L1_ZDC_EMPTY','L1_ZDC_A_C','L1_ZDC_A_C_EMPTY' ,
+        #RD0, RD1
+        'L1_RD0_EMPTY', 'L1_RD0_FILLED','L1_RD0_FIRSTEMPTY','L1_RD0_UNPAIRED_ISO',       
+        'L1_RD1_EMPTY' ,'L1_RD1_FILLED',
+        #TRT, ZB
+        'L1_TRT',  
+        'L1_ZB',        
+        #LUCID
+        'L1_LUCID','L1_LUCID_EMPTY','L1_LUCID_UNPAIRED_ISO',
+        'L1_LUCID_COMM','L1_LUCID_COMM_EMPTY','L1_LUCID_COMM_UNPAIRED_ISO',
+        'L1_LUCID_BGRP7',
+        'L1_LUCID_A_C','L1_LUCID_A_C_EMPTY','L1_LUCID_A_C_UNPAIRED_ISO','L1_LUCID_A_C_UNPAIRED_NONISO', 
+        #MBTS
+        'L1_MBTS_1', 'L1_MBTS_2' ,'L1_MBTS_4_4',
+        'L1_MBTS_2_UNPAIRED_ISO' ,
+        'L1_MBTS_1_UNPAIRED_ISO',
+        'L1_MBTS_2_BGRP7'        ,
+        #BCM
+        'L1_BCM_Wide_EMPTY','L1_BCM_Wide_UNPAIRED_ISO','L1_BCM_Wide_UNPAIRED_NONISO',
+        'L1_BCM_Wide_BGRP0','L1_BCM_HT_BGRP0', 'L1_BCM_AC_CA_BGRP0',
+        'L1_BCM_AC_CA_UNPAIRED_ISO' ,                       
+        'L1_CALREQ0','L1_CALREQ1','L1_CALREQ2',
+        #UNPAIRED_ISO ADDITIONS:
+        'L1_LUCID_A_ALFA_C_UNPAIRED_ISO','L1_LUCID_C_ALFA_A_UNPAIRED_ISO',
+        'L1_MBTS_2_C_ALFA_A_UNPAIRED_ISO','L1_MBTS_2_A_ALFA_C_UNPAIRED_ISO',
+        'L1_MBTS_1_C_ALFA_A_UNPAIRED_ISO','L1_MBTS_1_A_ALFA_C_UNPAIRED_ISO',
+
+        ]
+    
+
+    Lvl1Flags.CtpIdMap =  {}
+
+
+
+    
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/LVL1Menu/Menu_LS2_v1.py b/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/LVL1Menu/Menu_LS2_v1.py
new file mode 100644
index 0000000000000000000000000000000000000000..57b67588ca4f8fbd63a18c17e11ae7a1800319c0
--- /dev/null
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/LVL1Menu/Menu_LS2_v1.py
@@ -0,0 +1,1550 @@
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+def defineMenu():
+    """
+    Defines the following LvlFlags:
+    
+    thresholds   .... list of all threshold names in the menu (includes forced thresholds)
+    items        .... list of all L1 item names in the menu
+    CtpIdMap     .... map of item names to CTP IDs
+    """
+    
+    from TriggerMenu.l1.Lvl1Flags import Lvl1Flags
+
+    Lvl1Flags.CTPVersion = 4 # new CTP
+
+    Lvl1Flags.BunchGroupPartitioning = [1, 14, 15] # partition 1: 1-10, partition 2: 14, partition 3: 15 (note that BGRP0 is used by all items)
+    Lvl1Flags.BunchGroupNames = ['BCRVeto', 'Paired', 'CalReq', 'Empty', 'IsolatedUnpaired', 'NonIsolatedUnpaired', 'EmptyAfterPaired', 'InTrain', 'AbortGapNotCalReq', 'VdM', 'ALFA', 'EmptyBeforePaired','EmptyAndPaired']
+    Lvl1Flags.BunchGroupNames += ['NotUsed'] * len(Lvl1Flags.BunchGroupNames())
+
+    Lvl1Flags.MenuPartitioning = [0, 472, 492] # partition 1: ctpid 0-471, partition 2: ctpid 472-491, partition 3: ctpid 492-511
+
+    Lvl1Flags.RemapThresholdsAsListed = True
+
+    Lvl1Flags.thresholds = [
+        #------------------------------------
+        #------------------------------------
+        #      !!!!!!!IMPORTANT!!!!!!!!!
+        # Please make sure to use the right
+        # order to get the mapping right!!!
+        #------------------------------------
+        #------------------------------------
+
+        # Note that the forced thresholds (FTHR) are not used in the menu but are needed for input monitoring
+        # They can always be replaced with something that is needed for the menu
+
+
+        #-------------------------
+        # SLOT 7 / CON 0,1 (EM1,2)
+        #-------------------------
+        
+        # 16 x EM
+        'EM3', 'EM7', 'EM8VH',
+        'EM8I',
+        'EM10VH', 'EM12', 'EM13VH', 'EM15', 'EM15VH',
+        'EM15HI',
+        'EM18VH', 'EM20VH', 'EM20VHI', 'EM22VHI', 'EM24VHI', 'EM26VHI', 
+
+        # 1 x ZB
+        'ZB_EM15',
+
+        #--------------------------
+        # SLOT 7 / CON 2,3 (TAU1,2)
+        #--------------------------
+
+        # 16 x TAU
+        'HA8', 'HA12', 'HA12IL', 'HA12IM', 'HA12IT', 'HA15', 'HA20', 'HA20IL',  'HA20IM', 'HA20IT', 'HA25', 'HA25IT', 'HA30', 'HA40', 'HA60', 'HA100', 
+
+        #----------------------
+        # SLOT 8 / CON 0 (JET1)
+        #----------------------
+        # 10 x 3-bit JET (can have multiplicity 4 or more)
+
+        # 8 x JETs and central jets
+        'J12', 'J15', 'J15.0ETA25','J20', 'J25','J25.0ETA23','J30', 'J40',
+        
+        # 2 x VBF
+        'J20.0ETA49', 'J30.0ETA49',
+
+
+        #----------------------
+        # SLOT 8 / CON 1 (JET2)
+        #----------------------
+        # 15 x 2-bit JET (can have maximum multiplicity of 3) (SLOT 8, CON 1)
+
+        # 3 x Central Jet
+        'J35.0ETA23','J40.0ETA25', 'J20.28ETA31',
+
+        # 6 Jets
+        'J50', 'J75', 'J85', 'J100', 'J120', 'J400',
+
+        # 6 x FJ              
+        'J15.31ETA49', 'J20.31ETA49', 'J30.31ETA49', 'J50.31ETA49', 'J75.31ETA49', 'J100.31ETA49', 
+
+
+        #---------------------
+        # SLOT 8 / CON 2 (EN1)
+        #---------------------
+        # 24 x 1-bit thresholds
+        
+        # 8 x TE
+        #'TE3', 'TE5', 'TE10', 'TE15', 'TE20', 'TE25', 'TE30', 'TE40',
+        #'TE5', 'TE30', 'TE40', 'TE45', 'TE50', 'TE55', 'TE60', 'TE65',
+        'TE5', 'TE10', 'TE15', 'TE20', 'TE25', 'TE30', 'TE40', 'TE70',
+
+        # 8 x XE (for standard XE)
+        #'XE35', 'XE40', 'XE45', 'XE50', 'XE55', 'XE60', 'XE70', 'XE80',
+        # 8 x XE (for restricted ETA XE: check ATR-13234 for any further change)
+        #'XE10', 'XE20', 'XE25', 'XE30', 'XE65', 'XE75', 'XE150', 'XE300',
+
+        'XE10', 'XE20', 'XE25', 'XE30', 'XE35', 'XE40', 'XE45', 'XE50',
+        'XE55', 'XE60', 'XE65', 'XE70', 'XE75', 'XE80', 'XE150', 'XE300',
+        
+        # 8 x XS
+        'XS20', 'XS30', 'XS40', 'XS45', 'XS50', 'XS55', 'XS60', 'XS65', 
+
+
+        #---------------------
+        # SLOT 8 / CON 3 (EN2)
+        #---------------------
+        # 16 x 1-bit thresholds
+
+        # 8 x weighted sum ET
+        #'RXE35', 'RXE40', 'RXE45', 'RXE50', 'RXE55', 'RXE60', 'RXE70', 'RXE80', # FTHR
+
+        # 8 x restricted eta range
+        #'TE3.0ETA24', 'TE5.0ETA24','TE10.0ETA24', 'TE15.0ETA24', 'TE20.0ETA24', 'TE25.0ETA24', 'TE30.0ETA24', 'TE40.0ETA24',
+        #'TE5.0ETA24', 'TE30.0ETA24','TE40.0ETA24', 'TE45.0ETA24', 'TE50.0ETA24', 'TE55.0ETA24', 'TE60.0ETA24', 'TE65.0ETA24',
+        'TE5.0ETA24', 'TE10.0ETA24', 'TE15.0ETA24', 'TE20.0ETA24', 'TE25.0ETA24', 'TE30.0ETA24', 'TE40.0ETA24', 'TE70.0ETA24',
+
+        #------------------------
+        # SLOT 9 / CON 0 (MUCTPi)
+        #------------------------
+        
+        # 6 x MU
+        'MU4', 'MU6', 'MU10', 'MU11', 'MU15', 'MU20',
+
+
+        #------------------------
+        # SLOT 9 / CON 1 (CTPCal)
+        #------------------------
+
+        # 3 x 1-bit BCM
+        'BCM_AtoC', 'BCM_CtoA', 'BCM_Wide',
+        # 1 x 3-bit BCM
+        'BCM_Comb',
+
+        # 8 x DBM
+        #'DBM0', 'DBM1', 'DBM2', 'DBM3', 'DBM4', 'DBM5', 'DBM6', 'DBM7', # FTHR
+
+        # 2  x BPTX
+       'BPTX0','BPTX1',
+
+        # 6 x LUCID 
+        'LUCID_A', 'LUCID_C',
+        #'LUCID_Coinc_AC', # FTHR
+        #'LUCID_COMM',
+        #'LUCID_05', 'LUCID_06', # FHTR
+
+        # 3 x ZDC
+        'ZDC_A', 'ZDC_C',
+        'ZDC_AND', # FTHR
+
+        # 3 x CALREQ
+        'CAL0','CAL1','CAL2',
+
+        #-----------------------------
+        # SLOT 9 / CON 2,3 (NIM1,NIM2)
+        #-----------------------------
+
+        # 2 x MBTS
+        'MBTS_A', 'MBTS_C',
+
+        # 24 x MBTSSI (all FTHR)
+        'MBTS_A0', 'MBTS_A1', 'MBTS_A2', 'MBTS_A3', 'MBTS_A4'  , 'MBTS_A5', 'MBTS_A6', 'MBTS_A7', 
+        'MBTS_A8', 'MBTS_A10', 'MBTS_A12' , 'MBTS_A14',
+        'MBTS_C0', 'MBTS_C1', 'MBTS_C2', 'MBTS_C3', 'MBTS_C4'  , 'MBTS_C5', 'MBTS_C6', 'MBTS_C7', 
+        'MBTS_C8', 'MBTS_C10', 'MBTS_C12' , 'MBTS_C14',
+
+        # L1A for CTP monitoring itself
+        'NIML1A',
+
+        # LHCF
+        'NIMLHCF',
+
+        # TGC
+        'NIMTGC',
+        
+        # RPC
+        'NIMRPC',
+        
+        # TRT
+        'NIMTRT',
+
+        # AFP
+        'AFP_NSC', 'AFP_FSC',
+
+        #-------------------------------------------------------------------
+        #L1 TOPO inputs 
+        #-------------------------------------------------------------------
+        
+        #HT
+        'HT190-AJ15all.ETA21',
+        'HT190-J15s5.ETA21',
+        'HT150-AJ20all.ETA31',
+        'HT150-J20s5.ETA31',
+
+        
+
+        #ZH 
+        '10MINDPHI-AJ20s2-XE50', '10MINDPHI-J20s2-XE50', '10MINDPHI-J20s2-XE30', '10MINDPHI-J20ab-XE50', '10MINDPHI-CJ20ab-XE50', 
+        #Jpsi T&P
+        '1INVM5-EMs1-EMs6', '1INVM5-EM7s1-EMs6', '1INVM5-EM12s1-EMs6',        
+
+        #W T&P
+        '05MINDPHI-AJj10s6-XE0',
+        '10MINDPHI-AJj10s6-XE0',
+        '15MINDPHI-AJj10s6-XE0',
+        '05MINDPHI-EM12s6-XE0',
+        '15MINDPHI-EM12s6-XE0',
+        '05MINDPHI-EM15s6-XE0',
+        '15MINDPHI-EM15s6-XE0',
+        '05RATIO-XE0-HT0-AJj15all.ETA49',
+        '90RATIO2-XE0-HT0-AJj15all.ETA49',
+        '250RATIO2-XE0-HT0-AJj15all.ETA49',
+        'HT20-AJj15all.ETA49',
+        'NOT-02MATCH-EM10s1-AJj15all.ETA49',
+        '25MT-EM12s6-XE0',
+        '35MT-EM12s6-XE0',
+        '35MT-EM15s6-XE0',
+        #'10MINDPHI-AJj15s2-XE0',
+        #'20MINDPHI-AJjs6-XE0',
+        #'20MINDPHI-AJj15s2-XE0',
+        #'10MINDPHI-EM6s1-XE0',
+        #'20MINDPHI-EM9s6-XE0',
+        #'20MINDPHI-EM6s1-XE0',
+        #'05RATIO-XE0-HT0-AJj15all.ETA49',
+        #'08RATIO-XE0-HT0-AJj0all.ETA49',
+        #'40RATIO2-XE0-HT0-AJj15all.ETA49',
+        #'90RATIO2-XE0-HT0-AJj0all.ETA49',
+        #'HT20-AJj0all.ETA49',
+        #'NOT-02MATCH-EM9s1-AJj15all.ETA49',
+        #'05RATIO-XE0-SUM0-EM9s1-HT0-AJj15all.ETA49',
+        #'20MT-EM6s6-XE0',
+        #'30MT-EM6s6-XE0',
+        #'40MT-EM6s6-XE0',
+        
+        # central muon
+        'MULT-CMU4ab',
+        'MULT-CMU6ab',
+        
+        #B-jet
+        '0DR04-MU4ab-CJ15ab', '0DR04-MU4ab-CJ20ab', '0DR04-MU4ab-CJ30ab', '0DR04-MU6ab-CJ20ab', '0DR04-MU6ab-CJ25ab',
+        #B-physics
+#SX        '2DR15-2MU4ab', 
+#SX        '2INVM999-2MU4ab', 
+#SX        '4INVM8-2MU4ab',
+        '2DR15-2MU6ab', 
+#SX        '2INVM999-2MU6ab', 
+#SX        '4INVM8-2MU6ab',
+
+        # L1 thresholds for L1Topo streamers
+#SX        '2INVM999-CMU4ab-MU4ab',
+#SX        '2INVM999-2CMU4ab',
+#SX        '2INVM999-MU6ab-MU4ab',
+#SX        '2INVM999-ONEBARREL-MU6ab-MU4ab',
+#SX        '2INVM999-CMU6ab-CMU4ab',
+#SX        '4INVM8-CMU4ab-MU4ab',
+#SX        '4INVM8-2CMU4ab',
+#SX        '4INVM8-MU6ab-MU4ab',
+#SX        '4INVM8-ONEBARREL-MU6ab-MU4ab',
+#SX        '4INVM8-CMU6ab-CMU4ab',        
+        '2DR99-2MU4ab',
+        '5DETA99-5DPHI99-MU6ab-MU4ab',
+        '5DETA99-5DPHI99-2MU6ab',
+        '0DR10-MU10ab-MU6ab',
+        '0DR15-2MU6ab',
+#        '0DETA04-0DPHI03-EM8abi-MU10ab',
+        '0DETA04-EM8abi-MU10ab',
+        '0DPHI03-EM8abi-MU10ab',
+#        '0DETA04-0DPHI03-EM15abi-MUab',
+        '0DETA04-EM15abi-MUab',
+        '0DPHI03-EM15abi-MUab',
+        '10MINDPHI-AJ20s2-XE50',
+        '10MINDPHI-J20s2-XE50',
+        '10MINDPHI-J20ab-XE50',
+        '10MINDPHI-CJ20ab-XE50',
+        '900INVM9999-AJ30s6-AJ20s6',
+        '800INVM9999-AJ30s6-AJ20s6',
+        '700INVM9999-AJ30s6-AJ20s6',
+        '500INVM9999-AJ30s6-AJ20s6',
+        '400INVM9999-AJ30s6-AJ20s6',
+        #'350INVM9999-AJ30s6-AJ20s6',
+        '300INVM9999-AJ30s6-AJ20s6',
+        '200INVM9999-AJ30s6-AJ20s6',
+        '100INVM9999-AJ30s6-AJ20s6',
+        #'350INVM9999-J30s6-J20s6',
+        #'300INVM9999-J30s6-J20s6',
+        #'250INVM9999-J30s6-J20s6',
+        #'200INVM9999-J30s6-J20s6',
+        'HT150-AJj15all.ETA49',
+        '0MATCH-4AJ20.ETA31-4AJj15.ETA31',
+        '100RATIO-0MATCH-TAU30si2-EMall',
+        'NOT-0MATCH-TAU30si2-EMall',
+        '0DR28-MU10ab-TAU12abi',
+        '1DISAMB-TAU12abi-J25ab',
+        '1DISAMB-EM15his2-TAU12abi-J25ab',
+        'DISAMB-0DR28-EM15his2-TAU12abi',
+        '1DISAMB-J25ab-0DR28-EM15his2-TAU12abi',
+        '1DISAMB-TAU20abi-TAU12abi-J25ab',
+        '0DR25-TAU20abi-TAU12abi',
+        '0DR28-TAU20abi-TAU12abi',
+        '0DETA20-0DPHI20-TAU20abi-TAU12abi',
+        '1DISAMB-J25ab-0DR25-TAU20abi-TAU12abi',
+        '1DISAMB-J25ab-0DR28-TAU20abi-TAU12abi',
+        'DISAMB-30INVM-EM20his2-TAU12ab',
+        '400INVM9999-AJ30s6.ETA31-AJ20s6.31ETA49',
+        'LAR-EM50s1',
+        'LAR-J100s1',
+#SX        '2DR15-CMU4ab-MU4ab',
+#SX        '2DR15-2CMU4ab',
+#SX        '2DR15-MU6ab-MU4ab',
+#SX        '2DR15-ONEBARREL-MU6ab-MU4ab',
+#SX        '2DR15-CMU6ab-CMU4ab',
+
+        '2INVM9-2MU6ab',
+        '7INVM15-2MU4ab', 
+        '2INVM8-ONEBARREL-MU6ab-MU4ab', 
+        '0DR24-2CMU4ab', 
+        '0DR22-2MU6ab',
+        '0DR34-2MU4ab', 
+        '0DR24-2MU4ab', 
+        '0DR24-CMU4ab-MU4ab',  
+        '2INVM8-CMU4ab-MU4ab',
+        '0DR15-2MU4ab',  
+        '0DR15-MU6ab-MU4ab',  
+        '0DR22-MU6ab-MU4ab', 
+        '8INVM15-MU6ab-MU4ab',  
+        '8INVM15-2MU6ab', 
+        '2INVM8-2MU4ab',  # ATR-15197 '2INVM9-2MU4ab',
+        '2INVM8-MU6ab-MU4ab', # ATR-15197 '2INVM9-MU6ab-MU4ab',
+        '2INVM9-2MU4ab',
+        '2INVM9-MU6ab-MU4ab',
+        'KF-XE40-AJall',
+        'KF-XE50-AJall',
+        'KF-XE55-AJall',
+        'KF-XE60-AJall',
+        'KF-XE65-AJall',
+        'KF-XE75-AJall',
+
+        'LATE-MU10s1',
+        'SC111-CJ15ab.ETA26',
+        'SC85-CJ15ab.ETA26',
+        
+        # ALFA (the replication is needed to build all the combinations in the CTPCore)
+        'ALFA_B7R1L', 'ALFA_B7R1U', 'ALFA_A7R1L', 'ALFA_A7R1U', 'ALFA_A7L1L', 'ALFA_A7L1U', 'ALFA_B7L1L', 'ALFA_B7L1U',
+        'ALFA2_B7R1L', 'ALFA2_B7R1U', 'ALFA2_A7R1L', 'ALFA2_A7R1U', 'ALFA2_A7L1L', 'ALFA2_A7L1U', 'ALFA2_B7L1L', 'ALFA2_B7L1U',
+        'ALFA3_B7R1L', 'ALFA3_B7R1U', 'ALFA3_A7R1L', 'ALFA3_A7R1U', 'ALFA3_A7L1L', 'ALFA3_A7L1U', 'ALFA3_B7L1L', 'ALFA3_B7L1U',
+        'ALFA4_B7R1L', 'ALFA4_B7R1U', 'ALFA4_A7R1L', 'ALFA4_A7R1U', 'ALFA4_A7L1L', 'ALFA4_A7L1U', 'ALFA4_B7L1L', 'ALFA4_B7L1U',
+#ATR-13743        'ALFA_B7R1L_OD', 'ALFA_B7R1U_OD', 'ALFA_A7R1L_OD', 'ALFA_A7R1U_OD', 'ALFA_A7L1L_OD', 'ALFA_A7L1U_OD', 'ALFA_B7L1L_OD', 'ALFA_B7L1U_OD',
+
+
+        ]
+
+    
+    Lvl1Flags.items = [
+
+        
+        # single EM
+
+        'L1_EM3','L1_EM7','L1_EM12', 'L1_EM8VH',
+#        'L1_EM8I',
+        'L1_EM10VH', 'L1_EM13VH', 'L1_EM15',
+        'L1_EM15I','L1_EM15HI',
+        'L1_EM26VHI','L1_EM15VH', 'L1_EM18VH', 'L1_EM20VH', 'L1_EM20VHI', 'L1_EM22VHI', 'L1_EM24VHI', # see Jira ATR-10334'L1_EM22VHLIL', #'L1_EM50V',
+        'L1_EM3_EMPTY', 'L1_EM7_EMPTY', 'L1_EM7_UNPAIRED_ISO', 'L1_EM7_FIRSTEMPTY','L1_EM7_UNPAIRED_NONISO',
+        'L1_EM20VH_FIRSTEMPTY',
+        'L1_EM22VHI_FIRSTEMPTY',
+        #'L1_EM15_BGRP7',
+
+        # see savannah https://savannah.cern.ch/bugs/?103935
+
+        # combined EM -jet
+        #'L1_JJ15.23ETA49', # 4x4 window
+
+        # single MU
+        "L1_MU4", "L1_MU6", "L1_MU10", "L1_MU11", "L1_MU15", "L1_MU20",
+
+        "L1_MU4_EMPTY", "L1_MU6_EMPTY", "L1_MU4_FIRSTEMPTY", "L1_MU11_EMPTY",
+        'L1_MU4_UNPAIRED_ISO','L1_MU4_UNPAIRED_NONISO',
+         'L1_MU20_FIRSTEMPTY',
+
+        
+        
+        # multi lepton
+        "L1_2EM3", "L1_2EM7", "L1_2EM10VH", "L1_2EM13VH", "L1_2EM15", "L1_2EM15VH", "L1_EM7_2EM3", "L1_EM12_2EM3", "L1_EM15VH_3EM7", "L1_EM15VH_3EM8VH", "L1_EM15VH_2EM10VH_3EM7",
+				"L1_2EM18VH", "L1_2EM20VH", "L1_EM15VH_3EM10VH", "L1_EM18VH_3EM8VH", "L1_EM18VH_2EM10VH_3EM7", "L1_EM20VH_3EM10VH", "L1_EM20VH_2EM10VH_3EM8VH",
+        "L1_EM7_MU10",
+        "L1_2MU4", "L1_2MU6", "L1_2MU10", "L1_2MU20_OVERLAY", "L1_MU10_2MU6", "L1_MU11_2MU6", "L1_3MU4", "L1_MU6_2MU4", "L1_3MU6",  "L1_4MU4", "L1_MU6_3MU4", "L1_2MU6_3MU4",
+
+        "L1_EM8I_MU10", "L1_EM15I_MU4", "L1_2EM8VH_MU10", "L1_EM15VH_MU10", 
+
+
+        # single tau
+        "L1_TAU12", "L1_TAU12IM",  "L1_TAU20", "L1_TAU20IM",
+        "L1_TAU30","L1_TAU30_EMPTY","L1_TAU30_UNPAIRED_ISO", "L1_TAU40", "L1_TAU60", "L1_TAU100", "L1_TAU8", "L1_TAU8_EMPTY", 
+        "L1_TAU8_UNPAIRED_ISO","L1_TAU8_FIRSTEMPTY","L1_TAU8_UNPAIRED_NONISO",
+
+        # multi tau
+        "L1_TAU20IM_2TAU12IM", "L1_TAU20_2TAU12", "L1_TAU40_2TAU20IM",
+
+        # combined tau - lepton
+        "L1_EM15HI_2TAU12IM",          
+        "L1_EM15HI_2TAU12IM_J25_3J12",   
+	"L1_EM15HI_TAU40_2TAU15",
+        "L1_MU10_TAU12IM",  
+        "L1_MU10_TAU12IM_J25_2J12", 
+#        "L1_MU10_TAU12_J25_2J12", 
+#        "L1_MU10_TAU20",
+        "L1_MU10_TAU20IM",
+        "L1_MU11_TAU20IM",
+        "L1_MU10_TAU20IM_J25_2J20",	
+
+        # combined tau - jet
+#        "L1_TAU25IT_2TAU12IT_2J25_3J12", 
+
+        "L1_TAU20IM_2TAU12IM_J25_2J20_3J12", 
+        'L1_J25_2J20_3J12_BOX-TAU20ITAU12I',  
+        'L1_DR-MU10TAU12I_TAU12I-J25', 
+        "L1_MU10_TAU12I-J25",
+
+
+        # combined tau - xe
+        "L1_TAU20IM_2J20_XE45", 
+#        "L1_TAU20_2J20_XE45", 
+#        "L1_TAU20IM_2J20_XE50",   
+
+        #"L1_EM15HI_2TAU12I_XE35", 
+        "L1_EM15HI_2TAU12IM_XE35", 
+        "L1_EM15HI_TAU20IM_2TAU15_J25_2J20_3J15",	 
+        'L1_EM20VHI_TAU20IM_2TAU20_J25_3J20',
+
+
+        "L1_MU10_TAU12IM_XE35",  
+#        "L1_MU10_TAU12IM_XE40",  
+
+        "L1_TAU20IM_2TAU12IM_XE35", 
+        "L1_TAU20_2TAU12_XE35",
+        "L1_TAU40_2TAU12IM_XE40",  
+
+
+
+        # combined em - jet
+        #'L1_EM15VH_J15.23ETA49',
+#        'L1_EM15VH_JJ15.23ETA49',
+        'L1_EM13VH_3J20',
+        'L1_EM18VH_3J20',
+
+        # combined mu - jet
+        'L1_MU4_J12',  'L1_MU4_J50_XE40', 'L1_MU6_J20', 'L1_MU6_J30.0ETA49_2J20.0ETA49', 'L1_MU6_J40', 'L1_MU6_J75',
+#ATR-13743        'L1_MU4_J30',
+        #'L1_MU4_J50',
+        'L1_MU10_2J20','L1_MU10_3J20', 'L1_MU10_2J15_J20',
+        'L1_2MU4_J40_XE20',
+        'L1_MU20_J40',
+        'L1_MU20_XE30',
+
+        # single jet
+        "L1_J12","L1_J15","L1_J20","L1_J25", "L1_J30", "L1_J40", "L1_J50" ,"L1_J75","L1_J85", "L1_J100", "L1_J120", "L1_J400",
+        "L1_J20.31ETA49", "L1_J30.31ETA49", "L1_J50.31ETA49", "L1_J75.31ETA49", "L1_J100.31ETA49",
+        #'L1_J15.23ETA49',
+         'L1_J15.31ETA49',
+        "L1_J20.28ETA31",
+        #'L1_J40.0ETA25', 
+        "L1_J12_EMPTY","L1_J12_FIRSTEMPTY", "L1_J12_UNPAIRED_ISO", "L1_J12_UNPAIRED_NONISO", "L1_J12_ABORTGAPNOTCALIB", 
+        "L1_J15.31ETA49_UNPAIRED_ISO",
+        "L1_J30_EMPTY", "L1_J30_FIRSTEMPTY", "L1_J30.31ETA49_EMPTY", "L1_J30.31ETA49_UNPAIRED_ISO",
+        "L1_J30.31ETA49_UNPAIRED_NONISO",
+        "L1_J50_UNPAIRED_ISO", "L1_J50_UNPAIRED_NONISO", "L1_J50_ABORTGAPNOTCALIB",         
+        "L1_J12_BGRP12", "L1_J30.31ETA49_BGRP12",
+        'L1_J100_FIRSTEMPTY',
+        'L1_J100.31ETA49_FIRSTEMPTY',
+        
+        # multi jet
+
+        "L1_J20_J20.31ETA49",
+        "L1_3J15", "L1_3J20","L1_3J40", 'L1_3J15.0ETA25', "L1_3J50", "L1_4J15", "L1_4J20",
+        "L1_4J20.0ETA49",
+        "L1_3J15.0ETA25_XE40",
+        
+        #"L1_3J75",
+        #"L1_4J30",
+        "L1_6J15",
+        "L1_J75_3J20",
+        "L1_J85_3J30",
+        "L1_J30.0ETA49_2J20.0ETA49",
+
+        "L1_J15.0ETA25_2J15.31ETA49",
+        "L1_J40.0ETA25_2J15.31ETA49",
+        "L1_J40.0ETA25_2J25_J20.31ETA49",
+        "L1_J40.0ETA25_2J30_J20.31ETA49",
+        
+        # multi jet central
+        "L1_3J25.0ETA23",
+        "L1_3J35.0ETA23",
+        "L1_4J15.0ETA25",
+        "L1_5J15.0ETA25", 
+        
+        # combined jet
+        "L1_2J15_XE55", "L1_J40_XE50", "L1_J75_XE50",
+
+        #'L1_2J40_XE45',
+        "L1_2J50_XE40", "L1_J40_XE60","L1_J40.0ETA25_XE50",
+
+        # XE
+        "L1_XE35", "L1_XE40", "L1_XE45", "L1_XE50", 
+        "L1_XE55", "L1_XE60", "L1_XE70", "L1_XE80",
+        'L1_XE10', 'L1_XE30', 'L1_XE65', 'L1_XE75', 'L1_XE150', 'L1_XE300',
+        
+        #XS
+        'L1_XS20', 'L1_XS30',
+        'L1_EM12_XS20', 'L1_EM15_XS30',
+        
+        # TE
+        #"L1_TE3",        "L1_TE5",        "L1_TE10",        "L1_TE15",        "L1_TE20",        "L1_TE25",        "L1_TE30",        "L1_TE40",
+        #"L1_TE5",        "L1_TE30",        "L1_TE40",        "L1_TE45",        "L1_TE50",        "L1_TE55",        "L1_TE60",        "L1_TE65",
+        "L1_TE5",        "L1_TE10",        "L1_TE15",   "L1_TE20",  "L1_TE25",  "L1_TE30",        "L1_TE40",      "L1_TE70",      
+
+        #"L1_TE3.0ETA24", "L1_TE5.0ETA24", "L1_TE10.0ETA24", "L1_TE15.0ETA24", "L1_TE20.0ETA24", "L1_TE25.0ETA24", "L1_TE30.0ETA24", "L1_TE40.0ETA24", 
+        #"L1_TE5.0ETA24", "L1_TE30.0ETA24", "L1_TE40.0ETA24", "L1_TE45.0ETA24", "L1_TE50.0ETA24", "L1_TE55.0ETA24", "L1_TE60.0ETA24", "L1_TE65.0ETA24", 
+        "L1_TE5.0ETA24", "L1_TE10.0ETA24", "L1_TE15.0ETA24", "L1_TE20.0ETA24", "L1_TE25.0ETA24", "L1_TE30.0ETA24", "L1_TE40.0ETA24","L1_TE70.0ETA24",
+
+        # MBTS
+        "L1_MBTS_1", "L1_MBTS_2", "L1_MBTS_1_1",
+        "L1_MBTS_1_EMPTY", "L1_MBTS_1_UNPAIRED_ISO", 
+        "L1_MBTS_2_EMPTY", "L1_MBTS_2_UNPAIRED_ISO",
+        "L1_MBTS_1_1_EMPTY", "L1_MBTS_1_1_UNPAIRED_ISO","L1_MBTS_4_A_UNPAIRED_ISO","L1_MBTS_4_C_UNPAIRED_ISO",
+#        'L1_MBTSA0' ,'L1_MBTSA1' ,'L1_MBTSA2' ,'L1_MBTSA3' ,'L1_MBTSA4' ,
+#        'L1_MBTSA5' ,'L1_MBTSA6' ,'L1_MBTSA7' ,'L1_MBTSA8' ,
+#        'L1_MBTSA10','L1_MBTSA12','L1_MBTSA14',
+#        'L1_MBTSC0' ,'L1_MBTSC1' ,'L1_MBTSC2' ,'L1_MBTSC3' ,'L1_MBTSC4' ,
+#        'L1_MBTSC5' ,'L1_MBTSC6' ,'L1_MBTSC7' ,'L1_MBTSC8' ,
+#        'L1_MBTSC10','L1_MBTSC12','L1_MBTSC14',
+        # beam splashes
+        "L1_MBTS_4_A", "L1_MBTS_4_C",
+
+        #BGRP9
+        'L1_MBTS_1_BGRP9','L1_MBTS_2_BGRP9',
+
+        #BGRP11
+        'L1_MBTS_1_BGRP11','L1_MBTS_2_BGRP11',
+
+        # RNDM
+        'L1_RD0_FILLED', 'L1_RD0_UNPAIRED_ISO','L1_RD0_EMPTY',
+        "L1_RD1_FILLED","L1_RD1_EMPTY","L1_RD1_BGRP10",
+        "L1_RD2_FILLED","L1_RD2_EMPTY","L1_RD2_BGRP12",
+        "L1_RD3_FILLED","L1_RD3_EMPTY",
+        'L1_RD0_FIRSTEMPTY', 
+        'L1_RD0_BGRP9', 'L1_RD0_BGRP11', 'L1_RD0_ABORTGAPNOTCALIB',
+
+        #LUCID
+        'L1_LUCID', 'L1_LUCID_EMPTY', 'L1_LUCID_UNPAIRED_ISO', 
+        'L1_LUCID_A_C_EMPTY', 'L1_LUCID_A_C_UNPAIRED_ISO', 'L1_LUCID_A_C_UNPAIRED_NONISO',
+        #'L1_LUCID_COMM_EMPTY', 'L1_LUCID_COMM_UNPAIRED_ISO', 
+
+        # ZDC
+        'L1_ZDC_A', 'L1_ZDC_C', 'L1_ZDC_A_C',
+        'L1_ZDC_AND', # FTHR
+
+        # VDM
+        'L1_BGRP9', #"L1_BGRP7",
+
+        # TRT
+        # "L1_TRT",
+        "L1_TRT_FILLED",
+        "L1_TRT_EMPTY",
+
+        # TGC
+        "L1_TGC_BURST",
+#        "L1_TGC_BURST_EMPTY",
+
+        # LHCF
+        "L1_LHCF", "L1_LHCF_UNPAIRED_ISO", "L1_LHCF_EMPTY",
+    
+        #CALREQ
+        "L1_CALREQ2",
+
+        #ZB
+        "L1_ZB",
+
+        # BPTX
+        "L1_BPTX0_BGRP0", "L1_BPTX1_BGRP0",
+        
+        # BCM
+        'L1_BCM_Wide_BGRP0','L1_BCM_AC_CA_BGRP0', 'L1_BCM_Wide_EMPTY','L1_BCM_Wide_UNPAIRED_ISO','L1_BCM_Wide_UNPAIRED_NONISO', 'L1_BCM_AC_CA_UNPAIRED_ISO',
+        'L1_BCM_AC_UNPAIRED_ISO','L1_BCM_CA_UNPAIRED_ISO',
+        'L1_BCM_AC_UNPAIRED_NONISO','L1_BCM_CA_UNPAIRED_NONISO',
+        'L1_BCM_AC_ABORTGAPNOTCALIB', 'L1_BCM_CA_ABORTGAPNOTCALIB','L1_BCM_Wide_ABORTGAPNOTCALIB',
+        'L1_BCM_AC_CALIB', 'L1_BCM_CA_CALIB','L1_BCM_Wide_CALIB',
+
+        #AFP
+        'L1_AFP_NSC', 'L1_AFP_FSC', 
+        'L1_AFP_C_ANY', 'L1_AFP_C_ANY_UNPAIRED_ISO', 'L1_AFP_C_ANY_UNPAIRED_NONISO', 'L1_AFP_C_ANY_EMPTY', 'L1_AFP_C_ANY_FIRSTEMPTY', 'L1_AFP_C_AND',
+
+        #--------------------------------
+        # TOPO items
+        #--------------------------------
+
+        # B-jet
+        'L1_BTAG-MU4J15', 'L1_BTAG-MU4J30', 'L1_BTAG-MU6J20', 'L1_BTAG-MU6J25',
+        #'L1_BTAG-MU4J20',
+        'L1_3J15_BTAG-MU4J15', 'L1_3J15_BTAG-MU4J30', 'L1_3J15_BTAG-MU6J25', 'L1_3J20_BTAG-MU4J20',
+        #'L1_3J20_BTAG-MU4J30', 'L1_3J20_BTAG-MU6J25',
+
+        # ZH
+        'L1_DPHI-AJ20s2XE50', 'L1_J40_DPHI-J20s2XE50', 'L1_J40_DPHI-J20XE50', 'L1_J40_DPHI-CJ20XE50', #'L1_J40_DPHI-J20s2XE30',
+#SX        'L1_BPH-DR-2MU4-B_BPH-2M-2MU4-B',
+#SX        'L1_BPH-DR-2MU4-B_BPH-4M8-2MU4-B',
+#SX        'L1_BPH-DR-2MU4-BO_BPH-2M-2MU4-BO',
+#SX        'L1_BPH-DR-2MU4-BO_BPH-4M8-2MU4-BO',
+
+        # HT
+        'L1_HT190-J15.ETA21',
+        'L1_HT190-J15s5.ETA21',
+        'L1_HT150-J20.ETA31',
+        'L1_HT150-J20s5.ETA31',   
+
+        "L1_HT150-J20s5.ETA31_MJJ-400",
+        "L1_HT150-J20s5.ETA31_MJJ-400-CF",
+        
+        # Jpsi T&P
+        'L1_JPSI-1M5', 'L1_JPSI-1M5-EM7', 'L1_JPSI-1M5-EM12',    
+        'L1_KF-XE40', 'L1_KF-XE50', 'L1_KF-XE55', 'L1_KF-XE60', 'L1_KF-XE65', 'L1_KF-XE75',
+        
+        # W T&P
+#        'L1_W-05DPHI-JXE-0',
+#        'L1_W-10DPHI-JXE-0',
+#        'L1_W-15DPHI-JXE-0',
+#        'L1_W-05DPHI-EMXE-1',
+        #'L1_W-15DPHI-EMXE-1',
+#        'L1_W-05DPHI-EM15XE-1',
+        #'L1_W-15DPHI-EM15XE-1',
+        'L1_W-05RO-XEHT-0',
+        'L1_W-90RO2-XEHT-0',
+        'L1_W-250RO2-XEHT-0',
+        'L1_W-HT20-JJ15.ETA49',
+        'L1_W-NOMATCH',
+        #'L1_W-NOMATCH_W-05RO-XEEMHT',
+        'L1_EM12_W-MT25',
+#        'L1_EM12_W-MT35',
+        'L1_EM15_W-MT35',
+        'L1_EM12_W-MT35_XS30_W-15DPHI-JXE-0_W-15DPHI-EMXE',
+        'L1_EM12_W-MT35_XS40_W-05DPHI-JXE-0_W-05DPHI-EMXE',
+        'L1_EM12_W-MT35_W-90RO2-XEHT-0_W-15DPHI-JXE-0_W-15DPHI-EMXE',
+        'L1_EM12_W-MT35_W-250RO2-XEHT-0_W-05DPHI-JXE-0_W-05DPHI-EMXE',
+        'L1_EM15_W-MT35_W-250RO2-XEHT-0_W-15DPHI-JXE-0_W-15DPHI-EM15XE',
+        'L1_EM15_W-MT35_W-250RO2-XEHT-0_W-05DPHI-JXE-0_W-05DPHI-EM15XE',
+        'L1_EM15_W-MT35_XS60_W-15DPHI-JXE-0_W-15DPHI-EM15XE',
+        'L1_EM15_W-MT35_XS60_W-05DPHI-JXE-0_W-05DPHI-EM15XE',
+        'L1_EM15_W-MT35_XS40_W-15DPHI-JXE-0_W-15DPHI-EM15XE',
+        'L1_EM15_W-MT35_XS40_W-05DPHI-JXE-0_W-05DPHI-EM15XE',
+        'L1_EM12_W-MT35_XS50',
+        'L1_EM15_W-MT35_XS60',
+        'L1_EM10VH_W-MT35_XS50',
+        'L1_EM15VH_W-MT35_XS60',
+        'L1_EM20VH_W-MT35_XS60',
+        'L1_EM22VHI_W-MT35_XS40',
+        # Old
+        'L1_EM12_W-MT25_W-15DPHI-JXE-0_W-15DPHI-EMXE_W-90RO2-XEHT-0',
+        'L1_EM12_W-MT25_W-15DPHI-JXE-0_W-15DPHI-EMXE_XS20',
+        'L1_EM12_W-MT25_W-15DPHI-JXE-0_W-15DPHI-EMXE',
+        'L1_EM15_W-MT35_W-05DPHI-JXE-0_W-05DPHI-EM15XE_XS30',
+        'L1_EM15_W-MT35_W-05DPHI-JXE-0_W-05DPHI-EM15XE',
+        #'L1_W-10DPHI-JXE-0',
+        #'L1_W-20DPHI-JXE-1',
+        #'L1_W-20DPHI-JXE-0',
+        #'L1_W-20DPHI-EMXE-1',
+        #'L1_W-20DPHI-EMXE-0',
+        #'L1_W-05RO-XEHT-0',
+        #'L1_W-08RO-XEHT-1',
+        #'L1_W-40RO2-XEHT-0',
+        #'L1_W-90RO2-XEHT-1',
+        #'L1_W-HT20-JJ0.ETA49',
+        #'L1_W-NOMATCH',
+        #'L1_W-NOMATCH_W-05RO-XEEMHT',
+        #'L1_EM3_W-MT20',
+        #'L1_EM3_W-MT40',
+
+        #Bphysics items
+#SX        'L1_BPH-DR-2MU4', 
+#SX        'L1_BPH-2M-2MU4', 
+#SX        'L1_BPH-4M8-2MU4',
+#SX        'L1_BPH-DR-2MU4_BPH-2M-2MU4', 'L1_BPH-DR-2MU4_BPH-4M8-2MU4',
+
+#SX        'L1_BPH-DR-2MU6', 
+#SX        'L1_BPH-2M-2MU6', 'L1_BPH-4M8-2MU6',
+#SX        'L1_BPH-DR-2MU6_BPH-2M-2MU6', 'L1_BPH-DR-2MU6_BPH-4M8-2MU6',
+
+        # temporarily commented out until CTP Simulation is fixed (menu generation and TMC understand multiplicity topo)
+#SX uncommenting
+        'L1_2MU4-BO',
+        'L1_2MU6-BO',
+        'L1_MU6MU4-BO', 
+
+        # L1 items for L1Topo streamers
+#SX        'L1_BPH-2M-2MU4-B',
+#SX        'L1_BPH-2M-2MU4-BO',
+#SX        'L1_BPH-2M-MU6MU4',
+#SX        'L1_BPH-2M-MU6MU4-B',
+#SX        'L1_BPH-2M-MU6MU4-BO',    
+#SX        'L1_BPH-4M8-2MU4-B',
+#SX        'L1_BPH-4M8-2MU4-BO',
+#SX        'L1_BPH-4M8-MU6MU4',
+#SX        'L1_BPH-4M8-MU6MU4-B',        
+#SX        'L1_BPH-4M8-MU6MU4-BO',
+        'L1_DY-DR-2MU4',
+        'L1_EM15VH_2EM8VH_MU6',
+        #'L1_DY-BOX-MU6MU4',
+        'L1_DY-BOX-2MU6',
+        'L1_LFV-MU',
+        'L1_LFV-MU6',
+        'L1_LFV-EM8I',
+        'L1_LFV-EM15I',
+        'L1_EM7_MU15',
+        'L1_EM8VH_MU15',
+        'L1_DPHI-J20s2XE50',
+        'L1_J40_XE50_DPHI-J20s2XE50',
+        'L1_DPHI-J20XE50',
+        'L1_DPHI-CJ20XE50',
+        'L1_MU4_J20_XE30_DPHI-J20s2XE30',
+        'L1_2MU4_J20_XE30_DPHI-J20s2XE30',
+        'L1_MU4_2EM3_J20_XE30_DPHI-J20s2XE30',
+        'L1_3EM3_J40_XE50_DPHI-J20s2XE50',
+        'L1_MJJ-900',
+        'L1_MJJ-800',
+        'L1_MJJ-700',
+        'L1_MJJ-400',
+        #'L1_MJJ-350',
+#        'L1_MJJ-300',
+#        'L1_MJJ-200',
+        'L1_MJJ-100',
+        'L1_HT150-JJ15.ETA49',
+        'L1_HT150-JJ15.ETA49_MJJ-400',
+        'L1_J4-MATCH',
+        'L1_LLP-RO',
+        'L1_LLP-NOMATCH',
+        'L1_DR-MU10TAU12I',    
+#        'L1_TAU12I-J25',    
+        'L1_EM15TAU12I-J25',
+        'L1_DR-EM15TAU12I',    
+        'L1_DR-EM15TAU12I-J25',    
+        'L1_TAU20ITAU12I-J25',
+        'L1_DR-TAU20ITAU12I',    
+        'L1_BOX-TAU20ITAU12I',
+        'L1_DR-TAU20ITAU12I-J25',
+
+        'L1_DR25-TAU20ITAU12I',
+        'L1_DR25-TAU20ITAU12I-J25',
+        'L1_30M-EM20ITAU12',
+        'L1_MJJ-400-CF',
+    
+        'L1_LAR-EM',
+        'L1_LAR-J',
+#SX        'L1_BPH-DR-2MU4-B',
+#SX        'L1_BPH-DR-2MU4-BO',
+#SX        'L1_BPH-DR-MU6MU4',
+#SX        'L1_BPH-DR-MU6MU4-B',
+#SX        'L1_BPH-DR-MU6MU4-BO',
+
+#new bhysics
+        #'L1_BPH-1M19-2MU4_BPH-0DR34-2MU4',
+        'L1_BPH-2M8-2MU4_BPH-0DR15-2MU4', # ATR-15197 'L1_BPH-2M9-2MU4_BPH-0DR15-2MU4',
+        'L1_BPH-2M9-2MU4_BPH-0DR15-2MU4',
+        'L1_BPH-7M15-2MU4_BPH-0DR24-2MU4',
+        'L1_BPH-2M8-MU6MU4_BPH-0DR15-MU6MU4', # ATR-15197 'L1_BPH-2M9-MU6MU4_BPH-0DR15-MU6MU4',
+        'L1_BPH-2M9-MU6MU4_BPH-0DR15-MU6MU4',
+        'L1_BPH-8M15-MU6MU4_BPH-0DR22-MU6MU4',
+        'L1_BPH-2M9-2MU6_BPH-2DR15-2MU6',
+        'L1_BPH-8M15-2MU6_BPH-0DR22-2MU6',
+        'L1_2MU4-B',
+        'L1_2MU6-B' ,
+        #'L1_BPH-1M19-2MU4-B_BPH-0DR34-2MU4',
+        'L1_BPH-2M8-2MU4-B_BPH-0DR15-2MU4' ,
+        'L1_BPH-7M15-2MU4_BPH-0DR24-2MU4-B' ,
+        #'L1_BPH-1M19-2MU4-BO_BPH-0DR34-2MU4' ,
+        #'L1_BPH-2M8-2MU4-BO_BPH-0DR15-2MU4' ,
+        'L1_BPH-7M15-2MU4_BPH-0DR24-2MU4-BO' ,
+        'L1_BPH-2M8-MU6MU4-B_BPH-0DR15-MU6MU4',
+        'L1_MU6_2MU4-B',
+
+        'L1_BPH-2M8-2MU4', # ATR-15197 'L1_BPH-2M9-2MU4',
+        'L1_BPH-8M15-MU6MU4',
+        'L1_BPH-8M15-2MU6',
+        
+        # combined L1Topo for VBF
+        'L1_MU6_MJJ-200',
+        'L1_MU6_MJJ-300',
+        'L1_MU6_MJJ-400',
+        'L1_MU6_MJJ-500',
+        'L1_J30_2J20_4J20.0ETA49_MJJ-400',
+        'L1_J30_2J20_4J20.0ETA49_MJJ-700',
+        'L1_J30_2J20_4J20.0ETA49_MJJ-800',
+        'L1_J30_2J20_4J20.0ETA49_MJJ-900',
+        'L1_3J20_4J20.0ETA49_MJJ-400',
+        'L1_3J20_4J20.0ETA49_MJJ-700',
+        'L1_3J20_4J20.0ETA49_MJJ-800',
+        'L1_3J20_4J20.0ETA49_MJJ-900',
+        
+        'L1_XE35_MJJ-200',
+   
+        ### ATR-15062
+        'L1_EM18VH_MJJ-300',
+
+        'L1_LATE-MU10_XE50', 'L1_LATE-MU10_J50',
+
+        'L1_TAU60_DR-TAU20ITAU12I',
+
+        'L1_SC111',
+        'L1_SC85',
+        
+        ##     # Partition 1
+        ##     'L1_CALREQ0_P1', 'L1_CALREQ1_P1', 'L1_CALREQ2_P1',
+
+        #ALFA
+#ALFA_B7R1L_OD        'L1_ALFA_ELAST1',
+#        'L1_ALFA_ELAST2',
+#        'L1_ALFA_ELAST11','L1_ALFA_ELAST12',
+#        'L1_ALFA_ELAST13','L1_ALFA_ELAST14','L1_ALFA_ELAST15','L1_ALFA_ELAST15_Calib',
+#        'L1_ALFA_ELAST16','L1_ALFA_ELAST17','L1_ALFA_ELAST18','L1_ALFA_ELAST18_Calib',
+#        'L1_ALFA_SDIFF5','L1_ALFA_SDIFF6','L1_ALFA_SDIFF7','L1_ALFA_SDIFF8',
+#        'L1_MBTS_1_A_ALFA_C','L1_MBTS_1_C_ALFA_A','L1_MBTS_1_A_ALFA_C_UNPAIRED_ISO','L1_MBTS_1_C_ALFA_A_UNPAIRED_ISO',
+#        'L1_MBTS_2_A_ALFA_C','L1_MBTS_2_C_ALFA_A','L1_MBTS_2_A_ALFA_C_UNPAIRED_ISO','L1_MBTS_2_C_ALFA_A_UNPAIRED_ISO',
+#        'L1_LUCID_A_ALFA_C','L1_LUCID_C_ALFA_A','L1_LUCID_A_ALFA_C_UNPAIRED_ISO','L1_LUCID_C_ALFA_A_UNPAIRED_ISO',
+#
+#        'L1_ALFA_ELASTIC_UNPAIRED_ISO', 'L1_ALFA_ANTI_ELASTIC_UNPAIRED_ISO',        
+#
+#        #'L1_ZDC_A_ALFA_C','L1_ZDC_C_ALFA_A','L1_ZDC_ALFA',
+#        'L1_EM3_ALFA_ANY',
+#        'L1_EM3_ALFA_ANY_UNPAIRED_ISO',
+#
+#        'L1_EM3_ALFA_EINE',
+#        'L1_J12_ALFA_ANY','L1_J12_ALFA_ANY_UNPAIRED_ISO',
+#        'L1_TE5_ALFA_ANY','L1_TE5_ALFA_ANY_UNPAIRED_ISO','L1_TE5_ALFA_EINE',
+#        'L1_TRT_ALFA_ANY','L1_TRT_ALFA_ANY_UNPAIRED_ISO',
+#        'L1_TRT_ALFA_EINE',
+#        #'L1_LHCF_ALFA_ANY_A',
+#        #'L1_LHCF_ALFA_ANY_C',
+##        'L1_LHCF_ALFA_ANY_A_UNPAIRED_ISO','L1_LHCF_ALFA_ANY_C_UNPAIRED_ISO',
+#        'L1_ALFA_BGT','L1_ALFA_BGT_UNPAIRED_ISO','L1_ALFA_BGT_BGRP10',
+#        'L1_ALFA_SHOWSYST5',
+#        'L1_ALFA_SYST9' ,'L1_ALFA_SYST10','L1_ALFA_SYST11','L1_ALFA_SYST12',
+#        'L1_ALFA_SYST17','L1_ALFA_SYST18',
+#        'L1_ALFA_ANY',
+#        'L1_ALFA_ANY_EMPTY','L1_ALFA_ANY_FIRSTEMPTY','L1_ALFA_ANY_UNPAIRED_ISO','L1_ALFA_ANY_UNPAIRED_NONISO',
+#        'L1_ALFA_ANY_BGRP10','L1_ALFA_ANY_ABORTGAPNOTCALIB','L1_ALFA_ANY_CALIB',
+        'L1_ALFA_B7L1U','L1_ALFA_B7L1L','L1_ALFA_A7L1U','L1_ALFA_A7L1L','L1_ALFA_A7R1U','L1_ALFA_A7R1L','L1_ALFA_B7R1U','L1_ALFA_B7R1L',
+#        'L1_ALFA_ANY_A_EMPTY','L1_ALFA_ANY_C_EMPTY',
+#        'L1_ALFA_B7L1U_OD','L1_ALFA_B7L1L_OD','L1_ALFA_A7L1U_OD','L1_ALFA_A7L1L_OD','L1_ALFA_A7R1U_OD','L1_ALFA_A7R1L_OD','L1_ALFA_B7R1U_OD','L1_ALFA_B7R1L_OD',
+#        'L1_ALFA_B7L1_OD','L1_ALFA_A7L1_OD','L1_ALFA_B7R1_OD','L1_ALFA_A7R1_OD',
+#
+         'L1_AFP_C_MBTS_A',
+         'L1_AFP_C_ZDC_C',
+         'L1_AFP_C_J12',
+         'L1_AFP_C_EM3',
+         'L1_AFP_C_TE5',
+         'L1_AFP_C_ALFA_C',
+         'L1_AFP_C_ALFA_A',
+         'L1_AFP_C_ANY_MBTS_A',
+         'L1_AFP_C_MU4',
+
+
+        #item with FTK trigger type, for FTK commissioning
+        'L1_MU6_FTK',
+        'L1_MU15_FTK',
+        'L1_MU20_FTK',
+        'L1_TAU12IM_FTK', 
+        'L1_TAU20IM_FTK',
+        'L1_MU20_TAU12IM_FTK', 
+        'L1_TAU20IM_2TAU12IM_J25_2J20_3J12_FTK',
+        'L1_DR-TAU20ITAU12I-J25_FTK',
+        'L1_4J15_FTK',
+        'L1_4J15.0ETA25_FTK',
+        'L1_J15_FTK',
+        'L1_J40_FTK',
+        'L1_J100_FTK'
+                
+        ]
+    
+
+    # the CTP ID mapping still has to be defined, currently it is taken from the order of the items
+    #Free slot [ATR-14858], 16-08-16
+    #[82,143,377,378,379,406,409,416,480]
+
+    
+
+    Lvl1Flags.CtpIdMap = {
+        'L1_EM3' : 0,
+        'L1_EM7' : 1,
+        'L1_EM12' : 2,
+        'L1_EM8VH' : 3,
+        'L1_EM10VH' : 4,
+        'L1_EM13VH' : 5,
+        'L1_EM15' : 6,
+        'L1_EM15VH' : 7,
+        'L1_EM18VH' : 8,
+        'L1_EM20VH' : 9,
+        'L1_EM20VHI' : 10,
+        'L1_EM22VHI' : 11,
+        'L1_EM3_EMPTY' : 12,
+        'L1_EM7_EMPTY' : 13,
+        'L1_MU4' : 14,
+        'L1_MU6' : 15,
+        'L1_MU10' : 16,
+        'L1_MU11' : 256,
+        'L1_MU15' : 17,
+        'L1_MU20' : 18,
+        'L1_MU4_EMPTY' : 19,
+        'L1_MU6_EMPTY' : 66,
+        'L1_MU4_FIRSTEMPTY' : 20,
+        'L1_MU11_EMPTY' : 21,
+        'L1_MU4_UNPAIRED_ISO' : 22,
+        'L1_2EM3' : 23,
+        'L1_2EM7' : 24,
+        'L1_2EM10VH' : 25,
+        'L1_2EM13VH' : 26,
+        'L1_2EM15' : 27,
+        'L1_2EM15VH' : 28,
+        'L1_EM7_2EM3' : 29,
+        'L1_EM12_2EM3' : 30,
+        'L1_EM15VH_3EM7' : 31,
+	'L1_2EM18VH':398,
+	'L1_2EM20VH':400,
+	'L1_EM15VH_3EM10VH':401,
+	'L1_EM18VH_3EM8VH':406,
+	'L1_EM18VH_2EM10VH_3EM7':408,
+        'L1_EM20VH_3EM10VH':431, 
+        'L1_EM20VH_2EM10VH_3EM8VH':432,
+        'L1_2MU4' : 32,
+        'L1_2MU6' : 33,
+        'L1_2MU10' : 34,
+        'L1_2MU20_OVERLAY' : 35,
+        'L1_MU10_2MU6' : 36,
+        'L1_MU11_2MU6' : 37,
+        'L1_3MU4' : 38,
+        'L1_MU6_2MU4' : 39,
+        'L1_3MU6' : 40,
+        'L1_4MU4' : 46,
+        'L1_4J15.0ETA25' : 41,
+        'L1_EM15I_MU4' : 42,
+        'L1_2EM8VH_MU10' : 43,
+        'L1_EM15VH_MU10' : 44,
+        'L1_TAU12' : 45,
+        'L1_TAU12IM' : 47,
+        'L1_TAU20' : 49,
+        'L1_TAU20IM' : 51,
+        'L1_TAU30' : 53,
+        'L1_TAU40' : 54,
+        'L1_TAU60' : 55,
+        'L1_TAU100' : 52,
+        'L1_TAU8' : 56,
+        'L1_TAU8_EMPTY' : 57,
+        'L1_TAU20IM_2TAU12IM' : 58,
+        'L1_TAU20_2TAU12' : 59,
+        'L1_EM15HI_2TAU12IM' : 60,
+        'L1_EM15HI_2TAU12IM_J25_3J12' : 61,
+        'L1_EM15HI_TAU20IM_2TAU15_J25_2J20_3J15' : 378,
+        'L1_EM20VHI_TAU20IM_2TAU20_J25_3J20' : 69,
+        'L1_EM15HI_TAU40_2TAU15' : 62,
+        'L1_MU10_TAU12IM' : 63,
+        'L1_MU10_TAU12IM_J25_2J12' : 64,
+        'L1_EM7_MU10':65,
+        'L1_TAU30_EMPTY':341,
+        'L1_MU10_TAU20IM' : 67,
+        'L1_MU11_TAU20IM' : 430,
+        'L1_MU10_TAU20IM_J25_2J20' : 377,
+
+        'L1_TAU20IM_2TAU12IM_J25_2J20_3J12' : 70,
+        'L1_J25_2J20_3J12_BOX-TAU20ITAU12I' : 71,
+        'L1_DR-MU10TAU12I_TAU12I-J25' : 72,
+        'L1_MU10_TAU12I-J25' : 73,
+        'L1_TAU20IM_2J20_XE45' : 74,
+        'L1_TAU30_UNPAIRED_ISO' :343,
+        'L1_TAU60_DR-TAU20ITAU12I' : 76,
+        'L1_EM15HI_2TAU12IM_XE35' : 78,
+        'L1_MU10_TAU12IM_XE35' : 81,
+#        'L1_MU10_TAU12IM_XE40' : 82,
+        'L1_TAU20IM_2TAU12IM_XE35' : 83,
+        'L1_TAU20_2TAU12_XE35' : 84,
+        'L1_TAU40_2TAU12IM_XE40' : 429,
+#        'L1_EM15VH_JJ15.23ETA49' : 86,
+        'L1_MU4_J12' : 87,
+        'L1_MU4_J50_XE40' : 330,
+        'L1_MU6_J20' : 88,
+        'L1_MU6_J40' : 89,
+        'L1_MU6_J75' : 90,
+        'L1_2MU4_J40_XE20' : 331,
+        'L1_MU20_J40'  : 428,
+        'L1_MU20_XE30' : 433,
+        'L1_J12' : 91,
+        'L1_J15' : 92,
+        'L1_J20' : 93,
+        'L1_J25' : 94,
+        'L1_J30' : 95,
+        
+        'L1_J40' : 96,
+        'L1_J50' : 97,
+        'L1_J75' : 98,
+        'L1_J85' : 99,
+        'L1_J100' : 100,
+        'L1_J120' : 101,
+        'L1_J400' : 102,
+        'L1_J20.31ETA49' : 103,
+        'L1_J30.31ETA49' : 104,
+        'L1_J50.31ETA49' : 105,
+        'L1_J75.31ETA49' : 106,
+        'L1_J100.31ETA49' : 107,
+#        'L1_J40.0ETA25' : 108,
+        
+        'L1_J15.31ETA49' : 109,
+        'L1_J20.28ETA31' : 110,
+        'L1_J12_EMPTY' : 111,
+        'L1_J12_FIRSTEMPTY' : 112,
+        'L1_J12_UNPAIRED_ISO' : 113,
+        'L1_J12_UNPAIRED_NONISO' : 114,
+        'L1_J12_ABORTGAPNOTCALIB' : 115,
+        'L1_J15.31ETA49_UNPAIRED_ISO' : 75,
+        'L1_J30_EMPTY' : 116,
+        'L1_J30_FIRSTEMPTY' : 117,
+        'L1_J30.31ETA49_EMPTY' : 118,
+        'L1_J30.31ETA49_UNPAIRED_ISO' : 119,
+        'L1_J30.31ETA49_UNPAIRED_NONISO' : 120,
+        'L1_J50_UNPAIRED_ISO' : 121,
+        'L1_J50_UNPAIRED_NONISO' : 122,
+        'L1_J50_ABORTGAPNOTCALIB' : 123,
+
+        'L1_J20_J20.31ETA49' : 125,
+        'L1_3J15' : 126,
+        'L1_3J20' : 127,
+        'L1_3J40' : 128,
+        'L1_3J15.0ETA25' : 129,
+        'L1_3J50' : 130,
+        'L1_4J15' : 131,
+        'L1_4J20' : 132,
+        'L1_3J15.0ETA25_XE40' : 184,
+        
+#        'L1_3J75' : 133,
+#        'L1_4J30' : 134,
+        'L1_6J15' : 135,
+        'L1_J75_3J20' : 136,
+        'L1_J85_3J30' : 480,
+        'L1_J30.0ETA49_2J20.0ETA49' : 137,
+
+       
+        'L1_TE10' : 138,
+        'L1_TE15' : 82,
+        'L1_TE25' : 143,
+
+        'L1_5J15.0ETA25' : 140,
+        'L1_2J15_XE55' : 141,
+        'L1_J40_XE50' : 142,
+        #'L1_J75_XE40' : 143,
+        'L1_J75_XE50' : 133,
+
+        'L1_XE10': 68,
+        #'L1_XE25': 82,
+        'L1_XE30': 85,
+        'L1_XE65': 108,
+        'L1_XE75': 134,
+        'L1_XE150': 156,
+        'L1_XE300': 187,
+        
+        'L1_XE35' : 144,
+        'L1_XE40' : 145,
+        'L1_XE45' : 146,
+        'L1_XE50' : 147,
+        'L1_XE55' : 148,
+        'L1_XE60' : 149,
+        'L1_XE70' : 150,
+        'L1_XE80' : 151,
+        'L1_XS20' : 152,
+        'L1_XS30' : 153,
+        'L1_EM12_XS20' : 154,
+        'L1_EM15_XS30' : 155,
+
+        'L1_TE30' : 157,
+        'L1_TE40' : 158,
+        'L1_TE70' : 159,
+        'L1_TE30.0ETA24' : 160,
+        'L1_BCM_Wide_UNPAIRED_NONISO' : 161,
+        'L1_BCM_AC_CA_UNPAIRED_ISO' : 162,
+        'L1_BCM_AC_UNPAIRED_ISO' : 163,
+        'L1_MBTS_1_EMPTY' : 164,
+        'L1_MBTS_1_UNPAIRED_ISO' : 165,
+        'L1_MBTS_2_EMPTY' : 166,
+        'L1_MBTS_2_UNPAIRED_ISO' : 167,
+        'L1_MBTS_1_1_EMPTY' : 168,
+        'L1_MBTS_1_1_UNPAIRED_ISO' : 169,
+
+        'L1_DPHI-AJ20s2XE50' : 171,
+        'L1_EM13VH_3J20' : 172,
+        'L1_EM18VH_3J20' : 295,
+        'L1_MU10_3J20' : 173,
+
+        'L1_2J50_XE40' : 175,
+        'L1_J40_XE60' : 176,
+        'L1_J40.0ETA25_XE50' : 177,
+        'L1_MU10_2J20' : 278,
+	'L1_TAU40_2TAU20IM' : 254,
+        'L1_MU10_2J15_J20' : 255,
+# freeing some CTPIDs  
+#        'L1_MBTSA0' : 170,
+#        'L1_MBTSA1' : 171,
+#        'L1_MBTSA2' : 172,
+#        'L1_MBTSA3' : 173,
+#        'L1_MBTSA4' : 174,
+#        'L1_MBTSA5' : 175,
+#        'L1_MBTSA6' : 176,
+#        'L1_MBTSA7' : 177,
+#        'L1_MBTSA8' : 178,
+#        'L1_MBTSA10' : 179,
+#        'L1_MBTSA12' : 180,
+#        'L1_MBTSA14' : 181,
+#        'L1_MBTSC0' : 182,
+#        'L1_MBTSC1' : 183,
+#        'L1_MBTSC2' : 184,
+#        'L1_MBTSC3' : 185,
+#        'L1_MBTSC4' : 186,
+#        'L1_MBTSC5' : 187,
+#        'L1_MBTSC6' : 188,
+#        'L1_MBTSC7' : 189,
+#        'L1_MBTSC8' : 190,
+#        'L1_MBTSC10' : 191,
+#        'L1_MBTSC12' : 192,
+#        'L1_MBTSC14' : 193,
+
+        
+        'L1_BPH-2M8-2MU4' : 178, # ATR-15197 'L1_BPH-2M9-2MU4' : 178,
+        'L1_BPH-8M15-MU6MU4' : 179,
+        'L1_BPH-8M15-2MU6' : 180,
+        'L1_J15.0ETA25_2J15.31ETA49': 305 , 
+        'L1_J40.0ETA25_2J15.31ETA49' : 181,
+        'L1_J40.0ETA25_2J25_J20.31ETA49' : 182,
+
+        "L1_J40.0ETA25_2J30_J20.31ETA49":250 , 
+
+        "L1_HT150-J20s5.ETA31_MJJ-400": 272 , ## noid(ea)
+        "L1_HT150-J20s5.ETA31_MJJ-400-CF": 273,
+        
+        ## the ctp ids are a mess.. no 7 consequetive ids are free.. but these here are:
+        'L1_AFP_C_MBTS_A':183,
+        'L1_AFP_C_ZDC_C':189,
+        'L1_AFP_C_J12':190,
+        'L1_AFP_C_EM3':191,
+        'L1_AFP_C_TE5':192,
+        'L1_AFP_C_ALFA_C':193,
+        'L1_AFP_C_ALFA_A':170,
+        'L1_AFP_C_ANY_MBTS_A':174,
+        'L1_AFP_C_MU4':379,   
+        
+#        'L1_EM8I' : 183,
+#        'L1_EM15I': 184,
+        'L1_MBTS_4_A_UNPAIRED_ISO' : 185,
+        'L1_MBTS_4_C_UNPAIRED_ISO' : 186,        
+        'L1_MBTS_4_A' : 194,
+        'L1_MBTS_4_C' : 195,
+        'L1_MBTS_1_BGRP9' : 196,
+        'L1_MBTS_2_BGRP9' : 197,
+        'L1_MBTS_1_BGRP11' : 198,
+        'L1_MBTS_2_BGRP11' : 199,
+        'L1_RD0_FILLED' : 200,
+        'L1_RD0_UNPAIRED_ISO' : 201,
+        'L1_RD0_EMPTY' : 202,
+        'L1_RD1_FILLED' : 203,
+        'L1_RD1_EMPTY' : 204,
+        'L1_RD1_BGRP10' : 188,
+        'L1_RD2_FILLED' : 205,
+        'L1_RD2_EMPTY' : 206,
+        'L1_RD3_FILLED' : 207,
+        'L1_RD3_EMPTY' : 208,
+        'L1_RD0_FIRSTEMPTY' : 209,
+        'L1_RD0_BGRP9' : 210,
+        'L1_RD0_BGRP11' : 211,
+        'L1_LUCID' : 212,
+        'L1_LUCID_EMPTY' : 213,
+        'L1_LUCID_UNPAIRED_ISO' : 214,
+        'L1_LUCID_A_C_EMPTY' : 215,
+        'L1_LUCID_A_C_UNPAIRED_ISO' : 216,
+        'L1_LUCID_A_C_UNPAIRED_NONISO' : 217,
+        'L1_TRT_FILLED' : 218,
+        'L1_TRT_EMPTY' : 219,
+        'L1_TGC_BURST' : 220,
+#        'L1_TGC_BURST_EMPTY' : 184,
+        'L1_LHCF' : 221,
+        'L1_BCM_Wide_BGRP0' : 222,
+        'L1_BCM_AC_CA_BGRP0' : 223,
+        'L1_BCM_Wide_EMPTY' : 224,
+        'L1_BCM_Wide_UNPAIRED_ISO' : 225,
+        'L1_MBTS_1' : 226,
+        'L1_MBTS_2' : 227,
+        'L1_MBTS_1_1' : 228,
+        
+      
+        'L1_BCM_CA_UNPAIRED_ISO' : 229,
+        'L1_BCM_AC_UNPAIRED_NONISO' : 230,
+        'L1_BCM_CA_UNPAIRED_NONISO' : 231,
+        'L1_BCM_AC_ABORTGAPNOTCALIB' : 232,
+        'L1_BCM_CA_ABORTGAPNOTCALIB' : 233,
+        'L1_BCM_Wide_ABORTGAPNOTCALIB' : 234,
+        'L1_BCM_AC_CALIB' : 235,
+        'L1_BCM_CA_CALIB' : 236,
+        'L1_BCM_Wide_CALIB' : 237,
+        'L1_BTAG-MU4J15' : 238,
+        'L1_BTAG-MU4J30' : 239,
+        'L1_ZB' : 240,
+        'L1_BPTX0_BGRP0' : 241,
+        'L1_BPTX1_BGRP0' : 242,
+        'L1_BTAG-MU6J20' : 243,
+        'L1_BTAG-MU6J25' : 244,
+#        'L1_BTAG-MU4J20' : 245,
+        'L1_3J15_BTAG-MU4J15' : 246,
+        'L1_3J15_BTAG-MU4J30' : 247,
+        'L1_3J15_BTAG-MU6J25' : 248,
+        'L1_3J20_BTAG-MU4J20' : 249,
+#        'L1_J40_DPHI-Js2XE50' : 250,
+        'L1_J40_DPHI-J20s2XE50' : 251,
+        #'L1_J40_DPHI-J20s2XE30' : 257,
+        'L1_J40_XE50_DPHI-J20s2XE50': 245,
+        'L1_J40_DPHI-J20XE50' : 252,
+        'L1_J40_DPHI-CJ20XE50' : 253,
+        'L1_MU4_J20_XE30_DPHI-J20s2XE30' : 257,
+        'L1_2MU4_J20_XE30_DPHI-J20s2XE30' : 271,
+        'L1_MU4_2EM3_J20_XE30_DPHI-J20s2XE30' : 434,
+        'L1_3EM3_J40_XE50_DPHI-J20s2XE50' : 435,
+#SX
+#        'L1_BPH-DR-2MU4-B_BPH-2M-2MU4-B' : 254,
+#        'L1_BPH-DR-2MU4-B_BPH-4M8-2MU4-B' : 255,
+#        'L1_BPH-DR-2MU4-BO_BPH-2M-2MU4-BO' : 256,
+#        'L1_BPH-DR-2MU4-BO_BPH-4M8-2MU4-BO' : 257,
+
+        
+        'L1_HT190-J15.ETA21' : 258,
+        'L1_HT190-J15s5.ETA21' : 259,
+        'L1_HT150-J20.ETA31' : 260,
+        'L1_HT150-J20s5.ETA31' : 261,
+        'L1_JPSI-1M5' : 262,
+        'L1_JPSI-1M5-EM7' : 263,
+        'L1_JPSI-1M5-EM12' : 264,
+        'L1_KF-XE40' : 265,
+        'L1_KF-XE50' : 266,
+        'L1_KF-XE55' : 267,
+        'L1_KF-XE60' : 268,
+        'L1_KF-XE65' : 269,
+        'L1_KF-XE75' : 270,
+#        'L1_W-05DPHI-JXE-0' : 271,
+#        'L1_W-10DPHI-JXE-0' : 272,
+#        'L1_W-15DPHI-JXE-0' : 273,
+        #'L1_W-15DPHI-EMXE-1' : 271,
+        #'L1_W-15DPHI-EM15XE-1' : 272,
+#        'L1_W-05DPHI-EMXE-1' : 276,
+        'L1_W-05RO-XEHT-0' : 277,
+        'L1_W-90RO2-XEHT-0' : 279,
+        'L1_W-250RO2-XEHT-0' : 280,
+        'L1_W-HT20-JJ15.ETA49' : 281,
+        'L1_W-NOMATCH' : 282,
+        #'L1_W-NOMATCH_W-05RO-XEEMHT' : 283,
+        'L1_EM10_W-MT25' : 284,
+        'L1_EM15_W-MT35' : 286,
+        'L1_EM10_W-MT25_W-15DPHI-JXE-0_W-15DPHI-EMXE_W-90RO2-XEHT-0' : 287,
+        'L1_EM10_W-MT25_W-15DPHI-JXE-0_W-15DPHI-EMXE_XS30' : 288,
+        'L1_EM10_W-MT25_W-15DPHI-JXE-0_W-15DPHI-EMXE_XS20' : 289,
+        'L1_EM10_W-MT25_W-15DPHI-JXE-0_W-15DPHI-EMXE' : 290,
+        'L1_EM15_W-MT35_W-05DPHI-JXE-0_W-05DPHI-EMXE_W-250RO2-XEHT-0' : 291,
+        'L1_EM15_W-MT35_W-05DPHI-JXE-0_W-05DPHI-EMXE_XS60' : 292,
+        'L1_EM15_W-MT35_W-05DPHI-JXE-0_W-05DPHI-EMXE_XS30' : 293,
+        'L1_EM15_W-MT35_W-05DPHI-JXE-0_W-05DPHI-EMXE' : 294,
+#SX
+#        'L1_BPH-DR-2MU4' : 295,
+#        'L1_BPH-2M-2MU4' : 296,
+#        'L1_BPH-4M8-2MU4' : 297,
+#        'L1_BPH-DR-2MU4_BPH-2M-2MU4' : 298,
+#        'L1_BPH-DR-2MU4_BPH-4M8-2MU4' : 299,
+#        'L1_BPH-DR-2MU6' : 300,
+#        'L1_BPH-2M-2MU6' : 301,
+#        'L1_BPH-4M8-2MU6' : 302,
+#        'L1_BPH-DR-2MU6_BPH-2M-2MU6' : 303,
+#        'L1_BPH-DR-2MU6_BPH-4M8-2MU6' : 304,
+#        'L1_BPH-2M-2MU4-B' : 305,
+#        'L1_BPH-2M-2MU4-BO' : 306,
+#        'L1_BPH-2M-MU6MU4' : 307,
+#        'L1_BPH-2M-MU6MU4-B' : 308,
+#        'L1_BPH-2M-MU6MU4-BO' : 309,
+#        'L1_BPH-4M8-2MU4-B' : 310,
+#        'L1_BPH-4M8-2MU4-BO' : 311,
+#        'L1_BPH-4M8-MU6MU4' : 312,
+#        'L1_BPH-4M8-MU6MU4-B' : 313,
+#        'L1_BPH-4M8-MU6MU4-BO' : 314,
+
+#SX adding
+        #'L1_BPH-1M19-2MU4_BPH-0DR34-2MU4' : 295,
+        'L1_BPH-2M8-2MU4_BPH-0DR15-2MU4'  : 296, #  ATR-15197 'L1_BPH-2M9-2MU4_BPH-0DR15-2MU4'  : 296,
+        'L1_BPH-7M15-2MU4_BPH-0DR24-2MU4'  : 297,
+        'L1_BPH-2M8-MU6MU4_BPH-0DR15-MU6MU4'  : 298, # ATR-15197 'L1_BPH-2M9-MU6MU4_BPH-0DR15-MU6MU4'  : 298,
+        'L1_BPH-8M15-MU6MU4_BPH-0DR22-MU6MU4'  : 299,
+        'L1_BPH-2M9-2MU6_BPH-2DR15-2MU6' : 300,
+        'L1_BPH-8M15-2MU6_BPH-0DR22-2MU6'  : 301,
+        'L1_MU6MU4-BO' : 302,
+        'L1_2MU4-B' : 303,
+        'L1_2MU6-B'  : 304,
+        #'L1_BPH-1M19-2MU4-B_BPH-0DR34-2MU4'  : 305,
+        'L1_BPH-2M8-2MU4-B_BPH-0DR15-2MU4'  : 306,
+        'L1_BPH-7M15-2MU4_BPH-0DR24-2MU4-B'  :  307,
+        #'L1_BPH-1M19-2MU4-BO_BPH-0DR34-2MU4'   : 308,
+        #'L1_BPH-2M8-2MU4-BO_BPH-0DR15-2MU4'  : 309,
+        'L1_BPH-7M15-2MU4_BPH-0DR24-2MU4-BO'  : 310,
+        'L1_BPH-2M8-MU6MU4-B_BPH-0DR15-MU6MU4' : 311,
+        'L1_2MU4-BO' : 312,
+        'L1_2MU6-BO' : 313,
+        'L1_MU6_2MU4-B'  : 314,
+
+        ### ATR-14350 - these should be replaced in 2017 with items 296 and 298
+        'L1_BPH-2M9-2MU4_BPH-0DR15-2MU4' : 426,
+        'L1_BPH-2M9-MU6MU4_BPH-0DR15-MU6MU4' : 427,
+
+
+        'L1_DY-DR-2MU4' : 315,
+        'L1_EM15VH_2EM8VH_MU6' : 316,
+        #'L1_DY-BOX-MU6MU4' : 317,
+        'L1_DY-BOX-2MU6' : 318,
+        'L1_LFV-MU' : 319,
+        'L1_LFV-MU6' : 332,
+        'L1_LFV-EM8I' : 320,
+        'L1_LFV-EM15I' : 321,
+        'L1_EM7_MU15' : 322,
+        'L1_EM8VH_MU15' : 48,
+        'L1_DPHI-J20s2XE50' : 323,
+        'L1_DPHI-J20XE50' : 324,
+        'L1_DPHI-CJ20XE50' : 325,
+        'L1_MJJ-900' : 326,
+        'L1_MJJ-800' : 327,
+        'L1_MJJ-700' : 328,
+        'L1_MJJ-400' : 329,
+        #'L1_MJJ-350' : 330,
+#        'L1_MJJ-300' : 331,
+#        'L1_MJJ-200' : 332,
+        'L1_MJJ-100' : 333,
+        'L1_HT150-JJ15.ETA49' : 334,
+        'L1_J4-MATCH' : 336,
+        'L1_LLP-RO' : 338,
+        'L1_LLP-NOMATCH' : 339,
+        'L1_DR-MU10TAU12I' : 340,
+#        'L1_TAU12I-J25' : 341,
+        'L1_EM15TAU12I-J25' : 345,
+        'L1_DR-EM15TAU12I-J25' : 346,
+        'L1_TAU20ITAU12I-J25' : 347,
+        'L1_DR-TAU20ITAU12I' : 348,
+        'L1_BOX-TAU20ITAU12I' : 349,
+        'L1_DR-TAU20ITAU12I-J25' : 350,
+
+        'L1_DR25-TAU20ITAU12I' : 337,
+
+        'L1_DR25-TAU20ITAU12I-J25' : 386,
+        'L1_30M-EM20ITAU12' : 387,
+        'L1_MJJ-400-CF': 397,
+
+        'L1_LAR-EM' : 351,
+        'L1_LAR-J' : 352,
+        'L1_DR-EM15TAU12I' : 353,        
+        'L1_LATE-MU10_XE50': 354,
+        'L1_LATE-MU10_J50' : 355,
+        'L1_SC111' : 356,
+        'L1_SC85' : 357,
+#SX
+#        'L1_BPH-DR-2MU4-B' : 353,
+#        'L1_BPH-DR-2MU4-BO' : 354,
+#        'L1_BPH-DR-MU6MU4' : 355,
+#        'L1_BPH-DR-MU6MU4-B' : 356,
+#        'L1_BPH-DR-MU6MU4-BO' : 357,
+        'L1_MU6_MJJ-200' : 358,
+        'L1_MU6_MJJ-300' : 359,
+        'L1_MU6_MJJ-400' : 360,
+        'L1_MU6_MJJ-500' : 361,
+        'L1_J30_2J20_4J20.0ETA49_MJJ-400' : 362,
+        'L1_J30_2J20_4J20.0ETA49_MJJ-700' : 363,
+        'L1_J30_2J20_4J20.0ETA49_MJJ-800' : 364,
+        'L1_J30_2J20_4J20.0ETA49_MJJ-900' : 365,
+        'L1_3J20_4J20.0ETA49_MJJ-400' : 366,
+        'L1_3J20_4J20.0ETA49_MJJ-700' : 367,
+        'L1_3J20_4J20.0ETA49_MJJ-800' : 368,
+        'L1_3J20_4J20.0ETA49_MJJ-900' : 369,
+        'L1_XE35_MJJ-200' : 370,
+        'L1_EM7_FIRSTEMPTY': 371, 
+        'L1_RD0_ABORTGAPNOTCALIB':372,
+        'L1_3J25.0ETA23' : 373,
+        'L1_3J35.0ETA23' : 425,
+        'L1_TE20' : 374,
+        'L1_TE10.0ETA24' : 375,
+        'L1_TE15.ETA24' : 416,
+        'L1_TE20.0ETA24' : 376,
+        'L1_TE25.0ETA24' : 409,
+        #'L1_XS40' : 377,
+        #'L1_XS50' : 378,
+        #'L1_XS60' : 379,
+        'L1_J12_BGRP12' : 380,
+        'L1_J30.31ETA49_BGRP12' : 381,
+        'L1_MU6_J30.0ETA49_2J20.0ETA49' : 382,
+        'L1_4J20.0ETA49' : 383,
+        'L1_HT150-JJ15.ETA49_MJJ400' : 384,
+
+        ### ATR-15062
+        'L1_EM18VH_MJJ-300' : 385,
+        
+#ATR-13743        'L1_MU4_J30' : 386,
+#        'L1_MU4_J50' : 387,
+
+        
+        'L1_TAU8_UNPAIRED_ISO': 388,
+        'L1_EM7_UNPAIRED_ISO': 389,
+        'L1_TAU8_UNPAIRED_NONISO': 467,
+        'L1_EM7_UNPAIRED_NONISO': 468,
+        'L1_MU4_UNPAIRED_NONISO' : 469,
+        'L1_RD2_BGRP12'   : 390,
+        'L1_TAU8_FIRSTEMPTY': 391,
+        'L1_EM24VHI'           : 392,
+        'L1_LHCF_UNPAIRED_ISO' : 393,
+        'L1_LHCF_EMPTY' : 394,
+        'L1_EM15VH_2EM10VH_3EM7': 395,
+        'L1_EM15VH_3EM8VH': 396, 
+        'L1_EM8I_MU10'  : 399,
+        "L1_EM26VHI"    :402,
+        "L1_EM15HI"    :423,
+        "L1_EM15I"    :424,
+        "L1_MU6_3MU4"  :403,
+        "L1_2MU6_3MU4" :404,
+        "L1_BGRP9"     :405,
+        #'L1_TE50'       :406,
+        'L1_TE5'       :407,
+        #'L1_TE60'      :408,
+        #'L1_TE50.0ETA24':409,
+        'L1_TE5.0ETA24':410, 
+        'L1_EM20VH_FIRSTEMPTY':411, 
+        'L1_EM22VHI_FIRSTEMPTY':412, 
+        'L1_MU20_FIRSTEMPTY':413, 
+        'L1_J100_FIRSTEMPTY':414, 
+        'L1_J100.31ETA49_FIRSTEMPTY':415, 
+        #'L1_TE60.0ETA24':416, 
+        'L1_TE70.0ETA24':417, 
+        'L1_TE40.0ETA24':418, 
+
+        # 3 x ZDC
+        'L1_ZDC_A':419,
+        'L1_ZDC_C':420,
+        'L1_ZDC_AND':421, 
+        'L1_ZDC_A_C':422, 
+        
+#ATR-13743        'L1_ALFA_ELAST1'  : 424,
+#        'L1_ALFA_ELAST2'  : 425,
+#        'L1_ALFA_ELAST11' : 426,
+#        'L1_ALFA_ELAST12' : 427,
+#        'L1_ALFA_ELAST13' : 428,
+#        'L1_ALFA_ELAST14' : 429,
+#        'L1_ALFA_ELAST15' : 430,
+#        'L1_ALFA_ELAST15_Calib' : 431,
+#        'L1_ALFA_ELAST16' : 432,
+#        'L1_ALFA_ELAST17' : 433,
+#        'L1_ALFA_ELAST18' : 434,
+#        'L1_ALFA_ELAST18_Calib' : 435,
+#        'L1_ALFA_SDIFF5' : 436,
+#        'L1_ALFA_SDIFF6' : 437,
+#        'L1_ALFA_SDIFF7' : 438,
+#        'L1_ALFA_SDIFF8' : 439,
+#        'L1_MBTS_1_A_ALFA_C' : 440,
+#        'L1_MBTS_1_C_ALFA_A' : 441,
+#        'L1_MBTS_1_A_ALFA_C_UNPAIRED_ISO' : 442,
+#        'L1_MBTS_1_C_ALFA_A_UNPAIRED_ISO' : 443,
+#        'L1_MBTS_2_A_ALFA_C' : 444,
+#        'L1_MBTS_2_C_ALFA_A' : 445,
+#        'L1_MBTS_2_A_ALFA_C_UNPAIRED_ISO' : 446,
+#        'L1_MBTS_2_C_ALFA_A_UNPAIRED_ISO' : 447,
+#        'L1_LUCID_A_ALFA_C' : 448,
+#        'L1_LUCID_C_ALFA_A' : 449,
+#        'L1_LUCID_A_ALFA_C_UNPAIRED_ISO' : 450,
+#        'L1_LUCID_C_ALFA_A_UNPAIRED_ISO' : 451,
+#        'L1_EM3_ALFA_ANY' : 452,
+#        'L1_EM3_ALFA_ANY_UNPAIRED_ISO' : 453,
+#        'L1_EM3_ALFA_EINE' :   454,
+#        'L1_ALFA_ELASTIC_UNPAIRED_ISO' : 455,
+#        'L1_ALFA_ANTI_ELASTIC_UNPAIRED_ISO' : 456,
+#        'L1_ALFA_ANY_A_EMPTY' : 457,
+#        'L1_ALFA_ANY_C_EMPTY' : 458,
+#        'L1_J12_ALFA_ANY' : 459,
+#        'L1_J12_ALFA_ANY_UNPAIRED_ISO' : 460,
+#        'L1_TE5_ALFA_ANY' : 461,
+#        'L1_TE5_ALFA_ANY_UNPAIRED_ISO' : 462,
+#        'L1_TE5_ALFA_EINE' : 463,
+#        'L1_TRT_ALFA_ANY' : 464,
+#        'L1_TRT_ALFA_ANY_UNPAIRED_ISO' : 465,
+#        'L1_TRT_ALFA_EINE' :   466,
+##        'L1_LHCF_ALFA_ANY_A' : 467,
+##        'L1_LHCF_ALFA_ANY_C' : 468,
+##        'L1_LHCF_ALFA_ANY_A_UNPAIRED_ISO' : 469,
+##        'L1_LHCF_ALFA_ANY_C_UNPAIRED_ISO' : 470,
+#        
+#        'L1_ALFA_BGT' : 471,
+#        'L1_ALFA_BGT_UNPAIRED_ISO' : 472,
+#        'L1_ALFA_BGT_BGRP10' : 473,
+#        'L1_ALFA_SHOWSYST5' : 474,
+#        'L1_ALFA_SYST9'  : 475,
+#        'L1_ALFA_SYST10' : 476,
+#        'L1_ALFA_SYST11' : 477,
+#        'L1_ALFA_SYST12' : 478,
+#        'L1_ALFA_SYST17' : 479,
+#        'L1_ALFA_SYST18' : 480,
+#        'L1_ALFA_ANY' : 481,
+#        'L1_ALFA_ANY_EMPTY' : 482,
+#        'L1_ALFA_ANY_FIRSTEMPTY' : 483,
+#        'L1_ALFA_ANY_UNPAIRED_ISO' : 484,
+#        'L1_ALFA_ANY_UNPAIRED_NONISO' : 485,
+#        'L1_ALFA_ANY_BGRP10' : 486,
+#        'L1_ALFA_ANY_ABORTGAPNOTCALIB' : 487,
+#        'L1_ALFA_ANY_CALIB' : 488,
+         'L1_ALFA_B7L1U' : 489,
+         'L1_ALFA_B7L1L' : 490,
+         'L1_ALFA_A7L1U' : 491,
+         'L1_ALFA_A7L1L' : 492,
+         'L1_ALFA_A7R1U' : 493,
+         'L1_ALFA_A7R1L' : 494,
+         'L1_ALFA_B7R1U' : 495,
+         'L1_ALFA_B7R1L' : 496,
+
+        
+        'L1_MU6_FTK'                           : 499,
+        'L1_MU15_FTK'                          : 497,
+        'L1_MU20_FTK'                          : 500,
+        'L1_TAU12IM_FTK'                       : 501,
+        'L1_TAU20IM_FTK'                       : 86,
+        'L1_TAU20IM_2TAU12IM_J25_2J20_3J12_FTK': 502,
+        'L1_DR-TAU20ITAU12I-J25_FTK'           : 503,
+        'L1_4J15_FTK'                          : 504,
+        'L1_4J15.0ETA25_FTK'                   : 505,
+        'L1_J15_FTK'                           : 506,
+        'L1_J40_FTK'                           : 507,
+        'L1_J100_FTK'                          : 508,           
+        'L1_MU20_TAU12IM_FTK'                  : 498,
+#        'L1_ALFA_B7L1U_OD' : 497,
+#        'L1_ALFA_B7L1L_OD' : 498,
+#        'L1_ALFA_A7L1U_OD' : 499,
+#        'L1_ALFA_A7L1L_OD' : 500,
+#        'L1_ALFA_A7R1U_OD' : 501,
+#        'L1_ALFA_A7R1L_OD' : 502,
+#        'L1_ALFA_B7R1U_OD' : 503,
+#        'L1_ALFA_B7R1L_OD' : 504,
+#        'L1_ALFA_B7L1_OD'  : 505,
+#        'L1_ALFA_A7L1_OD'  : 506,
+#        'L1_ALFA_B7R1_OD'  : 507,
+#        'L1_ALFA_A7R1_OD'  : 508,
+        'L1_CALREQ2' : 511,  # never use 509-511 for anything else than CALREQ triggers
+}
+
+
+    Lvl1Flags.prescales = {}
+
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/LVL1Menu/MonitorDef.py b/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/LVL1Menu/MonitorDef.py
new file mode 100644
index 0000000000000000000000000000000000000000..ba87ea3f3c68753488868c10b154176d055d1d35
--- /dev/null
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/LVL1Menu/MonitorDef.py
@@ -0,0 +1,257 @@
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+"""
+The CTP monitors three different types of signals. In the XML file
+they are listed in the section <TriggerCounterList>
+
+1) type CTPIN
+
+Almost each input threshold is monitored with one counter per
+multiplicity it can have. E.g. there are 7 counters for the EM10VH
+threshold: "1EM10VH" ... "7EM10VH"
+
+Due to limitations of the CTPIN monitoring LUT (there are only 4 LUT
+per CTPIN connector and a LUT has 8 bit input) only 2 3-bit thresholds
+can be monitored per LUT, so max 8 3-bit thresholds per
+connector. Hence JET thresholds 8 and 9 can not be monitored.
+
+
+2) type CTPMON
+
+This allows to monitor any combination of conditions built in the same
+way as L1 Items. However, since we can also monitor L1 Items directly
+(see 3)), there is little need for this type of monitoring. We use it to monitor simple conditions
+
+
+3) type TBP, TAP, TAV
+
+For each of these type 64 L1Items can be monitored independently
+
+"""
+
+from TriggerMenu.l1.Lvl1Menu import Lvl1Menu
+from TriggerMenu.l1.Lvl1MonCounters import Lvl1MonCounters, Lvl1CtpinCounter, Lvl1CtpmonCounter
+
+class MonitorDef:
+
+    LOW_FREQ = 0
+    HIGH_FREQ = 1
+
+
+    # CTPIN counters
+    # these are generated for all CTPIN except the two highest JET inputs and the direct inputs
+    @staticmethod
+    def ctpinCounters( thresholds ):
+
+        counters = []
+
+        for thr in thresholds:
+            # this special check addresses the LUT size issue for the monitoring (see file header and Cabling.py)
+            dontGenerateCounter = (thr.ttype=="JET" and (thr.mapping==8 or thr.mapping==9)) \
+                                  or thr.ttype=="TOPO" or thr.ttype=="ALFA"
+            if dontGenerateCounter: continue
+            for mult in range(1, 2**thr.cableinfo.bitnum):
+                counters += [ Lvl1CtpinCounter(thr.name,mult) ]
+
+        return counters
+
+
+    # CTPMON counters
+    # we only have a few for the moment
+    @staticmethod
+    def ctpmonCounters( thresholds ):
+
+        counters = []
+
+        from operator import attrgetter
+        emthresholds = sorted([thr for thr in thresholds if thr.ttype=='EM'], key = attrgetter('mapping'))
+        
+        thrNames = [thr.name for thr in thresholds]
+        if "MBTS_A" in thrNames:
+            counters += [ Lvl1CtpmonCounter("MBTS_A",1) ]
+        if "MBTS_C" in thrNames:
+            counters += [ Lvl1CtpmonCounter("MBTS_C",1) ]
+        if emthresholds:
+            counters += [ Lvl1CtpmonCounter(emthresholds[0].name,1) ] # lowest EM threshold
+
+        return counters
+
+    @staticmethod
+    def applyItemCounter( items ):
+
+        TBP=1
+        TAP=2
+        TAV=4
+
+        monItems = { 1 :[], 2: [], 3: [], 4: [], 5: [], 6: [], 7: [] }
+        monItemsHF = { 1 :[], 2: [], 3: [], 4: [], 5: [], 6: [], 7: [] }
+
+        # definitions hardcoded at the moment
+
+#        monItems[TBP] = [
+#            "L1_MBTSA0", "L1_MBTSA1", "L1_MBTSA2", "L1_MBTSA3", "L1_MBTSA4", "L1_MBTSA5", "L1_MBTSA6", "L1_MBTSA7", "L1_MBTSA8", "L1_MBTSA10", "L1_MBTSA12", "L1_MBTSA14", 
+#            "L1_MBTSC0", "L1_MBTSC1", "L1_MBTSC2", "L1_MBTSC3", "L1_MBTSC4", "L1_MBTSC5", "L1_MBTSC6", "L1_MBTSC7", "L1_MBTSC8", "L1_MBTSC10", "L1_MBTSC12", "L1_MBTSC14",
+#            "L1_LUCID", "L1_LUCID_A_C_EMPTY",
+#            "L1_LHCF",
+#            "L1_ALFA_A7R1U",
+#            "L1_ALFA_B7L1_OD","L1_ALFA_A7L1_OD","L1_ALFA_A7R1_OD","L1_ALFA_B7R1_OD",
+#            "L1_BPTX0_BGRP0", "L1_BPTX1_BGRP0",
+#            ]
+#
+#        
+#        monItems[TAP|TAV] = [
+#            "L1_EM7", "L1_EM12", "L1_EM8VH", "L1_EM10VH", "L1_EM15", "L1_EM15HI", "L1_EM15VH", 
+#            "L1_MU6", "L1_MU10", "L1_MU11", "L1_MU15", "L1_MU20",
+#            "L1_TAU20", "L1_TAU20IL", "L1_TAU20IM", "L1_TAU20IT", 
+#            "L1_J20", "L1_J100", 
+#            "L1_XE80", "L1_XS65", "L1_TE50",
+#            "L1_MBTS_1", "L1_MBTS_2", "L1_MBTS_1_1",
+#            ]
+#        
+#        monItems[TBP|TAP|TAV] = [
+#            "L1_EM3", "L1_MU4", "L1_TAU12", "L1_J12", "L1_XE35", "L1_XS20", "L1_TE20",
+#            "L1_MBTS_4_A", "L1_MBTS_4_C", 
+#            "L1_HT200-J20s5.ETA49", "L1_HT1-J0.ETA49", "L1_HT190-J20s5.ETA49", "L1_JPSI-1M5-EMs", "L1_JPSI-1M5-EM6s", "L1_JPSI-1M5-EM12s",
+#            "L1_MJJ-4", "L1_MJJ-3", "L1_MJJ-2", "L1_MJJ-1", "L1_MJJ-350-0", "L1_MJJ-300-0", "L1_MJJ-250-0", "L1_MJJ-200-0", 
+#            "L1_RD0_FILLED", "L1_RD1_FILLED", "L1_RD2_FILLED", "L1_RD3_FILLED", 
+#            ]
+#
+#        monItemsHF[TBP] = [
+#            "L1_ALFA_ANY", 
+#            "L1_ALFA_A7R1L","L1_ALFA_B7R1U","L1_ALFA_B7R1L", "L1_ALFA_B7L1U", "L1_ALFA_B7L1L","L1_ALFA_A7L1U","L1_ALFA_A7L1L",
+#            ]
+#
+#
+#
+#        monItemsHF[TBP|TAP|TAV] = [
+#            "L1_BCM_Wide_BGRP0",
+#            "L1_BCM_AC_CA_BGRP0",
+#            "L1_BCM_AC_UNPAIRED_ISO",
+#            "L1_BCM_CA_UNPAIRED_ISO",
+#            "L1_J12",
+#            "L1_MBTS_1", "L1_MBTS_2", "L1_MBTS_1_1",
+#            ]
+
+
+
+        monItems[TBP] = [
+            "L1_ALFA_B7L1U", "L1_ALFA_B7L1L", "L1_ALFA_A7L1U", "L1_ALFA_A7L1L", "L1_ALFA_A7R1U", "L1_ALFA_A7R1L", "L1_ALFA_B7R1U", "L1_ALFA_B7R1L"
+            ]
+
+
+        monItems[TBP|TAP|TAV] = [
+            "L1_EM3","L1_EM20VH","L1_EM22VHI",
+            "L1_MU4","L1_MU10","L1_MU20",
+            "L1_TAU12", "L1_TAU12IT", "L1_TAU20", "L1_TAU60",
+            "L1_J12", "L1_J20", "L1_J100", "L1_J400", "L1_J20.31ETA49", "L1_J30.31ETA49",
+            "L1_XE35", "L1_XE80", "L1_XS20", 
+            "L1_MBTS_4_A", "L1_MBTS_4_C", "L1_MBTS_1", "L1_MBTS_2", "L1_MBTS_1_1",
+            "L1_LUCID", "L1_LUCID_A_C_EMPTY", "L1_ALFA_ANY",
+            "L1_ZDC_A", "L1_ZDC_C", "L1_ZDC_AND",
+            "L1_BPTX0_BGRP0","L1_BPTX1_BGRP0",
+            "L1_CALREQ2",
+            "L1_AFP_NSC","L1_AFP_FSC",
+            "L1_BPH-2M8-2MU4","L1_BPH-2M8-MU6MU4_BPH-0DR15-MU6MU4","L1_BPH-2M9-2MU6_BPH-2DR15-2MU6",
+            "L1_MU6MU4-BO","L1_2MU4-B",
+            "L1_LFV-EM8I",
+            "L1_TGC_BURST",
+            "L1_LLP-NOMATCH",
+            "L1_DR-TAU20ITAU12I",
+            "L1_HT190-J15s5.ETA21",
+            "L1_3J15_BTAG-MU4J15",
+            "L1_MJJ-900",
+            "L1_J40_DPHI-J20s2XE50",
+            "L1_KF-XE55",
+            ]
+
+        monItemsHF[TBP|TAP|TAV] = [
+            "L1_BCM_Wide_BGRP0",
+            "L1_BCM_AC_CA_BGRP0",
+            "L1_BCM_AC_UNPAIRED_ISO",
+            "L1_BCM_CA_UNPAIRED_ISO",
+            "L1_J12",
+            "L1_MBTS_1", "L1_MBTS_2", "L1_MBTS_1_1",
+            ]
+
+
+
+        check = False
+        if check:
+            counts_LF_items = { TBP : set(), TAP : set(), TAV : set() }
+            counts_HF_items = { TBP : set(), TAP : set(), TAV : set() }
+
+            for k in range(1,8):
+
+                if k & TBP:
+                    counts_LF_items[TBP].update( monItems[k] )
+                    counts_HF_items[TBP].update( monItemsHF[k] )
+
+                if k & TAP:
+                    counts_LF_items[TAP].update( monItems[k] )
+                    counts_HF_items[TAP].update( monItemsHF[k] )
+
+                if k & TAV:
+                    counts_LF_items[TAV].update( monItems[k] )
+                    counts_HF_items[TAV].update( monItemsHF[k] )
+
+            counts_LF = dict( map(lambda (x,y) : (x,len(y)), counts_LF_items.items() ) )
+            counts_HF = dict( map(lambda (x,y) : (x,len(y)), counts_HF_items.items() ) )
+
+            lutsLF = ( max(counts_LF.values())-1) / 8 + 1
+            lutsHF = ( max(counts_HF.values())-1) / 8 + 1
+
+            if lutsLF + lutsHF > 8:
+                print "WARNING: too many monitoring items are defined:"
+                print "   low frequency  TBP: %i" % counts_LF[TBP]
+                print "                  TAP: %i" % counts_LF[TAP]
+                print "                  TAV: %i" % counts_LF[TAV]
+                print "   required LUTs: %i" % lutsLF
+                print "   high frequency TBP: %i" % counts_HF[TBP]
+                print "                  TAP: %i" % counts_HF[TAP]
+                print "                  TAV: %i" % counts_HF[TAV]
+                print "   required LUTs: %i" % lutsHF
+                print "   this menu requires %i monitoring LUTs while only 8 are available" % (lutsLF + lutsHF)
+            
+
+
+        #MonitorDef.checkForNonExistingMonItems(items, monItems)
+
+        # for each item set the monitor flags
+        for item in items:
+
+            itemName = item.name
+            for k,l in monItems.items():
+
+                if itemName in l:
+                    item.addMonitor(k, MonitorDef.LOW_FREQ)
+
+
+            for k,l in monItemsHF.items():
+
+                if itemName in l:
+                    item.addMonitor(k, MonitorDef.HIGH_FREQ)
+
+
+
+
+
+
+    @staticmethod
+    def checkForNonExistingMonItems(items, monItems):
+        # check is based on item names
+        allItemNames = [item.name for item in items]
+
+        # unify all item names that are monitored
+        allMonitorItems = set()
+        for i in range(1,8):
+            allMonitorItems.update(monItems[i])
+
+        # register all monitems that don't exist in here
+        nonExistiginMonItems = []
+        
+        for monItem in allMonitorItems:
+            if monItem not in allItemNames:
+                nonExistiginMonItems += [monItem]
+
+        if len(nonExistiginMonItems)>0:
+            raise RuntimeError("These monitoring items are part of the menu: %s" % ','.join(nonExistiginMonItems))
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/LVL1Menu/ThresholdDef.py b/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/LVL1Menu/ThresholdDef.py
new file mode 100644
index 0000000000000000000000000000000000000000..46734451dd3e619640e24b5b9293270bc3955e5e
--- /dev/null
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/LVL1Menu/ThresholdDef.py
@@ -0,0 +1,430 @@
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+from TriggerMenu.l1.Lvl1Thresholds import LVL1Threshold, ThresholdValue
+from TriggerMenu.l1.Limits import CaloLimits as CL
+from TriggerJobOpts.TriggerFlags import TriggerFlags
+
+ClusterOff   = CL.ClusterOff
+IsolationOff = CL.IsolationOff
+JetOff       = CL.JetOff
+EtSumOff     = CL.EtSumOff
+EtMissOff    = CL.EtMissOff
+JetEtOff     = CL.JetEtOff
+
+
+class ThresholdDef:
+
+    @staticmethod
+    def registerThresholds(tc):
+        
+        # MUON
+        ThresholdValue.setDefaults('MUON', {'etamin' : -49,'etamax' : 49, 'phimin' : 0,'phimax' : 64}) # keep this as an example how defaults for groups can be defined
+
+        for thrV in [0, 4, 6, 10, 11, 15, 20]:
+            tc.registerThr('MU%i' % thrV, 'MUON').addThrValue(thrV)
+
+
+        # EM 
+        ThresholdValue.setDefaults('EM',{'isobits' : '00000', 'use_relIso' : True })
+
+        for thrV in [3, 4, 5, 6, 7, 8, 10, 12, 14, 15, 16, 18, 20, 22, 30, 50]:
+            tc.registerThr('EM%i' % thrV, 'EM').addThrValue(thrV)
+
+
+        # for beam splashes:
+        #ThresholdValue.setDefaults('EM', {'etamin' : 16,'etamax' : 20, 'phimin' : 0,'phimax' : 64, 'isobits' : '00000', 'use_relIso' : True })
+        tc.registerThr('EM20A', 'EM').addThrValue(255, priority=1)\
+            .addThrValue(20,16,20,priority=2)
+        
+        #ThresholdValue.setDefaults('EM', {'etamin' : -20,'etamax' : -16, 'phimin' : 0,'phimax' : 64, 'isobits' : '00000', 'use_relIso' : True })
+        tc.registerThr('EM20C', 'EM').addThrValue(255, priority=1)\
+            .addThrValue(20,-20,-16,priority=2)
+
+
+
+        # variable thresholds (V)
+        # hadronic isolation (H) had_isolation=1GeV
+        # em isolation (I)
+
+        # V section
+        
+        tc.registerThr( 'EM50V', type='EM').addThrValue(52, priority=1)\
+                        .addThrValue(51, -12, -8, priority=2).addThrValue(51, 8, 12, priority=2)\
+                        .addThrValue(50, -16, -12, priority=2).addThrValue(50, 12, 16, priority=2)\
+                        .addThrValue(51, -20, -16, priority=2).addThrValue(51, 16, 20, priority=2)
+
+        # VH section
+
+        ThresholdValue.setDefaults('EM', {'isobits' : '00001', 'use_relIso' : True })
+
+        tc.registerThr( 'EM8VH', type='EM').addThrValue(9, priority=1)\
+            .addThrValue(9, -8, 0, priority=2).addThrValue(9, 0, 8, priority=2)\
+            .addThrValue(7, -11, -8, priority=2).addThrValue(7, 8, 11, priority=2)\
+            .addThrValue(6, -14, -11, priority=2).addThrValue(6, 11, 14, priority=2)\
+            .addThrValue(5, -15, -14, priority=2).addThrValue(5, 14, 15, priority=2)\
+            .addThrValue(7, -18, -15, priority=2).addThrValue(7, 15, 18, priority=2)\
+            .addThrValue(8, -25, -18, priority=2).addThrValue(8, 18, 25, priority=2)
+        
+        tc.registerThr( 'EM10VH', type='EM').addThrValue(11, priority=1)\
+            .addThrValue(11, -8, 0, priority=2).addThrValue(11, 0, 8, priority=2)\
+            .addThrValue(9, -11, -8, priority=2).addThrValue(9, 8, 11, priority=2)\
+            .addThrValue(8, -14, -11, priority=2).addThrValue(8, 11, 14, priority=2)\
+            .addThrValue(7, -15, -14, priority=2).addThrValue(7, 14, 15, priority=2)\
+            .addThrValue(9, -18, -15, priority=2).addThrValue(9, 15, 18, priority=2)\
+            .addThrValue(10, -25, -18, priority=2).addThrValue(10, 18, 25, priority=2)
+        
+        tc.registerThr( 'EM13VH', type='EM').addThrValue(15, priority=1)\
+            .addThrValue(15, -7, 0, priority=2).addThrValue(15, 0, 7, priority=2)\
+            .addThrValue(14, -9, -7, priority=2).addThrValue(14, 7, 9, priority=2)\
+            .addThrValue(13, -12, -9, priority=2).addThrValue(13, 9, 12, priority=2)\
+            .addThrValue(12, -14, -12, priority=2).addThrValue(12, 12, 14, priority=2)\
+            .addThrValue(11, -15, -14, priority=2).addThrValue(11, 14, 15, priority=2)\
+            .addThrValue(13, -17, -15, priority=2).addThrValue(13, 15, 17, priority=2)\
+            .addThrValue(14, -25, -17, priority=2).addThrValue(14, 17, 25, priority=2)
+        
+        tc.registerThr( 'EM15VH', type='EM').addThrValue(17, priority=1)\
+            .addThrValue(17, -7, 0, priority=2).addThrValue(17, 0, 7, priority=2)\
+            .addThrValue(16, -9, -7, priority=2).addThrValue(16, 7, 9, priority=2)\
+            .addThrValue(15, -12, -9, priority=2).addThrValue(15, 9, 12, priority=2)\
+            .addThrValue(14, -14, -12, priority=2).addThrValue(14, 12, 14, priority=2)\
+            .addThrValue(13, -15, -14, priority=2).addThrValue(13, 14, 15, priority=2)\
+            .addThrValue(15, -17, -15, priority=2).addThrValue(15, 15, 17, priority=2)\
+            .addThrValue(16, -25, -17, priority=2).addThrValue(16, 17, 25, priority=2)
+        
+        tc.registerThr( 'EM18VH', type='EM').addThrValue(20, priority=1)\
+            .addThrValue(20, -7, 0, priority=2).addThrValue(20, 0, 7, priority=2)\
+            .addThrValue(19, -8, -7, priority=2).addThrValue(19, 7, 8, priority=2)\
+            .addThrValue(18, -11, -8, priority=2).addThrValue(18, 8, 11, priority=2)\
+            .addThrValue(17, -13, -11, priority=2).addThrValue(17, 11, 13, priority=2)\
+            .addThrValue(16, -14, -13, priority=2).addThrValue(16, 13, 14, priority=2)\
+            .addThrValue(15, -15, -14, priority=2).addThrValue(15, 14, 15, priority=2)\
+            .addThrValue(17, -17, -15, priority=2).addThrValue(17, 15, 17, priority=2)\
+            .addThrValue(19, -25, -17, priority=2).addThrValue(19, 17, 25, priority=2)
+        
+        tc.registerThr( 'EM20VH', type='EM').addThrValue(22, priority=1)\
+            .addThrValue(22, -7, 0, priority=2).addThrValue(22, 0, 7, priority=2)\
+            .addThrValue(21, -8, -7, priority=2).addThrValue(21, 7, 8, priority=2)\
+            .addThrValue(20, -11, -8, priority=2).addThrValue(20, 8, 11, priority=2)\
+            .addThrValue(19, -13, -11, priority=2).addThrValue(19, 11, 13, priority=2)\
+            .addThrValue(18, -14, -13, priority=2).addThrValue(18, 13, 14, priority=2)\
+            .addThrValue(17, -15, -14, priority=2).addThrValue(17, 14, 15, priority=2)\
+            .addThrValue(19, -17, -15, priority=2).addThrValue(19, 15, 17, priority=2)\
+            .addThrValue(21, -25, -17, priority=2).addThrValue(21, 17, 25, priority=2)       
+
+        # I section
+
+        ThresholdValue.setDefaults('EM', {'isobits' : '00010', 'use_relIso' : True })
+
+        for thrV in [8]:
+            tc.registerThr('EM%iI' % thrV, 'EM').addThrValue(thrV)
+
+
+
+        # (V)HI section
+        ThresholdValue.setDefaults('EM', {'isobits' : '00100', 'use_relIso' : True })
+
+        for thrV in [15]:
+            tc.registerThr('EM%iHI' % thrV, 'EM').addThrValue(thrV)
+
+        tc.registerThr( 'EM20VHI', type='EM').addThrValue(22, priority=1)\
+            .addThrValue(22, -7, 0, priority=2).addThrValue(22, 0, 7, priority=2)\
+            .addThrValue(21, -8, -7, priority=2).addThrValue(21, 7, 8, priority=2)\
+            .addThrValue(20, -11, -8, priority=2).addThrValue(20, 8, 11, priority=2)\
+            .addThrValue(19, -13, -11, priority=2).addThrValue(19, 11, 13, priority=2)\
+            .addThrValue(18, -14, -13, priority=2).addThrValue(18, 13, 14, priority=2)\
+            .addThrValue(17, -15, -14, priority=2).addThrValue(17, 14, 15, priority=2)\
+            .addThrValue(19, -17, -15, priority=2).addThrValue(19, 15, 17, priority=2)\
+            .addThrValue(21, -25, -17, priority=2).addThrValue(21, 17, 25, priority=2)
+
+        tc.registerThr( 'EM22VHI', type='EM').addThrValue(24, priority=1)\
+            .addThrValue(24, -7, 0, priority=2).addThrValue(24, 0, 7, priority=2)\
+            .addThrValue(23, -8, -7, priority=2).addThrValue(23, 7, 8, priority=2)\
+            .addThrValue(22, -11, -8, priority=2).addThrValue(22, 8, 11, priority=2)\
+            .addThrValue(21, -13, -11, priority=2).addThrValue(21, 11, 13, priority=2)\
+            .addThrValue(20, -14, -13, priority=2).addThrValue(20, 13, 14, priority=2)\
+            .addThrValue(19, -15, -14, priority=2).addThrValue(19, 14, 15, priority=2)\
+            .addThrValue(21, -17, -15, priority=2).addThrValue(21, 15, 17, priority=2)\
+            .addThrValue(23, -25, -17, priority=2).addThrValue(23, 17, 25, priority=2)
+        
+        tc.registerThr( 'EM24VHI', type='EM').addThrValue(24, priority=1)\
+            .addThrValue(26, -7, 0, priority=2).addThrValue(26, 0, 7, priority=2)\
+            .addThrValue(25, -8, -7, priority=2).addThrValue(25, 7, 8, priority=2)\
+            .addThrValue(24, -11, -8, priority=2).addThrValue(24, 8, 11, priority=2)\
+            .addThrValue(23, -13, -11, priority=2).addThrValue(23, 11, 13, priority=2)\
+            .addThrValue(22, -14, -13, priority=2).addThrValue(22, 13, 14, priority=2)\
+            .addThrValue(21, -15, -14, priority=2).addThrValue(21, 14, 15, priority=2)\
+            .addThrValue(23, -17, -15, priority=2).addThrValue(23, 15, 17, priority=2)\
+            .addThrValue(25, -25, -17, priority=2).addThrValue(25, 17, 25, priority=2)
+        
+        tc.registerThr( 'EM26VHI', type='EM').addThrValue(26, priority=1)\
+            .addThrValue(28, -7, 0, priority=2).addThrValue(28, 0, 7, priority=2)\
+            .addThrValue(27, -8, -7, priority=2).addThrValue(27, 7, 8, priority=2)\
+            .addThrValue(26, -11, -8, priority=2).addThrValue(26, 8, 11, priority=2)\
+            .addThrValue(25, -13, -11, priority=2).addThrValue(25, 11, 13, priority=2)\
+            .addThrValue(24, -14, -13, priority=2).addThrValue(24, 13, 14, priority=2)\
+            .addThrValue(23, -15, -14, priority=2).addThrValue(23, 14, 15, priority=2)\
+            .addThrValue(25, -17, -15, priority=2).addThrValue(25, 15, 17, priority=2)\
+            .addThrValue(27, -25, -17, priority=2).addThrValue(27, 17, 25, priority=2)
+
+
+        tc.registerThr( 'EM3HI', type='EM').addThrValue(3, priority=1)\
+
+
+        #ThresholdValue.setDefaults('EM', {'etamin' : 16,'etamax' : 20, 'phimin' : 0,'phimax' : 64, 'isobits' : '00000', 'use_relIso' : True })
+        #tc.registerThr('EM20A', 'EM').addThrValue(20)
+        #ThresholdValue.setDefaults('EM', {'etamin' : -20,'etamax' : -16, 'phimin' : 0,'phimax' : 64, 'isobits' : '00000', 'use_relIso' : True })
+        #tc.registerThr('EM20C', 'EM').addThrValue(20)
+
+
+
+
+        ThresholdValue.setDefaults('EM', {})
+
+
+        # TAU
+
+        ThresholdValue.setDefaults('TAU',{'isobits' : '00000', 'use_relIso' : True })
+
+        for thrV in [6, 8, 12, 15, 20, 25, 30, 35, 40, 50, 60,100]:
+            tc.registerThr('HA%i' % thrV, 'TAU').addThrValue(thrV)
+
+        # beam splashes     
+        for thrV in [20]: 
+            tc.registerThr('HA%iA' % thrV, 'TAU').addThrValue(255, priority=1).addThrValue( thrV, etamin = 12,  etamax = 16, priority=2) 
+            tc.registerThr('HA%iC' % thrV, 'TAU').addThrValue(255, priority=1).addThrValue( thrV, etamin = -16,  etamax = -12, priority=2) 
+
+
+#        ThresholdValue.setDefaults('TAU', {'isobits' : '00100', 'use_relIso' : True })
+#        for thrV in [12,20]:
+#            tc.registerThr('HA%iI' % thrV, 'TAU').addThrValue(thrV)
+#
+#        ThresholdValue.setDefaults('TAU', {'isobits' : '00001', 'use_relIso' : True })
+#        for thrV in [12]:
+#            tc.registerThr('HA%iIL' % thrV, 'TAU').addThrValue(thrV)
+
+        ThresholdValue.setDefaults('TAU', {'isobits' : '00001', 'use_relIso' : True })
+        for thrV in [12,20]:
+            tc.registerThr('HA%iIL' % thrV, 'TAU').addThrValue(thrV)
+
+        ThresholdValue.setDefaults('TAU', {'isobits' : '00010', 'use_relIso' : True })
+        for thrV in [12,20]:
+            tc.registerThr('HA%iIM' % thrV, 'TAU').addThrValue(thrV)
+
+        ThresholdValue.setDefaults('TAU', {'isobits' : '00100', 'use_relIso' : True })
+        for thrV in [12,20,25]:
+            tc.registerThr('HA%iIT' % thrV, 'TAU').addThrValue(thrV)
+
+        ThresholdValue.setDefaults('TAU', {'isobits' : '01000', 'use_relIso' : True })
+        for thrV in [12,20]:
+            tc.registerThr('HA%iI' % thrV, 'TAU').addThrValue(thrV)
+
+        ThresholdValue.setDefaults('TAU', {})
+            
+            
+        # JET
+
+        ThresholdValue.setDefaults('JET', {'window' : 8})
+
+        for thrV in [5, 10, 12, 15, 20, 25, 30, 35, 40, 50, 60, 70, 75, 85, 100, 120, 150,175, 250, 400]:
+            tc.registerThr('J%i' % thrV, 'JET').addThrValue(JetOff).addThrValue(thrV, etamin=-31, etamax=31, priority=1) # jets are between -31 and 31 -ATR-11526
+        
+        ThresholdValue.setDefaults('JET', {})
+
+        
+        # JB and JF
+
+        ThresholdValue.setDefaults('JET', {'window' : 8})
+        
+        #for thrV in [25]:
+        #    tc.registerThr('JF%i' % thrV, 'JET').addThrValue(JetOff).addThrValue( thrV, etamin=31,  etamax=49, priority=1)
+        #    tc.registerThr('JB%i' % thrV, 'JET').addThrValue(JetOff).addThrValue( thrV, etamin=-49, etamax=-31, priority=1)
+
+        # Beam Splashes
+        for thrV in [75]:
+            tc.registerThr('J%iA' % thrV, 'JET').addThrValue(JetOff).addThrValue( thrV, etamin = 16,  etamax = 24, priority=1)
+            tc.registerThr('J%iC' % thrV, 'JET').addThrValue(JetOff).addThrValue( thrV, etamin = -24,  etamax = -16, priority=1)          
+        
+
+        # Central jet
+        for (thrV, etamax) in [(15,25), (17,22), (20,28), (25,23), (35,23), (20,49), (30,49), (40,25)]:
+            tc.registerThr('J%i.0ETA%i'  % (thrV, etamax), 'JET').addThrValue(JetOff).addThrValue( thrV, etamin = -etamax,  etamax = etamax, priority=1)  
+
+        # Standard forward jet
+        for thrV in [10, 15, 20, 25, 30, 35, 45, 50, 70, 75, 100]:
+            tc.registerThr('J%i.31ETA49' % thrV, 'JET').addThrValue(JetOff).addThrValue( thrV, etamin=31,  etamax=49, priority=1).addThrValue( thrV, etamin=-49, etamax=-31, priority=1)
+
+        # Custom Forward jet and VBF jets
+        for (thrV, etamin, etamax) in [ (15,23,49), (15,24,49), (20,28,31) ]:
+            tc.registerThr('J%i.%iETA%i' % (thrV, etamin,etamax), 'JET').addThrValue(JetOff).addThrValue( thrV, etamin  =  etamin, etamax=etamax, priority=1).addThrValue( thrV, etamin = -etamax, etamax = -etamin, priority=1)
+
+        ##4x4 jet windows for forward electrons
+        ThresholdValue.setDefaults('JET', {'window' : 4})
+        
+        for thrV in [15]:
+            tc.registerThr('JJ%i.23ETA49' % thrV, 'JET').addThrValue(JetOff).addThrValue( thrV, etamin=23,  etamax=49, priority=1).addThrValue( thrV, etamin=-49, etamax=-23, priority=1)
+
+        ThresholdValue.setDefaults('JET', {})
+
+
+        # ZB
+        tc.registerThr('ZB_EM12', 'ZB', seed='EM12',seed_ttype = 'EM',  seed_multi=1, bcdelay=3564)
+        tc.registerThr('ZB_EM15', 'ZB', seed='EM15',seed_ttype = 'EM',  seed_multi=1, bcdelay=3564)
+        tc.registerThr('ZB_J10',  'ZB', seed='J10', seed_ttype = 'JET', seed_multi=1, bcdelay=3564)
+        # tc.registerThr('ZB_J20',  'ZB', seed='J20', seed_ttype = 'JET', seed_multi=1, bcdelay=3564)
+        tc.registerThr('ZB_J75',  'ZB', seed='J75', seed_ttype = 'JET', seed_multi=1, bcdelay=3564)
+
+
+        # JE
+
+        ThresholdValue.setDefaults('JE', {'etamin' : -49,'etamax' : 49, 'phimin' : 0,'phimax' : 64,
+                                                       'window' : 8, 'priority': 0})
+
+        for thrV in [100, 140, 200, 300, 350, 500]:
+            tc.registerThr('JE%i' % thrV, 'JE').addThrValue(thrV)
+
+        
+        # TE
+        for thrV in [0, 3, 5, 10, 15, 20, 25, 30, 40, 45, 50, 55, 60, 65, 70, 90, 100, 120, 140, 160, 200, 280, 300, 360, 2000, 4000, 10000, 12000, 14000]:
+            tc.registerThr('TE%i' % thrV, 'TE').addThrValue(thrV)
+
+        # XE
+        for thrV in [10, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 150, 300]:
+            tc.registerThr('XE%i' % thrV, 'XE').addThrValue(thrV)
+
+        # XS
+        for thrV in [20, 25, 30, 35, 40, 45, 50, 55, 60, 65]:
+            tc.registerThr('XS%i' % thrV, 'XS').addThrValue(thrV)
+
+        # Restricted range TE |eta|<2.4
+        etamax = 24
+        for thrV in [0, 3, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 80, 110, 150, 180, 1000, 2000, 5000, 6500, 8000, 9000]:
+            tc.registerThr('TE%i.0ETA%i' % (thrV, etamax), 'TE').addThrValue(EtSumOff).addThrValue( thrV, etamin = -etamax, etamax = etamax, priority=1)
+        
+        # RXE (restriced range ET miss)
+        for thrV in [35, 40, 45, 50, 55, 60, 70, 80]:
+            tc.registerThr('XE%i.0ETA%i'    % (thrV, etamax), 'XE').addThrValue(EtMissOff).addThrValue( thrV, etamin = -etamax, etamax = etamax, priority=1) 
+
+	 # Restricted range TE |eta|<4.9
+        etamax = 49
+        for thrV in [500, 1500, 3000, 3500, 5000, 6500, 8000, 9000]:
+            tc.registerThr('TE%i.0ETA%i' % (thrV, etamax), 'TE').addThrValue(EtSumOff).addThrValue( thrV, etamin = -etamax, etamax = etamax, priority=1)
+
+
+        ##RESTRICTED ETA THRESHOLD FOR TE and XE HAVE TO USE THE SAME ETA RANGE. Only possible for thesholds 8-15
+        #ThresholdValue.setDefaults('TE', {'etamin' : -24,'etamax' : 24, 'priority': 1})
+        #
+        #for  thrV in [(30),]:
+        #    tc.registerThr('TE%i.0ETA24' % (thrV), 'TE').addThrValue(thrV)
+            
+            
+        # CALREQ
+            
+        for i in range(3):
+            tc.registerThr('CAL%i' % i, 'CALREQ', mapping=i).addThrValue(40)
+
+
+        ## MBTS
+
+        # MBTS naming scheme defined in
+        # https://docs.google.com/spreadsheets/d/1R0s8Lw-0nPSjqe9YTuZBCeAdedn_Ve4Ax6bbMe_4bSk/edit#gid=1818891632
+
+        # run 1
+        thresholdA=[ 32.04, 26.98, 35.00, 33.54, 32.08, 36.46, 30.63, 32.08, 33.54, 30.63, 29.17, 33.54, 32.08, 32.08, 30.63, 26.25]
+        thresholdC=[ 55.42, 31.98, 32.81, 49.48, 98.44, 32.11, 32.62, 29.90, 24.06, 25.81, 25.52, 35.00, 27.71, 36.46, 26.25, 30.63]
+
+        # run 2 above MBTS_A08 only the even numbers are used
+        thresholdA=[ 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 0.0, 100.0, 0.0, 100.0, 0.0, 100.0, 0.0]
+        thresholdC=[ 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 0.0, 100.0, 0.0, 100.0, 0.0, 100.0, 0.0]
+
+        for i, (vA, vC) in enumerate(zip(thresholdA, thresholdC)):
+            #if(thresholdA[i]!=0):
+            tc.registerThr('MBTS_A%i' % i, 'MBTSSI').addThrValue(thresholdA[i])
+            #if(thresholdC[i]!=0):
+            tc.registerThr('MBTS_C%i' % i, 'MBTSSI').addThrValue(thresholdC[i])
+
+
+        thr_mbtsA = tc.registerThr('MBTS_A', 'MBTS', mapping=0)
+        thr_mbtsC = tc.registerThr('MBTS_C', 'MBTS', mapping=1)
+        for x in xrange(16):
+            if tc.getRegisteredThreshold('MBTS_A%i' % x):
+                thr_mbtsA.thresholdValues += [ tc.getRegisteredThreshold('MBTS_A%i' % x).thresholdValues[0] ]
+            if tc.getRegisteredThreshold('MBTS_C%i' % x):
+                thr_mbtsC.thresholdValues += [ tc.getRegisteredThreshold('MBTS_C%i' % x).thresholdValues[0] ]
+
+
+
+        ## ZDC
+        
+        tc.registerThr('ZDC_A',   'ZDC').addThrValue(250)
+        tc.registerThr('ZDC_C',   'ZDC').addThrValue(250)
+        tc.registerThr('ZDC_AND', 'ZDC').addThrValue(250)
+
+
+        ## BCM
+
+        tc.registerThr('BCM_AtoC', 'BCM').addThrValue(40)
+        tc.registerThr('BCM_CtoA', 'BCM').addThrValue(40)
+        tc.registerThr('BCM_Wide', 'BCM').addThrValue(40)
+        tc.registerThr('BCM_Comb', 'BCMCMB').addThrValue(40)
+
+        ## LUCID
+
+        tc.registerThr('LUCID_A', 'LUCID').addThrValue(650)
+        tc.registerThr('LUCID_C', 'LUCID').addThrValue(650)
+        tc.registerThr('LUCID_Coinc_AC', 'LUCID').addThrValue(650)
+        tc.registerThr('LUCID_COMM', 'LUCID').addThrValue(650)
+        tc.registerThr('LUCID_05', 'LUCID').addThrValue(650)
+        tc.registerThr('LUCID_06', 'LUCID').addThrValue(650)
+
+        ## AFP
+        tc.registerThr('AFP_NSC', 'NIM', mapping=2).addThrValue(50)
+        tc.registerThr('AFP_FSC', 'NIM', mapping=3).addThrValue(50)
+        tc.registerThr('AFP_NSA', 'NIM', mapping=4).addThrValue(50)
+        tc.registerThr('AFP_FSA', 'NIM', mapping=5).addThrValue(50)
+        
+
+        # Diamond beam monitors
+        #for i in range(8):
+        #    tc.registerThr('DBM%i'    % i, 'DBM')
+
+        ## BPTX
+
+        tc.registerThr('BPTX0', 'BPTX').addThrValue(40)
+        tc.registerThr('BPTX1', 'BPTX').addThrValue(40)
+
+
+        ## Other NIMs
+
+        tc.registerThr('NIML1A', 'NIM', mapping=0).addThrValue(40)
+        tc.registerThr('NIMLHCF', 'NIM', mapping=1).addThrValue(40)
+        tc.registerThr('NIMTGC', 'NIM', mapping=12).addThrValue(40)
+        tc.registerThr('NIMRPC', 'NIM', mapping=13).addThrValue(40)
+        tc.registerThr('NIMTRT', 'NIM', mapping=14).addThrValue(40)
+
+        #for m,i in enumerate([5,6,7,8,14,25,36]):
+        #for m,i in enumerate([5,25]):
+        #    tc.registerThr('NIMDIR%i' % i, 'NIM', mapping=m+2).addThrValue(40)
+        #tc.registerThr('NIMDIR26', 'NIM', mapping=35).addThrValue(40)
+
+
+        # ALFA
+        LUT1offset =  2 # this is needed because the first 4 direct inputs are in a LUT with 8 PITs so the OR with the next inputs would not work
+        LUT2offset =  8
+        LUT3offset = 14
+        LUT4offset = 20
+        LUT5offset = 26
+        for i, alfa in enumerate( ['B7R1L', 'B7R1U', 'A7R1L', 'A7R1U', 'A7L1L', 'A7L1U', 'B7L1L', 'B7L1U'] ):
+            phaseOffset = 32 * (i%2)
+            tc.registerThr('ALFA_%s'    % alfa, 'ALFA', mapping = LUT1offset + i/2 + phaseOffset )
+            tc.registerThr('ALFA2_%s'   % alfa, 'ALFA', mapping = LUT2offset + i/2 + phaseOffset )
+            tc.registerThr('ALFA3_%s'   % alfa, 'ALFA', mapping = LUT3offset + i/2 + phaseOffset )
+            tc.registerThr('ALFA4_%s'   % alfa, 'ALFA', mapping = LUT4offset + i/2 + phaseOffset )
+            tc.registerThr('ALFA_%s_OD' % alfa, 'ALFA', mapping = LUT5offset + i/2 + phaseOffset )
+
+
+
+
+
+        # DIRECT INPUTS
+        # all topo inputs are directly set from the L1Topo menu
+        
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/TriggerConfigL1Topo.py b/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/TriggerConfigL1Topo.py
new file mode 100644
index 0000000000000000000000000000000000000000..6b830341ef5aa9aece406564db5b87401815e75b
--- /dev/null
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/TriggerConfigL1Topo.py
@@ -0,0 +1,175 @@
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+from sys import settrace
+
+from l1topo.TopoAlgos import TopoAlgo
+from l1topo.L1TopoMenu import L1TopoMenu
+from l1topo.L1TopoFlags import L1TopoFlags
+
+from AthenaCommon.Logging import logging
+log = logging.getLogger("TriggerConfigL1Topo")
+
+class TriggerConfigL1Topo:
+    
+    current = None
+    def __init__(self, outputFile = None , inputFile = None , menuName = None ):
+        """
+        inputFile: if set the topo menu will be read from this xml file (not yet implemented)
+        outputFile: if no input file is specified the topo menu will be generated and written to outputFile
+        menuName: ignored now
+        """
+        current = self
+        from TriggerJobOpts.TriggerFlags import TriggerFlags
+
+        self.menuName = TriggerConfigL1Topo.getMenuBaseName(TriggerFlags.triggerMenuSetup())
+
+        self.inputFile     = inputFile
+        self.outputFile    = outputFile
+        
+        # all registered algos
+        self.registeredAlgos = {}
+
+        self.runningid=0
+        
+        # menu
+        self.menu = L1TopoMenu(self.menuName)
+        
+        if self.inputFile != None:
+            """Read menu from XML"""
+            print "Menu input is not implemented!!"
+        else:
+            """Build menu from menu name"""
+
+            # defines the menu (algo only for now)
+            self.defineMenu(self.menuName)
+
+            # registers all items ever defined
+            self.registerMenu()
+
+
+    # remove prescale suffixes
+    @staticmethod
+    def getMenuBaseName(menuName):
+        import re 
+        pattern = re.compile('_v\d+|DC14')
+        patternPos = pattern.search(menuName)
+        if patternPos:
+            menuName=menuName[:patternPos.end()]
+        else:
+            log.info('Can\'t find pattern to shorten menu name, either non-existent in name or not implemented.')
+        return menuName         
+
+
+
+
+    def registerAlgo(self, algo):
+        """ Add a L1Topo algo to the set of algos which are registered for further use"""
+
+        if algo.name in self.registeredAlgos:
+            raise RuntimeError('L1Topo algo %s is already registered' % algo.name)
+            
+        self.registeredAlgos[algo.name] = algo
+        log.debug("Added in the algo list: {0}, ID:{1}" .format(algo.name,algo.algoId))
+        return algo
+
+
+    
+    def getRegisteredAlgo(self, name):
+        if name in self.registeredAlgos:
+#            print "Returning algo: {0}, ID:{1}, reassigning to {2}" .format(self.registeredAlgos[name].name,self.registeredAlgos[name].algoId,self.runningid )
+#            self.registeredAlgos[name].algoId=self.runningid
+            self.runningid+=1
+            return self.registeredAlgos[name]
+        
+        return None
+
+
+    def findRegisteredSortingAlgoByOutput(self, algo):
+        """returns a list of all sorting algorithms that are needed to
+        produce the required output. Even one missing will raise a runtime exception"""
+        sortingAlgs = []
+        missingOutput = []
+        for requiredInput in algo.inputs:
+            foundOutput = False
+            for name, alg in self.registeredAlgos.items():
+                if type(alg.outputs)==list:
+                    foundOutput = (requiredInput in alg.outputs)
+                else:
+                    foundOutput = (requiredInput == alg.outputs)
+                if foundOutput:
+                    sortingAlgs += [alg]
+                    break
+            if not foundOutput:
+                missingOutput += [(algo.name, requiredInput)]
+        if missingOutput:
+            raise RuntimeError("For some algorithms not all inputs could be found. Missing are: %r" % ["%s <- %s" % (algname, inputname) for (algname, inputname) in missingOutput] )
+        return sortingAlgs
+
+
+    def writeXML(self):
+        """ Writes L1Topo XML file"""
+        if self.outputFile is None:
+            log.warning("Can't write xml file since no name was provided")
+            return
+        FH = open( self.outputFile, mode="wt" )
+        FH.write( self.menu.xml() )
+        FH.close()
+        log.info("Wrote %s " % self.outputFile)
+
+
+    @staticmethod
+    def defineMenu(menuName = None ):
+        """
+        Defines the list if algo names that will be in the menu
+
+        Calls defineMenu() of the correct module 'Menu_<menuname>.py'
+
+        Menu.defineMenu() defines the menu via L1TopoFlags
+        """
+
+        menuName = TriggerConfigL1Topo.getMenuBaseName(menuName)
+        from TriggerJobOpts.TriggerFlags import TriggerFlags
+        menumodule = __import__('l1topomenu.Menu_%s' % menuName, globals(), locals(), ['defineMenu'], -1)
+        menumodule.defineMenu()
+        log.info("%s menu contains %i algos." % ( menuName, len(L1TopoFlags.algos()) )) 
+        
+
+    def registerMenu(self):
+        """
+        Calls registerTopoAlgos() of the correct module 'TopoalgoDef.py'
+        
+        Has to run AFTER defineMenu
+        """
+        algodefmodule = __import__('l1topomenu.TopoAlgoDef', globals(), locals(), ['TopoAlgoDef'], -1)
+        algodefmodule.TopoAlgoDef.registerTopoAlgos(self)
+        log.info("Registered %i algos." % ( len(self.registeredAlgos) ) )
+
+        
+    def generateMenu(self):
+        """
+        Generates the menu structure from the list of algo names in the L1TopoFlags
+
+        Always to be called after defineMenu()
+        """
+        
+        from AthenaCommon.Logging import logging
+        log = logging.getLogger('L1Topo.generateMenu')
+
+        # add the algos to the menu
+        undefined_alg = False 
+        for topooutput in L1TopoFlags.algos():
+            topooutput.algo = self.getRegisteredAlgo(topooutput.algoname)
+            if topooutput.algo is None:
+                raise RuntimeError("L1Topo algo of name '%s' is not defined in L1Topo algo definition file TopoAlgoDef.py." % topooutput.algoname )
+
+            topooutput.sortingAlgos = self.findRegisteredSortingAlgoByOutput(topooutput.algo)
+
+            #print "For decision alg %s with inputs %r found the following sorting algs %r" % (topooutput.algo.name, topooutput.algo.inputs, [x.name for x in topooutput.sortingAlgos])
+
+            self.menu += topooutput
+
+        if not self.menu.check():
+            raise RuntimeError("Menu check failed")
+
+
+        
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/TriggerConfigLVL1.py b/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/TriggerConfigLVL1.py
new file mode 100644
index 0000000000000000000000000000000000000000..de27314421fd9201f181e508abb12c4c1029b3ee
--- /dev/null
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/TriggerConfigLVL1.py
@@ -0,0 +1,386 @@
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+import re
+
+from .TriggerConfigL1Topo import TriggerConfigL1Topo
+from l1.Lvl1Menu import Lvl1Menu
+from l1.Lvl1Flags import Lvl1Flags
+
+
+from AthenaCommon.Logging import logging
+log = logging.getLogger("TriggerConfigLVL1")
+
+class TriggerConfigLVL1:
+
+    current = None
+    def __init__(self, outputFile = None , inputFile = None , menuName = None , topoMenu = "MATCH" ):
+        """
+        menuName: if None taken from TF.triggerMenuSetup, otherwise assume externally defined menu
+        topoMenu: MATCH means that the L1Topo menu matches the L1 menu
+        """
+        TriggerConfigLVL1.current = self
+
+        from TriggerJobOpts.TriggerFlags import TriggerFlags
+
+        self.menuName = TriggerFlags.triggerMenuSetup() if menuName==None else menuName
+
+        self.inputFile     = inputFile
+        self.outputFile    = outputFile
+        self.topoMenu      = topoMenu
+        self.l1menuFromXML = None # flag if l1menu is read from XML file
+
+        # all registered items
+        self.registeredItems = {}
+        
+        # all registered thresholds
+        self.registeredThresholds = {}
+
+        # get L1Topo trigger line connections
+        if topoMenu=="MATCH": topoMenu = self.menuName # topo menu name should match CTP menu for correct connection
+        if topoMenu!=None:
+            self.topotriggers = self.getL1TopoTriggerLines(topoMenu)
+            self.registerAllTopoTriggersAsThresholds()
+
+
+        # menu
+        self.menu = Lvl1Menu(self.menuName)
+
+        if self.inputFile != None:
+            """Read menu from XML"""
+            self.l1menuFromXML = True
+            self.menu.readMenuFromXML(self.inputFile)
+        elif menuName==None:
+            """Build menu from menu name"""
+            # defines the menu (item and threshold names)
+            TriggerConfigLVL1.defineMenu(self.menuName)
+
+            # registers all items ever defined
+            self.registerMenu()
+
+
+    ## L1 Topo connection
+    def getL1TopoTriggerLines(self, menu):
+        if menu == None:
+            return None
+
+        if menu.endswith(".xml"):
+            raise RuntimeError("Can't read the topo trigger lines from xml yet")
+
+        else:
+            triggerLines = None
+            try:
+                tpcl1 = TriggerConfigL1Topo()
+                tpcl1.generateMenu()
+                triggerLines = tpcl1.menu.getTriggerLines()
+
+            except Exception, ex:
+                print "Topo menu generation inside L1 menu failed, but will be ignored for the time being",ex 
+
+            return triggerLines
+
+            
+    ## Thresholds
+    def registerThr(self, name, type, mapping=-1, active=1,
+                    seed='', seed_ttype='', seed_multi=0, bcdelay=0 ):
+        """
+        Add LVL1 thresholds with the given type and mapping and store
+        it in the list of available thresholds.
+
+        The cable input information will be calculated from type and
+        mapping.
+
+        Seed, seed_ttype, seed_multi and bcdelay are for the zero bias
+        trigger only.
+        """
+
+        if name in self.registeredThresholds:
+            log.error("LVL1 threshold of name '%s' already registered, will ignore this new registration request" % name)
+            return self.registeredThresholds[name]
+
+        from l1.Lvl1Thresholds import LVL1Threshold
+        thr = LVL1Threshold( name, type,
+                             mapping = mapping, active = active,
+                             seed_type = seed_ttype, seed = seed, seed_multi = seed_multi, bcdelay = bcdelay
+                             )
+
+        self.registeredThresholds[name] = thr
+        return thr
+
+
+    def registerAllTopoTriggersAsThresholds(self):
+        """
+        Add all L1Topo triggers as allowed input to the menu
+        """
+        if not self.topotriggers:
+            return
+        
+        from l1.Lvl1Thresholds import LVL1TopoInput
+        from collections import defaultdict
+
+        multibitTopoTriggers = defaultdict(list)
+        multibitPattern = re.compile("(?P<line>.*)\[(?P<bit>\d+)\]")
+        for triggerline in self.topotriggers:
+            m = multibitPattern.match(triggerline.trigger) # tries to match "trigger[bit]"
+            if m:
+                multibitTopoTriggers[m.groupdict()['line']] += [triggerline]  # multibit triggerlines are temporarilty stored in multibitTopoTriggers
+            else:
+                thr = LVL1TopoInput( triggerline )
+                thr.setCableInput()
+                self.registeredThresholds[thr.name] = thr
+
+        # create thresholds from topo-multibit 
+        for multibitTriggerlines in multibitTopoTriggers.values():
+            thr = LVL1TopoInput( multibitTriggerlines )
+            thr.setCableInput()
+            self.registeredThresholds[thr.name] = thr
+
+
+
+            
+    def getRegisteredThreshold(self, name):
+        if name in self.registeredThresholds:
+            return self.registeredThresholds[name]
+        return None
+    
+
+    ## Items
+    def registerItem(self, name, item):
+        """ Adds a LVL1 item to the set of items which are registered for further use"""
+        if name in self.registeredItems:
+            log.error('LVL1 item %s is already registered with ctpid=%d' % \
+                           (name, int(self.registeredItems[name].ctpid)))
+        else:
+            self.registeredItems[name] = item
+
+    def getRegisteredItem(self, name):
+        if name in self.registeredItems:
+            return self.registeredItems[name]
+        return None
+
+
+    def CTPInfo(self):
+        return self.menu.CTPInfo
+
+
+    def Lvl1CaloInfo(self):
+        return self.menu.CaloInfo
+
+
+    def writeXML(self):
+        """
+        Writes L1 XML file
+        returns the file name
+        """
+        if self.outputFile is None:
+            log.warning("Can't write xml file since no name was provided")
+            return
+
+        from l1.Lvl1MenuUtil import idgen
+        idgen.reset()
+
+        FH = open( self.outputFile, mode="wt" )
+        FH.write( self.menu.xml() )
+        FH.close()
+        from l1.Lvl1MenuUtil import oldStyle
+        log.info("Wrote %s in %s" % (self.outputFile, "run 1 style" if oldStyle() else "run 2 style"))
+        return self.outputFile
+
+
+
+    @staticmethod
+    def defineMenu(menuName = None ):
+        """
+        Defines the list if item and threshold names that will be in the menu
+
+        Calls defineMenu() of the correct module 'Menu_<menuname>.py'
+
+        Menu.defineMenu() defines the menu via Lvl1Flags
+        """
+
+        from TriggerJobOpts.TriggerFlags import TriggerFlags
+        if not menuName:
+            menuName = TriggerFlags.triggerMenuSetup()
+
+        menuName=TriggerConfigL1Topo.getMenuBaseName(menuName)
+        menumodule = __import__('l1menu.Menu_%s' % menuName, globals(), locals(), ['defineMenu'], -1)
+        menumodule.defineMenu()
+        log.info("menu %s contains %i items and %i thresholds" % ( menuName, len(Lvl1Flags.items()), len(Lvl1Flags.thresholds()) ) )
+
+
+
+    def registerMenu(self):
+        """
+        Registers the list if items and thresholds that could be used in the menu of Run1
+
+        Calls registerItem() of the correct module 'ItemDef.py' or 'ItemDefRun1.py'
+
+        Has to run AFTER defineMenu
+        """
+
+        run1 = Lvl1Flags.CTPVersion()<=3
+
+        itemdefmodule = __import__('l1menu.ItemDef%s' % ('Run1' if run1 else ''), globals(), locals(), ['ItemDef'], -1)
+
+        itemdefmodule.ItemDef.registerItems(self)
+        log.info("registered %i items and %i thresholds (%s)" % ( len(self.registeredItems), len(self.registeredThresholds), ('Run 1' if run1 else 'Run 2') ) )
+
+
+
+    def generateMenu(self):
+        """
+        Generates the menu structure from the list of item and threshold names in the Lvl1Flags
+
+        To be called after defineMenu()
+        """
+
+        if self.l1menuFromXML:
+            log.info("Menu was read from input file '%s', generateMenu() will not run" % self.inputFile)
+            return
+
+        # build list of items for the menu from the list of requested names
+        itemsForMenu = []
+
+        for itemName in Lvl1Flags.items():
+            registeredItem = self.getRegisteredItem(itemName)
+            if registeredItem == None:
+                log.fatal("LVL1 item '%s' has not been registered in l1menu/ItemDef.py" % itemName)
+                raise RuntimeError("LVL1 item %s has not been registered in l1menu/ItemDef.py" % itemName)
+
+            if itemName in Lvl1Flags.CtpIdMap():
+                newCTPID = Lvl1Flags.CtpIdMap()[itemName]
+                registeredItem.setCtpid(newCTPID)
+
+            itemsForMenu += [ registeredItem ]
+
+        # pre-assigned ctpIDs (as integer values)
+        assigned_ctpids = [item.ctpid for item in itemsForMenu]
+
+        # CTP IDs available for assignment
+        from l1.Limits import Limits
+        available_ctpids = sorted( list( set(range(Limits.MaxTrigItems)) - set(assigned_ctpids) ) )
+        available_ctpids.reverse()
+
+        # add the items to the menu
+        from TriggerMenu.l1.TriggerTypeDef import TT
+        for item in itemsForMenu:
+            # set the physics bit
+            if not item.name.startswith('L1_CALREQ'):
+                item.setTriggerType( item.trigger_type | TT.phys )
+            # assign ctp IDs to items that don't have one
+            if item.ctpid == -1:
+                item.setCtpid( available_ctpids.pop() )
+            # add the items into the menu
+            self.menu.addItem( item )
+
+        # printout
+        for item in self.menu.items:
+            if item.verbose:
+                log.info(str(item))
+
+        # add the thresholds to the menu
+        undefined_thr = False
+        list_of_undefined_thresholds = []
+        for index, thresholdName in enumerate(Lvl1Flags.thresholds()):
+                        
+            if thresholdName in self.menu.thresholds:
+                continue
+            threshold = self.getRegisteredThreshold(thresholdName)
+            if threshold is None and not thresholdName=="":
+                log.error('Threshold %s is listed in menu but not defined' % thresholdName )
+                undefined_thr = True
+                list_of_undefined_thresholds += [ thresholdName ]
+            else:
+                self.menu.addThreshold( threshold )
+        if undefined_thr:
+            raise RuntimeError("Found undefined threshold in menu %s, please add these thresholds to l1menu/ThresholdDef.py: %s" % (self.menu.menuName, ', '.join(list_of_undefined_thresholds)) )
+                
+        # threshold mapping
+        self.mapThresholds()
+
+        # ZB thresholds on the right connectors
+        self.assignZeroBiasConnectors()
+
+        # add the counters to the menu
+        self.menu.addCounters()
+
+        # update the prescales that are not 1
+        self.updateItemPrescales()
+
+        # other menu information
+        self.setCTPInfo()
+        self.setCaloInfo()
+
+        # final consistency check
+        self.menu.checkL1()
+
+
+
+    def mapThresholds(self):
+        """
+        Set the correct mapping of thresholds according to the
+        order it was given in Lvl1Flags.thresholds list. That list
+        is usually defined in the setupMenu function of each menu
+
+        NIM and CALREQ types are not remapped !!
+        """
+        existingMappings = {}
+        for thr in self.menu.thresholds():
+            if not thr.ttype in existingMappings:
+                existingMappings[thr.ttype] = set()
+            if thr.mapping<0: continue
+            existingMappings[thr.ttype].add(thr.mapping)
+                
+        nextFreeMapping = {}
+        for k in  existingMappings:
+            nextFreeMapping[k] = 0
+
+        for thr in self.menu.thresholds():
+            if thr.mapping < 0:
+                while nextFreeMapping[thr.ttype] in existingMappings[thr.ttype]:
+                    nextFreeMapping[thr.ttype] += 1
+                log.debug('Setting mapping of threshold %s as %i' % (thr, nextFreeMapping[thr.ttype]) )
+                thr.mapping = nextFreeMapping[thr.ttype]
+                nextFreeMapping[thr.ttype] += 1
+
+            thr.setCableInput()
+
+
+    def assignZeroBiasConnectors(self):
+        from collections import Counter
+        from copy import copy
+        c = Counter()
+        for thr in self.menu.thresholds:
+            if thr.ttype=="ZB":
+                if not thr.seed in self.menu.thresholds:
+                    raise RuntimeError("Zero bias threshold '%s' based on non-existing threshold '%s'" % (thr,thr.seed) )
+                seed = self.menu.thresholds.thresholdOfName(thr.seed) # the ZB seed
+                thr.cableinfo = copy(seed.cableinfo)
+                thr.cableinfo.bitnum      = 1
+                thr.cableinfo.range_begin = 30
+                thr.cableinfo.range_end   = 30
+                c += Counter( ((thr.cableinfo.slot,thr.cableinfo.connector),) ) 
+        
+        if len(c)>0 and sorted(c.values())[-1]>1:
+            for k,v in c.items():
+                if v>1:
+                    log.error("Slot %i, connector %i has more than one ZB threshold" % k)
+            raise RuntimeError("Multiple zero bias thresholds on single connector")
+            
+
+            
+    def updateItemPrescales(self):
+        for (it_name, ps) in Lvl1Flags.prescales().items():
+            item = self.menu.getItem(it_name)
+            if item:
+                item.prescale = ps
+            else:
+                log.warning('Cannot find item %s to set the prescale' % it_name )
+
+
+    def setCTPInfo(self):
+        self.menu.CTPInfo.bunchGroupSet.setDefaultBunchGroupDefinition()
+
+        
+    def setCaloInfo(self):
+        from l1menu.CaloDef import CaloDef
+        CaloDef.defineGlobalSettings(self)
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/scripts/generateL1TopoMenuMT.py b/Trigger/TriggerCommon/TriggerMenuMT/scripts/generateL1TopoMenuMT.py
new file mode 100755
index 0000000000000000000000000000000000000000..d160ac3352eba503c42da83a613eb402726f94ad
--- /dev/null
+++ b/Trigger/TriggerCommon/TriggerMenuMT/scripts/generateL1TopoMenuMT.py
@@ -0,0 +1,78 @@
+#!/bin/env python
+
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+from TriggerJobOpts.TriggerFlags import TriggerFlags as TF
+from TriggerMenu.TriggerConfigL1Topo import TriggerConfigL1Topo
+from TriggerMenu.l1topo.L1TopoFlags import L1TopoFlags
+
+def generateL1TopoMenu(menu):
+
+    from AthenaCommon.Logging import logging
+    log = logging.getLogger("TriggerConfigL1Topo")
+    log.setLevel(logging.INFO)
+
+
+    # what menu to build
+    TF.triggerMenuSetup = menu
+
+    # TPC for L1Topo
+    tpcl1 = TriggerConfigL1Topo( outputFile = TF.outputL1TopoConfigFile() )
+
+    # build the menu structure
+    tpcl1.generateMenu()
+
+    # write xml file
+    tpcl1.writeXML()
+
+def main():
+
+    if len(sys.argv)==1:
+        generateL1TopoMenu(menu="MC_pp_v7")
+        generateL1TopoMenu(menu="Physics_pp_v7")
+        generateL1TopoMenu(menu="LS2_v1" )
+        return 0
+
+    if sys.argv[1] in ["LS2_v1","Physics_pp_v7", "MC_pp_v7"]: # explicit names for TMXML nightly
+        generateL1TopoMenu(menu=sys.argv[1])
+        return 0
+
+    if sys.argv[1].lower().startswith("ph"): # for interactive production
+        generateL1TopoMenu(menu="Physics_pp_v7")
+        return 0
+
+    if sys.argv[1].lower().startswith("mc"):
+        generateL1TopoMenu(menu="MC_pp_v7")
+        return 0
+
+    if sys.argv[1].lower().startswith("hiph"):
+        generateL1TopoMenu(menu="Physics_HI_v3")
+        return 0
+
+    if sys.argv[1].lower().startswith("himc"):
+        generateL1TopoMenu(menu="MC_HI_v3")
+        return 0
+    
+    if sys.argv[1].lower().startswith("hipph"):
+        generateL1TopoMenu(menu="Physics_HI_v4")
+        return 0
+
+    if sys.argv[1].lower().startswith("hipmc"):
+        generateL1TopoMenu(menu="MC_HI_v4")
+        return 0    
+
+    if sys.argv[1].lower().startswith("ls"):
+        generateL1TopoMenu(menu="LS2_v1")
+        return 0
+
+    if sys.argv[1].lower().startswith("dc"):
+        generateL1TopoMenu(menu="DC14")
+        return 0
+
+    generateL1TopoMenu(menu=sys.argv[1])
+
+
+if __name__=="__main__":
+    import sys
+    sys.exit( main() )
+
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/scripts/generateLVL1MenuMT.py b/Trigger/TriggerCommon/TriggerMenuMT/scripts/generateLVL1MenuMT.py
new file mode 100755
index 0000000000000000000000000000000000000000..383ba34c7877119c067f82928d49884c67802c86
--- /dev/null
+++ b/Trigger/TriggerCommon/TriggerMenuMT/scripts/generateLVL1MenuMT.py
@@ -0,0 +1,233 @@
+#!/bin/env python
+
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+import sys,os
+
+from TriggerJobOpts.TriggerFlags import TriggerFlags as TF
+from TriggerMenu.TriggerConfigLVL1 import TriggerConfigLVL1
+from TriggerMenu.l1.Lvl1Flags import Lvl1Flags
+
+def generateL1Menu(menu, doFTK="False",useTopoMenu="MATCH"):    
+
+    from AthenaCommon.Logging import logging
+    log = logging.getLogger("TriggerConfigLVL1")
+    log.setLevel(logging.INFO)
+    logging.getLogger("TriggerMenu.l1.Lvl1Menu").setLevel(logging.INFO)
+
+    TF.doFTK=doFTK
+    log.info("doFTK: %s " % TF.doFTK)
+
+    # what menu to build
+    TF.triggerMenuSetup = menu
+
+    # TPC for L1
+    tpcl1 = TriggerConfigLVL1( outputFile = TF.outputLVL1configFile() )
+
+    # build the menu structure
+    tpcl1.generateMenu()
+
+    # write xml file
+    outfilename = tpcl1.writeXML()
+
+    # consistency checker
+    checkResult = os.system("get_files -xmls -symlink LVL1config.dtd > /dev/null")
+    checkResult = os.system("xmllint --noout --dtdvalid LVL1config.dtd %s" % outfilename)
+    if checkResult == 0:
+        log.info("XML file %s is conform with LVL1config.dtd" % outfilename)
+    else:
+        log.error("the XML does not follow the document type definition LVL1config.dtd")
+        
+    return tpcl1.menu
+
+
+def readL1MenuFromXML(menu="LVL1config_Physics_pp_v6.xml"):
+
+    from AthenaCommon.Logging import logging
+    log = logging.getLogger("TriggerConfigLVL1")
+    log.setLevel(logging.INFO)
+    
+    fullname = None
+
+    if '/' in menu:
+        fullname = menu
+    
+    import os
+    for path in os.environ['XMLPATH'].split(':'):
+        if not 'TriggerMenuXML' in os.listdir(path):
+            continue
+        if menu in os.listdir("%s/TriggerMenuXML/" % path):
+            fullname = "%s/TriggerMenuXML/%s" % (path,menu)
+        break # we only want to look into the first TriggerMenuXML package
+
+    if fullname:
+        tpcl1 = TriggerConfigLVL1( inputFile = fullname, outputFile = "test.xml" )
+        tpcl1.writeXML()
+        return tpcl1.menu
+    else:
+        print "Did not find file %s" % menu
+        return None
+
+
+
+def findUnneededRun2():
+    from TriggerJobOpts.TriggerFlags import TriggerFlags as TF
+    from TriggerMenu.l1.Lvl1Flags import Lvl1Flags
+    
+    menus = ['Physics_pp_v6']
+
+    for menu in menus:
+        TF.triggerMenuSetup = menu
+        tpcl1 = TriggerConfigLVL1()
+
+        print set(tpcl1.registeredItems.keys()) - set(Lvl1Flags.items())
+
+
+
+def findRequiredItemsFromXML():
+    from TriggerJobOpts.TriggerFlags import TriggerFlags as TF
+    from TriggerMenu.l1.Lvl1Flags import Lvl1Flags
+    
+    menus = ['Physics_pp_v7','MC_pp_v7','LS2_v1']
+
+    from TriggerMenu.l1.XMLReader import L1MenuXMLReader
+
+    allItems = set()
+    allThrs = set()
+
+    path='/afs/cern.ch/atlas/software/builds/AtlasP1HLT/18.1.0.2/InstallArea/XML/TriggerMenuXML'
+
+    for menu in menus:
+        xmlfile = "%s/LVL1config_%s.xml" % (path,menu)
+        r = L1MenuXMLReader(xmlfile)
+        allItems.update( [x['name'] for x in r.getL1Items()] )
+        allThrs.update( [x['name'] for x in r.getL1Thresholds()] )
+        print menu, len(allItems), len(allThrs)
+
+    from pickle import dump
+    f = open("L1Items.pickle","w")
+    dump([menus,allItems,allThrs],f)
+
+
+def findUnneededRun1(what="items"):
+    
+    from pickle import load
+    f = open("L1Items.pickle","r")
+    [menus,allItems,allThrs] = load(f)
+
+    # the TPC for L1
+    tpcl1 = TriggerConfigLVL1( outputFile = TF.outputLVL1configFile() )
+
+    if what=="items":
+        unneeded = sorted(list(set( tpcl1.registeredItems.keys() ) - allItems))
+    else:
+        unneeded = sorted(list(set( tpcl1.registeredThresholds.keys() ) - allThrs))
+
+    print "==> unneeded ",what,":",len(unneeded)
+
+    import re
+    p = re.compile('.*$')
+
+    print [x for x in unneeded if p.match(x)]
+
+def findFreeCTPIDs(menu):
+    from pickle import load
+    f = open("L1Items.pickle","r")
+    [menus,allItems,allThrs] = load(f)
+
+    TF.triggerMenuSetup = menu
+    tpcl1 = TriggerConfigLVL1( outputFile = TF.outputLVL1configFile() )
+
+    print set(Lvl1Flags.CtpIdMap().keys()) - allItems
+
+
+    
+def main():
+    printCabling = False
+    FTKFlag= False
+    for arg in sys.argv:
+        if arg.lower().startswith("cab"):
+            printCabling = True
+        if arg.lower().startswith("doftk"):
+            FTKFlag = True
+
+    if len(sys.argv)==1 or (len(sys.argv)==2 and FTKFlag):        
+        
+        #generateL1Menu(menu="Physics_pp_v7",doFTK=FTKFlag)
+        #generateL1Menu(menu="MC_pp_v7",doFTK=FTKFlag)
+        generateL1Menu(menu="LS2_v1" )
+        return 0
+
+    
+    if sys.argv[1].endswith(".xml"):
+        readL1MenuFromXML(sys.argv[1])
+        return 0
+    
+    if sys.argv[1].lower().startswith("phy6"):
+        menu = generateL1Menu(menu="Physics_pp_v6",doFTK=FTKFlag)
+        if printCabling:
+            menu.printCabling()
+        return 0
+
+    if sys.argv[1].lower().startswith("phy7"):
+        menu = generateL1Menu(menu="Physics_pp_v7",doFTK=FTKFlag)
+        if printCabling:
+            menu.printCabling()
+        return 0
+    
+    if sys.argv[1].lower().startswith("mc6"):
+        menu = generateL1Menu(menu="MC_pp_v6",doFTK=FTKFlag)
+        if printCabling:
+            menu.printCabling()
+        return 0
+
+    if sys.argv[1].lower().startswith("mc7"):
+        menu = generateL1Menu(menu="MC_pp_v7",doFTK=FTKFlag)
+        if printCabling:
+            menu.printCabling()
+        return 0
+
+
+    if sys.argv[1].lower().startswith("mc4"):
+        generateL1Menu(menu="MC_pp_v4",doFTK=FTKFlag)
+        return 0
+
+    if sys.argv[1].lower().startswith("mc"):
+        generateL1Menu(menu="MC_pp_v6",doFTK=FTKFlag)
+        return 0
+
+    if sys.argv[1].lower().startswith("mcp"):
+        generateL1Menu(menu="MC_pp_v6_no_prescale",doFTK=FTKFlag)
+        generateL1Menu(menu="MC_pp_v6_loose_mc_prescale",doFTK=FTKFlag)
+        generateL1Menu(menu="MC_pp_v6_tight_mc_prescale",doFTK=FTKFlag)
+        return 0
+
+    if sys.argv[1].lower().startswith("ls"):
+        menu = generateL1Menu(menu="LS1_v1")
+        menu.printCabling()
+        return 0
+
+    if sys.argv[1].lower().startswith("dc14"):
+        generateL1Menu(menu="DC14",doFTK=FTKFlag,useTopoMenu="Physics_pp_v6")
+        return 0
+
+    if sys.argv[1].lower().startswith("hiphy"):
+        generateL1Menu(menu="Physics_HI_v3",doFTK=FTKFlag)
+        return 0
+
+    if sys.argv[1].lower().startswith("himc"):
+        generateL1Menu(menu="MC_HI_v3",doFTK=FTKFlag)
+        return 0
+    
+    if sys.argv[1].lower().startswith("hipphy"):
+        generateL1Menu(menu="Physics_HI_v4",doFTK=FTKFlag)
+        return 0
+
+    if sys.argv[1].lower().startswith("hipmc"):
+        generateL1Menu(menu="MC_HI_v4",doFTK=FTKFlag)
+        return 0    
+
+if __name__=="__main__":
+    sys.exit( main() )
+        
+        
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/scripts/generateMenuMT.py b/Trigger/TriggerCommon/TriggerMenuMT/scripts/generateMenuMT.py
new file mode 100644
index 0000000000000000000000000000000000000000..f8f6a7dd08cb76985cdb25c368024bf20967c6c3
--- /dev/null
+++ b/Trigger/TriggerCommon/TriggerMenuMT/scripts/generateMenuMT.py
@@ -0,0 +1,20 @@
+#!/bin/env python
+
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+def generateMenu(menu):
+
+    from TriggerMenu import setUseNewTriggerMenu
+    setUseNewTriggerMenu()
+
+    from TriggerMenu.menu import GenerateMenu
+    from TriggerJobOpts.TriggerFlags import TriggerFlags
+
+    # what menu to build
+    TriggerFlags.triggerMenuSetup = menu
+
+    GenerateMenu.generateMenu()
+
+
+if __name__=="__main__":
+    generateMenu(menu="Physics_pp_v6")
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/scripts/testMenuMT.sh b/Trigger/TriggerCommon/TriggerMenuMT/scripts/testMenuMT.sh
new file mode 100755
index 0000000000000000000000000000000000000000..8a937e1b3b54b80fc462cd62af44d2fa461a1516
--- /dev/null
+++ b/Trigger/TriggerCommon/TriggerMenuMT/scripts/testMenuMT.sh
@@ -0,0 +1,2 @@
+#!/usr/bin/env sh
+athena.py -c "TriggerMenuSetup='MC_pp_v7'" TriggerMenuXML/runHLT_forXMLgeneration.py
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/share/generateMT.py b/Trigger/TriggerCommon/TriggerMenuMT/share/generateMT.py
new file mode 100755
index 0000000000000000000000000000000000000000..642777fb25ae7953f86d72e5822e39c5f1cb1f05
--- /dev/null
+++ b/Trigger/TriggerCommon/TriggerMenuMT/share/generateMT.py
@@ -0,0 +1,16 @@
+#!/bin/env python
+
+from AthenaCommon.AthenaCommonFlags import jobproperties 
+from AthenaCommon.GlobalFlags import jobproperties
+
+jobproperties.print_JobProperties('tree&value')
+
+
+from TriggerMenuMT.HLTMenuConfig.Menu.GenerateMenu import GenerateMenuMT
+
+g = GenerateMenuMT()
+g.generateMT()
+
+jobproperties.AthenaCommonFlags.EvtMax=0
+
+jobproperties.print_JobProperties('tree&value')
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/share/trigermenuMT_test.py b/Trigger/TriggerCommon/TriggerMenuMT/share/trigermenuMT_test.py
new file mode 100644
index 0000000000000000000000000000000000000000..3a6c756a3321759b38e447d554a08894a117d695
--- /dev/null
+++ b/Trigger/TriggerCommon/TriggerMenuMT/share/trigermenuMT_test.py
@@ -0,0 +1,55 @@
+#
+# Minimal example to build a trigger menu
+#
+from TriggerMenu.TriggerConfigLVL1 import TriggerConfigLVL1            
+from TriggerMenu.l1.Lvl1Flags import Lvl1Flags
+from TriggerMenu.l1.Lvl1MenuItems import LVL1MenuItem
+from TriggerMenu.l1.TriggerTypeDef import TT
+from TriggerMenu.l1.Lvl1Condition import ThrCondition, Lvl1InternalTrigger
+from TriggerMenu.l1.Logic import Logic
+
+# Define L1 menu thresholds and items
+Lvl1Flags.RemapThresholdsAsListed = True
+Lvl1Flags.thresholds = ['EM3','MU4']
+Lvl1Flags.items = ['L1_EM3','L1_MU4']
+
+l1menu = TriggerConfigLVL1( outputFile = 'l1menu.xml', 
+                            menuName = 'menutest',
+                            topoMenu = None )
+
+LVL1MenuItem.l1configForRegistration = l1menu
+
+# Register L1 menu
+bgrp = Logic(Lvl1InternalTrigger('BGRP0')) & Logic(Lvl1InternalTrigger('BGRP1'))
+
+EM3 = l1menu.registerThr('EM3','EM').addThrValue(3)
+LVL1MenuItem('L1_EM3'       ).setLogic( ThrCondition(EM3) & bgrp ).setTriggerType( TT.calo )
+
+MU4 = l1menu.registerThr('MU4','MUON').addThrValue(4)
+LVL1MenuItem('L1_MU4'       ).setLogic( ThrCondition(MU4) & bgrp ).setTriggerType( TT.muon )
+
+# Generate and write L1 menu
+l1menu.generateMenu()        
+l1menu.writeXML()
+
+
+from TriggerMenu.menu.TriggerPythonConfig import TriggerPythonConfig
+from TriggerMenu.menu.HLTObjects import HLTChain
+hltmenu = TriggerPythonConfig('hltmenu.xml')
+
+from TrigSteeringTest.TrigSteeringTestConf import PESA__dummyAlgo
+defalgo = PESA__dummyAlgo('Em3')
+hltmenu.addSequence("EM3" , defalgo, "em3" )
+
+chain = HLTChain( chain_name="HLT_e3", chain_counter="1", lower_chain_name="EM3", level = "HLT", prescale="1", pass_through="1")
+chain.addHLTSignature( "em3" ).addHLTSignature( "em3" )
+chain.addTriggerTypeBit('4')
+chain.addStreamTag('electrons', prescale='1', obeyLB="yes")
+chain.addStreamTag('IDCalibration', prescale='1', obeyLB="no", type="calibration")
+chain.addGroup("electrons")
+hltmenu.addHLTChain(chain)
+
+hltmenu.writeConfigFiles();
+
+import sys
+sys.exit(0)
diff --git a/Trigger/TriggerRelease/share/runHLT_standalone.py b/Trigger/TriggerRelease/share/runHLT_standalone.py
index 20a9781bd856fb12f00f9f943a1f63b4b7233d2f..cb88c05de2fcdba6cf57aeecceda98ba4095bd14 100755
--- a/Trigger/TriggerRelease/share/runHLT_standalone.py
+++ b/Trigger/TriggerRelease/share/runHLT_standalone.py
@@ -70,6 +70,9 @@ log = logging.getLogger('runHLT_standalone.py')
 
 #predefined menu setups accessible using 'test<NAME>[MC]=True' commandline
 menuMap={
+         #Run-3 preparation menu
+         'LS2V1':           ('LS2_v1',                  'TriggerMenuXML/LVL1config_LS2_v1.xml'),         
+
          #2017 menus:       menu name                   L1 xml file
          'PhysicsV7':       ('Physics_pp_v7',           'TriggerMenuXML/LVL1config_Physics_pp_v7.xml'),
          'MCV7':            ('MC_pp_v7',                'TriggerMenuXML/LVL1config_MC_pp_v7.xml'),