The Gaudi Framework  v33r1 (b1225454)
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 932 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 955 of file Bindings.py.

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

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

Member Function Documentation

◆ __new__()

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

Definition at line 933 of file Bindings.py.

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

◆ __reset__()

def GaudiPython.Bindings.AppMgr.__reset__ (   self)

Definition at line 941 of file Bindings.py.

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

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

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

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

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

◆ algorithm()

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

Definition at line 1124 of file Bindings.py.

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

◆ algorithms()

def GaudiPython.Bindings.AppMgr.algorithms (   self)

Definition at line 1131 of file Bindings.py.

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

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

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

◆ configure()

def GaudiPython.Bindings.AppMgr.configure (   self)

Definition at line 1337 of file Bindings.py.

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

◆ createSvc()

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

Definition at line 1117 of file Bindings.py.

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

◆ datasvc()

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

Definition at line 1146 of file Bindings.py.

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

◆ declSvcType()

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

Definition at line 1114 of file Bindings.py.

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

◆ detsvc()

def GaudiPython.Bindings.AppMgr.detsvc (   self)

Definition at line 1155 of file Bindings.py.

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

◆ evtsel()

def GaudiPython.Bindings.AppMgr.evtsel (   self)

Definition at line 1161 of file Bindings.py.

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

◆ evtsvc()

def GaudiPython.Bindings.AppMgr.evtsvc (   self)

Definition at line 1152 of file Bindings.py.

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

◆ execute()

def GaudiPython.Bindings.AppMgr.execute (   self)

Definition at line 1360 of file Bindings.py.

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

◆ executeEvent()

def GaudiPython.Bindings.AppMgr.executeEvent (   self)

Definition at line 1357 of file Bindings.py.

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

◆ exit()

def GaudiPython.Bindings.AppMgr.exit (   self)

Definition at line 1403 of file Bindings.py.

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

◆ filerecordsvc()

def GaudiPython.Bindings.AppMgr.filerecordsvc (   self)

Definition at line 1158 of file Bindings.py.

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

◆ FSMState()

def GaudiPython.Bindings.AppMgr.FSMState (   self)

Definition at line 1101 of file Bindings.py.

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

◆ histsvc()

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

Definition at line 1168 of file Bindings.py.

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

◆ ntuplesvc()

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

Definition at line 1172 of file Bindings.py.

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

◆ optSvc()

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

Definition at line 1189 of file Bindings.py.

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

◆ partsvc()

def GaudiPython.Bindings.AppMgr.partsvc (   self)

Definition at line 1179 of file Bindings.py.

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

◆ printAlgsSequences()

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

Definition at line 1240 of file Bindings.py.

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

◆ property()

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

Definition at line 1138 of file Bindings.py.

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

◆ readOptions()

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

Definition at line 1193 of file Bindings.py.

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

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

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

◆ run()

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

Definition at line 1346 of file Bindings.py.

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

◆ runSelectedEvents()

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

Definition at line 1363 of file Bindings.py.

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

◆ service()

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

Definition at line 1107 of file Bindings.py.

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

◆ services()

def GaudiPython.Bindings.AppMgr.services (   self)

Definition at line 1120 of file Bindings.py.

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

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

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

◆ start()

def GaudiPython.Bindings.AppMgr.start (   self)

Reimplemented from GaudiPython.Bindings.iService.

Definition at line 1340 of file Bindings.py.

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

◆ state()

def GaudiPython.Bindings.AppMgr.state (   self)

Definition at line 1098 of file Bindings.py.

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

◆ targetFSMState()

def GaudiPython.Bindings.AppMgr.targetFSMState (   self)

Definition at line 1104 of file Bindings.py.

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

◆ terminate()

def GaudiPython.Bindings.AppMgr.terminate (   self)

Definition at line 1343 of file Bindings.py.

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

◆ tool()

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

Definition at line 1135 of file Bindings.py.

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

◆ toolsvc()

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

Definition at line 1185 of file Bindings.py.

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

Member Data Documentation

◆ detSvc

def GaudiPython.Bindings.AppMgr.detSvc = detsvc
static

Definition at line 1425 of file Bindings.py.

◆ evtSel

def GaudiPython.Bindings.AppMgr.evtSel = evtsel
static

Definition at line 1424 of file Bindings.py.

◆ evtSvc

def GaudiPython.Bindings.AppMgr.evtSvc = evtsvc
static

Definition at line 1421 of file Bindings.py.

◆ histSvc

def GaudiPython.Bindings.AppMgr.histSvc = histsvc
static

Definition at line 1422 of file Bindings.py.

◆ JobOptionsType

GaudiPython.Bindings.AppMgr.JobOptionsType

Definition at line 989 of file Bindings.py.

◆ ntupleSvc

def GaudiPython.Bindings.AppMgr.ntupleSvc = ntuplesvc
static

Definition at line 1423 of file Bindings.py.

◆ OutputLevel

GaudiPython.Bindings.AppMgr.OutputLevel

Definition at line 999 of file Bindings.py.

◆ partSvc

def GaudiPython.Bindings.AppMgr.partSvc = partsvc
static

Definition at line 1427 of file Bindings.py.

◆ toolSvc

def GaudiPython.Bindings.AppMgr.toolSvc = toolsvc
static

Definition at line 1426 of file Bindings.py.

◆ topAlg

GaudiPython.Bindings.AppMgr.topAlg

Definition at line 1226 of file Bindings.py.


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