5 from collections
import OrderedDict, 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 AthenaCommon.Logging
import logging
12 __log = logging.getLogger(
'TriggerConfig')
16 return hasattr( alg,
"MultiplicitiesMap" )
19 """extract step number frmo strings like Step2... -> 2"""
20 return int(stepName.split(
'_')[0].
replace(
"Step",
""))
25 Method iterating over the CF and picking all the Hypothesis algorithms
27 Returned is a map with the step name and list of all instances of hypos in that step.
28 Input is top HLT sequencer.
30 __log.info(
"Collecting hypos from steps")
31 hypos = defaultdict( list )
33 for stepSeq
in steps.Members:
37 if "filter" in stepSeq.getName():
38 __log.debug(
"Skipping filtering steps %s", stepSeq.getName() )
41 __log.debug(
"collecting hypos from step %s", stepSeq.getName() )
43 for alg
in sorted(algs, key=
lambda t:
str(t.getName())):
47 if hasattr(alg,
'HypoInputDecisions'):
48 __log.debug(
"found hypo %s in %s", alg.getName(), stepSeq.getName())
49 if __isCombo( alg )
and len(alg.ComboHypoTools):
50 __log.debug(
" with %d comboHypoTools: %s", len(alg.ComboHypoTools),
' '.
join(map(str, [tool.getName()
for tool
in alg.ComboHypoTools])))
51 hypos[stepSeq.getName()].
append( alg )
53 __log.verbose(
"Not a hypo %s", alg.getName())
55 return OrderedDict(hypos)
58 """ return all chains served by this hypo and the keys of produced decision object """
59 from TrigCompositeUtils.TrigCompositeUtils
import isLegId
60 __log.debug(
"Hypo type %s is combo %r", hypo.getName(),
__isCombo(hypo))
62 return [key
for key
in list(hypo.MultiplicitiesMap.keys())
if not isLegId(key)], hypo.HypoOutputDecisions
64 return [ t.getName()
for t
in hypo.HypoTools
if not isLegId(t.getName())], [
str(hypo.HypoOutputDecisions)]
68 """ collect all view maker algorithms in the configuration """
75 for seq,algs
in algsInSeq.items():
77 if "EventViewCreator" in alg.getFullJobOptName():
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 "filter" 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 = OrderedDict()
184 for stepName, stepHypos
in sorted( hypos.items(), key=
lambda x :
__stepNumber(x[0]) ):
191 orderedStepHypos =
sorted(stepHypos, key=
lambda hypo:
not __isCombo(hypo))
193 chainToCollectionInStep = OrderedDict()
194 for hypo
in orderedStepHypos:
196 for chain
in hypoChains:
197 if chain
not in chainToCollectionInStep:
198 chainToCollectionInStep[chain] = hypoOutputKeys
199 chainToLastCollection.update( chainToCollectionInStep )
201 from TriggerMenuMT.HLT.Config.Utility.HLTMenuConfig
import HLTMenuConfig
202 from HLTSeeding.HLTSeedingConfig
import mapThresholdToL1DecisionCollection
203 if len(HLTMenuConfig.dicts()) == 0:
204 __log.warning(
"No HLT menu, chains w/o algorithms are not handled")
206 for chainName, chainDict
in HLTMenuConfig.dicts().
items():
207 if chainName
not in chainToLastCollection:
208 __log.debug(
"The chain %s is not mentioned in any step", chainName)
210 assert len(chainDict[
'chainParts']) == 1,
"Chains w/o the steps can not have multiple parts in chainDict, it makes no sense: %s"%chainName
213 for c, cont
in chainToLastCollection.items():
214 __log.debug(
"Final decision of chain %s will be read from %d %s", c, len(cont),
str(cont))
216 collectionsWithFinalDecisions = []
217 for chain, collections
in chainToLastCollection.items():
218 for c
in collections:
219 if c
not in collectionsWithFinalDecisions:
220 collectionsWithFinalDecisions.append(c)
221 __log.debug(
"Final keys %s", collectionsWithFinalDecisions)
222 decisionSummaryAlg.FinalDecisionKeys = collectionsWithFinalDecisions
223 decisionSummaryAlg.FinalStepDecisions = dict(chainToLastCollection)
224 decisionSummaryAlg.DecisionsSummaryKey =
"HLTNav_Summary"
225 decisionSummaryAlg.SetFilterStatus = flags.Trigger.writeBS
226 return acc, decisionSummaryAlg
231 Configures components needed for monitoring chains
234 TrigSignatureMoni, DecisionCollectorTool=CompFactory.getComps(
"TrigSignatureMoni",
"DecisionCollectorTool",)
236 mon.L1Decisions =
"HLTSeedingSummary"
237 mon.FinalDecisionKey =
"HLTNav_Summary"
239 __log.warning(
"Menu is not configured")
246 assert __stepNumber(stepName) == stepCounter,
"There are steps that have no hypos, decisions counting is not going to work"
248 stepDecisionKeys = []
249 stepFeatureDecisionKeys = []
250 for hypo
in stepHypos:
253 stepDecisionKeys.extend( hypoOutputKeys )
255 stepFeatureDecisionKeys.extend( hypoOutputKeys )
257 dcEventTool =
DecisionCollectorTool(
"EventDecisionCollector" + stepName, Decisions=
list(OrderedDict.fromkeys(stepDecisionKeys)))
258 dcFeatureTool =
DecisionCollectorTool(
"FeatureDecisionCollector" + stepName, Decisions=
list(OrderedDict.fromkeys(stepFeatureDecisionKeys)))
259 __log.debug(
"The step monitoring decisions in %s %s", dcEventTool.getName(), dcEventTool.Decisions)
260 __log.debug(
"The step monitoring decisions in %s %s", dcFeatureTool.getName(), dcFeatureTool.Decisions)
261 mon.DecisionCollectorTools += [ dcEventTool ]
262 mon.FeatureCollectorTools += [ dcFeatureTool ]
265 if flags.Trigger.Online.isPartition:
266 from TrigServices.TrigServicesConfig
import TrigServicesCfg
268 hltEventLoopMgr = onlineServicesAcc.getPrimary()
270 hltEventLoopMgr.TrigErrorMonTool.AlgToChainTool = CompFactory.TrigCompositeUtils.AlgToChainTool()
271 hltEventLoopMgr.TrigErrorMonTool.MonTool.defineHistogram(
272 'ErrorChainName,ErrorCode', path=
'EXPERT', type=
'TH2I',
273 title=
'Error StatusCodes per chain;Chain name;StatusCode',
274 xbins=1, xmin=0, xmax=1, ybins=1, ymin=0, ymax=1)
276 acc.merge(onlineServicesAcc)
278 mon.L1Decisions = hltSeeding.HLTSeedingSummaryKey
280 from DecisionHandling.DecisionHandlingConfig
import setupFilterMonitoring
292 onlineWriteBS =
False
293 offlineWriteBS =
False
296 if flags.Trigger.writeBS:
297 if flags.Trigger.Online.isPartition:
300 offlineWriteBS =
True
301 if flags.Output.doWriteRDO
or flags.Output.doWriteESD
or flags.Output.doWriteAOD:
305 if offlineWriteBS
and not flags.Output.doWriteBS:
306 __log.error(
'flags.Trigger.writeBS is True but flags.Output.doWriteBS is False')
308 if writePOOL
and onlineWriteBS:
309 __log.error(
"POOL HLT output writing is configured online")
311 if writePOOL
and offlineWriteBS:
312 __log.error(
"Writing HLT output to both BS and POOL in one job is not supported at the moment")
318 edmSet = flags.Trigger.AODEDMSet
if flags.Output.doWriteAOD
else flags.Trigger.ESDEDMSet
319 elif onlineWriteBS
or offlineWriteBS:
324 __log.info(
"Configuring online ByteStream HLT output")
327 __log.info(
"Configuring offline ByteStream HLT output")
330 __log.info(
"Configuring POOL HLT output")
333 __log.info(
"No HLT output writing is configured")
341 Returns CA with algorithms and/or tools required to do the serialisation
343 decObj - list of all navigation objects
344 decObjHypoOut - list of decisions produced by hypos
345 hypos - the {stepName: hypoList} dictionary with all hypo algorithms - used to find the PEB decision keys
346 offline - if true CA contains algorithms that need to be merged to output stream sequence,
347 if false the CA contains a tool that needs to be added to HltEventLoopMgr
349 from TrigEDMConfig
import DataScoutingInfo
350 from TrigEDMConfig.TriggerEDM
import getRun3BSList
351 from TrigEDMConfig.TriggerEDMDefs
import allowTruncation
352 from TrigOutputHandling.TrigOutputHandlingConfig
import TriggerEDMSerialiserToolCfg, StreamTagMakerToolCfg, TriggerBitsMakerToolCfg
355 collectionsToBS =
getRun3BSList(flags, [
"BS"] + DataScoutingInfo.getAllDataScoutingIdentifiers())
360 for typekey, bsfragments, props
in collectionsToBS:
362 moduleIDs =
sorted(DataScoutingInfo.getFullHLTResultID()
if f ==
'BS' else
363 DataScoutingInfo.getDataScoutingResultID(f)
364 for f
in bsfragments)
366 __log.debug(
'adding to serialiser list: %s, modules: %s', typekey, moduleIDs)
367 serialiser.addCollection(typekey, moduleIDs, allowTruncation = allowTruncation
in props)
375 for hypoList
in hypos.values():
376 for hypo
in hypoList:
377 if hypo.getFullJobOptName().startswith(
'PEBInfoWriterAlg/'):
378 PEBKeys.append(
str(hypo.HypoOutputDecisions))
381 __log.debug(
'Setting StreamTagMakerTool.PEBDecisionKeys = %s', PEBKeys)
382 stmaker.PEBDecisionKeys = PEBKeys
388 from TrigOutputHandling.TrigOutputHandlingConfig
import HLTResultMTMakerCfg
389 HLTResultMTMakerAlg=CompFactory.HLTResultMTMakerAlg
391 hltResultMakerTool.StreamTagMaker = stmaker
392 hltResultMakerTool.MakerTools = [bitsmaker, serialiser]
394 hltResultMakerAlg.ResultMaker = hltResultMakerTool
397 if flags.Input.Format
is Format.BS:
398 from TriggerJobOpts.TriggerByteStreamConfig
import ByteStreamReadCfg
400 readBSAcc.getEventAlgo(
'SGInputLoader').Load.add(
401 (
'ByteStreamMetadataContainer',
'InputMetaDataStore+ByteStreamMetadata'))
405 hltResultMakerAlg.ResultMaker.ExtraROBs = []
406 hltResultMakerAlg.ResultMaker.ExtraSubDets = []
409 decmaker = CompFactory.getComp(
"TrigDec::TrigDecisionMakerMT")(
"TrigDecMakerMT")
413 from TrigConfigSvc.TrigConfigSvcCfg
import L1PrescaleCondAlgCfg
417 from TriggerJobOpts.TriggerByteStreamConfig
import ByteStreamWriteCfg
418 writingOutputs = [
"HLT::HLTResultMT#HLTResultMT"]
419 writingInputs = [(
"HLT::HLTResultMT",
"HLTResultMT"),
420 (
"xAOD::TrigDecision",
"xTrigDecision")]
423 if flags.Trigger.doLVL1:
424 if flags.Trigger.enableL1MuonPhase1
or flags.Trigger.enableL1CaloPhase1:
425 writingOutputs += [
'xAOD::TrigCompositeContainer#L1TriggerResult']
426 writingInputs += [(
'xAOD::TrigCompositeContainer',
'StoreGateSvc+L1TriggerResult')]
427 if flags.Trigger.enableL1CaloLegacy
or not flags.Trigger.enableL1MuonPhase1:
428 writingOutputs += [
'ROIB::RoIBResult#RoIBResult']
429 writingInputs += [(
'ROIB::RoIBResult',
'StoreGateSvc+RoIBResult')]
431 from TrigT1ResultByteStream.TrigT1ResultByteStreamConfig
import L1TriggerByteStreamEncoderCfg
434 writingAcc =
ByteStreamWriteCfg(flags, type_names=writingOutputs, extra_inputs=writingInputs)
435 writingAcc.addEventAlgo(hltResultMakerAlg)
436 writingAcc.addEventAlgo(decmaker)
437 acc.merge(writingAcc)
440 from TrigServices.TrigServicesConfig
import TrigServicesCfg
442 hltEventLoopMgr = onlineServicesAcc.getPrimary()
443 hltEventLoopMgr.ResultMaker.StreamTagMaker = stmaker
444 hltEventLoopMgr.ResultMaker.MakerTools = [serialiser, bitsmaker]
445 onlineServicesAcc.getEventAlgo(
'SGInputLoader').Load.add(
446 (
'ByteStreamMetadataContainer',
'InputMetaDataStore+ByteStreamMetadata'))
447 acc.merge(onlineServicesAcc)
455 from TrigEDMConfig.TriggerEDM
import getTriggerEDMList
458 bitsmaker = CompFactory.TriggerBitsMakerTool()
459 decmaker = CompFactory.TrigDec.TrigDecisionMakerMT(
"TrigDecMakerMT", BitsMakerTool = bitsmaker)
460 acc.addEventAlgo( decmaker )
463 from .TriggerRecoConfig
import TriggerMetadataWriterCfg
465 acc.merge( metadataAcc )
468 from AnalysisTriggerAlgs.AnalysisTriggerAlgsConfig
import RoIBResultToxAODCfg
470 acc.merge(xRoIBResultAcc)
475 for doit, outputType, edmSet
in [( flags.Output.doWriteRDO,
'RDO', flags.Trigger.ESDEDMSet),
476 ( flags.Output.doWriteESD,
'ESD', flags.Trigger.ESDEDMSet),
477 ( flags.Output.doWriteAOD,
'AOD', flags.Trigger.AODEDMSet)]:
478 if not doit:
continue
484 for edmType, edmKeys
in edmList.items():
485 itemsToRecord.extend([edmType+
'#'+collKey
for collKey
in edmKeys])
488 itemsToRecord.append(
'xAOD::EventInfo#EventInfo')
489 itemsToRecord.append(
'xAOD::EventAuxInfo#EventInfoAux.')
492 from OutputStreamAthenaPool.OutputStreamConfig
import OutputStreamCfg, outputStreamName
494 disableEventTag=
True, takeItemsFromInput=(outputType ==
'RDO')))
495 from xAODMetaDataCnv.InfileMetaDataConfig
import SetupMetaDataForStreamCfg
497 createMetadata=[MetadataCategory.TriggerMenuMetaData]))
502 (
"xAOD::TrigDecision",
str(decmaker.TrigDecisionKey)),
503 (
"xAOD::TrigConfKeys", metadataOutputs)} |
set(xRoIBResultOutputs)
509 """Configure the view merging algorithm"""
511 from TrigEDMConfig.TriggerEDMDefs
import InViews
512 from TrigEDMConfig.TriggerEDM
import getRawTriggerEDMList
515 mergingTool = CompFactory.HLTEDMCreator(
"ViewsMergingTool")
516 alg = CompFactory.HLTEDMCreatorAlg(
"EDMCreatorAlg",
517 OutputTools = [mergingTool])
521 any(isinstance(v, InViews)
for v
in x[3])]
522 __log.info(
"These collections need merging: %s",
" ".
join([ c[0]
for c
in needMerging ]))
524 for coll
in needMerging:
525 collType, collName = coll[0].
split(
"#")
526 collType = collType.split(
":")[-1]
527 possibleViews = [
str(v)
for v
in coll[3]
if isinstance(v, InViews) ]
528 for viewsColl
in possibleViews:
529 attrView = getattr(mergingTool, collType+
"Views", [])
530 attrInView = getattr(mergingTool, collType+
"InViews", [])
531 attrName = getattr(mergingTool, collType, [])
532 attrView.append( viewsColl )
533 attrInView.append( collName )
534 attrName.append( collName )
536 setattr(mergingTool, collType+
"Views", attrView )
537 setattr(mergingTool, collType+
"InViews", attrInView )
538 setattr(mergingTool, collType, attrName )
539 producer = [ maker
for maker
in viewMakers
if maker.Views == viewsColl ]
540 if len(producer) == 0:
541 __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)
543 if len(producer) > 1:
544 for pr
in producer[1:]:
545 if pr != producer[0]:
546 __log.error(
"Several View making algorithms produce the same output collection %s: %s", viewsColl,
' '.
join([p.getName()
for p
in producer ]))
549 acc.addEventAlgo(alg)
554 """Configure the EDM gap filler"""
556 from TrigEDMConfig.TriggerEDMDefs
import Alias
557 from TrigEDMConfig.TriggerEDM
import getRawTriggerEDMList
563 ".*AuxContainer#.*",
".*AuxInfo#.*",
565 if flags.Trigger.doHLT:
567 ignore += [
"xAOD::TrigCompositeContainer#HLTNav_Summary_OnlineSlimmed",
568 "xAOD::TrigCompositeContainer#HLT_RuntimeMetadata"]
571 tool = CompFactory.HLTEDMCreator(f
"GapFiller{'' if edmSet==['BS'] else '_'+'_'.join(edmSet)}")
572 alg = CompFactory.HLTEDMCreatorAlg(
"EDMCreatorAlg",
573 OutputTools = [tool])
574 alg.ExtraInputs =
set(extraInputs)
575 alg.ExtraOutputs =
set(extraOutputs)
576 alg.ExtraOutputs.add((
"xAOD::TrigConfKeys",
"TrigConfKeysOnline"))
581 alg.ExtraOutputs.add((
'xAOD::JetContainer',
'HLT_AntiKt4EMTopoJets_subjesIS' ))
582 alg.ExtraOutputs.add((
'xAOD::JetContainer',
'HLT_AntiKt4EMTopoJets_subjesgscIS_ftf' ))
583 alg.ExtraOutputs.add((
'xAOD::JetContainer',
'HLT_AntiKt4EMTopoJets_subresjesgscIS_ftf' ))
584 alg.ExtraOutputs.add((
'xAOD::JetContainer',
'HLT_AntiKt4EMTopoJets_subjesIS_fastftag'))
585 alg.ExtraOutputs.add((
'xAOD::JetContainer',
'HLT_AntiKt4EMPFlowJets_subjesgscIS_ftf' ))
586 alg.ExtraOutputs.add((
'xAOD::JetContainer',
'HLT_AntiKt4EMPFlowJets_subjesIS_ftf'))
587 alg.ExtraOutputs.add((
'xAOD::JetContainer',
'HLT_AntiKt4EMPFlowJets_subresjesgscIS_ftf' ))
588 alg.ExtraOutputs.add((
'xAOD::JetContainer',
'HLT_AntiKt10LCTopoJets_subjes'))
589 alg.ExtraOutputs.add((
'xAOD::CaloClusterContainer',
'HLT_TopoCaloClustersLCFS'))
592 tool.RenounceOutputs = flags.Trigger.doHLT
595 groupedByType = defaultdict( list )
596 re_ignore = [re.compile(x)
for x
in ignore]
600 if not any([ outputType
in el[1].
split()
for outputType
in edmSet ]):
602 if any(ign.fullmatch(el[0])
for ign
in re_ignore):
604 collType, collName = el[0].
split(
"#")
605 if collName[-1] !=
".":
606 collType = collType.replace(
"AuxInfo",
"Info").
replace(
"AuxContainer",
"Container")
607 __log.debug(
"GapFiller will create EDM decorations on type '%s' of '%s'", collType, collName)
608 collNameList = collName.split(
".")
609 collName = (collNameList[0] +
".").
replace(
"Aux.",
".")
610 for decorName
in collNameList[1:]:
611 alg.ExtraOutputs.add((collType,
"StoreGateSvc+"+collName+decorName))
613 collType, collName = el[0].
split(
"#")
615 aliases = [
str(a)
for a
in el[3]
if isinstance(a, Alias) ]
616 if len(aliases) == 1:
617 __log.debug(
"GapFiller configuration found an aliased type '%s' for '%s'", aliases[0], collType)
618 collType = aliases[0]
619 elif len(aliases) > 1:
620 __log.error(
"GapFiller configuration found inconsistent '%s' (too many aliases?)", aliases)
622 groupedByType[collType].
append( collName )
624 for collType, collNameList
in groupedByType.items():
625 propName = collType.split(
":")[-1]
626 if hasattr( tool, propName ):
627 setattr( tool, propName, collNameList )
628 __log.debug(
"GapFiller will create EDM collection type '%s' for '%s'", collType, collNameList)
630 __log.debug(
"EDM collections of type %s are not going to be added to StoreGate, if not created by the HLT", collType )
632 if decObj
or decObjHypoOut:
633 __log.debug(
"GapFiller is ensuring the creation of all the decision object collections")
634 __log.debug(
"'%s'", decObj)
636 tool.FixLinks =
list(decObjHypoOut)
638 tool.TrigCompositeContainer +=
list(decObj)
640 acc.addEventAlgo(alg, primary=
True)
646 top of the trigger config (for real triggering online or on MC)
652 from TrigConfigSvc.TrigConfigSvcCfg
import L1ConfigSvcCfg
656 acc.addSequence(
seqOR(
"HLTTop") )
659 if flags.Trigger.CostMonitoring.doCostMonitoring:
660 acc.addSequence(
parOR(
"HLTPreSeq"), parentName=
"HLTTop" )
662 from TrigCostMonitor.TrigCostMonitorConfig
import TrigCostMonitorCfg
666 acc.addSequence(
parOR(
"HLTBeginSeq"), parentName=
"HLTTop" )
670 if flags.Trigger.doCFEmulationTest:
671 from TriggerMenuMT.CFtest.EmuStepProcessingConfig
import emulateHLTSeedingCfg
675 from HLTSeeding.HLTSeedingConfig
import HLTSeedingCfg
678 from AthenaConfiguration.Enums
import LHCPeriod
679 if flags.GeoModel.Run > LHCPeriod.Run3:
680 from InDetConfig.TrackRecoConfig
import SiDetectorElementStatusCfg
684 acc.merge( hltSeedingAcc, sequenceName=
"HLTBeginSeq" )
688 menuAcc =
menu( flags )
689 HLTSteps = menuAcc.getSequence(
"HLTAllSteps" )
690 __log.info(
"Configured menu with %d steps", len(HLTSteps.Members))
691 acc.merge( menuAcc, sequenceName=
"HLTTop")
696 acc.addSequence(
parOR(
"HLTEndSeq"), parentName=
"HLTTop" )
697 acc.addSequence(
seqAND(
"HLTFinalizeSeq"), parentName=
"HLTEndSeq" )
699 nfilters =
sum(len(v)
for v
in filters.values())
700 nhypos =
sum(len(v)
for v
in hypos.values())
701 __log.info(
"Algorithms counting: Number of Filter algorithms: %d - Number of Hypo algoirthms: %d", nfilters , nhypos)
704 acc.merge( summaryAcc, sequenceName=
"HLTFinalizeSeq" )
705 if flags.Trigger.doCFEmulationTest:
706 summaryAlg.Prescaler=CompFactory.PrescalingEmulationTool()
707 acc.addEventAlgo( summaryAlg, sequenceName=
"HLTFinalizeSeq" )
711 hltSeedingAlg = hltSeedingAcc.getEventAlgo(
"HLTSeeding")
714 acc.merge( monitoringAcc, sequenceName=
"HLTEndSeq" )
715 acc.addEventAlgo( monitoringAlg, sequenceName=
"HLTEndSeq" )
725 from TrigEDMConfig.TriggerEDMRun3
import TriggerHLTListRun3, addHLTNavigationToEDMList
726 __log.info(
"Number of EDM items before adding navigation: %d", len(TriggerHLTListRun3))
728 __log.info(
"Number of EDM items after adding navigation: %d", len(TriggerHLTListRun3))
732 if flags.Trigger.ExtraEDMList:
733 from TrigEDMConfig.TriggerEDM
import _addExtraCollectionsToEDMList
734 __log.info(
"Adding extra collections to EDM: %s",
str(flags.Trigger.ExtraEDMList))
739 acc.merge( outputAcc, sequenceName=
"HLTTop" )
742 from TrigCostMonitor.TrigCostMonitorConfig
import TrigCostMonitorFinalizeCfg
745 acc.addEventAlgo(costFinalizeAlg, sequenceName=
"HLTFinalizeSeq" )
753 decObj, decObjHypoOut), sequenceName=
"HLTFinalizeSeq" )
755 if flags.Trigger.doOnlineNavigationCompactification:
756 from TrigNavSlimmingMT.TrigNavSlimmingMTConfig
import getTrigNavSlimmingMTOnlineConfig
758 acc.addEventAlgo( onlineSlimAlg, sequenceName=
"HLTFinalizeSeq" )
761 from TriggerMenuMT.HLT.Config.Utility.HLTMenuConfig
import HLTMenuConfig
762 HLTMenuConfig.destroy()
769 Configures IDC cache loading
774 if flags.Trigger.doMuon:
775 from MuonConfig.MuonBytestreamDecodeConfig
import MuonCacheCfg
776 acc.merge(
MuonCacheCfg(flags), sequenceName = seqName )
778 from MuonConfig.MuonRdoDecodeConfig
import MuonPrdCacheCfg
781 if flags.Trigger.doID:
782 from TrigInDetConfig.TrigInDetConfig
import InDetIDCCacheCreatorCfg
785 if flags.Trigger.useActsTracking:
786 from TrigInDetConfig.TrigInDetConfig
import ActsIDCCacheCreatorCfg
793 from TriggerMenuMT.HLT.Config.Utility.HLTMenuConfig
import HLTMenuConfig
795 acceptedEventChainDicts = [cd
for cd
in HLTMenuConfig.dictsList() \
796 if 'Calib' in cd[
'signatures'] \
797 and 'acceptedevts' in cd[
'chainParts'][0][
'purpose']]
802 if not (flags.Trigger.enableEndOfEventProcessing
and acceptedEventChainDicts):
806 endOfEventRoIMaker = CompFactory.EndOfEventROIConfirmerAlg(
'EndOfEventROIConfirmerAlg')
807 acc.addEventAlgo( endOfEventRoIMaker )
808 acc.addSequence(
parOR(
"acceptedEventTopSeq") )
809 acc.getSequence(
"acceptedEventTopSeq").IgnoreFilterPassed=
True
812 def EndOfEventSeqCfg(flags, prescaleChain, purposes):
814 seqLabel = prescaleChain.replace(
'HLT_acceptedevts',
'')
815 seqName =
'acceptedEventSeq'+seqLabel
816 acc.addSequence(
seqAND(seqName) )
818 endOfEventFilterAlg = CompFactory.EndOfEventFilterAlg(
'EndOfEventFilterAlg'+seqLabel, ChainName=prescaleChain)
819 acc.addEventAlgo(endOfEventFilterAlg, sequenceName=seqName)
821 if 'larnoiseburst' in purposes:
825 endOfEventFilterAlg.StreamFilter = [
'Main',
'VBFDelayed',
'TLA',
'DarkJetPEBTLA',
'FTagPEBTLA',
'CosmicCalo']
827 from TriggerMenuMT.HLT.CalibCosmicMon.CalibChainConfiguration
import getLArNoiseBurstRecoCfg
829 elif any(purpose.startswith(
"met")
for purpose
in purposes):
830 from TriggerMenuMT.HLT.MET.EndOfEvent
import getMETRecoSequences
832 endOfEventFilterAlg.StreamFilter = streams
833 endOfEventRoIMaker.RoIs = [x
for x
in rois
if x
not in endOfEventRoIMaker.RoIs]
834 acc.merge(metcfg, sequenceName=seqName)
839 for acceptedEventChainDict
in acceptedEventChainDicts:
841 prescaleChain = acceptedEventChainDict[
'chainName']
843 purposes = acceptedEventChainDict[
'chainParts'][0][
'purpose']
845 acc.merge(EndOfEventSeqCfg(flags, prescaleChain, purposes), sequenceName=
"acceptedEventTopSeq")
851 Configures components needed for processing trigger information in RAW/ESD step
860 if __name__ ==
"__main__":
861 from AthenaConfiguration.AllConfigFlags
import initConfigFlags
864 flags.Trigger.forceEnableAllChains =
True
865 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",]
866 from AthenaConfiguration.TestDefaults
import defaultGeometryTags
867 flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN2
872 menuCA.addSequence(
seqAND(
"HLTAllSteps") )
877 f=
open(
"TriggerRunConf.pkl",
"wb")