Skip to content
Snippets Groups Projects
Commit 2b1b6b6c authored by Stewart Martin-Haugh's avatar Stewart Martin-Haugh
Browse files

Merge branch 'interface-sig-menu-ala-newjo' into 'master'

Change to current menu generation that makes it more New JO compliant

See merge request atlas/athena!16227

Former-commit-id: 07ce9286
parents 91ca0271 d5d47b72
No related branches found
No related tags found
No related merge requests found
...@@ -107,6 +107,7 @@ atlas_install_scripts( scripts/generateMenuMT.py ) ...@@ -107,6 +107,7 @@ atlas_install_scripts( scripts/generateMenuMT.py )
atlas_install_scripts( scripts/generateL1MenuMT.sh ) atlas_install_scripts( scripts/generateL1MenuMT.sh )
atlas_install_scripts( scripts/generateLVL1MenuMT.py ) atlas_install_scripts( scripts/generateLVL1MenuMT.py )
atlas_install_scripts( scripts/generateL1TopoMenuMT.py ) atlas_install_scripts( scripts/generateL1TopoMenuMT.py )
atlas_install_scripts( scripts/test_HLTmenu.sh )
atlas_install_xmls( data/*.dtd data/*.xml ) atlas_install_xmls( data/*.dtd data/*.xml )
...@@ -120,6 +121,10 @@ atlas_add_test( generateMenuMT_newJO SCRIPT python -m TriggerMenuMT.HLTMenuConfi ...@@ -120,6 +121,10 @@ atlas_add_test( generateMenuMT_newJO SCRIPT python -m TriggerMenuMT.HLTMenuConfi
PROPERTIES TIMEOUT 500 PROPERTIES TIMEOUT 500
) )
atlas_add_test( generateMenuMT SCRIPT bash test_HLTmenu.sh
PROPERTIES TIMEOUT 1000
)
#file( MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/unitTestRun_generateMenu ) #file( MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/unitTestRun_generateMenu )
......
...@@ -5,10 +5,41 @@ logging.getLogger().info("Importing %s",__name__) ...@@ -5,10 +5,41 @@ logging.getLogger().info("Importing %s",__name__)
log = logging.getLogger("TriggerMenuMT.HLTMenuConfig.Egamma.ElectronDef") log = logging.getLogger("TriggerMenuMT.HLTMenuConfig.Egamma.ElectronDef")
from TrigUpgradeTest.electronMenuDefs import fastCaloSequence, electronSequence
from TriggerMenuMT.HLTMenuConfig.Menu.MenuComponents import Chain, ChainStep from TriggerMenuMT.HLTMenuConfig.Menu.MenuComponents import Chain, ChainStep, RecoFragmentsPool
from TriggerMenuMT.HLTMenuConfig.Menu.TriggerConfigHLT import TriggerConfigHLT from TriggerMenuMT.HLTMenuConfig.Menu.TriggerConfigHLT import TriggerConfigHLT
# fragments generating configuration will be functions in New JO, so let's make them functions already now
def fastCaloSequenceCfg( flags ):
from TrigUpgradeTest.electronMenuDefs import fastCaloSequence
return fastCaloSequence()
def electronSequenceCfg( flags ):
from TrigUpgradeTest.electronMenuDefs import electronSequence
return electronSequence()
def generateChain(flags, chainDict ): # in New JO we will add flags here
chainDict = type("chainDict", (object,), chainDict)
# translation from chainDict["chainName"] to chainDict.chainName (less typing),
# it is not exact as the things like the multiplicity are not converted to int, however they should be made int in the first place
#
# this is the cache, we hope we will be able to get rid of it in future
fastCalo = RecoFragmentsPool.retrieve( fastCaloSequenceCfg, None ) # the None will be used for flags in future
electronReco = RecoFragmentsPool.retrieve( electronSequenceCfg, None )
return Chain(name = chainDict.chainName,
Seed = chainDict.L1item,
ChainSteps = [
ChainStep('ElectronStep1', [fastCalo]),
ChainStep('ElectronStep2', [electronReco])
])
class Chain_electron: class Chain_electron:
def __init__(self, chainDict): def __init__(self, chainDict):
...@@ -37,7 +68,7 @@ class Chain_electron: ...@@ -37,7 +68,7 @@ class Chain_electron:
self.chainSteps = chainSteps self.chainSteps = chainSteps
myChain = Chain(name = 'HLT_'+self.chainName, myChain = Chain(name = self.chainName,
Seed = self.chainL1Item, Seed = self.chainL1Item,
ChainSteps = self.chainSteps) ChainSteps = self.chainSteps)
return myChain return myChain
......
# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration # Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
from TriggerMenuMT.HLTMenuConfig.Egamma.ElectronDef import Chain_electron as Chain_electron from TriggerMenuMT.HLTMenuConfig.Egamma.ElectronDef import generateChain as generateElectronChain
from TriggerMenuMT.HLTMenuConfig.Menu.MenuComponents import Chain from TriggerMenuMT.HLTMenuConfig.Menu.MenuComponents import Chain
from TriggerMenuMT.HLTMenuConfig.Menu.MenuUtils import splitChainDict from TriggerMenuMT.HLTMenuConfig.Menu.MenuUtils import splitChainDict
#from TriggerMenuMT.HLTMenuConfig.Egamma.ElectronDef import Chain_electron as Chain_electron
from AthenaCommon.Logging import logging from AthenaCommon.Logging import logging
log = logging.getLogger( 'TriggerMenuMT.HLTMenuConfig.Egamma.generateChainConfigs' ) log = logging.getLogger( 'TriggerMenuMT.HLTMenuConfig.Egamma.generateChainConfigs' )
...@@ -20,8 +22,10 @@ def generateChainConfigs( chainDict ): ...@@ -20,8 +22,10 @@ def generateChainConfigs( chainDict ):
for subChainDict in listOfChainDicts: for subChainDict in listOfChainDicts:
log.debug("IN ELECTRON GENERATION CODE") log.debug("IN ELECTRON GENERATION CODE")
Electron = Chain_electron(subChainDict).assembleChain()
log.debug('Electron object: type name of class: %s', Electron.__class__.__name__) Electron = generateElectronChain( None, subChainDict )
#Electron = Chain_electron(subChainDict).assembleChain()
listOfChainDefs += [Electron] listOfChainDefs += [Electron]
log.debug('length of chaindefs %s', len(listOfChainDefs) ) log.debug('length of chaindefs %s', len(listOfChainDefs) )
......
...@@ -51,7 +51,7 @@ class GenerateMenuMT: ...@@ -51,7 +51,7 @@ class GenerateMenuMT:
def setTriggerConfigHLT(self): def setTriggerConfigHLT(self):
# setting the hlt menu configuration # setting the hlt menu configuration
(HLTPrescales) = self.setupMenu() #(HLTPrescales) = self.setupMenu()
self.triggerConfigHLT = TriggerConfigHLT(TriggerFlags.outputHLTconfigFile()) self.triggerConfigHLT = TriggerConfigHLT(TriggerFlags.outputHLTconfigFile())
self.triggerConfigHLT.menuName = TriggerFlags.triggerMenuSetup() self.triggerConfigHLT.menuName = TriggerFlags.triggerMenuSetup()
log.debug("Working with menu: %s", self.triggerConfigHLT.menuName) log.debug("Working with menu: %s", self.triggerConfigHLT.menuName)
...@@ -63,10 +63,9 @@ class GenerateMenuMT: ...@@ -63,10 +63,9 @@ class GenerateMenuMT:
""" """
if self.doEgammaChains: if self.doEgammaChains:
try: try:
import TriggerMenuMT.HLTMenuConfig.Egamma.generateElectronChainDefs import TriggerMenuMT.HLTMenuConfig.Egamma.generateElectronChainDefs
except: except:
log.error('Problems when importing generateElectronChainDefs, disabling egamma chains.') log.exception('Problems when importing generateElectronChainDefs, disabling egamma chains.')
log.info(traceback.print_exc())
self.doEgammaChains = False self.doEgammaChains = False
listOfChainConfigs = [] listOfChainConfigs = []
...@@ -84,12 +83,14 @@ class GenerateMenuMT: ...@@ -84,12 +83,14 @@ class GenerateMenuMT:
if chainDict["signature"] == "Electron" and self.doEgammaChains: if chainDict["signature"] == "Electron" and self.doEgammaChains:
try: try:
log.debug("Try to get chain config") log.debug("Try to get chain config")
chainConfigs = TriggerMenuMT.HLTMenuConfig.Egamma.generateElectronChainDefs.generateChainConfigs(chainDict) chainConfigs = TriggerMenuMT.HLTMenuConfig.Egamma.generateElectronChainDefs.generateChainConfigs(chainDict)
except: except:
log.error('Problems creating ChainDef for chain %s ' % (chainDict['chainName'])) log.exception( 'Problems creating ChainDef for chain\n %s ' % (chainDict['chainName']) )
log.info(traceback.print_exc())
continue continue
else: else:
log.error('Chain %s ignored - either trigger signature is turned off or the corresponding chain dictionary cannot be read.' %(chainDict['chainName'])) log.error('Chain %s ignored - either trigger signature is turned off or the corresponding chain dictionary cannot be read.' %(chainDict['chainName']))
log.debug('Chain dictionary of failed chain is %s.', chainDict) log.debug('Chain dictionary of failed chain is %s.', chainDict)
...@@ -102,7 +103,8 @@ class GenerateMenuMT: ...@@ -102,7 +103,8 @@ class GenerateMenuMT:
if len(listOfChainConfigs) == 0: if len(listOfChainConfigs) == 0:
log.error('No Chain Configuration found ') log.error('No Chain Configuration found ')
return False return None
elif len(listOfChainConfigs)>1: elif len(listOfChainConfigs)>1:
if ("mergingStrategy" in chainDicts[0].keys()): if ("mergingStrategy" in chainDicts[0].keys()):
log.warning("Need to define merging strategy, returning only first chain part configuration") log.warning("Need to define merging strategy, returning only first chain part configuration")
...@@ -125,9 +127,16 @@ class GenerateMenuMT: ...@@ -125,9 +127,16 @@ class GenerateMenuMT:
log.debug('Creating one big list of of enabled signatures and chains') log.debug('Creating one big list of of enabled signatures and chains')
chains = [] chains = []
# we can already use new set of flags
from AthenaConfiguration.AllConfigFlags import ConfigFlags
from TriggerMenuMT.HLTMenuConfig.Menu.LS2_v1_newJO import setupMenu as setupMenuFlags
setupMenuFlags( ConfigFlags )
ConfigFlags.lock()
if (TriggerFlags.CombinedSlice.signatures() or TriggerFlags.EgammaSlice.signatures()) and self.doEgammaChains: #if (TriggerFlags.CombinedSlice.signatures() or TriggerFlags.EgammaSlice.signatures()) and self.doEgammaChains:
chains += TriggerFlags.EgammaSlice.signatures() if ConfigFlags.Trigger.menu.electron and self.doEgammaChains:
chains += ConfigFlags.Trigger.menu.electron
log.debug("egamma chains "+str(ConfigFlags.Trigger.menu.egamma))
else: else:
self.doEgammaChains = False self.doEgammaChains = False
...@@ -181,8 +190,10 @@ class GenerateMenuMT: ...@@ -181,8 +190,10 @@ class GenerateMenuMT:
def setupMenu(self): def setupMenu(self):
# go over the slices and put together big list of signatures requested # go over the slices and put together big list of signatures requested
#(L1Prescales, HLTPrescales, streamConfig) = lumi(self.triggerPythonConfig) #(L1Prescales, HLTPrescales, streamConfig) = lumi(self.triggerPythonConfig)
(self.L1Prescales, self.HLTPrescales) = lumi(self.triggerConfigHLT) # that does not seem to work
return (self.HLTPrescales) #(self.L1Prescales, self.HLTPrescales) = lumi(self.triggerConfigHLT)
#return (self.HLTPrescales)
pass
......
#!bin/sh #!bin/sh
athena -l DEBUG --threads=1 --skipEvents=10 --evtMax=20 --filesInput="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TrigP1Test/data17_13TeV.00327265.physics_EnhancedBias.merge.RAW._lb0100._SFO-1._0001.1" TriggerMenuMT/generateMenuMT.py athena -l DEBUG --threads=1 --skipEvents=10 --evtMax=20 --filesInput="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TrigP1Test/data17_13TeV.00327265.physics_EnhancedBias.merge.RAW._lb0100._SFO-1._0001.1" TriggerMenuMT/generateMT.py
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