5 from collections
import defaultdict
6 from AthenaConfiguration.ComponentAccumulator
import ComponentAccumulator
7 from AthenaConfiguration.ComponentFactory
import CompFactory
8 from AthenaConfiguration.Enums
import Format, MetadataCategory
9 from AthenaCommon.CFElements
import seqAND, seqOR, parOR, flatAlgorithmSequences, getSequenceChildren, isSequence
10 from TriggerMenuMT.HLT.Config.ControlFlow.MenuComponentsNaming
import CFNaming
11 from AthenaCommon.Logging
import logging
13 __log = logging.getLogger(
'TriggerConfig')
17 return hasattr( alg,
"MultiplicitiesMap" )
20 """extract step number frmo strings like Step2... -> 2"""
21 return int(stepName.split(
'_')[0].
replace(
"Step",
""))
26 Method iterating over the CF and picking all the Hypothesis algorithms
28 Returned is a map with the step name and list of all instances of hypos in that step.
29 Input is top HLT sequencer.
31 __log.info(
"Collecting hypos from steps")
32 hypos = defaultdict( list )
34 for stepSeq
in steps.Members:
38 if CFNaming.FILTER_POSTFIX
in stepSeq.getName():
39 __log.debug(
"Skipping filtering steps %s", stepSeq.getName() )
42 __log.debug(
"collecting hypos from step %s", stepSeq.getName() )
44 for alg
in sorted(algs, key=
lambda t:
str(t.getName())):
48 if hasattr(alg,
'HypoInputDecisions'):
49 __log.debug(
"found hypo %s in %s", alg.getName(), stepSeq.getName())
50 if __isCombo( alg )
and len(alg.ComboHypoTools):
51 __log.debug(
" with %d comboHypoTools: %s", len(alg.ComboHypoTools),
' '.
join(map(str, [tool.getName()
for tool
in alg.ComboHypoTools])))
52 hypos[stepSeq.getName()].
append( alg )
54 __log.verbose(
"Not a hypo %s", alg.getName())
59 """ return all chains served by this hypo and the keys of produced decision object """
60 from TrigCompositeUtils.TrigCompositeUtils
import isLegId
61 __log.debug(
"Hypo type %s is combo %r", hypo.getName(),
__isCombo(hypo))
63 return [key
for key
in list(hypo.MultiplicitiesMap.keys())
if not isLegId(key)], hypo.HypoOutputDecisions
65 return [ t.getName()
for t
in hypo.HypoTools
if not isLegId(t.getName())], [
str(hypo.HypoOutputDecisions)]
69 """ collect all EventViewCreatorAlgorithm algorithms in the configuration """
76 for seq,algs
in algsInSeq.items():
78 if "Views" in alg._properties:
80 __log.debug(
"Found ViewMakers: %s",
' '.
join([ maker.getName()
for maker
in makers ]))
87 Similarly to collectHypos but works for filter algorithms
89 The logic is simpler as all filters are grouped in step filter sequences
90 Returns map: step name -> list of all filters of that step
92 __log.info(
"Collecting filters")
93 filters = defaultdict( list )
95 for stepSeq
in steps.Members:
96 if CFNaming.FILTER_POSTFIX
in stepSeq.getName():
97 filters[stepSeq.getName()] = stepSeq.Members
98 __log.debug(
"Found Filters in Step %s : %s", stepSeq.getName(), stepSeq.Members)
104 decisionObjects =
set()
105 decisionObjects.update([
str(d.Decisions)
for d
in hltSeeding.RoIBRoIUnpackers + hltSeeding.xAODRoIUnpackers ])
106 decisionObjects.update([
str(d.DecisionsProbe)
for d
in hltSeeding.RoIBRoIUnpackers + hltSeeding.xAODRoIUnpackers ])
107 from HLTSeeding.HLTSeedingConfig
import mapThresholdToL1DecisionCollection
109 decisionObjects.discard(
'')
110 decisionObjects.discard(
'StoreGateSvc+')
111 __log.info(
"Collecting %i decision objects from HLTSeeding instance", len(decisionObjects))
112 return decisionObjects
115 decisionObjects =
set()
116 for step, stepHypos
in sorted(hypos.items()):
117 for hypoAlg
in stepHypos:
118 __log.debug(
"Hypo %s with input %s and output %s ",
119 hypoAlg.getName(), hypoAlg.HypoInputDecisions, hypoAlg.HypoOutputDecisions )
120 if isinstance( hypoAlg.HypoInputDecisions, GaudiConfig2.semantics._ListHelper):
122 [ decisionObjects.add(
str(d) )
for d
in hypoAlg.HypoInputDecisions ]
124 [ decisionObjects.add(
str(d) )
for d
in hypoAlg.HypoOutputDecisions ]
127 decisionObjects.add(
str(hypoAlg.HypoInputDecisions) )
129 decisionObjects.add(
str(hypoAlg.HypoOutputDecisions) )
130 __log.info(
"Collecting %i decision objects from hypos", len(decisionObjects))
131 return sorted(decisionObjects)
134 decisionObjects =
set()
135 for step, stepFilters
in filters.items():
136 for filt
in stepFilters:
137 if inputs
and hasattr( filt,
"Input" ):
138 decisionObjects.update(
str(i)
for i
in filt.Input )
139 if outputs
and hasattr( filt,
"Output" ):
140 decisionObjects.update(
str(o)
for o
in filt.Output )
141 __log.info(
"Collecting %i decision objects from filters", len(decisionObjects))
142 return decisionObjects
145 decisionObjects =
set()
146 decisionObjects.add(
str(hltSummary.DecisionsSummaryKey) )
147 __log.info(
"Collecting %i decision objects from hltSummary", len(decisionObjects))
148 return decisionObjects
152 Returns the set of all decision objects of HLT
161 decisionObjects =
set()
162 decisionObjects.update(decObjL1)
163 decisionObjects.update(decObjHypo)
164 decisionObjects.update(decObjFilter)
165 decisionObjects.update(decObjSummary)
166 __log.info(
"Number of decision objects found in HLT CF %d of which %d are the outputs of hypos",
167 len(decisionObjects), len(decObjHypo) )
168 __log.debug( decisionObjects )
169 return list(
sorted(decisionObjects)), decObjHypo
173 Configures an algorithm(s) that should be run after the selection process
174 Returns: ca, algorithm
177 from TrigOutputHandling.TrigOutputHandlingConfig
import DecisionSummaryMakerAlgCfg
179 chainToLastCollection = {}
183 for stepName, stepHypos
in sorted( hypos.items(), key=
lambda x :
__stepNumber(x[0]) ):
190 orderedStepHypos =
sorted(stepHypos, key=
lambda hypo:
not __isCombo(hypo))
192 chainToCollectionInStep = {}
193 for hypo
in orderedStepHypos:
195 for chain
in hypoChains:
196 if chain
not in chainToCollectionInStep:
197 chainToCollectionInStep[chain] = hypoOutputKeys
198 chainToLastCollection.update( chainToCollectionInStep )
200 from TriggerMenuMT.HLT.Config.Utility.HLTMenuConfig
import HLTMenuConfig
201 from HLTSeeding.HLTSeedingConfig
import mapThresholdToL1DecisionCollection
202 if len(HLTMenuConfig.dicts()) == 0:
203 __log.warning(
"No HLT menu, chains w/o algorithms are not handled")
205 for chainName, chainDict
in HLTMenuConfig.dicts().
items():
206 if chainName
not in chainToLastCollection:
207 __log.debug(
"The chain %s is not mentioned in any step", chainName)
209 assert len(chainDict[
'chainParts']) == 1,
"Chains w/o the steps can not have multiple parts in chainDict, it makes no sense: %s"%chainName
212 for c, cont
in chainToLastCollection.items():
213 __log.debug(
"Final decision of chain %s will be read from %d %s", c, len(cont),
str(cont))
215 collectionsWithFinalDecisions = []
216 for chain, collections
in chainToLastCollection.items():
217 for c
in collections:
218 if c
not in collectionsWithFinalDecisions:
219 collectionsWithFinalDecisions.append(c)
220 __log.debug(
"Final keys %s", collectionsWithFinalDecisions)
221 decisionSummaryAlg.FinalDecisionKeys = collectionsWithFinalDecisions
222 decisionSummaryAlg.FinalStepDecisions = dict(chainToLastCollection)
223 decisionSummaryAlg.DecisionsSummaryKey =
"HLTNav_Summary"
224 decisionSummaryAlg.SetFilterStatus = flags.Trigger.writeBS
225 return acc, decisionSummaryAlg
230 Configures components needed for monitoring chains
233 TrigSignatureMoni, DecisionCollectorTool=CompFactory.getComps(
"TrigSignatureMoni",
"DecisionCollectorTool",)
235 mon.L1Decisions =
"HLTSeedingSummary"
236 mon.FinalDecisionKey =
"HLTNav_Summary"
238 __log.warning(
"Menu is not configured")
245 assert __stepNumber(stepName) == stepCounter,
"There are steps that have no hypos, decisions counting is not going to work"
247 stepDecisionKeys = []
248 stepFeatureDecisionKeys = []
249 for hypo
in stepHypos:
252 stepDecisionKeys.extend( hypoOutputKeys )
254 stepFeatureDecisionKeys.extend( hypoOutputKeys )
256 dcEventTool =
DecisionCollectorTool(
"EventDecisionCollector" + stepName, Decisions=
list(dict.fromkeys(stepDecisionKeys)))
257 dcFeatureTool =
DecisionCollectorTool(
"FeatureDecisionCollector" + stepName, Decisions=
list(dict.fromkeys(stepFeatureDecisionKeys)))
258 __log.debug(
"The step monitoring decisions in %s %s", dcEventTool.getName(), dcEventTool.Decisions)
259 __log.debug(
"The step monitoring decisions in %s %s", dcFeatureTool.getName(), dcFeatureTool.Decisions)
260 mon.DecisionCollectorTools += [ dcEventTool ]
261 mon.FeatureCollectorTools += [ dcFeatureTool ]
264 if flags.Trigger.Online.isPartition:
265 from TrigServices.TrigServicesConfig
import TrigServicesCfg
267 hltEventLoopMgr = onlineServicesAcc.getPrimary()
269 hltEventLoopMgr.TrigErrorMonTool.AlgToChainTool = CompFactory.TrigCompositeUtils.AlgToChainTool()
270 hltEventLoopMgr.TrigErrorMonTool.MonTool.defineHistogram(
271 'ErrorChainName,ErrorCode', path=
'EXPERT', type=
'TH2I',
272 title=
'Error StatusCodes per chain;Chain name;StatusCode',
273 xbins=1, xmin=0, xmax=1, ybins=1, ymin=0, ymax=1)
275 acc.merge(onlineServicesAcc)
277 mon.L1Decisions = hltSeeding.HLTSeedingSummaryKey
279 if flags.Trigger.doValidationMonitoring:
280 from DecisionHandling.DecisionHandlingConfig
import setupFilterMonitoring
281 for algs
in filters.values():
294 onlineWriteBS =
False
295 offlineWriteBS =
False
298 if flags.Trigger.writeBS:
299 if flags.Trigger.Online.isPartition:
302 offlineWriteBS =
True
303 if flags.Output.doWriteRDO
or flags.Output.doWriteESD
or flags.Output.doWriteAOD:
307 if offlineWriteBS
and not flags.Output.doWriteBS:
308 __log.error(
'flags.Trigger.writeBS is True but flags.Output.doWriteBS is False')
310 if writePOOL
and onlineWriteBS:
311 __log.error(
"POOL HLT output writing is configured online")
313 if writePOOL
and offlineWriteBS:
314 __log.error(
"Writing HLT output to both BS and POOL in one job is not supported at the moment")
320 edmSet = flags.Trigger.AODEDMSet
if flags.Output.doWriteAOD
else flags.Trigger.ESDEDMSet
321 elif onlineWriteBS
or offlineWriteBS:
326 __log.info(
"Configuring online ByteStream HLT output")
329 __log.info(
"Configuring offline ByteStream HLT output")
332 __log.info(
"Configuring POOL HLT output")
335 __log.info(
"No HLT output writing is configured")
343 Returns CA with algorithms and/or tools required to do the serialisation
345 decObj - list of all navigation objects
346 decObjHypoOut - list of decisions produced by hypos
347 hypos - the {stepName: hypoList} dictionary with all hypo algorithms - used to find the PEB decision keys
348 offline - if true CA contains algorithms that need to be merged to output stream sequence,
349 if false the CA contains a tool that needs to be added to HltEventLoopMgr
351 from TrigEDMConfig
import DataScoutingInfo
352 from TrigEDMConfig.TriggerEDM
import getRun3BSList
353 from TrigEDMConfig.TriggerEDMDefs
import allowTruncation
354 from TrigOutputHandling.TrigOutputHandlingConfig
import TriggerEDMSerialiserToolCfg, StreamTagMakerToolCfg, TriggerBitsMakerToolCfg
357 collectionsToBS =
getRun3BSList(flags, [
"BS"] + DataScoutingInfo.getAllDataScoutingIdentifiers())
362 for typekey, bsfragments, props
in collectionsToBS:
364 moduleIDs =
sorted(DataScoutingInfo.getFullHLTResultID()
if f ==
'BS' else
365 DataScoutingInfo.getDataScoutingResultID(f)
366 for f
in bsfragments)
368 __log.debug(
'adding to serialiser list: %s, modules: %s', typekey, moduleIDs)
369 serialiser.addCollection(typekey, moduleIDs, allowTruncation = allowTruncation
in props)
377 for hypoList
in hypos.values():
378 for hypo
in hypoList:
379 if hypo.getFullJobOptName().startswith(
'PEBInfoWriterAlg/'):
380 PEBKeys.append(
str(hypo.HypoOutputDecisions))
383 __log.debug(
'Setting StreamTagMakerTool.PEBDecisionKeys = %s', PEBKeys)
384 stmaker.PEBDecisionKeys = PEBKeys
390 from TrigOutputHandling.TrigOutputHandlingConfig
import HLTResultMTMakerCfg
391 HLTResultMTMakerAlg=CompFactory.HLTResultMTMakerAlg
393 hltResultMakerTool.StreamTagMaker = stmaker
394 hltResultMakerTool.MakerTools = [bitsmaker, serialiser]
396 hltResultMakerAlg.ResultMaker = hltResultMakerTool
399 if flags.Input.Format
is Format.BS:
400 from TriggerJobOpts.TriggerByteStreamConfig
import ByteStreamReadCfg
402 readBSAcc.getEventAlgo(
'SGInputLoader').Load.add(
403 (
'ByteStreamMetadataContainer',
'InputMetaDataStore+ByteStreamMetadata'))
407 hltResultMakerAlg.ResultMaker.ExtraROBs = []
408 hltResultMakerAlg.ResultMaker.ExtraSubDets = []
411 decmaker = CompFactory.getComp(
"TrigDec::TrigDecisionMakerMT")(
"TrigDecMakerMT")
415 from TrigConfigSvc.TrigConfigSvcCfg
import L1PrescaleCondAlgCfg
419 from TriggerJobOpts.TriggerByteStreamConfig
import ByteStreamWriteCfg
420 writingOutputs = [
"HLT::HLTResultMT#HLTResultMT"]
421 writingInputs = [(
"HLT::HLTResultMT",
"HLTResultMT"),
422 (
"xAOD::TrigDecision",
"xTrigDecision")]
425 if flags.Trigger.doLVL1:
426 if flags.Trigger.enableL1MuonPhase1
or flags.Trigger.enableL1CaloPhase1:
427 writingOutputs += [
'xAOD::TrigCompositeContainer#L1TriggerResult']
428 writingInputs += [(
'xAOD::TrigCompositeContainer',
'StoreGateSvc+L1TriggerResult')]
429 if flags.Trigger.enableL1CaloLegacy
or not flags.Trigger.enableL1MuonPhase1:
430 writingOutputs += [
'ROIB::RoIBResult#RoIBResult']
431 writingInputs += [(
'ROIB::RoIBResult',
'StoreGateSvc+RoIBResult')]
432 if flags.Trigger.CTP.UseEDMxAOD:
433 writingOutputs += [
'xAOD::CTPResult#CTPResult']
434 writingInputs += [(
'xAOD::CTPResult',
'StoreGateSvc+CTPResult')]
436 from TrigT1ResultByteStream.TrigT1ResultByteStreamConfig
import L1TriggerByteStreamEncoderCfg
439 writingAcc =
ByteStreamWriteCfg(flags, type_names=writingOutputs, extra_inputs=writingInputs)
440 writingAcc.addEventAlgo(hltResultMakerAlg)
441 writingAcc.addEventAlgo(decmaker)
442 acc.merge(writingAcc)
445 from TrigServices.TrigServicesConfig
import TrigServicesCfg
447 hltEventLoopMgr = onlineServicesAcc.getPrimary()
448 hltEventLoopMgr.ResultMaker.StreamTagMaker = stmaker
449 hltEventLoopMgr.ResultMaker.MakerTools = [serialiser, bitsmaker]
450 onlineServicesAcc.getEventAlgo(
'SGInputLoader').Load.add(
451 (
'ByteStreamMetadataContainer',
'InputMetaDataStore+ByteStreamMetadata'))
452 acc.merge(onlineServicesAcc)
460 from TrigEDMConfig.TriggerEDM
import getTriggerEDMList
463 bitsmaker = CompFactory.TriggerBitsMakerTool()
464 decmaker = CompFactory.TrigDec.TrigDecisionMakerMT(
"TrigDecMakerMT", BitsMakerTool = bitsmaker, UseEDMxAOD=flags.Trigger.CTP.UseEDMxAOD)
465 acc.addEventAlgo( decmaker )
468 from .TriggerRecoConfig
import TriggerMetadataWriterCfg
470 acc.merge( metadataAcc )
473 from AnalysisTriggerAlgs.AnalysisTriggerAlgsConfig
import RoIBResultToxAODCfg
475 acc.merge(xRoIBResultAcc)
480 for doit, outputType, edmSet
in [( flags.Output.doWriteRDO,
'RDO', flags.Trigger.ESDEDMSet),
481 ( flags.Output.doWriteESD,
'ESD', flags.Trigger.ESDEDMSet),
482 ( flags.Output.doWriteAOD,
'AOD', flags.Trigger.AODEDMSet)]:
483 if not doit:
continue
489 for edmType, edmKeys
in edmList.items():
490 itemsToRecord.extend([edmType+
'#'+collKey
for collKey
in edmKeys])
493 itemsToRecord.append(
'xAOD::EventInfo#EventInfo')
494 itemsToRecord.append(
'xAOD::EventAuxInfo#EventInfoAux.')
497 from OutputStreamAthenaPool.OutputStreamConfig
import OutputStreamCfg, outputStreamName
499 disableEventTag=
True, takeItemsFromInput=(outputType ==
'RDO')))
500 from xAODMetaDataCnv.InfileMetaDataConfig
import SetupMetaDataForStreamCfg
502 createMetadata=[MetadataCategory.TriggerMenuMetaData]))
507 (
"xAOD::TrigDecision",
str(decmaker.TrigDecisionKey)),
508 (
"xAOD::TrigConfKeys", metadataOutputs)} |
set(xRoIBResultOutputs)
514 """Configure the view merging algorithm"""
516 from TrigEDMConfig.TriggerEDMDefs
import InViews
517 from TrigEDMConfig.TriggerEDM
import getRawTriggerEDMList
520 mergingTool = CompFactory.HLTEDMCreator(
"ViewsMergingTool")
521 alg = CompFactory.HLTEDMCreatorAlg(
"EDMCreatorAlg",
522 OutputTools = [mergingTool])
526 any(isinstance(v, InViews)
for v
in x[3])]
527 __log.info(
"These collections need merging: %s",
" ".
join([ c[0]
for c
in needMerging ]))
529 for coll
in needMerging:
530 collType, collName = coll[0].
split(
"#")
531 collType = collType.split(
":")[-1]
532 possibleViews = [
str(v)
for v
in coll[3]
if isinstance(v, InViews) ]
533 for viewsColl
in possibleViews:
534 attrView = getattr(mergingTool, collType+
"Views", [])
535 attrInView = getattr(mergingTool, collType+
"InViews", [])
536 attrName = getattr(mergingTool, collType, [])
537 attrView.append( viewsColl )
538 attrInView.append( collName )
539 attrName.append( collName )
541 setattr(mergingTool, collType+
"Views", attrView )
542 setattr(mergingTool, collType+
"InViews", attrInView )
543 setattr(mergingTool, collType, attrName )
544 producer = [ maker
for maker
in viewMakers
if maker.Views == viewsColl ]
545 if len(producer) == 0:
546 __log.warning(
"The producer of %s for %s not in the menu, its outputs won't ever make it out of the HLT", viewsColl, coll)
548 if len(producer) > 1:
549 for pr
in producer[1:]:
550 if pr != producer[0]:
551 __log.error(
"Several View making algorithms produce the same output collection %s: %s", viewsColl,
' '.
join([p.getName()
for p
in producer ]))
554 acc.addEventAlgo(alg)
559 """Configure the EDM gap filler"""
561 from TrigEDMConfig.TriggerEDMDefs
import Alias
562 from TrigEDMConfig.TriggerEDM
import getRawTriggerEDMList
568 ".*AuxContainer#.*",
".*AuxInfo#.*",
570 if flags.Trigger.doHLT:
572 ignore += [
"xAOD::TrigCompositeContainer#HLTNav_Summary_OnlineSlimmed",
573 "xAOD::TrigCompositeContainer#HLT_RuntimeMetadata"]
576 tool = CompFactory.HLTEDMCreator(f
"GapFiller{'' if edmSet==['BS'] else '_'+'_'.join(edmSet)}")
577 alg = CompFactory.HLTEDMCreatorAlg(
"EDMCreatorAlg",
578 OutputTools = [tool])
579 alg.ExtraInputs =
set(extraInputs)
580 alg.ExtraOutputs =
set(extraOutputs)
581 alg.ExtraOutputs.add((
"xAOD::TrigConfKeys",
"TrigConfKeysOnline"))
586 alg.ExtraOutputs.add((
'xAOD::JetContainer',
'HLT_AntiKt4EMTopoJets_subjesIS' ))
587 alg.ExtraOutputs.add((
'xAOD::JetContainer',
'HLT_AntiKt4EMTopoJets_subjesgscIS_ftf' ))
588 alg.ExtraOutputs.add((
'xAOD::JetContainer',
'HLT_AntiKt4EMTopoJets_subresjesgscIS_ftf' ))
589 alg.ExtraOutputs.add((
'xAOD::JetContainer',
'HLT_AntiKt4EMTopoJets_subjesIS_fastftag'))
590 alg.ExtraOutputs.add((
'xAOD::JetContainer',
'HLT_AntiKt4EMPFlowJets_subjesgscIS_ftf' ))
591 alg.ExtraOutputs.add((
'xAOD::JetContainer',
'HLT_AntiKt4EMPFlowJets_subjesIS_ftf'))
592 alg.ExtraOutputs.add((
'xAOD::JetContainer',
'HLT_AntiKt4EMPFlowJets_subresjesgscIS_ftf' ))
593 alg.ExtraOutputs.add((
'xAOD::JetContainer',
'HLT_AntiKt10LCTopoJets_subjes'))
594 alg.ExtraOutputs.add((
'xAOD::CaloClusterContainer',
'HLT_TopoCaloClustersLCFS'))
597 tool.RenounceOutputs = flags.Trigger.doHLT
600 groupedByType = defaultdict( list )
601 re_ignore = [re.compile(x)
for x
in ignore]
605 if not any([ outputType
in el[1].
split()
for outputType
in edmSet ]):
607 if any(ign.fullmatch(el[0])
for ign
in re_ignore):
609 collType, collName = el[0].
split(
"#")
610 if collName[-1] !=
".":
611 collType = collType.replace(
"AuxInfo",
"Info").
replace(
"AuxContainer",
"Container")
612 __log.debug(
"GapFiller will create EDM decorations on type '%s' of '%s'", collType, collName)
613 collNameList = collName.split(
".")
614 collName = (collNameList[0] +
".").
replace(
"Aux.",
".")
615 for decorName
in collNameList[1:]:
616 alg.ExtraOutputs.add((collType,
"StoreGateSvc+"+collName+decorName))
618 collType, collName = el[0].
split(
"#")
620 aliases = [
str(a)
for a
in el[3]
if isinstance(a, Alias) ]
621 if len(aliases) == 1:
622 __log.debug(
"GapFiller configuration found an aliased type '%s' for '%s'", aliases[0], collType)
623 collType = aliases[0]
624 elif len(aliases) > 1:
625 __log.error(
"GapFiller configuration found inconsistent '%s' (too many aliases?)", aliases)
627 groupedByType[collType].
append( collName )
629 for collType, collNameList
in groupedByType.items():
630 propName = collType.split(
":")[-1]
631 if hasattr( tool, propName ):
632 setattr( tool, propName, collNameList )
633 __log.debug(
"GapFiller will create EDM collection type '%s' for '%s'", collType, collNameList)
635 __log.debug(
"EDM collections of type %s are not going to be added to StoreGate, if not created by the HLT", collType )
637 if decObj
or decObjHypoOut:
638 __log.debug(
"GapFiller is ensuring the creation of all the decision object collections")
639 __log.debug(
"'%s'", decObj)
641 tool.FixLinks =
list(decObjHypoOut)
643 tool.TrigCompositeContainer +=
list(decObj)
645 acc.addEventAlgo(alg, primary=
True)
651 top of the trigger config (for real triggering online or on MC)
657 from TrigConfigSvc.TrigConfigSvcCfg
import L1ConfigSvcCfg
661 acc.addSequence(
seqOR(
"HLTTop") )
664 if flags.Trigger.CostMonitoring.doCostMonitoring:
665 acc.addSequence(
parOR(
"HLTPreSeq"), parentName=
"HLTTop" )
667 from TrigCostMonitor.TrigCostMonitorConfig
import TrigCostMonitorCfg
671 acc.addSequence(
parOR(
"HLTBeginSeq"), parentName=
"HLTTop" )
675 if flags.Trigger.doCFEmulationTest:
676 from TriggerMenuMT.CFtest.EmuStepProcessingConfig
import emulateHLTSeedingCfg
681 if flags.Trigger.doRuntimeNaviVal:
682 acc.addEventAlgo( CompFactory.TrigChainNameParserChecker(), sequenceName=
"HLTBeginSeq" )
684 from HLTSeeding.HLTSeedingConfig
import HLTSeedingCfg
687 from AthenaConfiguration.Enums
import LHCPeriod
688 if flags.GeoModel.Run > LHCPeriod.Run3:
689 from InDetConfig.TrackRecoConfig
import SiDetectorElementStatusCfg
693 acc.merge( hltSeedingAcc, sequenceName=
"HLTBeginSeq" )
697 menuAcc =
menu( flags )
698 HLTSteps = menuAcc.getSequence(
"HLTAllSteps" )
699 __log.info(
"Configured menu with %d steps", len(HLTSteps.Members))
700 acc.merge( menuAcc, sequenceName=
"HLTTop")
705 acc.addSequence(
parOR(
"HLTEndSeq"), parentName=
"HLTTop" )
706 acc.addSequence(
seqAND(
"HLTFinalizeSeq"), parentName=
"HLTEndSeq" )
708 nfilters =
sum(len(v)
for v
in filters.values())
709 nhypos =
sum(len(v)
for v
in hypos.values())
710 __log.info(
"Algorithms counting: Number of Filter algorithms: %d - Number of Hypo algoirthms: %d", nfilters , nhypos)
713 acc.merge( summaryAcc, sequenceName=
"HLTFinalizeSeq" )
714 if flags.Trigger.doCFEmulationTest:
715 summaryAlg.Prescaler=CompFactory.PrescalingEmulationTool()
716 acc.addEventAlgo( summaryAlg, sequenceName=
"HLTFinalizeSeq" )
720 hltSeedingAlg = hltSeedingAcc.getEventAlgo(
"HLTSeeding")
723 acc.merge( monitoringAcc, sequenceName=
"HLTEndSeq" )
724 acc.addEventAlgo( monitoringAlg, sequenceName=
"HLTEndSeq" )
734 from TrigEDMConfig.TriggerEDMRun3
import TriggerHLTListRun3, addHLTNavigationToEDMList
735 __log.info(
"Number of EDM items before adding navigation: %d", len(TriggerHLTListRun3))
737 __log.info(
"Number of EDM items after adding navigation: %d", len(TriggerHLTListRun3))
741 if flags.Trigger.ExtraEDMList:
742 from TrigEDMConfig.TriggerEDM
import _addExtraCollectionsToEDMList
743 __log.info(
"Adding extra collections to EDM: %s",
str(flags.Trigger.ExtraEDMList))
748 acc.merge( outputAcc, sequenceName=
"HLTTop" )
751 from TrigCostMonitor.TrigCostMonitorConfig
import TrigCostMonitorFinalizeCfg
754 acc.addEventAlgo(costFinalizeAlg, sequenceName=
"HLTFinalizeSeq" )
762 decObj, decObjHypoOut), sequenceName=
"HLTFinalizeSeq" )
764 if flags.Trigger.doOnlineNavigationCompactification:
765 from TrigNavSlimmingMT.TrigNavSlimmingMTConfig
import getTrigNavSlimmingMTOnlineConfig
767 acc.addEventAlgo( onlineSlimAlg, sequenceName=
"HLTFinalizeSeq" )
770 from TriggerMenuMT.HLT.Config.Utility.HLTMenuConfig
import HLTMenuConfig
771 HLTMenuConfig.destroy()
778 Configures IDC cache loading
783 if flags.Trigger.doMuon:
784 from MuonConfig.MuonBytestreamDecodeConfig
import MuonCacheCfg
785 acc.merge(
MuonCacheCfg(flags), sequenceName = seqName )
787 from MuonConfig.MuonRdoDecodeConfig
import MuonPrdCacheCfg
790 if flags.Trigger.doID:
791 from TrigInDetConfig.TrigInDetConfig
import InDetIDCCacheCreatorCfg
794 if flags.Trigger.useActsTracking:
795 from TrigInDetConfig.TrigInDetConfig
import ActsIDCCacheCreatorCfg
802 from TriggerMenuMT.HLT.Config.Utility.HLTMenuConfig
import HLTMenuConfig
804 acceptedEventChainDicts = [cd
for cd
in HLTMenuConfig.dictsList() \
805 if 'Calib' in cd[
'signatures'] \
806 and 'acceptedevts' in cd[
'chainParts'][0][
'purpose']]
811 if not (flags.Trigger.enableEndOfEventProcessing
and acceptedEventChainDicts):
815 endOfEventRoIMaker = CompFactory.EndOfEventROIConfirmerAlg(
'EndOfEventROIConfirmerAlg')
816 acc.addEventAlgo( endOfEventRoIMaker )
817 acc.addSequence(
parOR(
"acceptedEventTopSeq") )
818 acc.getSequence(
"acceptedEventTopSeq").IgnoreFilterPassed=
True
821 def EndOfEventSeqCfg(flags, prescaleChain, purposes):
823 seqLabel = prescaleChain.replace(
'HLT_acceptedevts',
'')
824 seqName =
'acceptedEventSeq'+seqLabel
825 acc.addSequence(
seqAND(seqName) )
827 endOfEventFilterAlg = CompFactory.EndOfEventFilterAlg(
'EndOfEventFilterAlg'+seqLabel, ChainName=prescaleChain)
828 acc.addEventAlgo(endOfEventFilterAlg, sequenceName=seqName)
830 if 'larnoiseburst' in purposes:
834 endOfEventFilterAlg.StreamFilter = [
'Main',
'VBFDelayed',
'TLA',
'DarkJetPEBTLA',
'FTagPEBTLA',
'CosmicCalo']
836 from TriggerMenuMT.HLT.CalibCosmicMon.CalibChainConfiguration
import getLArNoiseBurstRecoCfg
838 elif any(purpose.startswith(
"met")
for purpose
in purposes):
839 from TriggerMenuMT.HLT.MET.EndOfEvent
import getMETRecoSequences
841 endOfEventFilterAlg.StreamFilter = streams
842 endOfEventRoIMaker.RoIs = [x
for x
in rois
if x
not in endOfEventRoIMaker.RoIs]
843 acc.merge(metcfg, sequenceName=seqName)
848 for acceptedEventChainDict
in acceptedEventChainDicts:
850 prescaleChain = acceptedEventChainDict[
'chainName']
852 purposes = acceptedEventChainDict[
'chainParts'][0][
'purpose']
854 acc.merge(EndOfEventSeqCfg(flags, prescaleChain, purposes), sequenceName=
"acceptedEventTopSeq")
860 Configures components needed for processing trigger information in RAW/ESD step
869 if __name__ ==
"__main__":
870 from AthenaConfiguration.AllConfigFlags
import initConfigFlags
873 flags.Trigger.forceEnableAllChains =
True
874 flags.Input.Files = [
"/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TrigP1Test/data17_13TeV.00327265.physics_EnhancedBias.merge.RAW._lb0100._SFO-1._0001.1_50evt",]
875 from AthenaConfiguration.TestDefaults
import defaultGeometryTags
876 flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN2
881 menuCA.addSequence(
seqAND(
"HLTAllSteps") )
886 f=
open(
"TriggerRunConf.pkl",
"wb")