Skip to content
Snippets Groups Projects
Commit 36e90a6f authored by Mark Stockton's avatar Mark Stockton Committed by Tamara Vazquez Schroeder
Browse files

Add prescale to chain object

Update ApplyPrescale function to TMMT version of chain dictionary to overwrite default prescale for specific prescale sets
parent e4113401
No related branches found
No related tags found
No related merge requests found
......@@ -16,7 +16,7 @@ from TriggerMenuMT.HLTMenuConfig.Menu.DictFromChainName import dictFromChainName
from TriggerMenuMT.HLTMenuConfig.Menu.ChainDictTools import splitInterSignatureChainDict
from TriggerMenuMT.HLTMenuConfig.Menu.MenuPrescaleConfig import MenuPrescaleConfig
from TriggerMenuMT.HLTMenuConfig.Menu.ChainMerging import mergeChainDefs
from TriggerMenuMT.HLTMenuConfig.Menu.MenuUtil import applyHLTPrescale
from AthenaCommon.Logging import logging
log = logging.getLogger( __name__ )
......@@ -99,8 +99,6 @@ class GenerateMenuMT(object):
== Setup of menu in terms of prescales and overwrite function
"""
# go over the slices and put together big list of signatures requested
#(L1Prescales, HLTPrescales, streamConfig) = MenuPrescaleConfig(self.triggerPythonConfig)
# that does not seem to work
(self.L1Prescales, self.HLTPrescales) = MenuPrescaleConfig(TriggerConfigHLT)
global _func_to_modify_signatures
if _func_to_modify_signatures is not None:
......@@ -171,6 +169,9 @@ class GenerateMenuMT(object):
chainCounter += 1
chainDict['chainCounter'] = chainCounter
#set default chain prescale
chainDict['prescale'] = 1
log.debug("Next: getting chain configuration for chain %s ", chain.name)
chainConfig= self.__generateChainConfig(chainDict)
......@@ -366,6 +367,9 @@ class GenerateMenuMT(object):
makeHLTTree(newJO=False, triggerConfigHLT = TriggerConfigHLT)
# the return values used for debugging, might be removed later
# Having built the Menu add prescales for disabling items (e.g. MC production)
applyHLTPrescale(TriggerConfigHLT, self.HLTPrescales, self.signaturesOverwritten)
from TriggerMenuMT.HLTMenuConfig.Menu.HLTMenuJSON import generateJSON
generateJSON()
......
......@@ -268,14 +268,14 @@ def setupMenu():
Prescales = mc_menu.Prescales
ps_online_list=[
'mb_sptrk_L1RD0_FILLED',
'timeburner_L1All'
'HLT_mb_sptrk_L1RD0_FILLED',
'HLT_timeburner_L1All'
]
Prescales.L1Prescales_trigvalid_mc_prescale = dict([(ctpid,1) for ctpid in Prescales.L1Prescales]) # setting all L1 prescales to 1
#for HLT only need to store any chains that have a prescale different from 1
Prescales.HLTPrescales_trigvalid_mc_prescale = {}
chain_list=ps_online_list
Prescales.HLTPrescales_trigvalid_mc_prescale.update(zip(chain_list,len(chain_list)*[ [-1, 0,-1] ]))
disable_chain_list=ps_online_list
Prescales.HLTPrescales_trigvalid_mc_prescale.update(zip(disable_chain_list,len(disable_chain_list)*[ [-1, 0,-1] ]))
......@@ -2,8 +2,11 @@
from TriggerJobOpts.TriggerFlags import TriggerFlags
from AthenaCommon.Logging import logging
from six import iteritems
log = logging.getLogger(__name__)
def getStreamTagForRerunChains(triggerPythonConfig, HLTPrescale):
list=[]
for item, prescales in HLTPrescale.iteritems():
......@@ -30,29 +33,30 @@ def getStreamTagForRerunChains(triggerPythonConfig, HLTPrescale):
def applyHLTPrescale(triggerPythonConfig, HLTPrescale):
for item, prescales in HLTPrescale.iteritems():
def applyHLTPrescale(triggerPythonConfig, HLTPrescale, signaturesOverwritten):
for item, prescales in iteritems(HLTPrescale):
# prescales is a list of 3 integers [HLT_prescale, HLT_pass_through, rerun_prescale]
if item not in triggerPythonConfig.allChains.keys():
if triggerPythonConfig.signaturesOverwritten:
if item not in triggerPythonConfig.dicts().keys():
if 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)
hltchain = triggerPythonConfig.dicts()[item]
if n > 0:
hltchain['prescale'] = str(prescales[0])
log.info('Applied HLTPS to the item '+item+': PS'+ hltchain['prescale'])
#
#passthrough and rerun still in the HLTPrescale object but not needed currently
#
#if n > 1:
# hltchain['pass_through'] = str(prescales[1])
#if n > 2:
# 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)
......
......@@ -140,7 +140,7 @@ class Prescales(object):
L1Prescales = {}
# Signature name | [ HLTprescale, HLTpass-through, rerun]
# - Prescale values should be a positive integer (default=1)
# - Chains only need adding if have a Prescale value different from 1 (default)
# - 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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment