ATLAS Offline Software
DecodeBS.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
2 #
3 # Script to unpack (Run-3) HLT bytestream and write ESD file. Only to be used
4 # for validation purposes. For reconstruction use the full TriggerRecoConfig.
5 #
6 
7 from AthenaConfiguration.MainServicesConfig import MainServicesCfg
8 from AthenaConfiguration.AllConfigFlags import initConfigFlags
9 from TriggerJobOpts.TriggerByteStreamConfig import ByteStreamReadCfg
10 from TriggerJobOpts.TriggerRecoConfig import Run3TriggerBSUnpackingCfg, TriggerEDMCfg
11 
12 # Set and parse flags
13 flags = initConfigFlags()
14 flags.parser().add_argument('--moduleID', type=int, default=0, help='HLT module ID to decode')
15 args = flags.fillFromArgs()
16 
17 flags.Output.ESDFileName = 'ESD.pool.root' if args.moduleID==0 else f'ESD.Module{args.moduleID}.pool.root'
18 flags.lock()
19 
20 cfg = MainServicesCfg(flags)
21 cfg.merge( ByteStreamReadCfg(flags) )
22 
23 from TrigEDMConfig.DataScoutingInfo import (
24  getAllDataScoutingResultIDs, getAllDataScoutingIdentifiers
25 )
26 # Map selected module ID to the data scouting type or default HLT result
27 id_to_dstype = {
28  id: dstype for id, dstype in zip(getAllDataScoutingResultIDs(), getAllDataScoutingIdentifiers())
29 }
30 id_to_dstype.update({0:''}) # Default HLT result
31 dstype = id_to_dstype[args.moduleID]
32 print(f'Expecting to deserialise {dstype if dstype else "default HLT result"}')
33 
34 # Check that this is in fact what we autoconfigured from the stream info in the file
36 assert acc_bs.getEventAlgo(f'TrigDeserialiser{dstype}').ModuleID == args.moduleID
37 cfg.merge(acc_bs)
38 
39 cfg.merge( TriggerEDMCfg(flags) )
40 
41 import sys
42 sys.exit(cfg.run().isFailure())
python.TriggerRecoConfig.Run3TriggerBSUnpackingCfg
def Run3TriggerBSUnpackingCfg(flags)
Definition: TriggerRecoConfig.py:364
python.ByteStreamConfig.ByteStreamReadCfg
def ByteStreamReadCfg(flags, type_names=None)
Definition: Event/ByteStreamCnvSvc/python/ByteStreamConfig.py:25
python.DataScoutingInfo.getAllDataScoutingIdentifiers
def getAllDataScoutingIdentifiers()
Definition: DataScoutingInfo.py:79
python.DataScoutingInfo.getAllDataScoutingResultIDs
def getAllDataScoutingResultIDs()
Definition: DataScoutingInfo.py:69
python.MainServicesConfig.MainServicesCfg
def MainServicesCfg(flags, LoopMgr='AthenaEventLoopMgr')
Definition: MainServicesConfig.py:260
python.TriggerRecoConfig.TriggerEDMCfg
def TriggerEDMCfg(flags)
Definition: TriggerRecoConfig.py:143
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19
dbg::print
void print(std::FILE *stream, std::format_string< Args... > fmt, Args &&... args)
Definition: SGImplSvc.cxx:70