ATLAS Offline Software
Loading...
Searching...
No Matches
GlobalAlgorithmsCollection.py
Go to the documentation of this file.
1# Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
2
3from AthenaCommon.Logging import logging
4log = logging.getLogger(__name__)
5
6from .GlobalAlgorithm import GlobalAlgorithm
7
9 """Wrapper class for encapsulating the list of all global algorithms."""
10 def __init__(self):
11 # all algos that are in menu (new and legacy)
12 self.globalAlgos: dict[str, GlobalAlgorithm] = {}
13
14 def addAlgo(self, algo: GlobalAlgorithm):
15 if algo.name in self.globalAlgos:
16 raise RuntimeError("Trying to add topo algorithm %s a second time" % algo.name)
17 self.globalAlgos[algo.name] = algo
18
19 def json(self):
20 confObj = {}
21 for alg in self.globalAlgos.values():
22 algType = alg.alg_type
23 if algType.key not in confObj:
24 confObj[algType.key] = {}
25 confObj[algType.key][alg.name] = alg.json()
26 return confObj
nlohmann::json json