5 from AthenaConfiguration.ComponentAccumulator
import ComponentAccumulator
6 from AthenaConfiguration.ComponentFactory
import CompFactory
7 from AthenaCommon.Logging
import logging
8 from TrigEDMConfig.TriggerEDM
import recordable
12 log = logging.getLogger(
'HLTSeedingConfig')
14 _mapL1ThresholdToDecisionCollection = {
16 "FSNOSEED":
"HLTNav_L1FSNOSEED",
19 "PROBEMU" :
"HLTNav_L1PROBEMU",
21 "eEM":
"HLTNav_L1eEM",
22 "eTAU":
"HLTNav_L1eTAU",
23 "jEM":
"HLTNav_L1jEM",
24 "jTAU":
"HLTNav_L1jTAU",
25 "cTAU":
"HLTNav_L1cTAU",
27 "jLJ":
"HLTNav_L1jLJ",
29 "gLJ":
"HLTNav_L1gLJ",
30 "PROBEeEM" :
"HLTNav_L1PROBEeEM",
31 "PROBEjEM" :
"HLTNav_L1PROBEjEM",
32 "PROBEeTAU" :
"HLTNav_L1PROBEeTAU",
33 "PROBEjTAU" :
"HLTNav_L1PROBEjTAU",
34 "PROBEcTAU" :
"HLTNav_L1PROBEcTAU",
38 "TAU":
"HLTNav_L1TAU",
39 "XE" :
"HLTNav_L1MET",
40 "XS" :
"HLTNav_L1MET",
41 "TE" :
"HLTNav_L1MET",
42 "PROBEEM" :
"HLTNav_L1PROBEEM",
43 "PROBETAU" :
"HLTNav_L1PROBETAU",
46 _mapL1ThresholdToRoICollection = {
48 "FSNOSEED":
"HLT_FSRoI",
51 "PROBEMU" :
"HLT_MURoIs",
54 "eTAU":
"HLT_eTAURoIs",
56 "jTAU":
"HLT_jTAURoIs",
57 "cTAU":
"HLT_cTAURoIs",
62 "PROBEeEM" :
"HLT_eEMRoIs",
63 "PROBEeTAU":
"HLT_eTAURoIs",
64 "PROBEjEM":
"HLT_jEMRoIs",
65 "PROBEjTAU":
"HLT_jTAURoIs",
66 "PROBEcTAU":
"HLT_cTAURoIs",
74 "PROBEEM" :
"HLT_EMRoIs",
75 "PROBETAU" :
"HLT_TAURoI",
81 Translates L1 threshold name of the DecisionsContainer name in the HLTSeeding unpacking tools
84 for (thresholdType, l1Collection)
in _mapL1ThresholdToDecisionCollection.items():
85 if threshold.startswith( thresholdType ):
88 log.error(
"Threshold \""+ threshold +
"\" not mapped to any Decision collection! Available are: " +
str(_mapL1ThresholdToDecisionCollection.values()))
93 Translates L1 threshold name of the RoIDescriptor name in the HLTSeeding unpacking tools
96 for (thresholdType, l1Collection)
in _mapL1ThresholdToRoICollection.items():
97 if threshold.startswith( thresholdType ):
100 log.error(
"Threshold \""+ threshold +
"\" not mapped to any ROI collection! Available are: " +
str(_mapL1ThresholdToRoICollection.values()))
104 from HLTSeeding.HLTSeedingMonitoring
import RoIsUnpackingMonitoring
108 MonTool =
RoIsUnpackingMonitoring( flags, prefix=
"EM", maxCount=30, etaOffset=0.05, phiOffset=math.pi/64., maxEta=2.5 ))
117 tauUnpacker.MonTool =
RoIsUnpackingMonitoring( flags, prefix=
"TAU", maxCount=30, etaOffset=0.05, phiOffset=math.pi/64., maxEta=2.5 )
124 return [emUnpacker, metUnpacker, tauUnpacker, jUnpacker ]
127 from HLTSeeding.HLTSeedingMonitoring
import RoIsUnpackingMonitoring
130 if flags.Trigger.L1.doeFex:
131 maxRoICount_eFex = 150
132 eFexEMUnpacker = CompFactory.eFexEMRoIsUnpackingTool(
136 RoIHalfWidthEta = 0.2,
137 RoIHalfWidthPhi = 0.2,
139 eFexTauUnpacker = CompFactory.eFexTauRoIsUnpackingTool(
143 RoIHalfWidthEta = 0.4,
144 RoIHalfWidthPhi = math.pi/8,
146 tools += [eFexEMUnpacker, eFexTauUnpacker]
148 if flags.Trigger.L1.dojFex:
149 maxRoICount_jFex = 200
150 jFexEMUnpacker = CompFactory.jFexFwdElRoIsUnpackingTool(
154 RoIHalfWidthEta = 0.4,
155 RoIHalfWidthPhi = math.pi/8,
157 jFexTauUnpacker = CompFactory.jFexTauRoIsUnpackingTool(
161 RoIHalfWidthEta = 0.4,
162 RoIHalfWidthPhi = math.pi/8,
164 jFexSRJetUnpacker = CompFactory.jFexSRJetRoIsUnpackingTool(
167 RoIHalfWidthEta = 0.1,
168 RoIHalfWidthPhi = 0.1,
170 jFexLRJetUnpacker = CompFactory.jFexLRJetRoIsUnpackingTool(
173 RoIHalfWidthEta = 0.1,
174 RoIHalfWidthPhi = 0.1,
176 tools += [jFexEMUnpacker, jFexTauUnpacker, jFexSRJetUnpacker, jFexLRJetUnpacker]
178 if flags.Trigger.L1.dogFex:
179 maxRoICount_gFex = 100
180 gFexSRJetUnpacker = CompFactory.gFexSRJetRoIsUnpackingTool(
183 RoIHalfWidthEta = 0.1,
184 RoIHalfWidthPhi = 0.1,
186 gFexLRJetUnpacker = CompFactory.gFexLRJetRoIsUnpackingTool(
189 RoIHalfWidthEta = 0.1,
190 RoIHalfWidthPhi = 0.1,
192 tools += [gFexSRJetUnpacker, gFexLRJetUnpacker]
195 if flags.Trigger.L1.doeFex
and flags.Trigger.L1.dojFex:
196 maxRoICount_eFex = 150
197 cTauUnpacker = CompFactory.cTauRoIsUnpackingTool(
201 RoIHalfWidthEta = 0.4,
202 RoIHalfWidthPhi = math.pi/8,
204 tools += [cTauUnpacker]
209 from HLTSeeding.HLTSeedingMonitoring
import RoIsUnpackingMonitoring
210 muUnpacker = CompFactory.MURoIsUnpackingTool(
219 from HLTSeeding.HLTSeedingMonitoring
import RoIsUnpackingMonitoring
220 muUnpacker = CompFactory.MuonRoIsUnpackingTool(
224 RoIHalfWidthEta = 0.1,
225 RoIHalfWidthPhi = 0.1,
230 from HLTSeeding.HLTSeedingMonitoring
import PrescalingMonitoring
236 keyWriter = CompFactory.getComp(
'TrigConf::KeyWriterTool')(
'KeyWriterToolOnline')
237 keyWriter.ConfKeys =
'TrigConfKeysOnline'
238 keyWriter.IncludeL1PrescaleKey =
False
239 keyWriter.IncludeBunchgroupKey =
False
246 l1trMaker = CompFactory.L1TriggerResultMaker(
250 jFexFwdElRoIKey =
"",
252 jFexSRJetRoIKey =
"",
253 jFexLRJetRoIKey =
"",
254 gFexSRJetRoIKey =
"",
255 gFexLRJetRoIKey =
"",
258 ThresholdPatternTools = [] )
261 if flags.Trigger.L1.doMuon
and flags.Trigger.enableL1MuonPhase1:
262 l1trMaker.MuRoIKey =
"LVL1MuonRoIs"
263 from TrigT1MuctpiPhase1.TrigT1MuctpiPhase1Config
import TrigThresholdDecisionToolCfg
267 if flags.Trigger.L1.doCalo
and flags.Trigger.enableL1CaloPhase1:
268 if flags.Trigger.L1.doeFex:
269 l1trMaker.eFexEMRoIKey =
"L1_eEMRoI"
270 l1trMaker.eFexTauRoIKey =
"L1_eTauRoI"
271 l1trMaker.ThresholdPatternTools += [
272 CompFactory.eFexEMRoIThresholdsTool(),
273 CompFactory.eFexTauRoIThresholdsTool(),
275 if flags.Trigger.L1.dojFex:
276 l1trMaker.jFexFwdElRoIKey =
"L1_jFexFwdElRoI"
277 l1trMaker.jFexTauRoIKey =
"L1_jFexTauRoI"
278 l1trMaker.jFexSRJetRoIKey =
"L1_jFexSRJetRoI"
279 l1trMaker.jFexLRJetRoIKey =
"L1_jFexLRJetRoI"
280 l1trMaker.ThresholdPatternTools += [
281 CompFactory.jFexFwdElRoIThresholdsTool(),
282 CompFactory.jFexTauRoIThresholdsTool(),
283 CompFactory.jFexSRJetRoIThresholdsTool(),
284 CompFactory.jFexLRJetRoIThresholdsTool(),
286 if flags.Trigger.L1.dogFex:
287 l1trMaker.gFexSRJetRoIKey =
"L1_gFexSRJetRoI"
288 l1trMaker.gFexLRJetRoIKey =
"L1_gFexLRJetRoI"
289 l1trMaker.ThresholdPatternTools += [
290 CompFactory.gFexSRJetRoIThresholdsTool(),
291 CompFactory.gFexLRJetRoIThresholdsTool(),
294 if flags.Trigger.L1.doeFex
and flags.Trigger.L1.dojFex:
295 l1trMaker.cTauRoIKey =
"L1_cTauRoI"
296 l1trMaker.cjTauLinkKey =
"L1_cTauRoI.jTauLink"
297 l1trMaker.ThresholdPatternTools += [
298 CompFactory.cTauRoIThresholdsTool(),
305 acc.addEventAlgo(l1trMaker, primary=
True)
311 from AthenaCommon.CFElements
import parOR
316 from HLTSeeding.HLTSeedingMonitoring
import CTPUnpackingMonitoring, L1DataConsistencyMonitoring
317 decoderAlg = CompFactory.HLTSeeding(
318 RoIBResult =
"RoIBResult" if flags.Trigger.enableL1CaloLegacy
or not flags.Trigger.enableL1MuonPhase1
else "",
319 L1TriggerResult =
"L1TriggerResult" if flags.Trigger.enableL1MuonPhase1
or flags.Trigger.enableL1CaloPhase1
else "",
320 HLTSeedingSummaryKey =
"HLTSeedingSummary",
321 ctpUnpacker = CompFactory.CTPUnpackingTool( ForceEnableAllChains = flags.Trigger.forceEnableAllChains,
326 if not flags.Trigger.forceEnableAllChains:
327 def checkConsistency(thrName):
328 '''Filter out threshold types for which HLT doesn't read TOBs from L1 readout'''
329 return thrName
not in [
'FSNOSEED',
'TE',
'XE',
'XS']
and not thrName.startswith(
'PROBE')
331 decoderAlg.L1DataConsistencyChecker = CompFactory.L1DataConsistencyChecker(
332 ThresholdToDecisionMap = dict([(k,v)
for k,v
in _mapL1ThresholdToDecisionCollection.items()
if checkConsistency(k)]),
334 ErrorOnMissingTOB = flags.Trigger.L1.errorOnMissingTOB )
337 from AthenaConfiguration.Enums
import Format
338 if flags.Input.Format
is Format.POOL:
339 transTypeKey = (
"TransientBSOutType",
"StoreGateSvc+TransientBSOutKey")
340 decoderAlg.ExtraInputs.add(transTypeKey)
342 decoderAlg.RoIBRoIUnpackers += [
346 if flags.Trigger.L1.doCalo:
347 if flags.Trigger.enableL1CaloPhase1:
349 if flags.Trigger.enableL1CaloLegacy:
352 if flags.Trigger.L1.doMuon:
353 if flags.Trigger.enableL1MuonPhase1:
360 decoderAlg.DoCostMonitoring = flags.Trigger.CostMonitoring.doCostMonitoring
361 decoderAlg.CostMonitoringChain = flags.Trigger.CostMonitoring.chain
362 decoderAlg.RoiZedWidthDefault = flags.Trigger.InDetTracking.RoiZedWidthDefault
364 if flags.Input.Format
is Format.BS
and not flags.Trigger.doLVL1:
366 from TrigT1ResultByteStream.TrigT1ResultByteStreamConfig
import L1TriggerByteStreamDecoderCfg
370 if flags.Trigger.enableL1MuonPhase1
or flags.Trigger.enableL1CaloPhase1:
373 acc.addEventAlgo( decoderAlg, sequenceName = seqName )
375 from TrigConfigSvc.TrigConfigSvcCfg
import TrigConfigSvcCfg, HLTPrescaleCondAlgCfg
380 from TriggerJobOpts.TriggerConfigFlags
import ROBPrefetching
381 if ROBPrefetching.InitialRoI
in flags.Trigger.ROBPrefetchingOptions:
382 allDecisionsSet =
set()
383 for roiUnpacker
in decoderAlg.RoIBRoIUnpackers + decoderAlg.xAODRoIUnpackers:
384 dec =
str(roiUnpacker.Decisions)
386 allDecisionsSet.add(dec)
388 from TrigGenericAlgs.TrigGenericAlgsConfig
import ROBPrefetchingAlgCfg_Si, ROBPrefetchingAlgCfg_Calo, ROBPrefetchingAlgCfg_Muon
389 acc.merge(
ROBPrefetchingAlgCfg_Si(flags,
"initialRoI", RoILinkName=
"initialRoI", ROBPrefetchingInputDecisions=allDecisions), sequenceName=seqName)
390 acc.merge(
ROBPrefetchingAlgCfg_Calo(flags,
"initialRoI", RoILinkName=
"initialRoI", ROBPrefetchingInputDecisions=allDecisions), sequenceName=seqName)
391 acc.merge(
ROBPrefetchingAlgCfg_Muon(flags,
"initialRoI", RoILinkName=
"initialRoI", ROBPrefetchingInputDecisions=allDecisions), sequenceName=seqName)
396 if __name__ ==
"__main__":
397 from AthenaConfiguration.AllConfigFlags
import initConfigFlags
400 flags.Trigger.forceEnableAllChains=
True
401 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",]
402 from AthenaConfiguration.TestDefaults
import defaultGeometryTags
403 flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN2