| # Gaudi Framework, version v25r0 |

Home |  | Generated: Mon Feb 17 2014

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

- Namespace List
- Namespace Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Classes | Functions | Variables
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__
| gbl cppyy.gbl
| 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 cppyy.libPyROOT
| makeNullPointer cppyy.libPyROOT.MakeNullPointer
| makeClass cppyy.libPyROOT.MakeRootClass
| setOwnership cppyy.libPyROOT.SetOwnership
| _CallbackStreamBufBase gbl.GaudiPython.CallbackStreamBuf
| _PyAlgorithm gbl.GaudiPython.PyAlgorithm

## Function Documentation

def GaudiPython.Bindings._copyFactoriesFromList | ( |  | factories | ) |
| private

Definition at line 1073 of file Bindings.py.

1073
1074 def _copyFactoriesFromList(factories) :
1075 result = []
1076 for i in range(factories.size()) :
1077 factory = factories.front()
1078 result.append(factory)
1079 factories.pop_front()
1080 for factory in result :
1081 factories.push_back(factory)
1082 return result
1083
1084 #----CallbackStreamBuf----------------------------------------------------------------
# Used for redirecting C++ messages to python

def GaudiPython.Bindings._getFIDandEvents | ( |  | pfn | ) |
| private

Definition at line 1018 of file Bindings.py.

1018
1019 def _getFIDandEvents( pfn ):
1020 tfile = gbl.TFile.Open(pfn)
1021 if not tfile : raise 'Cannot open ROOT file ', pfn
1022 tree = tfile.Get('##Params')
1023 tree.GetEvent(0)
1024 text = tree.db_string
1025 if 'NAME=FID' in text :
1026 fid = text[text.rfind('VALUE=')+6:-1]
1027 nevt = tfile.Get('_Event').GetEntries()
1028 tfile.Close()
1029 return fid, nevt
1030
#--------------------------------------------------------------------------------------

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

Definition at line 74 of file Bindings.py.

74
75 def deprecation(message):
76 warnings.warn('GaudiPython: '+ message, DeprecationWarning, stacklevel=3)
77
#----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 118 of file Bindings.py.

118
119 def getClass( name , libs = [] ) :
120 """
121 Function to retrieve a certain C++ class by name and to load dictionary if requested
122
123 Usage:
124
125 from gaudimodule import getClass
126 # one knows that class is already loaded
127 AppMgr = getClass( 'ApplicationMgr' )
128 # one knows where to look for class, if not loaded yet
129 MCParticle = getClass( 'MCParticle' , 'EventDict' )
130 # one knows where to look for class, if not loaded yet
131 Vertex = getClass( 'Vertex' , ['EventDict', 'PhysEventDict'] )
132 """
133 # see if class is already loaded
134 if hasattr( gbl , name ) : return getattr( gbl , name )
135 # try to load dictionaries and look for the required class
136 if type(libs) is not list : libs = [libs]
137 for lib in libs :
138 loaddict( lib )
139 if hasattr( gbl , name ) : return getattr( gbl , name )
140 # return None ( or raise exception? I do not know... )
141 return None
142
#----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 1031 of file Bindings.py.

1031
1032 def getComponentProperties( name ):
1033 """ Get all the properties of a component as a Python dictionary.
1034 The component is instantiated using the component library
1035 """
1036 properties = {}
1037 if name == 'GaudiCoreSvc' :
1038 if Helper.loadDynamicLib(name) != 1 :
1039 raise ImportError, 'Error loading component library '+ name
1040 factorylist = gbl.FactoryTable.instance().getEntries()
1041 factories = _copyFactoriesFromList(factorylist)
1042 g = AppMgr(outputlevel=7)
1043 else :
1044 g = AppMgr(outputlevel=7)
1045 if Helper.loadDynamicLib(name) != 1 :
1046 raise ImportError, 'Error loading component library '+ name
1047 factorylist = gbl.FactoryTable.instance().getEntries()
1048 factories = _copyFactoriesFromList(factorylist)
1049 svcloc = gbl.Gaudi.svcLocator()
1050 dummysvc = gbl.Service('DummySvc',svcloc)
1051 for factory in factories :
1052 if InterfaceCast(gbl.IAlgFactory)(factory) : ctype = 'Algorithm'
1053 elif InterfaceCast(gbl.ISvcFactory)(factory) : ctype = 'Service'
1054 elif InterfaceCast(gbl.IToolFactory)(factory) : ctype = 'AlgTool'
1055 elif factory.ident() == 'ApplicationMgr' : ctype = 'ApplicationMgr'
1056 else : ctype = 'Unknown'
1057 cname = factory.ident().split()[-1]
1058 if ctype in ('Algorithm','Service', 'AlgTool', 'ApplicationMgr') :
1059 try :
1060 if ctype == 'AlgTool' :
1061 obj = factory.instantiate(dummysvc)
1062 else :
1063 obj = factory.instantiate(svcloc)
1064 except RuntimeError, text :
1065 print 'Error instantiating', cname, ' from ', name
1066 print text
1067 continue
1068 prop = iProperty('dummy', obj)
1069 properties[cname] = [ctype, prop.properties()]
1070 try: obj.release()
1071 except: pass
1072 return properties

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

    Load a LCG dictionary using various mechanisms

Definition at line 108 of file Bindings.py.

108
109 def loaddict(dict) :
110 """ Load a LCG dictionary using various mechanisms"""
111 if Helper.loadDynamicLib(dict) == 1 : return
112 else :
113 try:
114 cppyy.loadDict(dict)
115 except:
116 raise ImportError, 'Error loading dictionary library'
117
#---get a class (by loading modules if needed)--------------------------------------------

## Variable Documentation

list GaudiPython.Bindings.__all__

Initial value:
1 [ 'gbl','InterfaceCast', 'Interface', 'PropertyEntry',
2 'AppMgr', 'PyAlgorithm', 'CallbackStreamBuf',
3 'iAlgorithm', 'iDataSvc', 'iHistogramSvc','iNTupleSvc','iService', 'iAlgTool', 'Helper',
4 'SUCCESS', 'FAILURE', 'toArray',
5 'ROOT', 'makeNullPointer', 'makeClass', 'setOwnership',
6 'getClass', 'loaddict', 'deprecation' ]

Definition at line 10 of file Bindings.py.

GaudiPython.Bindings._CallbackStreamBufBase gbl.GaudiPython.CallbackStreamBuf

Definition at line 1085 of file Bindings.py.

GaudiPython.Bindings._gaudi None

Definition at line 42 of file Bindings.py.

GaudiPython.Bindings._PyAlgorithm gbl.GaudiPython.PyAlgorithm

Definition at line 1097 of file Bindings.py.

GaudiPython.Bindings.DataObject gbl.DataObject

Definition at line 50 of file Bindings.py.

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

Definition at line 52 of file Bindings.py.

GaudiPython.Bindings.Gaudi gbl.Gaudi

Definition at line 40 of file Bindings.py.

GaudiPython.Bindings.GaudiHandleArrayProperty gbl.GaudiHandleArrayProperty

Definition at line 49 of file Bindings.py.

GaudiPython.Bindings.GaudiHandleProperty gbl.GaudiHandleProperty

Definition at line 48 of file Bindings.py.

GaudiPython.Bindings.gbl cppyy.gbl

Definition at line 39 of file Bindings.py.

GaudiPython.Bindings.Helper gbl.GaudiPython.Helper

Definition at line 45 of file Bindings.py.

GaudiPython.Bindings.makeClass cppyy.libPyROOT.MakeRootClass

Definition at line 71 of file Bindings.py.

GaudiPython.Bindings.makeNullPointer cppyy.libPyROOT.MakeNullPointer

Definition at line 70 of file Bindings.py.

GaudiPython.Bindings.ROOT cppyy.libPyROOT

Definition at line 69 of file Bindings.py.

GaudiPython.Bindings.setOwnership cppyy.libPyROOT.SetOwnership

Definition at line 72 of file Bindings.py.

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

Definition at line 46 of file Bindings.py.

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

Definition at line 47 of file Bindings.py.

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

Definition at line 51 of file Bindings.py.

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

Definition at line 63 of file Bindings.py.