ATLAS Offline Software
Loading...
Searching...
No Matches
TrigT1ResultByteStreamConfig Namespace Reference

Functions

 RoIBResultByteStreamToolCfg (flags, name, writeBS=False)
 CTPResultByteStreamToolCfg (flags, name, robID=0, writeBS=False)
 ExampleL1TriggerByteStreamToolCfg (flags, name, writeBS=False)
 MuonRoIByteStreamToolCfg (flags, name, writeBS=False, writeDecodedMuonRoIs=True)
 doRoIBResult (flags)
 L1TriggerByteStreamDecoderCfg (flags)
 L1TriggerByteStreamEncoderCfg (flags)
 MuCTPIPhase1ByteStreamAlgoCfg (flags)

Variables

 _log = logging.getLogger('TrigT1ResultByteStreamConfig')

Function Documentation

◆ CTPResultByteStreamToolCfg()

TrigT1ResultByteStreamConfig.CTPResultByteStreamToolCfg ( flags,
name,
robID = 0,
writeBS = False )

Definition at line 51 of file TrigT1ResultByteStreamConfig.py.

51def CTPResultByteStreamToolCfg(flags, name, robID=0, writeBS=False):
52 acc = ComponentAccumulator()
53 tool = CompFactory.CTPResultByteStreamTool(name)
54 ctp_robid = int(SourceIdentifier(SubDetector.TDAQ_CTP, robID)) # (robID=1 for ROIB ROB , robID=0 for CTP ROB)
55 tool.ROBIDs = [ctp_robid]
56
57 if writeBS:
58 # write BS == read RDO
59 tool.CTPResultReadKey="CTPResult"
60 tool.CTPResultWriteKey=""
61 else:
62 # read BS == write RDO
63 tool.CTPResultReadKey=""
64 tool.CTPResultWriteKey="CTPResult"
65
66 acc.setPrivateTools(tool)
67 return acc
68

◆ doRoIBResult()

TrigT1ResultByteStreamConfig.doRoIBResult ( flags)
Helper function returning a logic combination of flags deciding
whether the RoIBResult decoding/encoding is required in the job

Definition at line 131 of file TrigT1ResultByteStreamConfig.py.

131def doRoIBResult(flags):
132 '''
133 Helper function returning a logic combination of flags deciding
134 whether the RoIBResult decoding/encoding is required in the job
135 '''
136 if flags.Trigger.L1.doCalo and flags.Trigger.enableL1CaloLegacy:
137 # Only needed for legacy (Run-2) L1Calo system
138 return True
139 if flags.Trigger.L1.doMuon and not flags.Trigger.enableL1MuonPhase1:
140 # Only needed for legacy (Run-2) MUCTPI data
141 return True
142 if flags.Trigger.L1.doTopo:
143 # Currently only RoIBResult path implemented for L1Topo
144 return True
145 if flags.Trigger.L1.doCTP and not flags.Trigger.CTP.UseEDMxAOD:
146 # Currently only RoIBResult path implemented for CTP
147 return True
148 # Otherwise don't need RoIBResult
149 return False
150

◆ ExampleL1TriggerByteStreamToolCfg()

TrigT1ResultByteStreamConfig.ExampleL1TriggerByteStreamToolCfg ( flags,
name,
writeBS = False )

Definition at line 69 of file TrigT1ResultByteStreamConfig.py.

69def ExampleL1TriggerByteStreamToolCfg(flags, name, writeBS=False):
70 acc = ComponentAccumulator()
71 tool = CompFactory.ExampleL1TriggerByteStreamTool(name)
72 muctpi_moduleid = 0
73 muctpi_robid = int(SourceIdentifier(SubDetector.TDAQ_MUON_CTP_INTERFACE, muctpi_moduleid))
74 tool.ROBIDs = [muctpi_robid]
75 if writeBS:
76 # write BS == read xAOD
77 tool.MuonRoIContainerReadKey="LVL1MuonRoIs"
78 tool.MuonRoIContainerWriteKey=""
79 tool.L1TopoOutputLocID=""
80 else:
81 # read BS == write xAOD
82 tool.MuonRoIContainerReadKey=""
83 tool.MuonRoIContainerWriteKey=recordable("LVL1MuonRoIs")
84 acc.setPrivateTools(tool)
85 return acc
86

◆ L1TriggerByteStreamDecoderCfg()

TrigT1ResultByteStreamConfig.L1TriggerByteStreamDecoderCfg ( flags)

Definition at line 151 of file TrigT1ResultByteStreamConfig.py.

151def L1TriggerByteStreamDecoderCfg(flags):
152 acc = ComponentAccumulator()
153 decoderTools = []
154 maybeMissingRobs = []
155
156
159 if not flags.Trigger.doLVL1: #if we rerun L1, don't decode the original RoIBResult
160 if doRoIBResult(flags):
161 roibResultTool = acc.popToolsAndMerge(RoIBResultByteStreamToolCfg(
162 flags, name="RoIBResultBSDecoderTool", writeBS=False))
163 decoderTools += [roibResultTool]
164 # Always treat L1Topo as "maybe missing" as it was under commissioning in Run 2 and had readout issues in Run 3
165 for module_id in roibResultTool.L1TopoModuleIds:
166 maybeMissingRobs.append(int(SourceIdentifier(SubDetector.TDAQ_CALO_TOPO_PROC, module_id)))
167 if flags.Trigger.EDMVersion == 2 and not flags.Trigger.doHLT:
168 # L1Calo occasional readout errors weren't caught by HLT in 2015 - ignore these in offline reco, see ATR-24493
169 for module_id in roibResultTool.JetModuleIds:
170 maybeMissingRobs.append(int(SourceIdentifier(SubDetector.TDAQ_CALO_JET_PROC_ROI, module_id)))
171 for module_id in roibResultTool.EMModuleIds:
172 maybeMissingRobs.append(int(SourceIdentifier(SubDetector.TDAQ_CALO_CLUSTER_PROC_ROI, module_id)))
173
174 # ########################################
175 # # CTP decoding via CTPResult
176 # ########################################
177 if not flags.Trigger.doLVL1 and flags.Trigger.CTP.UseEDMxAOD:
178 rob = 0 # use CTP ROB by default
179 if flags.Trigger.CTP.UseRoibROB:
180 rob = 1
181 ctpResultTool = acc.popToolsAndMerge(CTPResultByteStreamToolCfg(
182 flags, name="CTPResultBSDecoderTool", robID=rob, writeBS=False))
183 decoderTools += [ctpResultTool]
184
185
188 if flags.Trigger.L1.doMuon and flags.Trigger.enableL1MuonPhase1 and flags.Trigger.doHLT :
189 muonRoiTool = acc.popToolsAndMerge(MuonRoIByteStreamToolCfg(
190 flags, name="L1MuonBSDecoderTool", writeBS=False))
191 decoderTools += [muonRoiTool]
192
193
196 if flags.Trigger.L1.doCalo and flags.Trigger.enableL1CaloPhase1:
197 #--------------------
198 # eFex
199 #--------------------
200 if flags.Trigger.L1.doeFex:
201 # Online case in HLT with TOB decoding only
202 if flags.Trigger.doHLT:
203 eFexByteStreamTool = acc.popToolsAndMerge(eFexByteStreamToolCfg(
204 flags,
205 'eFexBSDecoderTool',
206 writeBS=False,
207 TOBs=True,
208 xTOBs=False,
209 multiSlice=False
210 ))
211 # Reco/monitoring case (either online but downstream from HLT, or at Tier-0) with xTOB, input tower and multi-slice decoding
212 else:
213 eFexByteStreamTool = acc.popToolsAndMerge(eFexByteStreamToolCfg(
214 flags,
215 'eFexBSDecoderTool',
216 writeBS=False,
217 TOBs=False,
218 xTOBs=True,
219 multiSlice=True,
220 decodeInputs=flags.Trigger.L1.doCaloInputs
221 ))
222 decoderTools += [eFexByteStreamTool]
223 # Allow the data to be missing at T0, due to the commissioning of the phase-1 L1Calo in RAW data from 2022
224 # Forbit the data to be missing at Point 1 (2023+)
225 if not flags.Trigger.doHLT:
226 maybeMissingRobs += eFexByteStreamTool.ROBIDs
227
228 #--------------------
229 # jFex
230 #--------------------
231 if flags.Trigger.L1.dojFex:
232 # Online case in HLT with TOB decoding only
233 if flags.Trigger.doHLT:
234 jFexRoiByteStreamTool = acc.popToolsAndMerge(jFexRoiByteStreamToolCfg(
235 flags,
236 'jFexBSDecoderTool',
237 writeBS=False
238 ))
239 # Reco/monitoring case (either online but downstream from HLT, or at Tier-0) with xTOB decoding only
240 else:
241 jFexRoiByteStreamTool = acc.popToolsAndMerge(jFexRoiByteStreamToolCfg(
242 flags,
243 'jFexBSDecoderTool',
244 writeBS=False,
245 xTOBs=True
246 ))
247 decoderTools += [jFexRoiByteStreamTool]
248 maybeMissingRobs += jFexRoiByteStreamTool.ROBIDs # Allow the data to be missing during commissioning of the phase-1 L1Calo (2022)
249
250 # Input towers decoding
251 if flags.Trigger.L1.doCaloInputs:
252 jFexInputByteStreamTool = acc.popToolsAndMerge(jFexInputByteStreamToolCfg(
253 flags,
254 'jFexInputBSDecoderTool',
255 writeBS=False
256 ))
257 decoderTools += [jFexInputByteStreamTool]
258 maybeMissingRobs += jFexInputByteStreamTool.ROBIDs # Allow the data to be missing during commissioning of the phase-1 L1Calo (2022)
259
260
261 #--------------------
262 # gFex
263 #--------------------
264 if flags.Trigger.L1.dogFex:
265 # Online case in HLT with TOB decoding (no 'else' case because gFex doesn't have xTOBs to decode offline)
266 if flags.Trigger.doHLT:
267 gFexByteStreamTool = acc.popToolsAndMerge(gFexByteStreamToolCfg(
268 flags,
269 'gFexBSDecoderTool',
270 writeBS=False
271 ))
272 decoderTools += [gFexByteStreamTool]
273 maybeMissingRobs += gFexByteStreamTool.ROBIDs # Allow the data to be missing during commissioning of the phase-1 L1Calo (2022)
274
275 else:
276 gFexByteStreamTool = acc.popToolsAndMerge(gFexByteStreamToolCfg(
277 flags,
278 'gFexBSDecoderTool',
279 writeBS=False,
280 multiSlice=True,
281 TOBs=False
282 ))
283 decoderTools += [gFexByteStreamTool]
284 maybeMissingRobs += gFexByteStreamTool.ROBIDs # Allow the data to be missing during commissioning of the phase-1 L1Calo (2022)
285
286 # Input towers decoding
287 if flags.Trigger.L1.doCaloInputs:
288 gFexInputByteStreamTool = acc.popToolsAndMerge(gFexInputByteStreamToolCfg(
289 flags,
290 'gFexInputBSDecoderTool',
291 writeBS=False
292 ))
293 decoderTools += [gFexInputByteStreamTool]
294 maybeMissingRobs += gFexInputByteStreamTool.ROBIDs # Allow the data to be missing during commissioning of the phase-1 L1Calo (2022)
295
296
299 if flags.Trigger.L1.doTopo and flags.Trigger.enableL1CaloPhase1 and flags.Trigger.L1.doTopoPhase1:
300 topoByteStreamTool = acc.popToolsAndMerge(L1TopoPhase1ByteStreamToolCfg(
301 flags,
302 "L1TopoBSDecoderTool",
303 writeBS=False
304 ))
305 decoderTools += [topoByteStreamTool]
306 maybeMissingRobs += topoByteStreamTool.ROBIDs # Allow the data to be missing during commissioning of the phase-1 L1Topo (2022)
307
308 decoderAlg = CompFactory.L1TriggerByteStreamDecoderAlg(name="L1TriggerByteStreamDecoder",
309 DecoderTools=decoderTools,
310 MaybeMissingROBs=list(set(maybeMissingRobs)))
311
312 if flags.Trigger.doHLT or flags.DQ.Steering.doHLTMon:
313 from TrigT1ResultByteStream.TrigT1ResultByteStreamMonitoringConfig import L1TriggerByteStreamDecoderMonitoringCfg
314 decoderAlg.MonTool = acc.popToolsAndMerge(L1TriggerByteStreamDecoderMonitoringCfg(flags, decoderAlg.getName(), decoderTools))
315
316 acc.addEventAlgo(decoderAlg, primary=True)
317
318 # The decoderAlg needs to load ByteStreamMetadata for the detector mask
319 from TriggerJobOpts.TriggerByteStreamConfig import ByteStreamReadCfg
320 readBSAcc = ByteStreamReadCfg(flags)
321 readBSAcc.getEventAlgo('SGInputLoader').Load.add(
322 ('ByteStreamMetadataContainer', 'InputMetaDataStore+ByteStreamMetadata'))
323 acc.merge(readBSAcc)
324
325 # In reconstruction/monitoring jobs add the decoders' output EDM to the output file
326 if not flags.Trigger.doHLT:
327 from OutputStreamAthenaPool.OutputStreamConfig import addToESD, addToAOD
328 outputEDM = getEDMListFromWriteHandles([tool for tool in decoderAlg.DecoderTools if ('RoIBResult' not in tool.getName() and 'CTPResult' not in tool.getName())])
329
330 # Only add CTPResult explicitly if CTP decoding via CTPResult is being used and result uses CTP ROB
331 if (any('CTPResult' in tool.getName() for tool in decoderAlg.DecoderTools) and (not flags.Trigger.CTP.UseRoibROB)):
332 for item in ('xAOD::CTPResult#CTPResult','xAOD::CTPResultAuxInfo#CTPResultAux.-'):
333 outputEDM.append(item)
334
335 _log.info('Adding the following output EDM to ItemList: %s', outputEDM)
336 acc.merge(addToESD(flags, outputEDM))
337 acc.merge(addToAOD(flags, outputEDM))
338
339 return acc
340
STL class.

◆ L1TriggerByteStreamEncoderCfg()

TrigT1ResultByteStreamConfig.L1TriggerByteStreamEncoderCfg ( flags)

Definition at line 341 of file TrigT1ResultByteStreamConfig.py.

341def L1TriggerByteStreamEncoderCfg(flags):
342 acc = ComponentAccumulator()
343
344 # Legacy encoding via RoIBResult
345 if doRoIBResult(flags):
346 roibResultTool = acc.popToolsAndMerge(RoIBResultByteStreamToolCfg(
347 flags, name="RoIBResultBSEncoderTool", writeBS=True))
348 acc.addPublicTool(roibResultTool)
349
350 # Run-3 L1Muon encoding
351 if flags.Trigger.L1.doMuon and flags.Trigger.enableL1MuonPhase1:
352 muonRoiTool = acc.popToolsAndMerge(MuonRoIByteStreamToolCfg(
353 flags, name="L1MuonBSEncoderTool", writeBS=True))
354 acc.addPublicTool(muonRoiTool)
355
356 # Phase-I CTP encoding
357 if flags.Trigger.CTP.UseEDMxAOD:
358 ctpResultTool = acc.popToolsAndMerge(CTPResultByteStreamToolCfg(
359 flags, name="CTPResultBSEncoderTool", writeBS=True))
360 acc.addPublicTool(ctpResultTool)
361
362 # eFex encoding
363 if flags.Trigger.L1.doeFex:
364 eFexTool = acc.popToolsAndMerge(eFexByteStreamToolCfg(
365 flags,
366 'eFexBSEncoderTool',
367 writeBS=True,
368 TOBs=True,
369 xTOBs=True,
370 multiSlice=False, # multi-slice encoding not yet supported in encoder
371 decodeInputs=flags.Trigger.L1.doCaloInputs
372 ))
373 acc.addPublicTool(eFexTool)
374
375 # TODO: Run-3 L1Calo, L1Topo
376
377 return acc
378

◆ MuCTPIPhase1ByteStreamAlgoCfg()

TrigT1ResultByteStreamConfig.MuCTPIPhase1ByteStreamAlgoCfg ( flags)

Definition at line 379 of file TrigT1ResultByteStreamConfig.py.

379def MuCTPIPhase1ByteStreamAlgoCfg(flags):
380 #print("MUCTPI DQ DEBUG python include algo")
381 acc = ComponentAccumulator()
382 alg = CompFactory.MuCTPIPhase1ByteStreamAlgo()
383 acc.addEventAlgo(alg)
384 return acc
385

◆ MuonRoIByteStreamToolCfg()

TrigT1ResultByteStreamConfig.MuonRoIByteStreamToolCfg ( flags,
name,
writeBS = False,
writeDecodedMuonRoIs = True )

Definition at line 87 of file TrigT1ResultByteStreamConfig.py.

87def MuonRoIByteStreamToolCfg(flags, name, writeBS=False, writeDecodedMuonRoIs=True):
88 acc = ComponentAccumulator()
89 tool = CompFactory.MuonRoIByteStreamTool(name)
90 muctpi_moduleid = 0 # No RoIB in Run 3, we always read the DAQ ROB
91 muctpi_robid = int(SourceIdentifier(SubDetector.TDAQ_MUON_CTP_INTERFACE, muctpi_moduleid)) # 0x760000
92 tool.ROBIDs = [muctpi_robid]
93 tool.DoTopo = flags.Trigger.L1.doMuonTopoInputs
94 tool.WriteDecodedMuonRoIs = writeDecodedMuonRoIs
95
96 from TrigT1ResultByteStream.TrigT1ResultByteStreamMonitoringConfig import L1MuonBSConverterMonitoringCfg
97 tool.MonTool = acc.popToolsAndMerge(L1MuonBSConverterMonitoringCfg(flags, name, writeBS))
98
99 # Build container names for each bunch crossing in the maximum readout window (size 5)
100 containerBaseName = "LVL1MuonRoIs"
101 containerNames = [
102 containerBaseName + "BCm2",
103 containerBaseName + "BCm1",
104 containerBaseName,
105 containerBaseName + "BCp1",
106 containerBaseName + "BCp2",
107 ]
108 topocontainerBaseName = "L1MuCTPItoL1TopoLocationFromMuonRoI"
109 topocontainerNames = [
110 topocontainerBaseName + "-2",
111 topocontainerBaseName + "-1",
112 topocontainerBaseName,
113 topocontainerBaseName + "1",
114 topocontainerBaseName + "2",
115 ]
116 if writeBS:
117 # write BS == read xAOD
118 tool.MuonRoIContainerReadKeys += containerNames
119 else:
120 # read BS == write xAOD
121 tool.MuonRoIContainerWriteKeys += [recordable(c) for c in containerNames]
122 tool.L1TopoOutputLocID += topocontainerNames
123
124 tool.RPCRecRoiTool = acc.popToolsAndMerge(RPCRecRoiToolCfg(flags))
125 tool.TGCRecRoiTool = acc.popToolsAndMerge(TGCRecRoiToolCfg(flags))
126 tool.TrigThresholdDecisionTool = acc.popToolsAndMerge(TrigThresholdDecisionToolCfg(flags))
127
128 acc.setPrivateTools(tool)
129 return acc
130

◆ RoIBResultByteStreamToolCfg()

TrigT1ResultByteStreamConfig.RoIBResultByteStreamToolCfg ( flags,
name,
writeBS = False )

Definition at line 18 of file TrigT1ResultByteStreamConfig.py.

18def RoIBResultByteStreamToolCfg(flags, name, writeBS=False):
19 acc = ComponentAccumulator()
20 tool = CompFactory.RoIBResultByteStreamTool(name)
21
22 if not flags.Trigger.L1.doCTP or flags.Trigger.CTP.UseEDMxAOD:
23 # disable CTP ByteStream decoding/encoding as part of RoIBResult if doCTP is disabled or if CTPResultByteStreamTool is used instead
24 tool.CTPModuleId = 0xFF
25
26 if flags.Trigger.enableL1MuonPhase1 or not flags.Trigger.L1.doMuon:
27 # disable legacy MUCTPI ByteStream decoding/encoding as part of RoIBResult
28 tool.MUCTPIModuleId = 0xFF
29
30 if not flags.Trigger.enableL1CaloLegacy or not flags.Trigger.L1.doCalo:
31 # disable legacy L1Calo ByteStream decoding/encoding as part of RoIBResult
32 tool.JetModuleIds = []
33 tool.EMModuleIds = []
34
35 if flags.Trigger.EDMVersion == 1 or not flags.Trigger.L1.doTopo:
36 # disable legacy L1Topo ByteStream decoding/encoding as part of RoIBResult
37 tool.L1TopoModuleIds = []
38
39 if writeBS:
40 # write BS == read RDO
41 tool.RoIBResultReadKey="RoIBResult"
42 tool.RoIBResultWriteKey=""
43 else:
44 # read BS == write RDO
45 tool.RoIBResultReadKey=""
46 tool.RoIBResultWriteKey="RoIBResult"
47
48 acc.setPrivateTools(tool)
49 return acc
50

Variable Documentation

◆ _log

TrigT1ResultByteStreamConfig._log = logging.getLogger('TrigT1ResultByteStreamConfig')
protected

Definition at line 16 of file TrigT1ResultByteStreamConfig.py.