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