5 from TriggerMenuMT.HLT.Config.MenuComponents
import ChainStep
6 from AthenaCommon.Logging
import logging
7 from ..Jet.JetChainConfiguration
import JetChainConfiguration
8 from ..Photon.PrecisionPhotonTLAMenuSequenceConfig
import PhotonTLAMenuSequenceGenCfg
9 from ..Jet.JetTLASequenceConfig
import JetTLAMenuSequenceGenCfg
10 from ..Muon.MuonTLASequenceConfig
import MuonTLAMenuSequenceGenCfg
11 log = logging.getLogger(__name__)
16 Add one extra chain step for TLA Activities
20 log.debug(
"addTLAStep: processing chain: %s", chainDict[
'chainName'])
23 for cPart
in chainDict[
'chainParts']:
25 log.debug(
"addTLAStep: processing signature: %s", cPart[
'signature'] )
27 tlaSequencesList.append(functools.partial(getTLASignatureSequenceGenCfg, flags, chainDict=chainDict, chainPart=cPart))
29 log.debug(
"addTLAStep: About to add a step with: %d parallel sequences.", len(tlaSequencesList))
33 prevStep = chain.steps[-1]
34 stepName =
'TLAStep_{:s}'.
format(prevStep.name)
35 step = ChainStep(name = stepName,
36 SequenceGens = tlaSequencesList,
37 chainDicts = prevStep.stepDicts)
39 log.debug(
"addTLAStep: About to add step %s ", stepName)
40 chain.steps.append(step)
46 signature= chainPart[
'signature']
48 if signature ==
'Photon':
49 photonOutCollectionName =
"HLT_egamma_Photons"
52 elif signature ==
'Muon':
55 elif signature ==
'Jet' or signature ==
'Bjet':
58 jetChainConfig.prepareDataDependencies(flags)
59 jetInputCollectionName = jetChainConfig.jetName
60 log.debug(f
"TLA jet input collection = {jetInputCollectionName}")
68 if jetChainConfig.recoDict[
"trkopt"] ==
"notrk": attachBtag =
False
73 tlaSteps = [s
for s
in chainConfig.steps
if 'TLAStep' in s.name
and 'EmptyPEBAlign' not in s.name
and 'EmptyTLAAlign' not in s.name
and 'PEBInfoWriter' not in s.name]
74 if len(tlaSteps) == 0:
76 elif len(tlaSteps) > 1:
77 raise RuntimeError(
'Multiple TLA steps in one chain are not supported. ', len(tlaSteps),
' were found in chain ' + chainConfig.name)
83 all_tla_chain_configs = [ch
for ch
in chain_configs
if 'PhysicsTLA' in chain_dicts[ch.name][
'eventBuildType']]
85 def getTLAStepPosition(chainConfig):
87 log.debug(
'getTLAStepPosition found step %s and return %d',tlaStep,chainConfig.steps.index(tlaStep) + 1)
88 return chainConfig.steps.index(tlaStep) + 1
91 maxTLAStepPosition = 0
92 for chain
in all_tla_chain_configs:
93 tlaStepPosition = getTLAStepPosition(chain)
94 if tlaStepPosition > maxTLAStepPosition:
95 maxTLAStepPosition = tlaStepPosition
97 log.debug(
'maxTLAStepPosition=%d',maxTLAStepPosition)
100 for chain
in all_tla_chain_configs:
101 tlaStepPosition = getTLAStepPosition(chain)
102 log.debug(
'Aligning TLA step at step %d for chain %s ', tlaStepPosition, chain.name)
103 if tlaStepPosition < maxTLAStepPosition:
104 numStepsNeeded = maxTLAStepPosition - tlaStepPosition
105 log.debug(
'Aligning TLA step for chain %s by adding %d empty steps', chain.name, numStepsNeeded)
106 chain.insertEmptySteps(
'EmptyTLAAlign', numStepsNeeded, tlaStepPosition-1)
107 chain.numberAllSteps()