151def L1TriggerByteStreamDecoderCfg(flags):
152 acc = ComponentAccumulator()
153 decoderTools = []
154 maybeMissingRobs = []
155
156
159 if not flags.Trigger.doLVL1:
160 if doRoIBResult(flags):
161 roibResultTool = acc.popToolsAndMerge(RoIBResultByteStreamToolCfg(
162 flags, name="RoIBResultBSDecoderTool", writeBS=False))
163 decoderTools += [roibResultTool]
164
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
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
176
177 if not flags.Trigger.doLVL1 and flags.Trigger.CTP.UseEDMxAOD:
178 rob = 0
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
199
200 if flags.Trigger.L1.doeFex:
201
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
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
224
225 if not flags.Trigger.doHLT:
226 maybeMissingRobs += eFexByteStreamTool.ROBIDs
227
228
229
230
231 if flags.Trigger.L1.dojFex:
232
233 if flags.Trigger.doHLT:
234 jFexRoiByteStreamTool = acc.popToolsAndMerge(jFexRoiByteStreamToolCfg(
235 flags,
236 'jFexBSDecoderTool',
237 writeBS=False
238 ))
239
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
249
250
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
259
260
261
262
263
264 if flags.Trigger.L1.dogFex:
265
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
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
285
286
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
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
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
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
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
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