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)
40 from AthenaMonitoringKernel.GenericMonitoringTool
import GenericMonitoringTool
50 title =
'L1 correlation; delta BC (relative to L1A); Events',
56 'BeforeAfterFlag,otherType',
59 title =
'delta BC vs Other-BC type; delta BC (relative to L1A); Other-BC type',
60 xbins = nbin, xmin = -maxBC-0.5, xmax = maxBC+0.5,
61 ybins = 8, ymin = -0.5, ymax = 7.5)
68 title =
'Type matrix ; L1A type ; Other-BC type',
69 xbins = 8, xmin = -0.5, xmax = 7.5,
70 ybins = 8, ymin = -0.5, ymax = 7.5)
73 'BeforeAfterFlag,l1Accept',
76 title =
'delta BC vs L1A type; delta BC (relative); L1A type',
77 xbins = nbin, xmin = -maxBC-0.5, xmax = maxBC+0.5,
78 ybins = 8, ymin = -0.5, ymax = 7.5)
85 title =
'Offset of earlier BC trigger relative to L1A; delta BC before; Events',
96 title =
'Offset of later BC trigger relative to L1A; delta BC after; Events',
107 title =
'Trigger type of the earlier neighbor BC; Type code; Events',
118 title =
'Trigger type of the later neighbor BC; Type code; Events',
126 'OtherTypeBefore,OtherTypeAfter',
129 title =
'Trigger type before vs after; Earlier BC type; Later BC type',
130 xbins = 8, xmin = -0.5, xmax = 7.5,
131 ybins = 8, ymin = -0.5, ymax = 7.5
136 'BeforeOffset,AfterOffset',
139 title =
'Offset before vs after; delta BC before; delta BC after',
140 xbins = maxBC, xmin = -0.5, xmax = maxBC + 0.5,
141 ybins = maxBC, ymin = -0.5, ymax = maxBC + 0.5
146 'DeltaBCAll,CTPIDAll;MistimeMap_TBP',
147 path=
'EXPERT', type=
'TH2F',
148 title=
'TBP occupancy vs delta BC and CTPID;delta BC (relative to L1A);CTPID',
149 xbins=2*maxBC+1, xmin=-maxBC-0.5, xmax=maxBC+0.5,
150 ybins=512, ymin=-0.5, ymax=511.5
155 'DeltaBCAll_TAP,CTPIDAll_TAP;MistimeMap_TAP',
156 path=
'EXPERT', type=
'TH2F',
157 title=
'TAP occupancy vs delta BC and CTPID;delta BC (relative to L1A);CTPID',
158 xbins=2*maxBC+1, xmin=-maxBC-0.5, xmax=maxBC+0.5,
159 ybins=512, ymin=-0.5, ymax=511.5
164 'CTPID0tbp_m2,CTPIDtbp_m2;PairMap_TBP_DeltaBCm2',
165 path=
'EXPERT', type=
'TH2F',
166 title=
'TBP: CTPID at BC 0 vs CTPID at BC=-2;CTPID at BC=0;CTPID at BC=-2',
167 xbins=512, xmin=-0.5, xmax=511.5,
168 ybins=512, ymin=-0.5, ymax=511.5
171 'CTPID0tbp_m1,CTPIDtbp_m1;PairMap_TBP_DeltaBCm1',
172 path=
'EXPERT', type=
'TH2F',
173 title=
'TBP: CTPID at BC 0 vs CTPID at BC=-1;CTPID at BC=0;CTPID at BC=-1',
174 xbins=512, xmin=-0.5, xmax=511.5,
175 ybins=512, ymin=-0.5, ymax=511.5
178 'CTPID0tbp_p1,CTPIDtbp_p1;PairMap_TBP_DeltaBCp1',
179 path=
'EXPERT', type=
'TH2F',
180 title=
'TBP: CTPID at BC 0 vs CTPID at BC=+1;CTPID at BC=0;CTPID at BC=+1',
181 xbins=512, xmin=-0.5, xmax=511.5,
182 ybins=512, ymin=-0.5, ymax=511.5
185 'CTPID0tbp_p2,CTPIDtbp_p2;PairMap_TBP_DeltaBCp2',
186 path=
'EXPERT', type=
'TH2F',
187 title=
'TBP: CTPID at BC 0 vs CTPID at BC=+2;CTPID at BC=0;CTPID at BC=+2',
188 xbins=512, xmin=-0.5, xmax=511.5,
189 ybins=512, ymin=-0.5, ymax=511.5
193 'CTPID0tap_m2,CTPIDtap_m2;PairMap_TAP_DeltaBCm2',
194 path=
'EXPERT', type=
'TH2F',
195 title=
'TAP: CTPID at BC 0 vs CTPID at BC=-2;CTPID at BC=0;CTPID at BC=-2',
196 xbins=512, xmin=-0.5, xmax=511.5, ybins=512, ymin=-0.5, ymax=511.5
199 'CTPID0tap_m1,CTPIDtap_m1;PairMap_TAP_DeltaBCm1',
200 path=
'EXPERT', type=
'TH2F',
201 title=
'TAP: CTPID at BC 0 vs CTPID at BC=-1;CTPID at BC=0;CTPID at BC=-1',
202 xbins=512, xmin=-0.5, xmax=511.5, ybins=512, ymin=-0.5, ymax=511.5
205 'CTPID0tap_p1,CTPIDtap_p1;PairMap_TAP_DeltaBCp1',
206 path=
'EXPERT', type=
'TH2F',
207 title=
'TAP: CTPID at BC 0 vs CTPID at BC=+1;CTPID at BC=0;CTPID at BC=+1',
208 xbins=512, xmin=-0.5, xmax=511.5, ybins=512, ymin=-0.5, ymax=511.5
211 'CTPID0tap_p2,CTPIDtap_p2;PairMap_TAP_DeltaBCp2',
212 path=
'EXPERT', type=
'TH2F',
213 title=
'TAP: CTPID at BC 0 vs CTPID at BC=+2;CTPID at BC=0;CTPID at BC=+2',
214 xbins=512, xmin=-0.5, xmax=511.5, ybins=512, ymin=-0.5, ymax=511.5
222 Factory for L1CorrelationAlg.
224 The C++ algorithm scans the full recorded window per event (from l1a_idx).
225 We book monitoring histograms with a fixed range (no job option).
231 return CompFactory.L1CorrelationAlg(name, **kw)
236 alg = CompFactory.ROBPrefetchingAlg(name, **kwargs)
237 alg.RegionSelectorTools = acc.popToolsAndMerge(
getRegSelTools(flags, regSelDets))
238 acc.addEventAlgo(alg, primary=
True)
243 return ROBPrefetchingAlgCfg(flags,
'ROBPrefetchingAlg_Si_'+nameSuffix, [
'Pixel',
'SCT'], **kwargs)
246 return ROBPrefetchingAlgCfg(flags,
'ROBPrefetchingAlg_Calo_'+nameSuffix, [
'TTEM',
'TTHEC',
'FCALEM',
'FCALHAD',
'TILE'], **kwargs)
249 return ROBPrefetchingAlgCfg(flags,
'ROBPrefetchingAlg_Muon_'+nameSuffix, [
'MDT',
'RPC',
'TGC',
'CSC',
'MM',
'sTGC'], **kwargs)
252 from TrigConfHLTUtils.HLTUtils
import string2hash
253 from AthenaCommon.CFElements
import getSequenceChildren, isSequence
254 from collections
import defaultdict
255 def sequenceAlgs(seq):
259 algs.extend(sequenceAlgs(alg))
260 elif alg.getName().startswith(
'IMEmpty'):
264 algs.append(alg.getName())
268 def firstNonEmptyStepAlgs(CF_list):
269 algsMap = defaultdict(list)
272 for cfseq_per_step
in CF_list:
273 for cfseq
in cfseq_per_step:
274 step = cfseq.sequenceCA.step
275 foundFirstSequence =
False
276 for ileg, menuSeq
in enumerate(step.sequences):
277 seqA = sequenceAlgs(menuSeq.sequence.Alg)
279 for stepD, chain
in zip(cfseq.stepDicts, cfseq.chains):
280 if chain
in firstSequence:
282 legName = stepD[ileg][
'chainName']
283 if legName
not in algsMap:
284 algsMap[legName] = seqA
285 firstSequence.append(chain)
286 foundFirstSequence =
True
288 if foundFirstSequence:
293 detGroupIdentifierAlgs = {
294 'Si' : [
'PixelRawDataProvider',
'SCTRawDataProvider'],
295 'Calo' : [
'HLTCaloCellMaker',
'FastCaloL2EgammaAlg'],
296 'Muon' : [
'RpcRawDataProvider',
'TgcRawDataProvider',
'MdtRawDataProvider',
'sTgcRawDataProvider',
'MMRawDataProvider']
299 def algsToDetGroup(algs):
301 for group,idAlgs
in detGroupIdentifierAlgs.items():
302 if any([ida
in algName
for algName
in algs
for ida
in idAlgs]):
305 raise RuntimeError(f
'Multiple detector groups: {groups:s} matched to the list of algs: {algs:s}')
306 return groups[0]
if groups
else None
315 algsMap = firstNonEmptyStepAlgs(CF_list)
316 for legName,algs
in algsMap.items():
317 det = algsToDetGroup(algs)
320 _log.debug(
"%s initialRoI will prefetch %s", legName, det)
322 return chainFilterMap
326 from AthenaCommon.AlgSequence
import AlgSequence
327 from AthenaCommon.CFElements
import findSubSequence, findAlgorithm
331 for det,chainFilter
in chainFilterMap.items():
332 prefetchAlg =
findAlgorithm(hltBeginSeq, f
'ROBPrefetchingAlg_{det}_initialRoI')
336 _log.info(
'No chains matched to %s - forcing ChainFilter=[0] to disable this alg\'s prefetching', prefetchAlg.getName())
339 prefetchAlg.ChainFilter = chainFilter
347 'Si': ROBPrefetchingAlgCfg_Si,
348 'Calo': ROBPrefetchingAlgCfg_Calo,
349 'Muon': ROBPrefetchingAlgCfg_Muon,
354 for det,chainFilter
in chainFilterMap.items():
358 _log.info(
'No chains matched to ROBPrefetchingAlg_%s_initialRoI - forcing ChainFilter=[0] to disable this alg\'s prefetching', det)
360 prefetchAlg = configurators[det](flags,
'initialRoI', ChainFilter=chainFilter)
361 prefetchCfg.merge(prefetchAlg)