ATLAS Offline Software
Loading...
Searching...
No Matches
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
7from AthenaConfiguration.MainServicesConfig import MainServicesCfg
8from AthenaConfiguration.AllConfigFlags import initConfigFlags
9from TriggerJobOpts.TriggerByteStreamConfig import ByteStreamReadCfg
10from TriggerJobOpts.TriggerRecoConfig import Run3TriggerBSUnpackingCfg, TriggerEDMCfg
11
12# Set and parse flags
13flags = initConfigFlags()
14flags.parser().add_argument('--moduleID', type=int, default=0, help='HLT module ID to decode')
15args = flags.fillFromArgs()
16
17flags.Output.ESDFileName = 'ESD.pool.root' if args.moduleID==0 else f'ESD.Module{args.moduleID}.pool.root'
18flags.lock()
19
20cfg = MainServicesCfg(flags)
21cfg.merge( ByteStreamReadCfg(flags) )
22
23from TrigEDMConfig.DataScoutingInfo import (
24 getAllDataScoutingResultIDs, getAllDataScoutingIdentifiers
25)
26# Map selected module ID to the data scouting type or default HLT result
27id_to_dstype = {
28 id: dstype for id, dstype in zip(getAllDataScoutingResultIDs(), getAllDataScoutingIdentifiers())
29}
30id_to_dstype.update({0:''}) # Default HLT result
31dstype = id_to_dstype[args.moduleID]
32print(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
35acc_bs = Run3TriggerBSUnpackingCfg(flags)
36assert acc_bs.getEventAlgo(f'TrigDeserialiser{dstype}').ModuleID == args.moduleID
37cfg.merge(acc_bs)
38
39cfg.merge( TriggerEDMCfg(flags) )
40
41import sys
42sys.exit(cfg.run().isFailure())
void print(char *figname, TCanvas *c1)