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')]
 
  433             from TrigT1ResultByteStream.TrigT1ResultByteStreamConfig 
import L1TriggerByteStreamEncoderCfg
 
  436         writingAcc = 
ByteStreamWriteCfg(flags, type_names=writingOutputs, extra_inputs=writingInputs)
 
  437         writingAcc.addEventAlgo(hltResultMakerAlg)
 
  438         writingAcc.addEventAlgo(decmaker)
 
  439         acc.merge(writingAcc)
 
  442         from TrigServices.TrigServicesConfig 
import TrigServicesCfg
 
  444         hltEventLoopMgr = onlineServicesAcc.getPrimary()
 
  445         hltEventLoopMgr.ResultMaker.StreamTagMaker = stmaker
 
  446         hltEventLoopMgr.ResultMaker.MakerTools = [serialiser, bitsmaker]
 
  447         onlineServicesAcc.getEventAlgo(
'SGInputLoader').Load.add(
 
  448             (
'ByteStreamMetadataContainer', 
'InputMetaDataStore+ByteStreamMetadata'))
 
  449         acc.merge(onlineServicesAcc)
 
  457     from TrigEDMConfig.TriggerEDM 
import getTriggerEDMList
 
  460     bitsmaker = CompFactory.TriggerBitsMakerTool()
 
  461     decmaker = CompFactory.TrigDec.TrigDecisionMakerMT(
"TrigDecMakerMT", BitsMakerTool = bitsmaker)
 
  462     acc.addEventAlgo( decmaker )
 
  465     from .TriggerRecoConfig 
import TriggerMetadataWriterCfg
 
  467     acc.merge( metadataAcc )
 
  470     from AnalysisTriggerAlgs.AnalysisTriggerAlgsConfig 
import RoIBResultToxAODCfg
 
  472     acc.merge(xRoIBResultAcc)
 
  477     for doit, outputType, edmSet 
in [( flags.Output.doWriteRDO, 
'RDO', flags.Trigger.ESDEDMSet), 
 
  478                                      ( flags.Output.doWriteESD, 
'ESD', flags.Trigger.ESDEDMSet), 
 
  479                                      ( flags.Output.doWriteAOD, 
'AOD', flags.Trigger.AODEDMSet)]:
 
  480         if not doit: 
continue 
  486         for edmType, edmKeys 
in edmList.items():
 
  487             itemsToRecord.extend([edmType+
'#'+collKey 
for collKey 
in edmKeys])
 
  490         itemsToRecord.append(
'xAOD::EventInfo#EventInfo')
 
  491         itemsToRecord.append(
'xAOD::EventAuxInfo#EventInfoAux.')
 
  494         from OutputStreamAthenaPool.OutputStreamConfig 
import OutputStreamCfg, outputStreamName
 
  496                                   disableEventTag=
True, takeItemsFromInput=(outputType == 
'RDO')))
 
  497         from xAODMetaDataCnv.InfileMetaDataConfig 
import SetupMetaDataForStreamCfg
 
  499                                             createMetadata=[MetadataCategory.TriggerMenuMetaData]))
 
  504             (
"xAOD::TrigDecision", 
str(decmaker.TrigDecisionKey)),
 
  505             (
"xAOD::TrigConfKeys", metadataOutputs)} | 
set(xRoIBResultOutputs)
 
  511     """Configure the view merging algorithm""" 
  513     from TrigEDMConfig.TriggerEDMDefs 
import InViews
 
  514     from TrigEDMConfig.TriggerEDM 
import getRawTriggerEDMList
 
  517     mergingTool = CompFactory.HLTEDMCreator(
"ViewsMergingTool")
 
  518     alg = CompFactory.HLTEDMCreatorAlg(
"EDMCreatorAlg",
 
  519                                        OutputTools = [mergingTool])
 
  523                    any(isinstance(v, InViews) 
for v 
in x[3])]
 
  524     __log.info(
"These collections need merging: %s", 
" ".
join([ c[0] 
for c 
in needMerging ]))
 
  526     for coll 
in needMerging:
 
  527         collType, collName = coll[0].
split(
"#")
 
  528         collType = collType.split(
":")[-1]
 
  529         possibleViews = [ 
str(v) 
for v 
in coll[3] 
if isinstance(v, InViews) ]
 
  530         for viewsColl 
in possibleViews:
 
  531             attrView = getattr(mergingTool, collType+
"Views", [])
 
  532             attrInView = getattr(mergingTool, collType+
"InViews", [])
 
  533             attrName = getattr(mergingTool, collType, [])
 
  534             attrView.append( viewsColl )
 
  535             attrInView.append( collName )
 
  536             attrName.append( collName )
 
  538             setattr(mergingTool, collType+
"Views", attrView )
 
  539             setattr(mergingTool, collType+
"InViews", attrInView )
 
  540             setattr(mergingTool, collType, attrName )
 
  541             producer = [ maker 
for maker 
in viewMakers 
if maker.Views == viewsColl ]
 
  542             if len(producer) == 0:
 
  543                 __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)
 
  545             if len(producer) > 1:
 
  546                 for pr 
in producer[1:]:
 
  547                     if pr != producer[0]:
 
  548                         __log.error(
"Several View making algorithms produce the same output collection %s: %s", viewsColl, 
' '.
join([p.getName() 
for p 
in producer ]))
 
  551     acc.addEventAlgo(alg)
 
  556     """Configure the EDM gap filler""" 
  558     from TrigEDMConfig.TriggerEDMDefs 
import Alias
 
  559     from TrigEDMConfig.TriggerEDM 
import getRawTriggerEDMList
 
  565         ".*AuxContainer#.*", 
".*AuxInfo#.*",
 
  567     if flags.Trigger.doHLT:
 
  569         ignore += [
"xAOD::TrigCompositeContainer#HLTNav_Summary_OnlineSlimmed",
 
  570                    "xAOD::TrigCompositeContainer#HLT_RuntimeMetadata"]
 
  573     tool = CompFactory.HLTEDMCreator(f
"GapFiller{'' if edmSet==['BS'] else '_'+'_'.join(edmSet)}")
 
  574     alg = CompFactory.HLTEDMCreatorAlg(
"EDMCreatorAlg",
 
  575                                        OutputTools = [tool])
 
  576     alg.ExtraInputs = 
set(extraInputs)
 
  577     alg.ExtraOutputs = 
set(extraOutputs)
 
  578     alg.ExtraOutputs.add((
"xAOD::TrigConfKeys",
"TrigConfKeysOnline")) 
 
  583     alg.ExtraOutputs.add((
'xAOD::JetContainer',
'HLT_AntiKt4EMTopoJets_subjesIS' ))
 
  584     alg.ExtraOutputs.add((
'xAOD::JetContainer',
'HLT_AntiKt4EMTopoJets_subjesgscIS_ftf' ))
 
  585     alg.ExtraOutputs.add((
'xAOD::JetContainer',
'HLT_AntiKt4EMTopoJets_subresjesgscIS_ftf' ))
 
  586     alg.ExtraOutputs.add((
'xAOD::JetContainer',
'HLT_AntiKt4EMTopoJets_subjesIS_fastftag'))
 
  587     alg.ExtraOutputs.add((
'xAOD::JetContainer',
'HLT_AntiKt4EMPFlowJets_subjesgscIS_ftf' ))
 
  588     alg.ExtraOutputs.add((
'xAOD::JetContainer',
'HLT_AntiKt4EMPFlowJets_subjesIS_ftf'))
 
  589     alg.ExtraOutputs.add((
'xAOD::JetContainer',
'HLT_AntiKt4EMPFlowJets_subresjesgscIS_ftf' ))
 
  590     alg.ExtraOutputs.add((
'xAOD::JetContainer',
'HLT_AntiKt10LCTopoJets_subjes'))
 
  591     alg.ExtraOutputs.add((
'xAOD::CaloClusterContainer',
'HLT_TopoCaloClustersLCFS'))
 
  594     tool.RenounceOutputs = flags.Trigger.doHLT 
 
  597         groupedByType = defaultdict( list )
 
  598         re_ignore = [re.compile(x) 
for x 
in ignore]
 
  602             if not any([ outputType 
in el[1].
split() 
for outputType 
in edmSet ]):
 
  604             if any(ign.fullmatch(el[0]) 
for ign 
in re_ignore):
 
  606                 collType, collName = el[0].
split(
"#")
 
  607                 if collName[-1] != 
".":
 
  608                     collType = collType.replace(
"AuxInfo",
"Info").
replace(
"AuxContainer",
"Container")
 
  609                     __log.debug(
"GapFiller will create EDM decorations on type '%s' of '%s'", collType, collName)
 
  610                     collNameList = collName.split(
".") 
 
  611                     collName = (collNameList[0] + 
".").
replace(
"Aux.",
".")
 
  612                     for decorName 
in collNameList[1:]:
 
  613                         alg.ExtraOutputs.add((collType,
"StoreGateSvc+"+collName+decorName))
 
  615             collType, collName = el[0].
split(
"#")
 
  617                 aliases = [ 
str(a) 
for a 
in el[3] 
if isinstance(a, Alias) ]
 
  618                 if len(aliases) == 1:
 
  619                     __log.debug(
"GapFiller configuration found an aliased type '%s' for '%s'", aliases[0], collType)
 
  620                     collType = aliases[0]
 
  621                 elif len(aliases) > 1:
 
  622                     __log.error(
"GapFiller configuration found inconsistent '%s' (too many aliases?)", aliases)
 
  624             groupedByType[collType].
append( collName )
 
  626         for collType, collNameList 
in groupedByType.items():
 
  627             propName = collType.split(
":")[-1]
 
  628             if hasattr( tool, propName ):
 
  629                 setattr( tool, propName, collNameList )
 
  630                 __log.debug(
"GapFiller will create EDM collection type '%s' for '%s'", collType, collNameList)
 
  632                 __log.debug(
"EDM collections of type %s are not going to be added to StoreGate, if not created by the HLT", collType )
 
  634     if decObj 
or decObjHypoOut:
 
  635         __log.debug(
"GapFiller is ensuring the creation of all the decision object collections")
 
  636         __log.debug(
"'%s'", decObj)
 
  638         tool.FixLinks = 
list(decObjHypoOut)
 
  640         tool.TrigCompositeContainer += 
list(decObj)
 
  642     acc.addEventAlgo(alg, primary=
True)
 
  648     top of the trigger config (for real triggering online or on MC) 
  654     from TrigConfigSvc.TrigConfigSvcCfg 
import L1ConfigSvcCfg
 
  658     acc.addSequence( 
seqOR( 
"HLTTop") )
 
  661     if flags.Trigger.CostMonitoring.doCostMonitoring:
 
  662         acc.addSequence( 
parOR(
"HLTPreSeq"), parentName=
"HLTTop" )
 
  664     from TrigCostMonitor.TrigCostMonitorConfig 
import TrigCostMonitorCfg
 
  668     acc.addSequence( 
parOR(
"HLTBeginSeq"), parentName=
"HLTTop" )
 
  672     if flags.Trigger.doCFEmulationTest:
 
  673         from TriggerMenuMT.CFtest.EmuStepProcessingConfig 
import emulateHLTSeedingCfg
 
  678         if flags.Trigger.doRuntimeNaviVal: 
 
  679             acc.addEventAlgo( CompFactory.TrigChainNameParserChecker(), sequenceName=
"HLTBeginSeq" )
 
  681         from HLTSeeding.HLTSeedingConfig 
import HLTSeedingCfg
 
  684         from AthenaConfiguration.Enums 
import LHCPeriod
 
  685         if flags.GeoModel.Run > LHCPeriod.Run3:
 
  686             from InDetConfig.TrackRecoConfig 
import SiDetectorElementStatusCfg
 
  690     acc.merge( hltSeedingAcc,  sequenceName=
"HLTBeginSeq" )
 
  694         menuAcc = 
menu( flags )
 
  695         HLTSteps = menuAcc.getSequence( 
"HLTAllSteps" )
 
  696         __log.info( 
"Configured menu with %d steps", len(HLTSteps.Members))
 
  697         acc.merge( menuAcc, sequenceName=
"HLTTop")
 
  702     acc.addSequence( 
parOR(
"HLTEndSeq"), parentName=
"HLTTop" )
 
  703     acc.addSequence( 
seqAND(
"HLTFinalizeSeq"), parentName=
"HLTEndSeq" )
 
  705     nfilters = 
sum(len(v) 
for v 
in filters.values())
 
  706     nhypos = 
sum(len(v) 
for v 
in hypos.values())
 
  707     __log.info( 
"Algorithms counting: Number of Filter algorithms: %d  -  Number of Hypo algoirthms: %d", nfilters , nhypos)
 
  710     acc.merge( summaryAcc, sequenceName=
"HLTFinalizeSeq" )
 
  711     if flags.Trigger.doCFEmulationTest:
 
  712         summaryAlg.Prescaler=CompFactory.PrescalingEmulationTool()
 
  713     acc.addEventAlgo( summaryAlg, sequenceName=
"HLTFinalizeSeq" )
 
  717     hltSeedingAlg = hltSeedingAcc.getEventAlgo(
"HLTSeeding")
 
  720     acc.merge( monitoringAcc, sequenceName=
"HLTEndSeq" )
 
  721     acc.addEventAlgo( monitoringAlg, sequenceName=
"HLTEndSeq" )
 
  731     from TrigEDMConfig.TriggerEDMRun3 
import TriggerHLTListRun3, addHLTNavigationToEDMList
 
  732     __log.info( 
"Number of EDM items before adding navigation: %d", len(TriggerHLTListRun3))
 
  734     __log.info( 
"Number of EDM items after adding navigation: %d", len(TriggerHLTListRun3))
 
  738     if flags.Trigger.ExtraEDMList:
 
  739         from TrigEDMConfig.TriggerEDM 
import _addExtraCollectionsToEDMList
 
  740         __log.info( 
"Adding extra collections to EDM: %s", 
str(flags.Trigger.ExtraEDMList))
 
  745     acc.merge( outputAcc, sequenceName=
"HLTTop" )
 
  748     from TrigCostMonitor.TrigCostMonitorConfig 
import TrigCostMonitorFinalizeCfg
 
  751         acc.addEventAlgo(costFinalizeAlg, sequenceName=
"HLTFinalizeSeq" )
 
  759                                           decObj, decObjHypoOut), sequenceName=
"HLTFinalizeSeq" )
 
  761         if flags.Trigger.doOnlineNavigationCompactification:
 
  762             from TrigNavSlimmingMT.TrigNavSlimmingMTConfig 
import getTrigNavSlimmingMTOnlineConfig
 
  764             acc.addEventAlgo( onlineSlimAlg, sequenceName=
"HLTFinalizeSeq" )
 
  767     from TriggerMenuMT.HLT.Config.Utility.HLTMenuConfig 
import HLTMenuConfig
 
  768     HLTMenuConfig.destroy()
 
  775     Configures IDC cache loading 
  780     if flags.Trigger.doMuon:
 
  781         from MuonConfig.MuonBytestreamDecodeConfig 
import MuonCacheCfg
 
  782         acc.merge( 
MuonCacheCfg(flags), sequenceName = seqName )
 
  784         from MuonConfig.MuonRdoDecodeConfig 
import MuonPrdCacheCfg
 
  787     if flags.Trigger.doID:
 
  788         from TrigInDetConfig.TrigInDetConfig 
import InDetIDCCacheCreatorCfg
 
  791     if flags.Trigger.useActsTracking:
 
  792         from TrigInDetConfig.TrigInDetConfig 
import ActsIDCCacheCreatorCfg
 
  799     from TriggerMenuMT.HLT.Config.Utility.HLTMenuConfig 
import HLTMenuConfig
 
  801     acceptedEventChainDicts = [cd 
for cd 
in HLTMenuConfig.dictsList() \
 
  802                                if 'Calib' in cd[
'signatures'] \
 
  803                                and 'acceptedevts' in cd[
'chainParts'][0][
'purpose']]
 
  808     if not (flags.Trigger.enableEndOfEventProcessing 
and acceptedEventChainDicts):
 
  812     endOfEventRoIMaker = CompFactory.EndOfEventROIConfirmerAlg(
'EndOfEventROIConfirmerAlg')
 
  813     acc.addEventAlgo( endOfEventRoIMaker )
 
  814     acc.addSequence( 
parOR(
"acceptedEventTopSeq") )
 
  815     acc.getSequence(
"acceptedEventTopSeq").IgnoreFilterPassed=
True 
  818     def EndOfEventSeqCfg(flags, prescaleChain, purposes):
 
  820         seqLabel = prescaleChain.replace(
'HLT_acceptedevts',
'')
 
  821         seqName = 
'acceptedEventSeq'+seqLabel
 
  822         acc.addSequence( 
seqAND(seqName) )
 
  824         endOfEventFilterAlg = CompFactory.EndOfEventFilterAlg(
'EndOfEventFilterAlg'+seqLabel, ChainName=prescaleChain)
 
  825         acc.addEventAlgo(endOfEventFilterAlg, sequenceName=seqName)
 
  827         if 'larnoiseburst' in purposes:
 
  831             endOfEventFilterAlg.StreamFilter = [
'Main',
'VBFDelayed',
'TLA',
'DarkJetPEBTLA',
'FTagPEBTLA',
'CosmicCalo']
 
  833             from TriggerMenuMT.HLT.CalibCosmicMon.CalibChainConfiguration 
import getLArNoiseBurstRecoCfg
 
  835         elif any(purpose.startswith(
"met") 
for purpose 
in purposes):
 
  836             from TriggerMenuMT.HLT.MET.EndOfEvent 
import getMETRecoSequences
 
  838             endOfEventFilterAlg.StreamFilter = streams
 
  839             endOfEventRoIMaker.RoIs = [x 
for x 
in rois 
if x 
not in endOfEventRoIMaker.RoIs]
 
  840             acc.merge(metcfg, sequenceName=seqName)
 
  845     for acceptedEventChainDict 
in acceptedEventChainDicts:
 
  847         prescaleChain = acceptedEventChainDict[
'chainName']
 
  849         purposes = acceptedEventChainDict[
'chainParts'][0][
'purpose']
 
  851         acc.merge(EndOfEventSeqCfg(flags, prescaleChain, purposes), sequenceName=
"acceptedEventTopSeq")
 
  857     Configures components needed for processing trigger information in RAW/ESD step 
  866 if __name__ == 
"__main__":
 
  867     from AthenaConfiguration.AllConfigFlags 
import initConfigFlags
 
  870     flags.Trigger.forceEnableAllChains = 
True 
  871     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",]
 
  872     from AthenaConfiguration.TestDefaults 
import defaultGeometryTags
 
  873     flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN2
 
  878         menuCA.addSequence( 
seqAND(
"HLTAllSteps") )
 
  883     f=
open(
"TriggerRunConf.pkl",
"wb")