312def Run3TriggerBSUnpackingCfg(flags):
313 """Configures conversions BS -> HLTResultMT -> Collections """
314 acc = ComponentAccumulator()
315
316 if flags.Trigger.decodeHLT is False:
317 log.debug("Run3TriggerBSUnpackingCfg: Nothing to do as Trigger.decodeHLT is False")
318 return acc
319
320 from AthenaCommon.CFElements import seqAND
321 from TrigEDMConfig.DataScoutingInfo import (
322 getDataScoutingStreams, getDataScoutingTypeFromStream,
323 getFullHLTResultID, getDataScoutingResultID,
324 )
325 from TriggerJobOpts.TriggerConfig import triggerEDMGapFillerCfg
326 from TrigDecisionTool.TrigDecisionToolConfig import getRun3NavigationContainerFromInput
327 ids_to_decode = []
328
329
330 if flags.Input.TriggerStream in getDataScoutingStreams():
331 dstype = getDataScoutingTypeFromStream(flags.Input.TriggerStream)
332
333 log.info(f'Configuring BS decoding/deserialisation of HLT result for \'{dstype}\' only')
334 ids_to_decode = [getDataScoutingResultID(dstype)]
335 id_to_deserialise = {dstype: getDataScoutingResultID(dstype)}
336 else:
337
338 ids_to_decode = [getFullHLTResultID()]
339 id_to_deserialise = {'': getFullHLTResultID()}
340
341
342 log.debug('Configuring BS decoding of all HLT results and deserialisation of full HLT')
343 partialHLT_streams = [
344 stream for stream in getDataScoutingStreams() if stream.split('_')[1] in flags.Input.ProcessingTags
345 ]
346 partialHLT_dstypes = [
347 getDataScoutingTypeFromStream(stream) for stream in partialHLT_streams
348 ]
349 partialHLT_dsids = [
350 getDataScoutingResultID(dstype) for dstype in partialHLT_dstypes
351 ]
352 log.debug(f'Configuring BS decoding and deserialisation of all HLT results: full HLT + {partialHLT_dstypes}')
353
354 ids_to_decode += partialHLT_dsids
355
356 id_to_deserialise.update({
357 dstype:dsid for dstype,dsid in zip(partialHLT_dstypes, partialHLT_dsids)
358 })
359
360 decoder = CompFactory.HLTResultMTByteStreamDecoderAlg(ModuleIdsToDecode=ids_to_decode)
361 acc.addSequence(seqAND("HLTDecodingSeq"))
362 acc.addEventAlgo( decoder, "HLTDecodingSeq")
363 for dstype, id in id_to_deserialise.items():
364 deserialiser = CompFactory.TriggerEDMDeserialiserAlg(
365 f"TrigDeserialiser{dstype}",
366 ModuleID=id,
367 )
368
369 if dstype == '':
370 deserialiser.ExtraOutputs.add(('xAOD::TrigCompositeContainer' , 'StoreGateSvc+DummyForGapFiller'))
371 else:
372 deserialiser.SkipDuplicateRecords = True
373 deserialiser.PermitMissingModule = True
374 acc.addEventAlgo( deserialiser, "HLTDecodingSeq")
375
376 if dstype=='':
377
378
379 gapFiller = triggerEDMGapFillerCfg(
380 flags, edmSet=['BS'],
381 extraInputs=[('xAOD::TrigCompositeContainer' , 'StoreGateSvc+DummyForGapFiller')],
382 extraOutputs=[(
383 'xAOD::TrigCompositeContainer',
384 'StoreGateSvc+'+getRun3NavigationContainerFromInput(flags)
385 )])
386 else:
387
388 gapFiller = triggerEDMGapFillerCfg(flags, edmSet=[dstype])
389 acc.merge( gapFiller, "HLTDecodingSeq" )
390
391 log.debug("Configured HLT result BS decoding sequence")
392 return acc
393
394