ATLAS Offline Software
Loading...
Searching...
No Matches
GenerateElectronChainDefs.py
Go to the documentation of this file.
1# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
2
3from TriggerMenuMT.HLT.Config.Utility.ChainDictTools import splitChainDict
4from ..Electron.ElectronChainConfiguration import ElectronChainConfiguration
5from TriggerMenuMT.HLT.Config.Utility.ChainMerging import mergeChainDefs
6from AthenaConfiguration.AthConfigFlags import AthConfigFlags
7
8import pprint
9from AthenaCommon.Logging import logging
10log = logging.getLogger(__name__)
11log.debug("Importing %s",__name__)
12
13
14
15def generateChainConfigs(flags, chainDict, perSig_lengthOfChainConfigs):
16
17 if log.isEnabledFor(logging.DEBUG): # pprint.pformat is expensive
18 log.debug('dictionary is: %s\n', pprint.pformat(chainDict))
19
20 listOfChainDicts = splitChainDict(chainDict)
21 listOfChainDefs = []
22
23 for subChainDict in listOfChainDicts:
24 log.debug('Assembling subChainsDict %s for chain %s', len(listOfChainDefs), subChainDict['chainName'] )
25 Electron = ElectronChainConfiguration(subChainDict).assembleChain(flags)
26
27 listOfChainDefs += [Electron]
28
29
30 if len(listOfChainDefs)>1:
31 theChainDef, perSig_lengthOfChainConfigs = mergeChainDefs(listOfChainDefs, chainDict, perSig_lengthOfChainConfigs)
32 else:
33 theChainDef = listOfChainDefs[0]
34
35
36 return theChainDef, perSig_lengthOfChainConfigs
37
38def prepareDefaultSignatureFlags(inflags : AthConfigFlags) -> AthConfigFlags:
39 """
40 invoked before generateChainConfigs method to prevent repeated cloning of flags within chain generation
41 """
42 from TrigInDetConfig.utils import cloneFlagsToActiveConfig
43 flags = cloneFlagsToActiveConfig(inflags, "electron", log)
44 return flags
45
46
47
48
49
50
51
AthConfigFlags prepareDefaultSignatureFlags(AthConfigFlags inflags)
generateChainConfigs(flags, chainDict, perSig_lengthOfChainConfigs)