The Gaudi Framework  v33r2 (a6f0ec87)
GaudiPython.Bindings.AppMgr Class Reference
Inheritance diagram for GaudiPython.Bindings.AppMgr:
Collaboration diagram for GaudiPython.Bindings.AppMgr:

Public Member Functions

def __new__ (cls, *args, **kwargs)
 
def __reset__ (self)
 
def __init__ (self, outputlevel=-1, joboptions=None, selfoptions={}, dllname=None, factname=None)
 
def state (self)
 
def FSMState (self)
 
def targetFSMState (self)
 
def service (self, name, interface=None)
 
def declSvcType (self, svcname, svctype)
 
def createSvc (self, name)
 
def services (self)
 
def algorithm (self, name, createIf=False)
 
def algorithms (self)
 
def tool (self, name)
 
def property (self, name)
 
def datasvc (self, name)
 
def evtsvc (self)
 
def detsvc (self)
 
def filerecordsvc (self)
 
def evtsel (self)
 
def histsvc (self, name='HistogramDataSvc')
 
def ntuplesvc (self, name='NTupleSvc')
 
def partsvc (self)
 
def toolsvc (self, name='ToolSvc')
 
def optSvc (self, name='JobOptionsSvc')
 
def readOptions (self, file)
 
def addAlgorithm (self, alg)
 
def setAlgorithms (self, algs)
 
def removeAlgorithm (self, alg)
 
def printAlgsSequences (self)
 
def config (self, **args)
 
def configure (self)
 
def start (self)
 
def terminate (self)
 
def run (self, n)
 
def executeEvent (self)
 
def execute (self)
 
def runSelectedEvents (self, pfn, events)
 
def exit (self)
 
def __del__ (self)
 
- Public Member Functions inherited from GaudiPython.Bindings.iService
def __init__ (self, name, isvc=None)
 
def retrieveInterface (self)
 
def initialize (self)
 
def stop (self)
 
def finalize (self)
 
def reinitialize (self)
 
def restart (self)
 
def isValid (self)
 
- Public Member Functions inherited from GaudiPython.Bindings.iProperty
def getInterface (self)
 
def __call_interface_method__ (self, ifname, method, *args)
 
def __setattr__ (self, name, value)
 
def __getattr__ (self, name)
 
def properties (self)
 
def name (self)
 

Public Attributes

 JobOptionsType
 
 OutputLevel
 
 topAlg
 

Static Public Attributes

def evtSvc = evtsvc
 
def histSvc = histsvc
 
def ntupleSvc = ntuplesvc
 
def evtSel = evtsel
 
def detSvc = detsvc
 
def toolSvc = toolsvc
 
def partSvc = partsvc
 

Private Member Functions

def _install_exit_handlers (self)
 

Detailed Description

Definition at line 941 of file Bindings.py.

Constructor & Destructor Documentation

◆ __init__()

def GaudiPython.Bindings.AppMgr.__init__ (   self,
  outputlevel = -1,
  joboptions = None,
  selfoptions = {},
  dllname = None,
  factname = None 
)

Definition at line 964 of file Bindings.py.

964  def __init__(self,
965  outputlevel=-1,
966  joboptions=None,
967  selfoptions={},
968  dllname=None,
969  factname=None):
970  global _gaudi
971  if _gaudi:
972  return
973  # Make sure the python stdout buffer is flushed before c++ runs
974  sys.stdout.flush()
975  # Protection against multiple calls to exit() if the finalization fails
976  self.__dict__['_exit_called'] = False
977  # keep the Gaudi namespace around (so it is still available during atexit shutdown)...
978  self.__dict__['_gaudi_ns'] = Gaudi
979  try:
980  from GaudiKernel.Proxy.Configurable import expandvars
981  except ImportError:
982  # pass-through implementation if expandvars is not defined (AthenaCommon)
983  def expandvars(data):
984  return data
985 
986  if dllname and factname:
987  self.__dict__['_appmgr'] = gbl.Gaudi.createApplicationMgr(
988  dllname, factname)
989  elif dllname:
990  self.__dict__['_appmgr'] = gbl.Gaudi.createApplicationMgr(dllname)
991  else:
992  self.__dict__['_appmgr'] = gbl.Gaudi.createApplicationMgr()
993  self.__dict__['_svcloc'] = gbl.Gaudi.svcLocator()
994  self.__dict__['_algmgr'] = InterfaceCast(gbl.IAlgManager)(self._appmgr)
995  self.__dict__['_evtpro'] = InterfaceCast(gbl.IEventProcessor)(
996  self._appmgr)
997  self.__dict__['_svcmgr'] = InterfaceCast(gbl.ISvcManager)(self._appmgr)
998  self.__dict__['pyalgorithms'] = []
999  iService.__init__(self, 'ApplicationMgr', self._appmgr)
1000  # ------python specific initialization-------------------------------------
1001  if self.FSMState(
1002  ) < Gaudi.StateMachine.CONFIGURED: # Not yet configured
1003  self.JobOptionsType = 'NONE'
1004  if joboptions:
1005  from GaudiKernel.ProcessJobOptions import importOptions
1006  importOptions(joboptions)
1007  # Ensure that the ConfigurableUser instances have been applied
1008  import GaudiKernel.Proxy.Configurable
1009  if hasattr(GaudiKernel.Proxy.Configurable,
1010  "applyConfigurableUsers"):
1011  GaudiKernel.Proxy.Configurable.applyConfigurableUsers()
1012  # This is the default and could be overridden with "selfopts"
1013  self.OutputLevel = 3
1014  try:
1015  appMgr = Configurable.allConfigurables['ApplicationMgr']
1016  selfprops = expandvars(appMgr.getValuedProperties())
1017  except KeyError:
1018  selfprops = {}
1019  for p, v in selfprops.items():
1020  setattr(self, p, v)
1021  for p, v in selfoptions.items():
1022  setattr(self, p, v)
1023  # Override job options
1024  if outputlevel != -1:
1025  self.OutputLevel = outputlevel
1026  self.configure()
1027  # ---MessageSvc------------------------------------------------------------
1028  ms = self.service('MessageSvc')
1029  if 'MessageSvc' in Configurable.allConfigurables:
1030  msprops = Configurable.allConfigurables['MessageSvc']
1031  ms = self.service('MessageSvc')
1032  if hasattr(msprops, "getValuedProperties"):
1033  msprops = expandvars(msprops.getValuedProperties())
1034  for p, v in msprops.items():
1035  setattr(ms, p, v)
1036  if outputlevel != -1:
1037  ms.OutputLevel = outputlevel
1038  # ---JobOptions------------------------------------------------------------
1039  self.__dict__['_optsvc'] = InterfaceCast(gbl.IJobOptionsSvc)(
1040  Helper.service(self._svcloc, 'JobOptionsSvc'))
1041  # ------Configurables initialization (part2)-------------------------------
1042  mkStringProperty = gbl.GaudiPython.Helpers.mkStringProperty
1043  for n in getNeededConfigurables():
1044  c = Configurable.allConfigurables[n]
1045  if n in ['ApplicationMgr', 'MessageSvc']:
1046  continue # These are already done---
1047  for p, v in c.getValuedProperties().items():
1048  v = expandvars(v)
1049  # Note: AthenaCommon.Configurable does not have Configurable.PropertyReference
1050  if hasattr(Configurable, "PropertyReference") and type(
1051  v) == Configurable.PropertyReference:
1052  # this is done in "getFullName", but the exception is ignored,
1053  # so we do it again to get it
1054  v = v.__resolve__()
1055  if type(v) == str:
1056  v = '"%s"' % v # need double quotes
1057  elif type(v) == long:
1058  v = '%d' % v # prevent pending 'L'
1059  self._optsvc.addPropertyToCatalogue(
1060  n, mkStringProperty(p, str(v)))
1061  if hasattr(Configurable, "_configurationLocked"):
1062  Configurable._configurationLocked = True
1063 
1064  self._install_exit_handlers()
1065 
getNeededConfigurables
Definition: Proxy.py:31
bool PyHelper() addPropertyToCatalogue(IInterface *p, char *comp, char *name, char *value)
Definition: Bootstrap.cpp:255

◆ __del__()

def GaudiPython.Bindings.AppMgr.__del__ (   self)

Definition at line 1427 of file Bindings.py.

1427  def __del__(self):
1428  self.exit()
1429 

Member Function Documentation

◆ __new__()

def GaudiPython.Bindings.AppMgr.__new__ (   cls,
args,
**  kwargs 
)

Definition at line 942 of file Bindings.py.

942  def __new__(cls, *args, **kwargs):
943  global _gaudi
944  if not _gaudi:
945  newobj = object.__new__(cls)
946  cls.__init__(newobj, *args, **kwargs)
947  _gaudi = newobj
948  return _gaudi
949 

◆ __reset__()

def GaudiPython.Bindings.AppMgr.__reset__ (   self)

Definition at line 950 of file Bindings.py.

950  def __reset__(self):
951  global _gaudi
952  # Stop, Finalize and Terminate the current AppMgr
953  self.exit()
954  # release interfaces
955  self._evtpro.release()
956  self._svcloc.release()
957  self._appmgr.release()
958  # Reset the C++ globals
959  gbl.Gaudi.setInstance(makeNullPointer('ISvcLocator'))
960  gbl.Gaudi.setInstance(makeNullPointer('IAppMgrUI'))
961  # Reset the Python global
962  _gaudi = None
963 

◆ _install_exit_handlers()

def GaudiPython.Bindings.AppMgr._install_exit_handlers (   self)
private
Ensure that the exit method is called when exiting from Python, and
try to ensure that ROOT doesn't intefere too much.

Definition at line 1066 of file Bindings.py.

1066  def _install_exit_handlers(self):
1067  """Ensure that the exit method is called when exiting from Python, and
1068  try to ensure that ROOT doesn't intefere too much."""
1069  import atexit
1070  atexit.register(self.exit)
1071 
1072  try:
1073  exit_handlers = atexit._exithandlers
1074  except AttributeError:
1075  # Python 3's atext does not expose _exithandlers, so we can't do
1076  # anything more
1077  return
1078 
1079  # ---Hack to avoid bad interactions with the ROOT exit handler
1080  # Look for an exit handler installed by ROOT
1081  root_handler_installed = False
1082  for h in exit_handlers:
1083  func = h[0]
1084  if hasattr(func, "__module__") and func.__module__ == "ROOT":
1085  root_handler_installed = True
1086  break
1087 
1088  # If the handler is not yet installed, let's install our private version
1089  # that detects that the ROOT exit handler is installed and add our own
1090  # after it to ensure it is called before.
1091  if not root_handler_installed:
1092  orig_register = atexit.register
1093 
1094  def register(func, *targs, **kargs):
1095  orig_register(func, *targs, **kargs)
1096  if hasattr(func, "__module__") and func.__module__ == "ROOT":
1097  orig_register(self.exit)
1098  # we do not need to remove out handler from the list because
1099  # it can be safely called more than once
1100 
1101  register.__doc__ = (
1102  orig_register.__doc__ +
1103  "\nNote: version hacked by GaudiPython to work " +
1104  "around a problem with the ROOT exit handler")
1105  atexit.register = register
1106 

◆ addAlgorithm()

def GaudiPython.Bindings.AppMgr.addAlgorithm (   self,
  alg 
)
Add an Algorithm to the list of Top algorithms. It can be either a instance of
    an Algorithm class or it name 

Definition at line 1205 of file Bindings.py.

1205  def addAlgorithm(self, alg):
1206  """ Add an Algorithm to the list of Top algorithms. It can be either a instance of
1207  an Algorithm class or it name """
1208  if type(alg) is str:
1209  self.topAlg += [alg]
1210  else:
1211  self.pyalgorithms.append(alg)
1212  setOwnership(alg, 0)
1213  if self.targetFSMState() >= Gaudi.StateMachine.INITIALIZED:
1214  alg.sysInitialize()
1215  if self.targetFSMState() == Gaudi.StateMachine.RUNNING:
1216  alg.sysStart()
1217  self.topAlg += [alg.name()]
1218 

◆ algorithm()

def GaudiPython.Bindings.AppMgr.algorithm (   self,
  name,
  createIf = False 
)

Definition at line 1133 of file Bindings.py.

1133  def algorithm(self, name, createIf=False):
1134  alg = Helper.algorithm(self._algmgr, name, createIf)
1135  if not alg:
1136  return iAlgorithm(name, alg)
1137  else:
1138  return iAlgorithm(alg.name(), alg)
1139 

◆ algorithms()

def GaudiPython.Bindings.AppMgr.algorithms (   self)

Definition at line 1140 of file Bindings.py.

1140  def algorithms(self):
1141  l = self._algmgr.getAlgorithms()
1142  return [a.name() for a in l]
1143 

◆ config()

def GaudiPython.Bindings.AppMgr.config (   self,
**  args 
)
Simple utility to perform the configuration of Gaudi application.
It reads the set of input job-options files, and set few
additional parameters 'options' through the usage of temporary *.opts file
Usage:
gaudi.config( files   = [ '$GAUSSOPTS/Gauss.opts'                     ,
                  '$DECFILESROOT/options/10022_010.0GeV.opts' ] ,
      options = [ 'EventSelector.PrintFreq   =   5  '         ] )

Definition at line 1276 of file Bindings.py.

1276  def config(self, **args):
1277  """
1278  Simple utility to perform the configuration of Gaudi application.
1279  It reads the set of input job-options files, and set few
1280  additional parameters 'options' through the usage of temporary *.opts file
1281  Usage:
1282  gaudi.config( files = [ '$GAUSSOPTS/Gauss.opts' ,
1283  '$DECFILESROOT/options/10022_010.0GeV.opts' ] ,
1284  options = [ 'EventSelector.PrintFreq = 5 ' ] )
1285  """
1286  files = args.get('files', [])
1287  for file in files:
1288  sc = self.readOptions(file)
1289  if sc.isFailure():
1290  raise RuntimeError(' Unable to read file "' + file + '" ')
1291  options = args.get('options', None)
1292  if options:
1293  import tempfile
1294  tmpfilename = tempfile.mktemp()
1295  tmpfile = open(tmpfilename, 'w')
1296  tmpfile.write('#pragma print on \n')
1297  tmpfile.write('/// File "' + tmpfilename +
1298  '" generated by GaudiPython \n\n')
1299  for opt in options:
1300  if type(options) is dict:
1301  tmpfile.write(' \t ' + opt + ' = ' + options[opt] +
1302  ' ; // added by GaudiPython \n')
1303  else:
1304  tmpfile.write(' \t ' + opt +
1305  ' ; // added by GaudiPython \n')
1306  tmpfile.write('/// End of file "' + tmpfilename +
1307  '" generated by GaudiPython \n\n')
1308  tmpfile.close()
1309  sc = self.readOptions(tmpfilename)
1310  if sc.isFailure():
1311  raise RuntimeError(' Unable to read file "' + tmpfilename +
1312  '" ')
1313  os.remove(tmpfilename)
1314  # We need to make sure that the options are taken by the ApplicationMgr
1315  # The state is already configured, so we need to do something....
1316  if self.FSMState() != Gaudi.StateMachine.OFFLINE:
1317 
1318  # get job-options-service, @see class iJobOptSvc
1319  jos = self.optSvc()
1320 
1321  # list of all libraries
1322  _dlls = jos.getProperty(self.name(), 'DLLs')
1323  # take care about libraries : APPEND if not done yet
1324  if _dlls:
1325  libs = [l for l in _dlls if not l in self.DLLs]
1326  if libs:
1327  self.DLLs += libs
1328 
1329  # all external services
1330  _svcs = jos.getProperty(self.name(), 'ExtSvc')
1331  # take care about services : APPEND if not done yet
1332  if _svcs:
1333  svcs = [s for s in _svcs if not s in self.ExtSvc]
1334  if svcs:
1335  self.ExtSvc += svcs
1336 
1337  # get all properties
1338  props = jos.getProperties(self.name())
1339  # finally treat all other properties (presumably scalar properties)
1340  for key in props:
1341  if 'DLLS' == key or 'EXTSVC' == key:
1342  continue
1343  self.__setattr__(key, props[key])
1344  return SUCCESS # RETURN
1345 

◆ configure()

def GaudiPython.Bindings.AppMgr.configure (   self)

Definition at line 1346 of file Bindings.py.

1346  def configure(self):
1347  return self._appmgr.configure()
1348 

◆ createSvc()

def GaudiPython.Bindings.AppMgr.createSvc (   self,
  name 
)

Definition at line 1126 of file Bindings.py.

1126  def createSvc(self, name):
1127  return Helper.service(self._svcloc, name, True)
1128 

◆ datasvc()

def GaudiPython.Bindings.AppMgr.datasvc (   self,
  name 
)

Definition at line 1155 of file Bindings.py.

1155  def datasvc(self, name):
1156  if self.state() == Gaudi.StateMachine.CONFIGURED:
1157  self.initialize()
1158  svc = Helper.service(self._svcloc, name)
1159  return iDataSvc(name, svc)
1160 

◆ declSvcType()

def GaudiPython.Bindings.AppMgr.declSvcType (   self,
  svcname,
  svctype 
)

Definition at line 1123 of file Bindings.py.

1123  def declSvcType(self, svcname, svctype):
1124  self._svcmgr.declareSvcType(svcname, svctype)
1125 

◆ detsvc()

def GaudiPython.Bindings.AppMgr.detsvc (   self)

Definition at line 1164 of file Bindings.py.

1164  def detsvc(self):
1165  return self.datasvc('DetectorDataSvc')
1166 

◆ evtsel()

def GaudiPython.Bindings.AppMgr.evtsel (   self)

Definition at line 1170 of file Bindings.py.

1170  def evtsel(self):
1171  if self.state() == Gaudi.StateMachine.CONFIGURED:
1172  self.initialize()
1173  if not hasattr(self, '_evtsel'):
1174  self.__dict__['_evtsel'] = iEventSelector()
1175  return self._evtsel
1176 

◆ evtsvc()

def GaudiPython.Bindings.AppMgr.evtsvc (   self)

Definition at line 1161 of file Bindings.py.

1161  def evtsvc(self):
1162  return self.datasvc('EventDataSvc')
1163 

◆ execute()

def GaudiPython.Bindings.AppMgr.execute (   self)

Definition at line 1369 of file Bindings.py.

1369  def execute(self):
1370  return self._evtpro.executeEvent()
1371 
executeEvent
Helpers for re-entrant interfaces.

◆ executeEvent()

def GaudiPython.Bindings.AppMgr.executeEvent (   self)

Definition at line 1366 of file Bindings.py.

1366  def executeEvent(self):
1367  return self._evtpro.executeEvent()
1368 
executeEvent
Helpers for re-entrant interfaces.

◆ exit()

def GaudiPython.Bindings.AppMgr.exit (   self)

Definition at line 1412 of file Bindings.py.

1412  def exit(self):
1413  # Protection against multiple calls to exit() if the finalization fails
1414  if not self._exit_called:
1415  self.__dict__['_exit_called'] = True
1416  Gaudi = self._gaudi_ns
1417  if self.FSMState() == Gaudi.StateMachine.RUNNING:
1418  self._appmgr.stop().ignore()
1419  if self.FSMState() == Gaudi.StateMachine.INITIALIZED:
1420  self._appmgr.finalize().ignore()
1421  if self.FSMState() == Gaudi.StateMachine.CONFIGURED:
1422  self._appmgr.terminate()
1423  return SUCCESS
1424 

◆ filerecordsvc()

def GaudiPython.Bindings.AppMgr.filerecordsvc (   self)

Definition at line 1167 of file Bindings.py.

1167  def filerecordsvc(self):
1168  return self.datasvc('FileRecordDataSvc')
1169 

◆ FSMState()

def GaudiPython.Bindings.AppMgr.FSMState (   self)

Definition at line 1110 of file Bindings.py.

1110  def FSMState(self):
1111  return self._isvc.FSMState()
1112 

◆ histsvc()

def GaudiPython.Bindings.AppMgr.histsvc (   self,
  name = 'HistogramDataSvc' 
)

Definition at line 1177 of file Bindings.py.

1177  def histsvc(self, name='HistogramDataSvc'):
1178  svc = Helper.service(self._svcloc, name)
1179  return iHistogramSvc(name, svc)
1180 

◆ ntuplesvc()

def GaudiPython.Bindings.AppMgr.ntuplesvc (   self,
  name = 'NTupleSvc' 
)

Definition at line 1181 of file Bindings.py.

1181  def ntuplesvc(self, name='NTupleSvc'):
1182  if name not in self.ExtSvc:
1183  self.ExtSvc += [name]
1184 # if self.HistogramPersistency == 'NONE' : self.HistogramPersistency = 'ROOT'
1185  svc = Helper.service(self._svcloc, name, True)
1186  return iNTupleSvc(name, svc)
1187 

◆ optSvc()

def GaudiPython.Bindings.AppMgr.optSvc (   self,
  name = 'JobOptionsSvc' 
)

Definition at line 1198 of file Bindings.py.

1198  def optSvc(self, name='JobOptionsSvc'):
1199  svc = Helper.service(self._svcloc, name, True)
1200  return iJobOptSvc(name, svc)
1201 

◆ partsvc()

def GaudiPython.Bindings.AppMgr.partsvc (   self)

Definition at line 1188 of file Bindings.py.

1188  def partsvc(self):
1189  if self.FSMState() == Gaudi.StateMachine.CONFIGURED:
1190  self.initialize()
1191  svc = Helper.service(self._svcloc, 'ParticlePropertySvc')
1192  return InterfaceCast(gbl.IParticlePropertySvc)(svc)
1193 

◆ printAlgsSequences()

def GaudiPython.Bindings.AppMgr.printAlgsSequences (   self)
Print the sequence of Algorithms.

Definition at line 1249 of file Bindings.py.

1249  def printAlgsSequences(self):
1250  """
1251  Print the sequence of Algorithms.
1252  """
1253 
1254  def printAlgo(algName, appMgr, prefix=' '):
1255  print(prefix + algName)
1256  alg = appMgr.algorithm(algName.split("/")[-1])
1257  prop = alg.properties()
1258  if "Members" in prop:
1259  subs = prop["Members"].value()
1260  for i in subs:
1261  printAlgo(i.strip('"'), appMgr, prefix + " ")
1262 
1263  mp = self.properties()
1264  prefix = 'ApplicationMgr SUCCESS '
1265  print(
1266  prefix +
1267  "****************************** Algorithm Sequence ****************************"
1268  )
1269  for i in mp["TopAlg"].value():
1270  printAlgo(i, self, prefix)
1271  print(
1272  prefix +
1273  "******************************************************************************"
1274  )
1275 

◆ property()

def GaudiPython.Bindings.AppMgr.property (   self,
  name 
)

Definition at line 1147 of file Bindings.py.

1147  def property(self, name):
1148  if name in self.algorithms():
1149  return self.algorithm(name)
1150  elif name in self.services():
1151  return self.service(name)
1152  else:
1153  return iProperty(name)
1154 

◆ readOptions()

def GaudiPython.Bindings.AppMgr.readOptions (   self,
  file 
)

Definition at line 1202 of file Bindings.py.

1202  def readOptions(self, file):
1203  return self._optsvc.readOptions(file)
1204 

◆ removeAlgorithm()

def GaudiPython.Bindings.AppMgr.removeAlgorithm (   self,
  alg 
)
Remove an Algorithm to the list of Top algorithms. It can be either a instance of
    an Algorithm class or it name 

Definition at line 1237 of file Bindings.py.

1237  def removeAlgorithm(self, alg):
1238  """ Remove an Algorithm to the list of Top algorithms. It can be either a instance of
1239  an Algorithm class or it name """
1240  tmp = self.topAlg
1241  if type(alg) is str:
1242  tmp.remove(alg)
1243  else:
1244  tmp.remove(alg.name())
1245  self.pyalgorithms.remove(alg)
1246  setOwnership(alg, 1)
1247  self.topAlg = tmp
1248 

◆ run()

def GaudiPython.Bindings.AppMgr.run (   self,
  n 
)

Definition at line 1355 of file Bindings.py.

1355  def run(self, n):
1356  if self.FSMState() == Gaudi.StateMachine.CONFIGURED:
1357  sc = self.initialize()
1358  if sc.isFailure() or self.ReturnCode != 0:
1359  return sc
1360  if self.FSMState() == Gaudi.StateMachine.INITIALIZED:
1361  sc = self.start()
1362  if sc.isFailure() or self.ReturnCode != 0:
1363  return sc
1364  return self._evtpro.executeRun(n)
1365 
return ep &&ep executeRun(maxevt).isSuccess()

◆ runSelectedEvents()

def GaudiPython.Bindings.AppMgr.runSelectedEvents (   self,
  pfn,
  events 
)

Definition at line 1372 of file Bindings.py.

1372  def runSelectedEvents(self, pfn, events):
1373  if self.FSMState() == Gaudi.StateMachine.CONFIGURED:
1374  sc = self.initialize()
1375  if sc.isFailure():
1376  return sc
1377  if self.FSMState() == Gaudi.StateMachine.INITIALIZED:
1378  sc = self.start()
1379  if sc.isFailure():
1380  return sc
1381  # --- Access a number of services ----
1382  if not hasattr(self, '_perssvc'):
1383  self.__dict__['_perssvc'] = self.service('EventPersistencySvc',
1384  'IAddressCreator')
1385  if not hasattr(self, '_filecat'):
1386  self.__dict__['_filecat'] = self.service('FileCatalog',
1387  'Gaudi::IFileCatalog')
1388  if not hasattr(self, '_evtmgr'):
1389  self.__dict__['_evtmgr'] = self.service('EventDataSvc',
1390  'IDataManagerSvc')
1391  # --- Get FID from PFN and number of events in file
1392  if pfn.find('PFN:') == 0:
1393  pfn = pfn[4:]
1394  fid, maxevt = _getFIDandEvents(pfn)
1395  # --- Add FID into catalog if needed ---
1396  if not self._filecat.existsFID(fid):
1397  self._filecat.registerPFN(fid, pfn, '')
1398  # --- Loop over events
1399  if type(events) is not list:
1400  events = (events, )
1401  for evt in events:
1402  # --- Create POOL Address from Generic Address
1403  gadd = gbl.GenericAddress(0x02, 1, fid, '/Event', 0, evt)
1404  oadd = makeNullPointer('IOpaqueAddress')
1405  self._perssvc.createAddress(gadd.svcType(), gadd.clID(),
1406  gadd.par(), gadd.ipar(), oadd)
1407  # --- Clear TES, set root and run all algorithms
1408  self._evtmgr.clearStore()
1409  self._evtmgr.setRoot('/Event', oadd)
1410  self._evtpro.executeEvent()
1411 
executeEvent
Helpers for re-entrant interfaces.
def _getFIDandEvents(pfn)
Definition: Bindings.py:1442

◆ service()

def GaudiPython.Bindings.AppMgr.service (   self,
  name,
  interface = None 
)

Definition at line 1116 of file Bindings.py.

1116  def service(self, name, interface=None):
1117  svc = Helper.service(self._svcloc, name)
1118  if interface:
1119  return InterfaceCast(interface)(svc)
1120  else:
1121  return iService(name, svc)
1122 

◆ services()

def GaudiPython.Bindings.AppMgr.services (   self)

Definition at line 1129 of file Bindings.py.

1129  def services(self):
1130  l = self._svcloc.getServices()
1131  return [s.name() for s in l]
1132 

◆ setAlgorithms()

def GaudiPython.Bindings.AppMgr.setAlgorithms (   self,
  algs 
)
Set the list of Top Algorithms.
    It can be an individual of a list of algorithms names or instances 

Definition at line 1219 of file Bindings.py.

1219  def setAlgorithms(self, algs):
1220  """ Set the list of Top Algorithms.
1221  It can be an individual of a list of algorithms names or instances """
1222  if type(algs) is not list:
1223  algs = [algs]
1224  names = []
1225  for alg in algs:
1226  if type(alg) is str:
1227  names.append(alg)
1228  else:
1229  self.pyalgorithms.append(alg)
1230  if self.targetFSMState() >= Gaudi.StateMachine.INITIALIZED:
1231  alg.sysInitialize()
1232  if self.targetFSMState() == Gaudi.StateMachine.RUNNING:
1233  alg.sysStart()
1234  names.append(alg.name())
1235  self.topAlg = names
1236 

◆ start()

def GaudiPython.Bindings.AppMgr.start (   self)

Reimplemented from GaudiPython.Bindings.iService.

Definition at line 1349 of file Bindings.py.

1349  def start(self):
1350  return self._appmgr.start()
1351 
def start
Definition: IOTest.py:108

◆ state()

def GaudiPython.Bindings.AppMgr.state (   self)

Definition at line 1107 of file Bindings.py.

1107  def state(self):
1108  return self._isvc.FSMState()
1109 

◆ targetFSMState()

def GaudiPython.Bindings.AppMgr.targetFSMState (   self)

Definition at line 1113 of file Bindings.py.

1113  def targetFSMState(self):
1114  return self._isvc.targetFSMState()
1115 

◆ terminate()

def GaudiPython.Bindings.AppMgr.terminate (   self)

Definition at line 1352 of file Bindings.py.

1352  def terminate(self):
1353  return self._appmgr.terminate()
1354 

◆ tool()

def GaudiPython.Bindings.AppMgr.tool (   self,
  name 
)

Definition at line 1144 of file Bindings.py.

1144  def tool(self, name):
1145  return iAlgTool(name)
1146 

◆ toolsvc()

def GaudiPython.Bindings.AppMgr.toolsvc (   self,
  name = 'ToolSvc' 
)

Definition at line 1194 of file Bindings.py.

1194  def toolsvc(self, name='ToolSvc'):
1195  svc = Helper.service(self._svcloc, name, True)
1196  return iToolSvc(name, svc)
1197 

Member Data Documentation

◆ detSvc

def GaudiPython.Bindings.AppMgr.detSvc = detsvc
static

Definition at line 1434 of file Bindings.py.

◆ evtSel

def GaudiPython.Bindings.AppMgr.evtSel = evtsel
static

Definition at line 1433 of file Bindings.py.

◆ evtSvc

def GaudiPython.Bindings.AppMgr.evtSvc = evtsvc
static

Definition at line 1430 of file Bindings.py.

◆ histSvc

def GaudiPython.Bindings.AppMgr.histSvc = histsvc
static

Definition at line 1431 of file Bindings.py.

◆ JobOptionsType

GaudiPython.Bindings.AppMgr.JobOptionsType

Definition at line 998 of file Bindings.py.

◆ ntupleSvc

def GaudiPython.Bindings.AppMgr.ntupleSvc = ntuplesvc
static

Definition at line 1432 of file Bindings.py.

◆ OutputLevel

GaudiPython.Bindings.AppMgr.OutputLevel

Definition at line 1008 of file Bindings.py.

◆ partSvc

def GaudiPython.Bindings.AppMgr.partSvc = partsvc
static

Definition at line 1436 of file Bindings.py.

◆ toolSvc

def GaudiPython.Bindings.AppMgr.toolSvc = toolsvc
static

Definition at line 1435 of file Bindings.py.

◆ topAlg

GaudiPython.Bindings.AppMgr.topAlg

Definition at line 1235 of file Bindings.py.


The documentation for this class was generated from the following file: