| The Gaudi Framework v27r1

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

- Namespace List
- Namespace Members

Classes | Functions | Variables
GaudiPython.Bindings Namespace Reference

## Classes
class | AppMgr
class | CallbackStreamBuf
class | iAlgorithm
class | iAlgTool
class | iDataSvc
class | iEventSelector
class | iHistogramSvc
class | iJobOptSvc
class | Interface
class | InterfaceCast
class | iNTupleSvc
class | iProperty
class | iService
class | iToolSvc
class | PropertyEntry
class | PyAlgorithm

## Functions
def | deprecation (message)
def | loaddict (dict)
def | getClass
def | _getFIDandEvents (pfn)
def | getComponentProperties (name)
def | _copyFactoriesFromList (factories)

## 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
| setOwnership = cppyy.libPyROOT.SetOwnership
| _CallbackStreamBufBase = gbl.GaudiPython.CallbackStreamBuf
| _PyAlgorithm = gbl.GaudiPython.PyAlgorithm

## Function Documentation

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

Definition at line 1080 of file Bindings.py.

1080 def _copyFactoriesFromList(factories) :
1081 result = []
1082 for i in range(factories.size()) :
1083 factory = factories.front()
1084 result.append(factory)
1085 factories.pop_front()
1086 for factory in result :
1087 factories.push_back(factory)
1088 return result
1089
1090 #----CallbackStreamBuf----------------------------------------------------------------
1091 # Used for redirecting C++ messages to python
Gaudi::range
NamedRange_< CONTAINER > range(const CONTAINER &cnt, std::string name)
simple function to create the named range form arbitrary container
Definition: NamedRange.h:130
GaudiPython.Bindings._copyFactoriesFromList
def _copyFactoriesFromList(factories)
Definition: Bindings.py:1080

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

Definition at line 1025 of file Bindings.py.

1025 def _getFIDandEvents( pfn ):
1026 tfile = gbl.TFile.Open(pfn)
1027 if not tfile : raise 'Cannot open ROOT file ', pfn
1028 tree = tfile.Get('##Params')
1029 tree.GetEvent(0)
1030 text = tree.db_string
1031 if 'NAME=FID' in text :
1032 fid = text[text.rfind('VALUE=')+6:-1]
1033 nevt = tfile.Get('_Event').GetEntries()
1034 tfile.Close()
1035 return fid, nevt
1036
1037 #--------------------------------------------------------------------------------------
GaudiPython.Bindings._getFIDandEvents
def _getFIDandEvents(pfn)
Definition: Bindings.py:1025

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

Definition at line 73 of file Bindings.py.

73 def deprecation(message):
74 warnings.warn('GaudiPython: '+ message, DeprecationWarning, stacklevel=3)
75
76 #----InterfaceCast class ----------------------------------------------------------------
GaudiPython.Bindings.deprecation
def deprecation(message)
Definition: Bindings.py:73

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

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

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

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

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

    Load a LCG dictionary using various mechanisms

Definition at line 107 of file Bindings.py.

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

## 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', 'setOwnership',
6 'getClass', 'loaddict', 'deprecation' ]

Definition at line 10 of file Bindings.py.

GaudiPython.Bindings._CallbackStreamBufBase = gbl.GaudiPython.CallbackStreamBuf

Definition at line 1092 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 1104 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.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 71 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.