Gaudi Framework, version v21r4

Home   Generated: 7 Sep 2009

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
def _atexit_

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::_atexit_ (  )  [private]

Definition at line 990 of file Bindings.py.

00990                :
00991   if _gaudi :
00992     state = _gaudi.FSMState()
00993     if state in [ Gaudi.StateMachine.CONFIGURED, Gaudi.StateMachine.INITIALIZED,
00994                   Gaudi.StateMachine.RUNNING ]:
00995         _gaudi.exit()
00996 atexit.register( _atexit_ )
00997   
00998 #----Enable tab completion------------------------------------------------------------
00999 try:
01000   import rlcompleter,readline    
01001   readline.parse_and_bind("tab: complete")
01002 except:
01003   pass
01004 

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

Definition at line 942 of file Bindings.py.

00942                                       :
00943   result = []
00944   for i in range(factories.size()) :
00945     factory = factories.front()
00946     result.append(factory)
00947     factories.pop_front()
00948   for factory in result :
00949     factories.push_back(factory)
00950   return result
00951 
00952 #----CallbackStreamBuf----------------------------------------------------------------
00953 #    Used for redirecting C++ messages to python
_CallbackStreamBufBase = gbl.GaudiPython.CallbackStreamBuf

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

Definition at line 887 of file Bindings.py.

00887                            :
00888   tfile = gbl.TFile.Open(pfn)
00889   if not tfile : raise 'Cannot open ROOT file ', pfn
00890   tree = tfile.Get('##Params')
00891   tree.GetEvent(0)
00892   text = tree.db_string
00893   if 'NAME=FID' in text :
00894     fid = text[text.rfind('VALUE=')+6:-1]
00895   nevt = tfile.Get('_Event').GetEntries()
00896   tfile.Close()
00897   return fid, nevt
00898 
00899 #--------------------------------------------------------------------------------------
def getComponentProperties( name ):

def GaudiPython::Bindings::deprecation (   message  ) 

Definition at line 61 of file Bindings.py.

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

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.

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

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 900 of file Bindings.py.

00900                                   :
00901   """ Get all the properties of a component as a Python dictionary. 
00902       The component is instantiated using the component library
00903   """
00904   properties = {}
00905   if name == 'GaudiSvc' :
00906     if Helper.loadDynamicLib(name) != 1 :
00907       raise ImportError,  'Error loading component library '+ name
00908     factorylist = gbl.FactoryTable.instance().getEntries()
00909     factories = _copyFactoriesFromList(factorylist)
00910     g = AppMgr(outputlevel=7)     
00911   else :
00912     g = AppMgr(outputlevel=7) 
00913     if Helper.loadDynamicLib(name) != 1 :
00914       raise ImportError,  'Error loading component library '+ name
00915     factorylist = gbl.FactoryTable.instance().getEntries()
00916     factories = _copyFactoriesFromList(factorylist)
00917   svcloc    = gbl.Gaudi.svcLocator()
00918   dummysvc  = gbl.Service('DummySvc',svcloc)
00919   for factory in factories :
00920     if    InterfaceCast(gbl.IAlgFactory)(factory) : ctype = 'Algorithm'
00921     elif  InterfaceCast(gbl.ISvcFactory)(factory) : ctype = 'Service'
00922     elif  InterfaceCast(gbl.IToolFactory)(factory) : ctype = 'AlgTool'
00923     elif  factory.ident() == 'ApplicationMgr' :  ctype = 'ApplicationMgr'
00924     else :  ctype = 'Unknown'
00925     cname = factory.ident().split()[-1]
00926     if ctype in ('Algorithm','Service', 'AlgTool', 'ApplicationMgr') :
00927       try :
00928         if ctype == 'AlgTool' :
00929           obj = factory.instantiate(dummysvc)
00930         else :
00931           obj = factory.instantiate(svcloc)
00932       except RuntimeError, text :
00933         print 'Error instantiating', cname, ' from ', name
00934         print text
00935         continue
00936       prop = iProperty('dummy', obj)
00937       properties[cname] = [ctype, prop.properties()]
00938       try:  obj.release()
00939       except: pass
00940   return properties
00941 
def _copyFactoriesFromList(factories) :

def GaudiPython::Bindings::loaddict (   dict  ) 

Load a LCG dictionary using various mechanisms

Definition at line 94 of file Bindings.py.

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


Variable Documentation

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 954 of file Bindings.py.

Definition at line 29 of file Bindings.py.

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

Definition at line 966 of file Bindings.py.

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.

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.


Generated at Mon Sep 7 18:26:32 2009 for Gaudi Framework, version v21r4 by Doxygen version 1.5.6 written by Dimitri van Heesch, © 1997-2004