ATLAS Offline Software
Loading...
Searching...
No Matches
python.AnaAlgorithmConfig.PrivateToolConfig Class Reference
Inheritance diagram for python.AnaAlgorithmConfig.PrivateToolConfig:
Collaboration diagram for python.AnaAlgorithmConfig.PrivateToolConfig:

Public Types

typedef HLT::TypeInformation::for_each_type_c< typenameEDMLIST::map, my_functor, my_result<>, my_arg< HLT::TypeInformation::get_cont, CONTAINER > >::type result

Public Member Functions

 __init__ (self, algorithm, prefix, type)
 __getattr__ (self, name)
 __setattr__ (self, key, value)
 __str__ (self)

Protected Attributes

 _algorithm = algorithm
 _prefix = prefix
 _type = type
dict _props = {}

Detailed Description

Standalone Private Tool Configuration

This class is used to mimic the behaviour of Athena tool configurable
classes. To be able to set the properties of private tools used by
dual-use algorithms in a way that's valid for both Athena and EventLoop.

Definition at line 298 of file AnaAlgorithmConfig.py.

Member Typedef Documentation

◆ result

Definition at line 90 of file EDM_MasterSearch.h.

Constructor & Destructor Documentation

◆ __init__()

python.AnaAlgorithmConfig.PrivateToolConfig.__init__ ( self,
algorithm,
prefix,
type )
Constructor for an private tool configuration object

Definition at line 306 of file AnaAlgorithmConfig.py.

306 def __init__( self, algorithm, prefix, type ):
307 """Constructor for an private tool configuration object
308 """
309
310 self._algorithm = algorithm
311 self._prefix = prefix
312 self._type = type
313 self._props = {}
314
315 pass
316

Member Function Documentation

◆ __getattr__()

python.AnaAlgorithmConfig.PrivateToolConfig.__getattr__ ( self,
name )
Get a previously set property value from the configuration

This function allows us to retrieve the value of a tool property that
was already set for an algorithm's private tool, to possibly use it in
some configuration decisions in the Python code itself.

Keyword arguments:
  name -- The name of the property

Definition at line 317 of file AnaAlgorithmConfig.py.

317 def __getattr__( self, name ):
318 """Get a previously set property value from the configuration
319
320 This function allows us to retrieve the value of a tool property that
321 was already set for an algorithm's private tool, to possibly use it in
322 some configuration decisions in the Python code itself.
323
324 Keyword arguments:
325 name -- The name of the property
326 """
327
328 # Fail if the property was not (yet) set:
329 if not name in self._props:
330 raise AttributeError( 'Property "%s" was not set on "%s/%s.%s"' %
331 ( name, self._algorithm.type(),
332 self._algorithm.name(), self._prefix ) )
333
334 # Return the property value:
335 return self._props[ name ]
336

◆ __setattr__()

python.AnaAlgorithmConfig.PrivateToolConfig.__setattr__ ( self,
key,
value )
Set a tool property on an existing configuration object

This function allows us to set/override properties on a private tool
of an algorithm configuration object. Allowing for the following syntax:

   alg = ...
   alg.Tool.IntProperty = 66
   alg.Tool.FloatProperty = 3.141592
   alg.Tool.StringProperty = "Foo"

Keyword arguments:
  key   -- The key/name of the property
  value -- The value to set for the property

Definition at line 337 of file AnaAlgorithmConfig.py.

337 def __setattr__( self, key, value ):
338 """Set a tool property on an existing configuration object
339
340 This function allows us to set/override properties on a private tool
341 of an algorithm configuration object. Allowing for the following syntax:
342
343 alg = ...
344 alg.Tool.IntProperty = 66
345 alg.Tool.FloatProperty = 3.141592
346 alg.Tool.StringProperty = "Foo"
347
348 Keyword arguments:
349 key -- The key/name of the property
350 value -- The value to set for the property
351 """
352
353 # Private variables should be set directly:
354 if key[ 0 ] == '_':
355 return super( PrivateToolConfig, self ).__setattr__( key, value )
356
357 # Construct the full name, used in the C++ code:
358 fullName = self._prefix + "." + key
359
360 # Set the property, and remember its value:
361 self._algorithm.setPropertyFromString( fullName,
362 stringPropValue( value ) )
363 self._props[ key ] = copy.deepcopy( value )
364 pass
365

◆ __str__()

python.AnaAlgorithmConfig.PrivateToolConfig.__str__ ( self)
Print the private tool configuration in a user friendly way

This is just to help with debugging configurations, allowing
the user to get a nice printout of their job configuration.

Definition at line 366 of file AnaAlgorithmConfig.py.

366 def __str__( self ):
367 """Print the private tool configuration in a user friendly way
368
369 This is just to help with debugging configurations, allowing
370 the user to get a nice printout of their job configuration.
371 """
372
373 name = 'Private Tool %s/%s' % ( self._type, self._prefix )
374 result = ' \n'
375 result += AnaAlgorithmConfig._printHeader( name )
376 result += '\n'
377 for key, value in sorted( self._props.items() ):
378 if isinstance( value, str ):
379 printedValue = "'%s'" % value
380 else:
381 printedValue = value
382 pass
383 result += "|- %s: %s\n" % ( key, indentBy( printedValue, "| " ) )
384 pass
385 result += AnaAlgorithmConfig._printFooter( name )
386 return result
387

Member Data Documentation

◆ _algorithm

python.AnaAlgorithmConfig.PrivateToolConfig._algorithm = algorithm
protected

Definition at line 310 of file AnaAlgorithmConfig.py.

◆ _prefix

python.AnaAlgorithmConfig.PrivateToolConfig._prefix = prefix
protected

Definition at line 311 of file AnaAlgorithmConfig.py.

◆ _props

dict python.AnaAlgorithmConfig.PrivateToolConfig._props = {}
protected

Definition at line 313 of file AnaAlgorithmConfig.py.

◆ _type

python.AnaAlgorithmConfig.PrivateToolConfig._type = type
protected

Definition at line 312 of file AnaAlgorithmConfig.py.


The documentation for this class was generated from the following file: