| The Gaudi Framework v28r2-patches (bc4ad17a)

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

List of all members
GaudiPython.GaudiAlgs.GaudiAlgo Class Reference

the base class for all algorithm Python-image of C++ clkass GaudiAlgorithm More...

Inheritance diagram for GaudiPython.GaudiAlgs.GaudiAlgo:
[legend]
Collaboration diagram for GaudiPython.GaudiAlgs.GaudiAlgo:
[legend]

## Additional Inherited Members
Public Member Functions inherited from GaudiPython.Bindings.iAlgorithm
def | __init__ (self, name, ialg=None)
def | retrieveInterface (self)
Public Member Functions inherited from GaudiPython.Bindings.iProperty
def | __init__ (self, name, ip=None)
def | getInterface (self)
def | retrieveInterface (self)
def | __call_interface_method__ (self, ifname, method, args)
def | __setattr__ (self, name, value)
def | __getattr__ (self, name)
def | properties (self)
def | name (self)
Static Public Attributes inherited from GaudiPython.Bindings.iAlgorithm
| initialize = lambdaself:self.__call_interface_method__("_ialg","initialize")
| start = lambdaself:self.__call_interface_method__("_ialg","start")
| execute = lambdaself:self.__call_interface_method__("_ialg","execute")
| stop = lambdaself:self.__call_interface_method__("_ialg","stop")
| finalize = lambdaself:self.__call_interface_method__("_ialg","finalize")
| reinitialize = lambdaself:self.__call_interface_method__("_ialg","reinitialize")
| restart = lambdaself:self.__call_interface_method__("_ialg","restart")
| sysInitialize = lambdaself:self.__call_interface_method__("_ialg","sysInitialize")
| sysStart = lambdaself:self.__call_interface_method__("_ialg","sysStart")
| sysExecute = lambdaself:self.__call_interface_method__("_ialg","sysExecute")
| sysStop = lambdaself:self.__call_interface_method__("_ialg","sysStop")
| sysFinalize = lambdaself:self.__call_interface_method__("_ialg","sysFinalize")
| sysReinitialize = lambdaself:self.__call_interface_method__("_ialg","sysReinitialize")
| sysRestart = lambdaself:self.__call_interface_method__("_ialg","sysRestart")

## Detailed Description

the base class for all algorithm Python-image of C++ clkass GaudiAlgorithm

    *******************************************************************************
    *                                                * 'Physisics do not like it, *
    *                                                *  physisics do not need it, *
    *                                                *  physisics do not use  it' *
    *                                                * ****************************
    *  Usage:                                                                     *
    *                                                                             *
    *  from GaudiPython.GaudiAlgs   import GaudiAlgo, SUCCESS                     *
    *                                                                             *
    *  class MyClass(GaudiAlgo) :                                                 *
    *       ' My specific Algorithm, derived from GaudiAlgo base class '          *
    *       def __init__( self , name , **args ) :                                *
    *            'Constructor from algorithm instance name & parameters'          *
    *             #invoke the constructor of base class                           *
    *             GaudiAlgo.__init__(self , name , **args )                       *
    *                                                                             *
    *       def initialize ( self ) :                                             *
    *           'Algorithm initialization'                                        *
    *           # initialize the base class                                       *
    *           status = GaudiAlgo.initialize( self )                             *
    *           if status.isFailure() : return status                             *
    *                                                                             *
    *           # locate the services and tools                                   *
    *                                                                             *
    *           # locate some tool:                                               *
    *           extrapolator = self.tool(ITrExtrapolator,'TrExtrapolator')        *
    *                                                                             *
    *           # locate the service                                              *
    *           rndmSvc = self.svc(IRndmGenSvc, 'RndmGenSvc')                     *
    *                                                                             *
    *           return SUCCESS                                                    *
    *                                                                             *
    *                                                                             *
    *       def execute ( self ) :                                                *
    *            'Major method (from IAlgorithm interface)'                       *
    *                                                                             *
    *           # get some data from Transient Event Store                        *
    *           tracks = self.get('/Event/Rec/Tracks')                            *
    *                                                                             *
    *           # use counters                                                    *
    *           c1 = self.counter('#Tracks')                                      *
    *           c2 = self.counter('No Tracks')                                    *
    *           if tracks.empty :                                                 *
    *              c2+=1                                                          *
    *           c1 += tracks->size()                                              *
    *                                                                             *
    *           if 1000 < tracks.size() :                                         *
    *                return self.Error('The event is *VERY* busy')                *
    *                                                                             *
    *           return SUCCESS                                                    *
    *                                                                             *
    *******************************************************************************

Usage:

1 from GauidPython.GaudiAlgs import GaudiAlgo, SUCCESS
2
3 class MyClass(GaudiAlgo) :
4 """
5 My specific Algorithm, derived from GaudiAlgo base class
6 """
7 def __init__( self , name , **args ) :
8 """
9 Constructor from algorithm instance name & parameters'
10 """
11 #invoke the constructor of base class
12 GaudiAlgo.__init__(self , name , **args )
13
14 def initialize ( self ) :
15 'Algorithm initialization'
16 # initialize the base class
17 status = GaudiAlgo.initialize( self )
18 if status.isFailure() : return status
19
20 # locate the services and tools
21
22 # locate some tool:
23 extrapolator = self.tool(ITrExtrapolator,'TrExtrapolator')
24
25 # locate the service
26 rndmSvc = self.svc(IRndmGenSvc, 'RndmGenSvc')
27
28 return SUCCESS
29
30
31 def execute ( self ) :
32 'Major method (from IAlgorithm interface)'
33
34 # get some data from Transient Event Store
35 tracks = self.get('/Event/Rec/Tracks')
36
37 # use counters
38 c1 = self.counter('#Tracks')
39 c2 = self.counter('No Tracks')
40 if tracks.empty :
41 c2+=1
42 c1 += tracks->size()
43
44 if 1000 < tracks.size() :
45 return self.Error('The event is *VERY* busy')
46
47 return SUCCESS

See also
  GaudiAlgorithm

Author
  Vanya BELYAEV ibely.nosp@m.aev@.nosp@m.physi.nosp@m.cs.s.nosp@m.yr.ed.nosp@m.u

Date
  2006-11-26

Definition at line 552 of file GaudiAlgs.py.

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

- GaudiPython/python/GaudiPython/GaudiAlgs.py