diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/ChainDefInMenu.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/ChainDefInMenu.py new file mode 100644 index 0000000000000000000000000000000000000000..a269f70b14af2fa89ca3cb9021f3a9d6c694f757 --- /dev/null +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/ChainDefInMenu.py @@ -0,0 +1,21 @@ +# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + +import collections + +def namedtuple_with_defaults(typename, field_names, default_values=()): + T = collections.namedtuple(typename, field_names) + T.__new__.__defaults__ = (None,) * len(T._fields) + if isinstance(default_values, collections.Mapping): + prototype = T(**default_values) + else: + prototype = T(*default_values) + T.__new__.__defaults__ = tuple(prototype) + return T + + +# namedtuple class with some defaults set for those entries that do not require settings +ChainProp = namedtuple_with_defaults("ChainProp", + ['name', 'l1SeedItem', 'l1SeedThresholds', 'stream', 'groups', 'merging', 'topoStartFrom'], + {'stream':['Main'], 'l1SeedItem': '', 'l1SeedThresholds': [], 'merging':[], 'topoStartFrom': False}) + + diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/DictFromChainName.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/DictFromChainName.py index 1667e9f3786a4710538ddd99bf5fcaa54176cdc6..a74a7bdba7e124db2c209f772d58676da3ae129f 100755 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/DictFromChainName.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/DictFromChainName.py @@ -24,52 +24,58 @@ class DictFromChainName(object): # ---- Loop over all chains (keys) in dictionary ---- # ---- Then complete the dict with other info ---- - # --- chainName = chainInfo[0] - # --- L1items_chainparts = chainInfo[1] - # --- Stream = chainInfo[2] - # --- groups = chainInfo[3] - + # Default input format will be namedtuple: + # ChainProp: ['name', 'L1chainParts'=[], 'stream', 'groups', + # 'merging'=[], 'topoStartFrom'=False], + + # these if/elif/else statements are due to temporary development if type(chainInfo) == str: m_chainName = chainInfo m_L1item = '' - m_L1items_chainParts = [] + m_L1chainParts = [] m_stream = '' m_groups = [] elif type(chainInfo) == list: m_chainName = chainInfo[0] m_L1item = '' - m_L1items_chainParts = chainInfo[1] + m_L1chainParts = chainInfo[1] m_stream = chainInfo[2] m_groups = chainInfo[3] + + elif 'ChainProp' in str(type(chainInfo)): + m_chainName = chainInfo.name + m_L1item = '' + m_L1chainParts = chainInfo.l1SeedThresholds + m_stream = chainInfo.stream + m_groups = chainInfo.groups + else: logDict.error("Format of chainInfo passed to genChainDict not known") m_L1item = self.getOverallL1item(m_chainName) logDict.debug("Analysing chain with name: %s", m_chainName) - chainProp = self.analyseShortName(m_chainName, m_L1items_chainParts, m_L1item) - logDict.debug('ChainProperties: %s', chainProp) + chainDict = self.analyseShortName(m_chainName, m_L1chainParts, m_L1item) + logDict.debug('ChainProperties: %s', chainDict) - chainProp['stream'] = m_stream - chainProp['groups'] = m_groups + chainDict['stream'] = m_stream + chainDict['groups'] = m_groups logDict.debug('Setting chain multiplicities') - allChainMultiplicities = self.getChainMultFromDict(chainProp) - - chainProp['chainMultiplicities'] = allChainMultiplicities + allChainMultiplicities = self.getChainMultFromDict(chainDict) + chainDict['chainMultiplicities'] = allChainMultiplicities # setting the L1 item - if (chainProp['L1item']== ''): - chainProp['L1item'] = m_L1item + if (chainDict['L1item']== ''): + chainDict['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)) - + logDict.debug('FINAL dictionary: %s', pp.pformat(chainDict)) - return chainProp + return chainDict def checkL1inName(self, m_chainName): @@ -82,7 +88,7 @@ class DictFromChainName(object): mainL1 = '' if not self.checkL1inName(chainName): - logDict.warning("Chain name not complying with naming convention: L1 item missing! PLEASE FIX THIS!!") + logDict.warning("Chain name %s not complying with naming convention: L1 item missing! PLEASE FIX THIS!!", chainName) return mainL1 # this assumes that the last string of a chain name is the overall L1 item cNameParts = chainName.split("_") diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/LS2_v1.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/LS2_v1.py index d4871354f33cc6908f7240224a2a10dbd1db8e47..46f2df087bf1c31386fa80b1609156ae87d1057b 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/LS2_v1.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/LS2_v1.py @@ -1,65 +1,54 @@ -# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration #------------------------------------------------------------------------# +# LS2_v1.py menu for the long shutdown development #------------------------------------------------------------------------# + +# This defines the input format of the chain and it's properties with the defaults set +# always required are: name, stream and groups +#['name', 'L1chainParts'=[], 'stream', 'groups', 'merging'=[], 'topoStartFrom'=False], +from TriggerMenuMT.HLTMenuConfig.Menu.ChainDefInMenu import ChainProp + 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', [L1 thresholds for chainParts], [stream], [groups]], 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 - #--------------------------------------------------------------------- + SingleMuonGroup = ['RATE:SingleMuon', 'BW:Muon'] + SingleElectronGroup = ['RATE:SingleElectron', 'BW:Electron'] + SingleMETGroup = ['RATE:MET', 'BW:MET'] TriggerFlags.Slices_all_setOff() TriggerFlags.TestSlice.signatures = [] TriggerFlags.MuonSlice.signatures = [ - ['HLT_mu6fast_L1MU6', [], [PhysicsStream], ['RATE:SingleMuon', 'BW:Muon']], - ['HLT_mu6Comb_L1MU6', [], [PhysicsStream], ['RATE:SingleMuon', 'BW:Muon']], - ['HLT_mu6_L1MU6', [], [PhysicsStream], ['RATE:SingleMuon', 'BW:Muon']], - - ['HLT_mu20_ivar_L1MU6', [], [PhysicsStream], ['RATE:SingleMuon', 'BW:Muon']], - ['HLT_2mu6Comb_L1MU6', [], [PhysicsStream], ['RATE:SingleMuon', 'BW:Muon']], - ['HLT_2mu6_L1MU6', [], [PhysicsStream], ['RATE:SingleMuon', 'BW:Muon']], - - ['HLT_mu6noL1_L1MU6', [], [PhysicsStream], ['RATE:SingleMuon', 'BW:Muon']], - + ChainProp(name='HLT_mu6fast_L1MU6', groups=SingleMuonGroup), + ChainProp(name='HLT_mu6Comb_L1MU6', groups=SingleMuonGroup), + ChainProp(name='HLT_mu6_L1MU6', groups=SingleMuonGroup), + + ChainProp(name='HLT_mu20_ivar_L1MU6', groups=SingleMuonGroup), + ChainProp(name='HLT_2mu6Comb_L1MU6', groups=SingleMuonGroup), + ChainProp(name='HLT_2mu6_L1MU6', groups=SingleMuonGroup), + ChainProp(name='HLT_mu6noL1_L1MU6', groups=SingleMuonGroup), ] + TriggerFlags.EgammaSlice.signatures = [ - ['HLT_e3_etcut1step_L1EM3', [] , [PhysicsStream], ['RATE:SingleElectron', 'BW:Electron']], - ['HLT_e3_etcut_L1EM3', [], [PhysicsStream], ['RATE:SingleElectron', 'BW:Electron']], - ['HLT_e5_etcut_L1EM3', [], [PhysicsStream], ['RATE:SingleElectron', 'BW:Electron']], - ['HLT_e7_etcut_L1EM3', [], [PhysicsStream], ['RATE:SingleElectron', 'BW:Electron']], - ] + ChainProp(name='HLT_e3_etcut1step_L1EM3', groups=SingleElectronGroup), + ChainProp(name='HLT_e3_etcut_L1EM3', groups=SingleElectronGroup), + ChainProp(name='HLT_e5_etcut_L1EM3', groups=SingleElectronGroup), + ChainProp(name='HLT_e7_etcut_L1EM3', stream=[PhysicsStream, 'express'], groups=SingleElectronGroup), + ] TriggerFlags.METSlice.signatures = [ - ['HLT_xe65_cell_L1XE50', [], [PhysicsStream], ['RATE:MET', 'BW:MET']], - ['HLT_xe30_cell_L1XE10', [], [PhysicsStream], ['RATE:MET', 'BW:MET']], + ChainProp(name='HLT_xe30_cell_L1XE10', groups=SingleMETGroup), + ChainProp(name='HLT_xe65_cell_L1XE50', groups=SingleMETGroup), ] - TriggerFlags.CombinedSlice.signatures = [ - - #['e8_mu8_L1EM6_MU6', [], [PhysicsStream], ['RATE:SingleMuon', 'BW:Muon']], - ] - TriggerFlags.JetSlice.signatures = [ ] + TriggerFlags.CombinedSlice.signatures = [] + TriggerFlags.JetSlice.signatures = [] TriggerFlags.BjetSlice.signatures = [] TriggerFlags.TauSlice.signatures = [] TriggerFlags.BphysicsSlice.signatures = [ ]