| The Gaudi Framework v28r2p1 (f1a77ff4)

- 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 (name, libs=[])
def | _getFIDandEvents (pfn)
def | getComponentProperties (name)
def | _copyFactoriesFromList (factories)

## Variables
list | __all__
| gbl = cppyy.gbl
| Gaudi = gbl.Gaudi
| _gaudi = None
| Helper = gbl.GaudiPython.Helper
| StringProperty = gbl.Gaudi.Property('std::string')
| StringPropertyRef = gbl.Gaudi.Property('std::string&')
| GaudiHandleProperty = gbl.GaudiHandleProperty
| GaudiHandleArrayProperty = gbl.GaudiHandleArrayProperty
| DataObject = gbl.DataObject
| SUCCESS = gbl.StatusCode( gbl.StatusCode.SUCCESS, True )
| FAILURE = gbl.StatusCode( gbl.StatusCode.FAILURE, True )
| 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 1090 of file Bindings.py.

1090 def _copyFactoriesFromList(factories) :
1091 result = []
1092 for i in range(factories.size()) :
1093 factory = factories.front()
1094 result.append(factory)
1095 factories.pop_front()
1096 for factory in result :
1097 factories.push_back(factory)
1098 return result
1099
1100 #----CallbackStreamBuf----------------------------------------------------------------
1101 # Used for redirecting C++ messages to python
Gaudi::Functional::details::zip::range
decltype(auto) range(Args &&...args)
Zips multiple containers together to form a single range.
Definition: FunctionalDetails.h:57
GaudiPython.Bindings._copyFactoriesFromList
def _copyFactoriesFromList(factories)
Definition: Bindings.py:1090

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

Definition at line 1035 of file Bindings.py.

1035 def _getFIDandEvents( pfn ):
1036 tfile = gbl.TFile.Open(pfn)
1037 if not tfile : raise 'Cannot open ROOT file ', pfn
1038 tree = tfile.Get('##Params')
1039 tree.GetEvent(0)
1040 text = tree.db_string
1041 if 'NAME=FID' in text :
1042 fid = text[text.rfind('VALUE=')+6:-1]
1043 nevt = tfile.Get('_Event').GetEntries()
1044 tfile.Close()
1045 return fid, nevt
1046
1047 #--------------------------------------------------------------------------------------
GaudiPython.Bindings._getFIDandEvents
def _getFIDandEvents(pfn)
Definition: Bindings.py:1035

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

Definition at line 82 of file Bindings.py.

82 def deprecation(message):
83 warnings.warn('GaudiPython: '+ message, DeprecationWarning, stacklevel=3)
84
85 #----InterfaceCast class ----------------------------------------------------------------
GaudiPython.Bindings.deprecation
def deprecation(message)
Definition: Bindings.py:82

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

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

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

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

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

    Load a LCG dictionary using various mechanisms

Definition at line 116 of file Bindings.py.

116 def loaddict(dict) :
117 """ Load a LCG dictionary using various mechanisms"""
118 if Helper.loadDynamicLib(dict) == 1 : return
119 else :
120 try:
121 cppyy.loadDict(dict)
122 except:
123 raise ImportError, 'Error loading dictionary library'
124
125 #---get a class (by loading modules if needed)--------------------------------------------
GaudiPython.Bindings.loaddict
def loaddict(dict)
Definition: Bindings.py:116

## Variable Documentation

list GaudiPython.Bindings.__all__
| private

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
| private

Definition at line 1102 of file Bindings.py.

GaudiPython.Bindings._gaudi = None
| private

Definition at line 42 of file Bindings.py.

GaudiPython.Bindings._PyAlgorithm = gbl.GaudiPython.PyAlgorithm
| private

Definition at line 1114 of file Bindings.py.

GaudiPython.Bindings.DataObject = gbl.DataObject

Definition at line 51 of file Bindings.py.

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

Definition at line 53 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 50 of file Bindings.py.

GaudiPython.Bindings.GaudiHandleProperty = gbl.GaudiHandleProperty

Definition at line 49 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 46 of file Bindings.py.

GaudiPython.Bindings.makeNullPointer = cppyy.libPyROOT.MakeNullPointer

Definition at line 79 of file Bindings.py.

GaudiPython.Bindings.ROOT = cppyy.libPyROOT

Definition at line 78 of file Bindings.py.

GaudiPython.Bindings.setOwnership = cppyy.libPyROOT.SetOwnership

Definition at line 80 of file Bindings.py.

GaudiPython.Bindings.StringProperty = gbl.Gaudi.Property('std::string')

Definition at line 47 of file Bindings.py.

GaudiPython.Bindings.StringPropertyRef = gbl.Gaudi.Property('std::string&')

Definition at line 48 of file Bindings.py.

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

Definition at line 52 of file Bindings.py.

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

Definition at line 72 of file Bindings.py.