3 from AthenaConfiguration.ComponentAccumulator
import ComponentAccumulator
4 from AthenaConfiguration.ComponentFactory
import CompFactory
5 from TrigPartialEventBuilding.TrigPartialEventBuildingConfig
import getRegSelTools
6 from AthenaCommon.Logging
import logging
7 _log = logging.getLogger( __name__ )
11 return CompFactory.TimeBurner(name, **kwargs)
15 return CompFactory.TrigGenericHypoTool(chainDict[
'chainName'],
19 return CompFactory.EndOfEventROIConfirmerAlg(name)
22 return CompFactory.EndOfEventFilterAlg(name, ChainName=chainName)
24 def TrigEventInfoRecorderAlgCfg(flags, name, trigEventInfoKey, decoratePFlowInfo, decorateEMTopoInfo, renounceAll=False, primaryVertexInputName="HLT_IDVertex_FS", RhoKey_PFlow = 'HLT_Kt4EMPFlowEventShape', RhoKey_EMTopo = 'HLT_Kt4EMTopoEventShape'):
26 alg = CompFactory.TrigEventInfoRecorderAlg(name,
27 trigEventInfoKey = trigEventInfoKey,
28 decoratePFlowInfo = decoratePFlowInfo,
29 decorateEMTopoInfo = decorateEMTopoInfo,
30 renounceAll = renounceAll,
31 primaryVertexInputName = primaryVertexInputName,
32 RhoKey_PFlow = RhoKey_PFlow,
33 RhoKey_EMTopo = RhoKey_EMTopo,
35 acc.addEventAlgo(alg, primary=
True)
39 from AthenaMonitoringKernel.GenericMonitoringTool
import GenericMonitoringTool
41 monTool.defineHistogram(
'EF_L1Corr_beforeafterflag', path=
'EXPERT', type=
'TH1F', title=
'beforeafterflag', xbins=4, xmin=-1.5, xmax=2.5)
42 monTool.defineHistogram(
'EF_L1Corr_l1a_type, EF_L1Corr_other_type', path=
'EXPERT', type=
'TH2F', title=
"typeMatrix ; L1A; Other", xbins=8, xmin=-0.5, xmax=7.5, ybins=8, ymin=-0.5, ymax=7.5)
47 return CompFactory.L1CorrelationAlg(name, **kwargs)
51 alg = CompFactory.ROBPrefetchingAlg(name, **kwargs)
52 alg.RegionSelectorTools = acc.popToolsAndMerge(
getRegSelTools(flags, regSelDets))
53 acc.addEventAlgo(alg, primary=
True)
58 return ROBPrefetchingAlgCfg(flags,
'ROBPrefetchingAlg_Si_'+nameSuffix, [
'Pixel',
'SCT'], **kwargs)
61 return ROBPrefetchingAlgCfg(flags,
'ROBPrefetchingAlg_Calo_'+nameSuffix, [
'TTEM',
'TTHEC',
'FCALEM',
'FCALHAD',
'TILE'], **kwargs)
64 return ROBPrefetchingAlgCfg(flags,
'ROBPrefetchingAlg_Muon_'+nameSuffix, [
'MDT',
'RPC',
'TGC',
'CSC',
'MM',
'sTGC'], **kwargs)
67 from TrigConfHLTUtils.HLTUtils
import string2hash
68 from AthenaCommon.CFElements
import getSequenceChildren, isSequence
69 from collections
import defaultdict
70 def sequenceAlgs(seq):
74 algs.extend(sequenceAlgs(alg))
75 elif alg.getName().startswith(
'IMEmpty'):
79 algs.append(alg.getName())
83 def firstNonEmptyStepAlgs(CF_list):
84 algsMap = defaultdict(list)
87 for cfseq_per_step
in CF_list:
88 for cfseq
in cfseq_per_step:
89 step = cfseq.sequenceCA.step
90 foundFirstSequence =
False
91 for ileg, menuSeq
in enumerate(step.sequences):
92 seqA = sequenceAlgs(menuSeq.sequence.Alg)
94 for stepD, chain
in zip(cfseq.stepDicts, cfseq.chains):
95 if chain
in firstSequence:
97 legName = stepD[ileg][
'chainName']
98 if legName
not in algsMap:
99 algsMap[legName] = seqA
100 firstSequence.append(chain)
101 foundFirstSequence =
True
103 if foundFirstSequence:
108 detGroupIdentifierAlgs = {
109 'Si' : [
'PixelRawDataProvider',
'SCTRawDataProvider'],
110 'Calo' : [
'HLTCaloCellMaker',
'FastCaloL2EgammaAlg'],
111 'Muon' : [
'RpcRawDataProvider',
'TgcRawDataProvider',
'MdtRawDataProvider',
'sTgcRawDataProvider',
'MMRawDataProvider']
114 def algsToDetGroup(algs):
116 for group,idAlgs
in detGroupIdentifierAlgs.items():
117 if any([ida
in algName
for algName
in algs
for ida
in idAlgs]):
120 raise RuntimeError(f
'Multiple detector groups: {groups:s} matched to the list of algs: {algs:s}')
121 return groups[0]
if groups
else None
130 algsMap = firstNonEmptyStepAlgs(CF_list)
131 for legName,algs
in algsMap.items():
132 det = algsToDetGroup(algs)
135 _log.debug(
"%s initialRoI will prefetch %s", legName, det)
137 return chainFilterMap
141 from AthenaCommon.AlgSequence
import AlgSequence
142 from AthenaCommon.CFElements
import findSubSequence, findAlgorithm
146 for det,chainFilter
in chainFilterMap.items():
147 prefetchAlg =
findAlgorithm(hltBeginSeq, f
'ROBPrefetchingAlg_{det}_initialRoI')
151 _log.info(
'No chains matched to %s - forcing ChainFilter=[0] to disable this alg\'s prefetching', prefetchAlg.getName())
154 prefetchAlg.ChainFilter = chainFilter
162 'Si': ROBPrefetchingAlgCfg_Si,
163 'Calo': ROBPrefetchingAlgCfg_Calo,
164 'Muon': ROBPrefetchingAlgCfg_Muon,
169 for det,chainFilter
in chainFilterMap.items():
173 _log.info(
'No chains matched to ROBPrefetchingAlg_%s_initialRoI - forcing ChainFilter=[0] to disable this alg\'s prefetching', det)
175 prefetchAlg = configurators[det](flags,
'initialRoI', ChainFilter=chainFilter)
176 prefetchCfg.merge(prefetchAlg)