The Gaudi Framework  v33r0 (d5ea422b)
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 931 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 954 of file Bindings.py.

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

1417  def __del__(self):
1418  self.exit()
1419 

Member Function Documentation

◆ __new__()

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

Definition at line 932 of file Bindings.py.

932  def __new__(cls, *args, **kwargs):
933  global _gaudi
934  if not _gaudi:
935  newobj = object.__new__(cls)
936  cls.__init__(newobj, *args, **kwargs)
937  _gaudi = newobj
938  return _gaudi
939 

◆ __reset__()

def GaudiPython.Bindings.AppMgr.__reset__ (   self)

Definition at line 940 of file Bindings.py.

940  def __reset__(self):
941  global _gaudi
942  # Stop, Finalize and Terminate the current AppMgr
943  self.exit()
944  # release interfaces
945  self._evtpro.release()
946  self._svcloc.release()
947  self._appmgr.release()
948  # Reset the C++ globals
949  gbl.Gaudi.setInstance(makeNullPointer('ISvcLocator'))
950  gbl.Gaudi.setInstance(makeNullPointer('IAppMgrUI'))
951  # Reset the Python global
952  _gaudi = None
953 

◆ _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 1056 of file Bindings.py.

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

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

1195  def addAlgorithm(self, alg):
1196  """ Add an Algorithm to the list of Top algorithms. It can be either a instance of
1197  an Algorithm class or it name """
1198  if type(alg) is str:
1199  self.topAlg += [alg]
1200  else:
1201  self.pyalgorithms.append(alg)
1202  setOwnership(alg, 0)
1203  if self.targetFSMState() >= Gaudi.StateMachine.INITIALIZED:
1204  alg.sysInitialize()
1205  if self.targetFSMState() == Gaudi.StateMachine.RUNNING:
1206  alg.sysStart()
1207  self.topAlg += [alg.name()]
1208 

◆ algorithm()

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

Definition at line 1123 of file Bindings.py.

1123  def algorithm(self, name, createIf=False):
1124  alg = Helper.algorithm(self._algmgr, name, createIf)
1125  if not alg:
1126  return iAlgorithm(name, alg)
1127  else:
1128  return iAlgorithm(alg.name(), alg)
1129 

◆ algorithms()

def GaudiPython.Bindings.AppMgr.algorithms (   self)

Definition at line 1130 of file Bindings.py.

1130  def algorithms(self):
1131  l = self._algmgr.getAlgorithms()
1132  return [a.name() for a in l]
1133 

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

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

◆ configure()

def GaudiPython.Bindings.AppMgr.configure (   self)

Definition at line 1336 of file Bindings.py.

1336  def configure(self):
1337  return self._appmgr.configure()
1338 

◆ createSvc()

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

Definition at line 1116 of file Bindings.py.

1116  def createSvc(self, name):
1117  return Helper.service(self._svcloc, name, True)
1118 

◆ datasvc()

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

Definition at line 1145 of file Bindings.py.

1145  def datasvc(self, name):
1146  if self.state() == Gaudi.StateMachine.CONFIGURED:
1147  self.initialize()
1148  svc = Helper.service(self._svcloc, name)
1149  return iDataSvc(name, svc)
1150 

◆ declSvcType()

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

Definition at line 1113 of file Bindings.py.

1113  def declSvcType(self, svcname, svctype):
1114  self._svcmgr.declareSvcType(svcname, svctype)
1115 

◆ detsvc()

def GaudiPython.Bindings.AppMgr.detsvc (   self)

Definition at line 1154 of file Bindings.py.

1154  def detsvc(self):
1155  return self.datasvc('DetectorDataSvc')
1156 

◆ evtsel()

def GaudiPython.Bindings.AppMgr.evtsel (   self)

Definition at line 1160 of file Bindings.py.

1160  def evtsel(self):
1161  if self.state() == Gaudi.StateMachine.CONFIGURED:
1162  self.initialize()
1163  if not hasattr(self, '_evtsel'):
1164  self.__dict__['_evtsel'] = iEventSelector()
1165  return self._evtsel
1166 

◆ evtsvc()

def GaudiPython.Bindings.AppMgr.evtsvc (   self)

Definition at line 1151 of file Bindings.py.

1151  def evtsvc(self):
1152  return self.datasvc('EventDataSvc')
1153 

◆ execute()

def GaudiPython.Bindings.AppMgr.execute (   self)

Definition at line 1359 of file Bindings.py.

1359  def execute(self):
1360  return self._evtpro.executeEvent()
1361 
executeEvent
Helpers for re-entrant interfaces.

◆ executeEvent()

def GaudiPython.Bindings.AppMgr.executeEvent (   self)

Definition at line 1356 of file Bindings.py.

1356  def executeEvent(self):
1357  return self._evtpro.executeEvent()
1358 
executeEvent
Helpers for re-entrant interfaces.

◆ exit()

def GaudiPython.Bindings.AppMgr.exit (   self)

Definition at line 1402 of file Bindings.py.

1402  def exit(self):
1403  # Protection against multiple calls to exit() if the finalization fails
1404  if not self._exit_called:
1405  self.__dict__['_exit_called'] = True
1406  Gaudi = self._gaudi_ns
1407  if self.FSMState() == Gaudi.StateMachine.RUNNING:
1408  self._appmgr.stop().ignore()
1409  if self.FSMState() == Gaudi.StateMachine.INITIALIZED:
1410  self._appmgr.finalize().ignore()
1411  if self.FSMState() == Gaudi.StateMachine.CONFIGURED:
1412  self._appmgr.terminate()
1413  return SUCCESS
1414 

◆ filerecordsvc()

def GaudiPython.Bindings.AppMgr.filerecordsvc (   self)

Definition at line 1157 of file Bindings.py.

1157  def filerecordsvc(self):
1158  return self.datasvc('FileRecordDataSvc')
1159 

◆ FSMState()

def GaudiPython.Bindings.AppMgr.FSMState (   self)

Definition at line 1100 of file Bindings.py.

1100  def FSMState(self):
1101  return self._isvc.FSMState()
1102 

◆ histsvc()

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

Definition at line 1167 of file Bindings.py.

1167  def histsvc(self, name='HistogramDataSvc'):
1168  svc = Helper.service(self._svcloc, name)
1169  return iHistogramSvc(name, svc)
1170 

◆ ntuplesvc()

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

Definition at line 1171 of file Bindings.py.

1171  def ntuplesvc(self, name='NTupleSvc'):
1172  if name not in self.ExtSvc:
1173  self.ExtSvc += [name]
1174 # if self.HistogramPersistency == 'NONE' : self.HistogramPersistency = 'ROOT'
1175  svc = Helper.service(self._svcloc, name, True)
1176  return iNTupleSvc(name, svc)
1177 

◆ optSvc()

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

Definition at line 1188 of file Bindings.py.

1188  def optSvc(self, name='JobOptionsSvc'):
1189  svc = Helper.service(self._svcloc, name, True)
1190  return iJobOptSvc(name, svc)
1191 

◆ partsvc()

def GaudiPython.Bindings.AppMgr.partsvc (   self)

Definition at line 1178 of file Bindings.py.

1178  def partsvc(self):
1179  if self.FSMState() == Gaudi.StateMachine.CONFIGURED:
1180  self.initialize()
1181  svc = Helper.service(self._svcloc, 'ParticlePropertySvc')
1182  return InterfaceCast(gbl.IParticlePropertySvc)(svc)
1183 

◆ printAlgsSequences()

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

Definition at line 1239 of file Bindings.py.

1239  def printAlgsSequences(self):
1240  """
1241  Print the sequence of Algorithms.
1242  """
1243 
1244  def printAlgo(algName, appMgr, prefix=' '):
1245  print(prefix + algName)
1246  alg = appMgr.algorithm(algName.split("/")[-1])
1247  prop = alg.properties()
1248  if "Members" in prop:
1249  subs = prop["Members"].value()
1250  for i in subs:
1251  printAlgo(i.strip('"'), appMgr, prefix + " ")
1252 
1253  mp = self.properties()
1254  prefix = 'ApplicationMgr SUCCESS '
1255  print(
1256  prefix +
1257  "****************************** Algorithm Sequence ****************************"
1258  )
1259  for i in mp["TopAlg"].value():
1260  printAlgo(i, self, prefix)
1261  print(
1262  prefix +
1263  "******************************************************************************"
1264  )
1265 

◆ property()

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

Definition at line 1137 of file Bindings.py.

1137  def property(self, name):
1138  if name in self.algorithms():
1139  return self.algorithm(name)
1140  elif name in self.services():
1141  return self.service(name)
1142  else:
1143  return iProperty(name)
1144 

◆ readOptions()

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

Definition at line 1192 of file Bindings.py.

1192  def readOptions(self, file):
1193  return self._optsvc.readOptions(file)
1194 

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

1227  def removeAlgorithm(self, alg):
1228  """ Remove an Algorithm to the list of Top algorithms. It can be either a instance of
1229  an Algorithm class or it name """
1230  tmp = self.topAlg
1231  if type(alg) is str:
1232  tmp.remove(alg)
1233  else:
1234  tmp.remove(alg.name())
1235  self.pyalgorithms.remove(alg)
1236  setOwnership(alg, 1)
1237  self.topAlg = tmp
1238 

◆ run()

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

Definition at line 1345 of file Bindings.py.

1345  def run(self, n):
1346  if self.FSMState() == Gaudi.StateMachine.CONFIGURED:
1347  sc = self.initialize()
1348  if sc.isFailure() or self.ReturnCode != 0:
1349  return sc
1350  if self.FSMState() == Gaudi.StateMachine.INITIALIZED:
1351  sc = self.start()
1352  if sc.isFailure() or self.ReturnCode != 0:
1353  return sc
1354  return self._evtpro.executeRun(n)
1355 
return ep &&ep executeRun(maxevt).isSuccess()

◆ runSelectedEvents()

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

Definition at line 1362 of file Bindings.py.

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

◆ service()

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

Definition at line 1106 of file Bindings.py.

1106  def service(self, name, interface=None):
1107  svc = Helper.service(self._svcloc, name)
1108  if interface:
1109  return InterfaceCast(interface)(svc)
1110  else:
1111  return iService(name, svc)
1112 

◆ services()

def GaudiPython.Bindings.AppMgr.services (   self)

Definition at line 1119 of file Bindings.py.

1119  def services(self):
1120  l = self._svcloc.getServices()
1121  return [s.name() for s in l]
1122 

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

1209  def setAlgorithms(self, algs):
1210  """ Set the list of Top Algorithms.
1211  It can be an individual of a list of algorithms names or instances """
1212  if type(algs) is not list:
1213  algs = [algs]
1214  names = []
1215  for alg in algs:
1216  if type(alg) is str:
1217  names.append(alg)
1218  else:
1219  self.pyalgorithms.append(alg)
1220  if self.targetFSMState() >= Gaudi.StateMachine.INITIALIZED:
1221  alg.sysInitialize()
1222  if self.targetFSMState() == Gaudi.StateMachine.RUNNING:
1223  alg.sysStart()
1224  names.append(alg.name())
1225  self.topAlg = names
1226 

◆ start()

def GaudiPython.Bindings.AppMgr.start (   self)

Reimplemented from GaudiPython.Bindings.iService.

Definition at line 1339 of file Bindings.py.

1339  def start(self):
1340  return self._appmgr.start()
1341 
def start
Definition: IOTest.py:108

◆ state()

def GaudiPython.Bindings.AppMgr.state (   self)

Definition at line 1097 of file Bindings.py.

1097  def state(self):
1098  return self._isvc.FSMState()
1099 

◆ targetFSMState()

def GaudiPython.Bindings.AppMgr.targetFSMState (   self)

Definition at line 1103 of file Bindings.py.

1103  def targetFSMState(self):
1104  return self._isvc.targetFSMState()
1105 

◆ terminate()

def GaudiPython.Bindings.AppMgr.terminate (   self)

Definition at line 1342 of file Bindings.py.

1342  def terminate(self):
1343  return self._appmgr.terminate()
1344 

◆ tool()

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

Definition at line 1134 of file Bindings.py.

1134  def tool(self, name):
1135  return iAlgTool(name)
1136 

◆ toolsvc()

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

Definition at line 1184 of file Bindings.py.

1184  def toolsvc(self, name='ToolSvc'):
1185  svc = Helper.service(self._svcloc, name, True)
1186  return iToolSvc(name, svc)
1187 

Member Data Documentation

◆ detSvc

def GaudiPython.Bindings.AppMgr.detSvc = detsvc
static

Definition at line 1424 of file Bindings.py.

◆ evtSel

def GaudiPython.Bindings.AppMgr.evtSel = evtsel
static

Definition at line 1423 of file Bindings.py.

◆ evtSvc

def GaudiPython.Bindings.AppMgr.evtSvc = evtsvc
static

Definition at line 1420 of file Bindings.py.

◆ histSvc

def GaudiPython.Bindings.AppMgr.histSvc = histsvc
static

Definition at line 1421 of file Bindings.py.

◆ JobOptionsType

GaudiPython.Bindings.AppMgr.JobOptionsType

Definition at line 988 of file Bindings.py.

◆ ntupleSvc

def GaudiPython.Bindings.AppMgr.ntupleSvc = ntuplesvc
static

Definition at line 1422 of file Bindings.py.

◆ OutputLevel

GaudiPython.Bindings.AppMgr.OutputLevel

Definition at line 998 of file Bindings.py.

◆ partSvc

def GaudiPython.Bindings.AppMgr.partSvc = partsvc
static

Definition at line 1426 of file Bindings.py.

◆ toolSvc

def GaudiPython.Bindings.AppMgr.toolSvc = toolsvc
static

Definition at line 1425 of file Bindings.py.

◆ topAlg

GaudiPython.Bindings.AppMgr.topAlg

Definition at line 1225 of file Bindings.py.


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