Gaudi Framework, version v23r5

Home   Generated: Wed Nov 28 2012
 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__
 
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 1048 of file Bindings.py.

1049 def _copyFactoriesFromList(factories) :
1050  result = []
1051  for i in range(factories.size()) :
1052  factory = factories.front()
1053  result.append(factory)
1054  factories.pop_front()
1055  for factory in result :
1056  factories.push_back(factory)
1057  return result
1058 
1059 #----CallbackStreamBuf----------------------------------------------------------------
# Used for redirecting C++ messages to python
def GaudiPython.Bindings._getFIDandEvents (   pfn)
private

Definition at line 993 of file Bindings.py.

994 def _getFIDandEvents( pfn ):
995  tfile = gbl.TFile.Open(pfn)
996  if not tfile : raise 'Cannot open ROOT file ', pfn
997  tree = tfile.Get('##Params')
998  tree.GetEvent(0)
999  text = tree.db_string
1000  if 'NAME=FID' in text :
1001  fid = text[text.rfind('VALUE=')+6:-1]
1002  nevt = tfile.Get('_Event').GetEntries()
1003  tfile.Close()
1004  return fid, nevt
1005 
#--------------------------------------------------------------------------------------
def GaudiPython.Bindings.deprecation (   message)

Definition at line 61 of file Bindings.py.

61 
62 def deprecation(message):
63  warnings.warn('GaudiPython: '+ message, DeprecationWarning, stacklevel=3)
64 
#----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.

105 def getClass( name , libs = [] ) :
106  """
107  Function to retrieve a certain C++ class by name and to load dictionary if requested
108 
109  Usage:
110 
111  from gaudimodule import getClass
112  # one knows that class is already loaded
113  AppMgr = getClass( 'ApplicationMgr' )
114  # one knows where to look for class, if not loaded yet
115  MCParticle = getClass( 'MCParticle' , 'EventDict' )
116  # one knows where to look for class, if not loaded yet
117  Vertex = getClass( 'Vertex' , ['EventDict', 'PhysEventDict'] )
118  """
119  # see if class is already loaded
120  if hasattr( gbl , name ) : return getattr( gbl , name )
121  # try to load dictionaries and look for the required class
122  if type(libs) is not list : libs = [libs]
123  for lib in libs :
124  loaddict( lib )
125  if hasattr( gbl , name ) : return getattr( gbl , name )
126  # return None ( or raise exception? I do not know... )
127  return None
128 
#----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 1006 of file Bindings.py.

1007 def getComponentProperties( name ):
1008  """ Get all the properties of a component as a Python dictionary.
1009  The component is instantiated using the component library
1010  """
1011  properties = {}
1012  if name == 'GaudiCoreSvc' :
1013  if Helper.loadDynamicLib(name) != 1 :
1014  raise ImportError, 'Error loading component library '+ name
1015  factorylist = gbl.FactoryTable.instance().getEntries()
1016  factories = _copyFactoriesFromList(factorylist)
1017  g = AppMgr(outputlevel=7)
1018  else :
1019  g = AppMgr(outputlevel=7)
1020  if Helper.loadDynamicLib(name) != 1 :
1021  raise ImportError, 'Error loading component library '+ name
1022  factorylist = gbl.FactoryTable.instance().getEntries()
1023  factories = _copyFactoriesFromList(factorylist)
1024  svcloc = gbl.Gaudi.svcLocator()
1025  dummysvc = gbl.Service('DummySvc',svcloc)
1026  for factory in factories :
1027  if InterfaceCast(gbl.IAlgFactory)(factory) : ctype = 'Algorithm'
1028  elif InterfaceCast(gbl.ISvcFactory)(factory) : ctype = 'Service'
1029  elif InterfaceCast(gbl.IToolFactory)(factory) : ctype = 'AlgTool'
1030  elif factory.ident() == 'ApplicationMgr' : ctype = 'ApplicationMgr'
1031  else : ctype = 'Unknown'
1032  cname = factory.ident().split()[-1]
1033  if ctype in ('Algorithm','Service', 'AlgTool', 'ApplicationMgr') :
1034  try :
1035  if ctype == 'AlgTool' :
1036  obj = factory.instantiate(dummysvc)
1037  else :
1038  obj = factory.instantiate(svcloc)
1039  except RuntimeError, text :
1040  print 'Error instantiating', cname, ' from ', name
1041  print text
1042  continue
1043  prop = iProperty('dummy', obj)
1044  properties[cname] = [ctype, prop.properties()]
1045  try: obj.release()
1046  except: pass
1047  return properties
def GaudiPython.Bindings.loaddict (   dict)
Load a LCG dictionary using various mechanisms

Definition at line 94 of file Bindings.py.

94 
95 def loaddict(dict) :
96  """ Load a LCG dictionary using various mechanisms"""
97  if Helper.loadDynamicLib(dict) == 1 : return
98  else :
99  try:
100  PyCintex.loadDict(dict)
101  except:
102  raise ImportError, 'Error loading dictionary library'
103 
#---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 11 of file Bindings.py.

GaudiPython.Bindings._CallbackStreamBufBase gbl.GaudiPython.CallbackStreamBuf

Definition at line 1060 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 1072 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.


Generated at Wed Nov 28 2012 12:17:40 for Gaudi Framework, version v23r5 by Doxygen version 1.8.2 written by Dimitri van Heesch, © 1997-2004