ATLAS Offline Software
EFTrackingXrtAlgorithmConfig.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
2 
3 def EFTrackingXrtAlgorithmCfg(flags, **kwargs):
4  from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
6 
7  # Example settings. No sensible defaults as the firmware distribution
8  # (cvmfs, eos) is not yet stadardised.
9  kwargs.setdefault("bufferSize", 8192)
10  #kwargs.setdefault("xclbinPath", "SerialLoaderToSerialUnloader")
11  #kwargs.setdefault("kernelDefinitions", {"serialLoader": [{"storeGateKey": "inputDataStream",
12  # "argumentIndex": "0",
13  # "interfaceMode": "INPUT"}],
14  # "serialUnloader" : [{"storeGateKey": "outputDataStream",
15  # "argumentIndex": "1",
16  # "interfaceMode": "OUTPUT"}]})
17 
18  from AthenaConfiguration.ComponentFactory import CompFactory
19  EFTrackingXrtAlgorithm = CompFactory.EFTrackingXrtAlgorithm("EFTrackingXrtAlgorithm", **kwargs)
20 
21  acc.addEventAlgo(EFTrackingXrtAlgorithm)
22 
23  return acc
24 
25 if __name__ == "__main__":
26  from AthenaConfiguration.AllConfigFlags import initConfigFlags
27  flags = initConfigFlags()
28  flags.lock()
29 
30  from AthenaConfiguration.MainServicesConfig import MainServicesCfg
31  acc = MainServicesCfg(flags)
32 
33  from argparse import ArgumentParser
34  argumentParser = ArgumentParser()
35  argumentParser.add_argument("--xclbinPath")
36  argumentParser.add_argument("--bufferSize", type = int, default = 8192)
37 
38  from argparse import Action
40  def __call__(self, parser, namespace, values, option_string=None):
41  from json import loads
42  setattr(namespace, self.dest, loads(values))
43 
44  argumentParser.add_argument("--kernelDefinitions", action=JsonToDictAction)
45  argumentParser.add_argument("--inputCsvPathToSgKeyMap", action=JsonToDictAction)
46  argumentParser.add_argument("--outputCsvPathToSgKeyMap", action=JsonToDictAction)
47 
48  arguments = argumentParser.parse_args()
49 
50  from AthenaConfiguration.ComponentFactory import CompFactory
51  acc.addService(CompFactory.AthXRT.DeviceMgmtSvc(XclbinPathsList = [arguments.xclbinPath]))
52 
53  for inputCsvPath, sgKey in arguments.inputCsvPathToSgKeyMap.items():
54  from EFTrackingDataStreamLoaderAlgorithmConfig import EFTrackingDataStreamLoaderAlgorithmCfg
56  bufferSize = arguments.bufferSize,
57  inputCsvPath = inputCsvPath,
58  inputDataStream = sgKey))
59 
60  acc.merge(EFTrackingXrtAlgorithmCfg(flags,
61  bufferSize = arguments.bufferSize,
62  xclbinPath = arguments.xclbinPath,
63  kernelDefinitions = arguments.kernelDefinitions))
64 
65  for outputCsvPath, sgKey in arguments.outputCsvPathToSgKeyMap.items():
66  from EFTrackingDataStreamUnloaderAlgorithmConfig import EFTrackingDataStreamUnloaderAlgorithmCfg
68  outputCsvPath = outputCsvPath,
69  outputDataStream = sgKey))
70 
71  acc.run(1)
72 
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
EFTrackingXrtAlgorithmConfig.JsonToDictAction.__call__
def __call__(self, parser, namespace, values, option_string=None)
Definition: EFTrackingXrtAlgorithmConfig.py:40
EFTrackingXrtAlgorithmConfig.JsonToDictAction
Definition: EFTrackingXrtAlgorithmConfig.py:39
python.MainServicesConfig.MainServicesCfg
def MainServicesCfg(flags, LoopMgr='AthenaEventLoopMgr')
Definition: MainServicesConfig.py:260
Crest::Action
Action
Definition: CrestRequest.h:21
EFTrackingDataStreamUnloaderAlgorithmConfig.EFTrackingDataStreamUnloaderAlgorithmCfg
def EFTrackingDataStreamUnloaderAlgorithmCfg(flags, **kwargs)
Definition: EFTrackingDataStreamUnloaderAlgorithmConfig.py:4
EFTrackingXrtAlgorithmConfig.EFTrackingXrtAlgorithmCfg
def EFTrackingXrtAlgorithmCfg(flags, **kwargs)
Definition: EFTrackingXrtAlgorithmConfig.py:3
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19
EFTrackingDataStreamLoaderAlgorithmConfig.EFTrackingDataStreamLoaderAlgorithmCfg
def EFTrackingDataStreamLoaderAlgorithmCfg(flags, **kwargs)
Definition: EFTrackingDataStreamLoaderAlgorithmConfig.py:4