| # Gaudi Framework, version v22r0 |

Home |  | Generated: 9 Feb 2011

# GaudiPython::Bindings Namespace Reference

## Classes
class | InterfaceCast
class | Interface
class | PropertyEntry
class | iProperty
class | iService
class | iAlgorithm
class | iAlgTool
class | iDataSvc
class | iHistogramSvc
class | iNTupleSvc
class | iToolSvc
class | iJobOptSvc
class | iEventSelector
class | AppMgr
class | CallbackStreamBuf
class | PyAlgorithm
## Functions
def | deprecation
def | loaddict
def | getClass
def | _getFIDandEvents
def | getComponentProperties
def | _copyFactoriesFromList
## Variables
list | __all__
tuple | gbl = PyCintex.makeNamespace('')
| Gaudi = gbl.Gaudi
| _gaudi = None
| Helper = gbl.GaudiPython.Helper
tuple | StringProperty = gbl.SimpleProperty('string','BoundedVerifier<string>')
tuple | StringPropertyRef = gbl.SimplePropertyRef('string','NullVerifier<string>')
| GaudiHandleProperty = gbl.GaudiHandleProperty
| GaudiHandleArrayProperty = gbl.GaudiHandleArrayProperty
| DataObject = gbl.DataObject
tuple | SUCCESS = gbl.StatusCode( gbl.StatusCode.SUCCESS, True )
tuple | FAILURE = gbl.StatusCode( gbl.StatusCode.FAILURE, True )
tuple | toArray = lambdatyp:getattr(Helper,"toArray")
| ROOT = PyCintex.libPyROOT
| makeNullPointer = PyCintex.libPyROOT.MakeNullPointer
| makeClass = PyCintex.libPyROOT.MakeRootClass
| setOwnership = PyCintex.libPyROOT.SetOwnership
| _CallbackStreamBufBase = gbl.GaudiPython.CallbackStreamBuf
| _PyAlgorithm = gbl.GaudiPython.PyAlgorithm

## Function Documentation

def GaudiPython::Bindings::_copyFactoriesFromList | ( |  | factories | ) | `[private]`

Definition at line 1075 of file Bindings.py.

    01076                                       :
    01077     result = []
    01078     for i in range(factories.size()) :
    01079         factory = factories.front()
    01080         result.append(factory)
    01081         factories.pop_front()
    01082     for factory in result :
    01083         factories.push_back(factory)
    01084     return result
    01085
    01086 #----CallbackStreamBuf----------------------------------------------------------------
    #    Used for redirecting C++ messages to python

def GaudiPython::Bindings::_getFIDandEvents | ( |  | pfn | ) | `[private]`

Definition at line 1020 of file Bindings.py.

    01021                            :
    01022     tfile = gbl.TFile.Open(pfn)
    01023     if not tfile : raise 'Cannot open ROOT file ', pfn
    01024     tree = tfile.Get('##Params')
    01025     tree.GetEvent(0)
    01026     text = tree.db_string
    01027     if 'NAME=FID' in text :
    01028         fid = text[text.rfind('VALUE=')+6:-1]
    01029     nevt = tfile.Get('_Event').GetEntries()
    01030     tfile.Close()
    01031     return fid, nevt
    01032
    #--------------------------------------------------------------------------------------

def GaudiPython::Bindings::deprecation | ( |  | message | ) |

Definition at line 61 of file Bindings.py.

    00062                         :
    00063     warnings.warn('GaudiPython: '+ message, DeprecationWarning, stacklevel=3)
    00064
    #----InterfaceCast class ----------------------------------------------------------------

def GaudiPython::Bindings::getClass | ( |  | name,
|  |  | libs = `[]` |
| ) |  |  |

    Function to retrieve a certain C++ class by name and to load dictionary if requested

    Usage:

    from gaudimodule import getClass
    # one knows that class is already loaded
    AppMgr     = getClass( 'ApplicationMgr'           )
    # one knows where to look for class, if not loaded yet
    MCParticle = getClass( 'MCParticle' , 'EventDict' )
    # one knows where to look for class, if not loaded yet
    Vertex     = getClass( 'Vertex' , ['EventDict', 'PhysEventDict'] )

Definition at line 104 of file Bindings.py.

    00105                                  :
    00106     """
    00107     Function to retrieve a certain C++ class by name and to load dictionary if requested
    00108
    00109     Usage:
    00110
    00111     from gaudimodule import getClass
    00112     # one knows that class is already loaded
    00113     AppMgr     = getClass( 'ApplicationMgr'           )
    00114     # one knows where to look for class, if not loaded yet
    00115     MCParticle = getClass( 'MCParticle' , 'EventDict' )
    00116     # one knows where to look for class, if not loaded yet
    00117     Vertex     = getClass( 'Vertex' , ['EventDict', 'PhysEventDict'] )
    00118     """
    00119     # see if class is already loaded
    00120     if hasattr( gbl , name )  : return getattr( gbl , name )
    00121     # try to load dictionaries and  look for the required class
    00122     if type(libs) is not list : libs = [libs]
    00123     for lib in libs :
    00124         loaddict( lib )
    00125         if hasattr( gbl , name ) : return getattr( gbl , name )
    00126     # return None ( or raise exception? I do not know...  )
    00127     return None
    00128
    #----PropertyEntry class---------------------------------------------------------------------

def GaudiPython::Bindings::getComponentProperties | ( |  | name | ) |

    Get all the properties of a component as a Python dictionary.
        The component is instantiated using the component library

Definition at line 1033 of file Bindings.py.

    01034                                   :
    01035     """ Get all the properties of a component as a Python dictionary.
    01036         The component is instantiated using the component library
    01037     """
    01038     properties = {}
    01039     if name == 'GaudiSvc' :
    01040         if Helper.loadDynamicLib(name) != 1 :
    01041             raise ImportError,  'Error loading component library '+ name
    01042         factorylist = gbl.FactoryTable.instance().getEntries()
    01043         factories = _copyFactoriesFromList(factorylist)
    01044         g = AppMgr(outputlevel=7)
    01045     else :
    01046         g = AppMgr(outputlevel=7)
    01047         if Helper.loadDynamicLib(name) != 1 :
    01048             raise ImportError,  'Error loading component library '+ name
    01049         factorylist = gbl.FactoryTable.instance().getEntries()
    01050         factories = _copyFactoriesFromList(factorylist)
    01051     svcloc    = gbl.Gaudi.svcLocator()
    01052     dummysvc  = gbl.Service('DummySvc',svcloc)
    01053     for factory in factories :
    01054         if    InterfaceCast(gbl.IAlgFactory)(factory) : ctype = 'Algorithm'
    01055         elif  InterfaceCast(gbl.ISvcFactory)(factory) : ctype = 'Service'
    01056         elif  InterfaceCast(gbl.IToolFactory)(factory) : ctype = 'AlgTool'
    01057         elif  factory.ident() == 'ApplicationMgr' :  ctype = 'ApplicationMgr'
    01058         else :  ctype = 'Unknown'
    01059         cname = factory.ident().split()[-1]
    01060         if ctype in ('Algorithm','Service', 'AlgTool', 'ApplicationMgr') :
    01061             try :
    01062                 if ctype == 'AlgTool' :
    01063                     obj = factory.instantiate(dummysvc)
    01064                 else :
    01065                     obj = factory.instantiate(svcloc)
    01066             except RuntimeError, text :
    01067                 print 'Error instantiating', cname, ' from ', name
    01068                 print text
    01069                 continue
    01070             prop = iProperty('dummy', obj)
    01071             properties[cname] = [ctype, prop.properties()]
    01072             try:  obj.release()
    01073             except: pass
    01074     return properties

def GaudiPython::Bindings::loaddict | ( |  | dict | ) |

    Load a LCG dictionary using various mechanisms

Definition at line 94 of file Bindings.py.

    00095                    :
    00096     """ Load a LCG dictionary using various mechanisms"""
    00097     if Helper.loadDynamicLib(dict) == 1 : return
    00098     else :
    00099         try:
    00100             PyCintex.loadDict(dict)
    00101         except:
    00102             raise ImportError, 'Error loading dictionary library'
    00103
    #---get a class (by loading modules if needed)--------------------------------------------

## Variable Documentation

list GaudiPython::Bindings::__all__

Initial value:

    [ 'gbl','InterfaceCast', 'Interface', 'PropertyEntry',
                'AppMgr', 'PyAlgorithm', 'CallbackStreamBuf',
                'iAlgorithm', 'iDataSvc', 'iHistogramSvc','iNTupleSvc','iService', 'iAlgTool', 'Helper',
                'SUCCESS', 'FAILURE', 'toArray',
                'ROOT', 'makeNullPointer', 'makeClass', 'setOwnership',
                'getClass', 'loaddict', 'deprecation' ]

Definition at line 11 of file Bindings.py.

GaudiPython::Bindings::_CallbackStreamBufBase = gbl.GaudiPython.CallbackStreamBuf

Definition at line 1087 of file Bindings.py.

GaudiPython::Bindings::_gaudi = None

Definition at line 29 of file Bindings.py.

GaudiPython::Bindings::_PyAlgorithm = gbl.GaudiPython.PyAlgorithm

Definition at line 1099 of file Bindings.py.

GaudiPython::Bindings::DataObject = gbl.DataObject

Definition at line 38 of file Bindings.py.

tuple GaudiPython::Bindings::FAILURE = gbl.StatusCode( gbl.StatusCode.FAILURE, True )

Definition at line 40 of file Bindings.py.

GaudiPython::Bindings::Gaudi = gbl.Gaudi

Definition at line 27 of file Bindings.py.

GaudiPython::Bindings::GaudiHandleArrayProperty = gbl.GaudiHandleArrayProperty

Definition at line 37 of file Bindings.py.

GaudiPython::Bindings::GaudiHandleProperty = gbl.GaudiHandleProperty

Definition at line 36 of file Bindings.py.

tuple GaudiPython::Bindings::gbl = PyCintex.makeNamespace('')

Definition at line 26 of file Bindings.py.

GaudiPython::Bindings::Helper = gbl.GaudiPython.Helper

Definition at line 33 of file Bindings.py.

GaudiPython::Bindings::makeClass = PyCintex.libPyROOT.MakeRootClass

Definition at line 58 of file Bindings.py.

GaudiPython::Bindings::makeNullPointer = PyCintex.libPyROOT.MakeNullPointer

Definition at line 57 of file Bindings.py.

GaudiPython::Bindings::ROOT = PyCintex.libPyROOT

Definition at line 56 of file Bindings.py.

GaudiPython::Bindings::setOwnership = PyCintex.libPyROOT.SetOwnership

Definition at line 59 of file Bindings.py.

tuple GaudiPython::Bindings::StringProperty = gbl.SimpleProperty('string','BoundedVerifier<string>')

Definition at line 34 of file Bindings.py.

tuple GaudiPython::Bindings::StringPropertyRef = gbl.SimplePropertyRef('string','NullVerifier<string>')

Definition at line 35 of file Bindings.py.

tuple GaudiPython::Bindings::SUCCESS = gbl.StatusCode( gbl.StatusCode.SUCCESS, True )

Definition at line 39 of file Bindings.py.

tuple GaudiPython::Bindings::toArray = lambdatyp:getattr(Helper,"toArray")

Definition at line 50 of file Bindings.py.

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines