6 from AthenaConfiguration.ComponentFactory
import CompFactory
13 """Create a generic configurable
15 This function is used to create an component "configurable" in a
16 dual-use way, either returning an actual Athena configurable, or
17 an appropriately configured PythonConfig instance.
20 typeName -- The C++ type name of the component
21 instanceName -- The instance name of the component to create
22 componentType -- The type of component in AnalysisBase
31 componentClass = CompFactory.getComp(typeName)
34 return componentClass( instanceName )
40 from AnaAlgorithm.PythonConfig
import PythonConfig
41 component = PythonConfig(
'%s/%s' % ( typeName, instanceName ) )
42 component.setComponentType( componentType )
49 """Create an algorithm configurable
51 This function is used to create an algorithm "configurable" in a dual-use
52 way, either returning an actual Athena configurable, or an appropriately
53 configured EL::AnaAlgorithmConfig instance.
56 typeName -- The C++ type name of the algorithm
57 instanceName -- The instance name of the algorithm to create
63 """Create a reentrant algorithm configurable
65 This function is used to create an algorithm "configurable" in a dual-use
66 way, either returning an actual Athena configurable, or an appropriately
67 configured EL::AnaAlgorithmConfig instance.
70 typeName -- The C++ type name of the algorithm
71 instanceName -- The instance name of the algorithm to create
73 return createComponent( typeName, instanceName,
'AnaReentrantAlgorithm' )
77 """Helper function for setting up a public tool for a dual-use algorithm
79 This function is meant to be used in the analysis algorithm sequence
80 configurations for setting up public tools on the analysis algorithms.
81 Public tools that could then be configured with a syntax shared between
85 typeName -- The C++ type name of the private tool
86 toolName -- The property name with which the tool handle was declared on
87 the algorithm. Also the instance name of the tool.
92 return CompFactory.getComp( typeName )( toolName )
101 """Helper function for setting up a service for a dual-use algorithm
103 This function is meant to be used to set up services in a dual-use
104 manner, particularly for the common CP algorithms. This allows to
105 use the same syntax in EventLoop and Athena, hiding the
106 differences internally. Since in EventLoop the service gets added
107 to a sequence (but in Athena does not), that sequence needs to be
108 passed into this function.
111 typeName -- The C++ type name of the service
112 serviceName -- The name with which the service handle was configured on
113 the algorithm. Also the instance name of the service.
114 sequence -- an optional argument of an algorithm sequence to add it to
115 in EventLoop (ignored in Athena)
121 return CompFactory.getComp( typeName )( serviceName )
127 if sequence
is not None :
134 """Helper function for declaring a private tool for a dual-use algorithm
136 This function is meant to be used in the analysis algorithm sequence
137 configurations for setting up private tools on the analysis algorithms.
138 Private tools that could then be configured with a syntax shared between
139 Athena and EventLoop.
142 alg -- The algorithm to set up the private tool on
143 toolName -- The property name with which the tool handle was declared on
144 the algorithm. Also the instance name of the tool.
145 typeName -- The C++ type name of the private tool
154 toolNames = toolName.split(
'.' )
158 for tname
in toolNames[ 0 : -1 ]:
159 component = getattr( component, tname )
163 toolClass = CompFactory.getComp(typeName)
166 setattr( component, toolNames[ -1 ], toolClass( toolNames[ -1 ] ) )
173 alg.addPrivateTool( toolName, typeName )
180 """Helper function for declaring a private tool in an array for a
183 This function is meant to be used in the analysis algorithm
184 sequence configurations for setting up private tools in arrays on
185 the analysis algorithms. Private tools that could then be
186 configured with a syntax shared between Athena and EventLoop.
189 alg -- The algorithm to set up the private tool on
190 toolName -- The property name with which the tool handle was declared on
191 the algorithm. Also the instance name of the tool.
192 typeName -- The C++ type name of the private tool
202 toolNames = toolName.split(
'.' )
206 for tname
in toolNames[ 0 : -1 ]:
207 component = getattr( component, tname )
211 toolClass = CompFactory.getComp(typeName)
214 getattr( component, toolNames[ -1 ] ).append (toolClass( toolNames[ -1 ] ) )
215 return getattr( component, toolNames[ -1 ] )
222 return alg.addPrivateToolInArray( toolName, typeName )
createAlgorithm(typeName, instanceName)
addPrivateTool(alg, toolName, typeName)
createComponent(typeName, instanceName, componentType)
addPrivateToolInArray(alg, toolName, typeName)
createPublicTool(typeName, toolName)
createReentrantAlgorithm(typeName, instanceName)
createService(typeName, serviceName, sequence=None)