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
265 elif flags.Trigger.L1.doMuon
and flags.Trigger.enableL0Muon:
266 l1trMaker.MuRoIKey =
"LVL1MuonRoIs"
267 l1trMaker.ThresholdPatternTools += [CompFactory.MURoIThresholdsTool()]
270 if flags.Trigger.L1.doCalo
and flags.Trigger.enableL1CaloPhase1:
271 if flags.Trigger.L1.doeFex:
272 l1trMaker.eFexEMRoIKey =
"L1_eEMRoI"
273 l1trMaker.eFexTauRoIKey =
"L1_eTauRoI"
274 l1trMaker.ThresholdPatternTools += [
275 CompFactory.eFexEMRoIThresholdsTool(),
276 CompFactory.eFexTauRoIThresholdsTool(),
278 if flags.Trigger.L1.dojFex:
279 l1trMaker.jFexFwdElRoIKey =
"L1_jFexFwdElRoI"
280 l1trMaker.jFexTauRoIKey =
"L1_jFexTauRoI"
281 l1trMaker.jFexSRJetRoIKey =
"L1_jFexSRJetRoI"
282 l1trMaker.jFexLRJetRoIKey =
"L1_jFexLRJetRoI"
283 l1trMaker.ThresholdPatternTools += [
284 CompFactory.jFexFwdElRoIThresholdsTool(),
285 CompFactory.jFexTauRoIThresholdsTool(),
286 CompFactory.jFexSRJetRoIThresholdsTool(),
287 CompFactory.jFexLRJetRoIThresholdsTool(),
289 if flags.Trigger.L1.dogFex:
290 l1trMaker.gFexSRJetRoIKey =
"L1_gFexSRJetRoI"
291 l1trMaker.gFexLRJetRoIKey =
"L1_gFexLRJetRoI"
292 l1trMaker.ThresholdPatternTools += [
293 CompFactory.gFexSRJetRoIThresholdsTool(),
294 CompFactory.gFexLRJetRoIThresholdsTool(),
297 if flags.Trigger.L1.doeFex
and flags.Trigger.L1.dojFex:
298 l1trMaker.cTauRoIKey =
"L1_cTauRoI"
299 l1trMaker.cjTauLinkKey =
"L1_cTauRoI.jTauLink"
300 l1trMaker.ThresholdPatternTools += [
301 CompFactory.cTauRoIThresholdsTool(),
308 acc.addEventAlgo(l1trMaker, primary=
True)
314 from AthenaCommon.CFElements
import parOR
319 from HLTSeeding.HLTSeedingMonitoring
import CTPUnpackingMonitoring, L1DataConsistencyMonitoring
320 decoderAlg = CompFactory.HLTSeeding(
321 RoIBResult =
"RoIBResult",
322 L1TriggerResult =
"L1TriggerResult" if flags.Trigger.enableL1MuonPhase1
or flags.Trigger.enableL1CaloPhase1
else "",
323 HLTSeedingSummaryKey =
"HLTSeedingSummary",
324 ctpUnpacker = CompFactory.CTPUnpackingTool( ForceEnableAllChains = flags.Trigger.forceEnableAllChains,
329 if not (flags.Trigger.forceEnableAllChains
or flags.Trigger.disableL1ConsistencyChecker):
330 def checkConsistency(thrName):
331 '''Filter out threshold types for which HLT doesn't read TOBs from L1 readout'''
332 return thrName
not in [
'FSNOSEED',
'TE',
'XE',
'XS']
and not thrName.startswith(
'PROBE')
334 decoderAlg.L1DataConsistencyChecker = CompFactory.L1DataConsistencyChecker(
335 ThresholdToDecisionMap = dict([(k,v)
for k,v
in _mapL1ThresholdToDecisionCollection.items()
if checkConsistency(k)]),
337 ErrorOnMissingTOB = flags.Trigger.L1.errorOnMissingTOB )
340 from AthenaConfiguration.Enums
import Format
341 if flags.Input.Format
is Format.POOL:
342 transTypeKey = (
"TransientBSOutType",
"StoreGateSvc+TransientBSOutKey")
343 decoderAlg.ExtraInputs.add(transTypeKey)
345 decoderAlg.RoIBRoIUnpackers += [
349 if flags.Trigger.L1.doCalo:
350 if flags.Trigger.enableL1CaloPhase1:
352 if flags.Trigger.enableL1CaloLegacy:
355 if flags.Trigger.L1.doMuon:
356 if flags.Trigger.enableL1MuonPhase1:
363 decoderAlg.DoCostMonitoring = flags.Trigger.CostMonitoring.doCostMonitoring
364 decoderAlg.CostMonitoringChain = flags.Trigger.CostMonitoring.chain
365 decoderAlg.RoiZedWidthDefault = flags.Trigger.InDetTracking.RoiZedWidthDefault
367 if flags.Input.Format
is Format.BS
and not flags.Trigger.doLVL1:
369 from TrigT1ResultByteStream.TrigT1ResultByteStreamConfig
import L1TriggerByteStreamDecoderCfg
373 if flags.Trigger.enableL1MuonPhase1
or flags.Trigger.enableL1CaloPhase1:
376 acc.addEventAlgo( decoderAlg, sequenceName = seqName )
378 from TrigConfigSvc.TrigConfigSvcCfg
import TrigConfigSvcCfg, HLTPrescaleCondAlgCfg
383 from TriggerJobOpts.TriggerConfigFlags
import ROBPrefetching
384 if ROBPrefetching.InitialRoI
in flags.Trigger.ROBPrefetchingOptions:
385 allDecisionsSet =
set()
386 for roiUnpacker
in decoderAlg.RoIBRoIUnpackers + decoderAlg.xAODRoIUnpackers:
387 dec =
str(roiUnpacker.Decisions)
389 allDecisionsSet.add(dec)
391 from TrigGenericAlgs.TrigGenericAlgsConfig
import ROBPrefetchingAlgCfg_Si, ROBPrefetchingAlgCfg_Calo, ROBPrefetchingAlgCfg_Muon
392 acc.merge(
ROBPrefetchingAlgCfg_Si(flags,
"initialRoI", RoILinkName=
"initialRoI", ROBPrefetchingInputDecisions=allDecisions), sequenceName=seqName)
393 acc.merge(
ROBPrefetchingAlgCfg_Calo(flags,
"initialRoI", RoILinkName=
"initialRoI", ROBPrefetchingInputDecisions=allDecisions), sequenceName=seqName)
394 acc.merge(
ROBPrefetchingAlgCfg_Muon(flags,
"initialRoI", RoILinkName=
"initialRoI", ROBPrefetchingInputDecisions=allDecisions), sequenceName=seqName)
399 if __name__ ==
"__main__":
400 from AthenaConfiguration.AllConfigFlags
import initConfigFlags
401 from AthenaConfiguration.TestDefaults
import defaultTestFiles, defaultGeometryTags
404 flags.Trigger.forceEnableAllChains=
True
405 flags.Input.Files = defaultTestFiles.RAW_RUN2
406 flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN2