ATLAS Offline Software
Control
AthenaConfiguration
python
ComponentFactory.py
Go to the documentation of this file.
1
# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2
3
import
sys
4
import
AthenaConfiguration.AtlasSemantics
# noqa: F401 (load ATLAS-specific semantics)
5
from
AthenaCommon.Configurable
import
Configurable
6
from
GaudiConfig2
import
Configurables
as
cfg2
7
8
9
def
isComponentAccumulatorCfg
():
10
"""Returns true if the python fragment is ComponentAccumulator-based"""
11
12
if
(
"AthenaCommon.Include"
not
in
sys.modules
13
or
not
Configurable._useGlobalInstances):
14
return
True
15
else
:
16
return
False
17
18
19
def
_getConf1
(name):
20
"""Return legacy Configurable class with given name"""
21
from
AthenaCommon.ConfigurableDb
import
getConfigurable
22
return
getConfigurable
(name.replace(
"::"
,
"__"
), assumeCxxClass=
False
)
23
24
25
class
_compFactory
():
26
"""Return Configurable factory for legacy/CA jobs"""
27
28
def
__getattr__
(self, name):
29
"""Return Configurable class with given name"""
30
if
not
name.startswith(
"__"
):
31
return
getattr(cfg2, name)
if
isComponentAccumulatorCfg
()
else
_getConf1
(name)
32
33
def
getComp
(self, name):
34
"""Return Configurable class with given name"""
35
return
cfg2.getByType(name)
if
isComponentAccumulatorCfg
()
else
_getConf1
(name)
36
37
def
getComps
(self, *names):
38
"""Return list of Configurable classes with given names"""
39
return
[self.
getComp
(name)
for
name
in
names]
40
41
42
CompFactory =
_compFactory
()
python.ComponentFactory._getConf1
def _getConf1(name)
Definition:
ComponentFactory.py:19
python.ConfigurableDb.getConfigurable
def getConfigurable(className, requester='', assumeCxxClass=True)
Definition:
ConfigurableDb.py:208
python.ComponentFactory._compFactory.getComps
def getComps(self, *names)
Definition:
ComponentFactory.py:37
Configurable
athena/gaudi ----------------------------------------------------------—
python.ComponentFactory._compFactory.getComp
def getComp(self, name)
Definition:
ComponentFactory.py:33
python.JetAnalysisCommon.isComponentAccumulatorCfg
isComponentAccumulatorCfg
Definition:
JetAnalysisCommon.py:263
python.ComponentFactory._compFactory
Definition:
ComponentFactory.py:25
python.ComponentFactory._compFactory.__getattr__
def __getattr__(self, name)
Definition:
ComponentFactory.py:28
Generated on Thu Nov 7 2024 21:12:12 for ATLAS Offline Software by
1.8.18