The Gaudi Framework  v32r2 (46d42edc)
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 921 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 944 of file Bindings.py.

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

◆ __del__()

def GaudiPython.Bindings.AppMgr.__del__ (   self)

Definition at line 1407 of file Bindings.py.

1407  def __del__(self):
1408  self.exit()
1409 

Member Function Documentation

◆ __new__()

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

Definition at line 922 of file Bindings.py.

922  def __new__(cls, *args, **kwargs):
923  global _gaudi
924  if not _gaudi:
925  newobj = object.__new__(cls)
926  cls.__init__(newobj, *args, **kwargs)
927  _gaudi = newobj
928  return _gaudi
929 

◆ __reset__()

def GaudiPython.Bindings.AppMgr.__reset__ (   self)

Definition at line 930 of file Bindings.py.

930  def __reset__(self):
931  global _gaudi
932  # Stop, Finalize and Terminate the current AppMgr
933  self.exit()
934  # release interfaces
935  self._evtpro.release()
936  self._svcloc.release()
937  self._appmgr.release()
938  # Reset the C++ globals
939  gbl.Gaudi.setInstance(makeNullPointer('ISvcLocator'))
940  gbl.Gaudi.setInstance(makeNullPointer('IAppMgrUI'))
941  # Reset the Python global
942  _gaudi = None
943 

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

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

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

1185  def addAlgorithm(self, alg):
1186  """ Add an Algorithm to the list of Top algorithms. It can be either a instance of
1187  an Algorithm class or it name """
1188  if type(alg) is str:
1189  self.topAlg += [alg]
1190  else:
1191  self.pyalgorithms.append(alg)
1192  setOwnership(alg, 0)
1193  if self.targetFSMState() >= Gaudi.StateMachine.INITIALIZED:
1194  alg.sysInitialize()
1195  if self.targetFSMState() == Gaudi.StateMachine.RUNNING:
1196  alg.sysStart()
1197  self.topAlg += [alg.name()]
1198 

◆ algorithm()

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

Definition at line 1113 of file Bindings.py.

1113  def algorithm(self, name, createIf=False):
1114  alg = Helper.algorithm(self._algmgr, name, createIf)
1115  if not alg:
1116  return iAlgorithm(name, alg)
1117  else:
1118  return iAlgorithm(alg.name(), alg)
1119 

◆ algorithms()

def GaudiPython.Bindings.AppMgr.algorithms (   self)

Definition at line 1120 of file Bindings.py.

1120  def algorithms(self):
1121  l = self._algmgr.getAlgorithms()
1122  return [a.name() for a in l]
1123 

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

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

◆ configure()

def GaudiPython.Bindings.AppMgr.configure (   self)

Definition at line 1326 of file Bindings.py.

1326  def configure(self):
1327  return self._appmgr.configure()
1328 

◆ createSvc()

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

Definition at line 1106 of file Bindings.py.

1106  def createSvc(self, name):
1107  return Helper.service(self._svcloc, name, True)
1108 

◆ datasvc()

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

Definition at line 1135 of file Bindings.py.

1135  def datasvc(self, name):
1136  if self.state() == Gaudi.StateMachine.CONFIGURED:
1137  self.initialize()
1138  svc = Helper.service(self._svcloc, name)
1139  return iDataSvc(name, svc)
1140 

◆ declSvcType()

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

Definition at line 1103 of file Bindings.py.

1103  def declSvcType(self, svcname, svctype):
1104  self._svcmgr.declareSvcType(svcname, svctype)
1105 

◆ detsvc()

def GaudiPython.Bindings.AppMgr.detsvc (   self)

Definition at line 1144 of file Bindings.py.

1144  def detsvc(self):
1145  return self.datasvc('DetectorDataSvc')
1146 

◆ evtsel()

def GaudiPython.Bindings.AppMgr.evtsel (   self)

Definition at line 1150 of file Bindings.py.

1150  def evtsel(self):
1151  if self.state() == Gaudi.StateMachine.CONFIGURED:
1152  self.initialize()
1153  if not hasattr(self, '_evtsel'):
1154  self.__dict__['_evtsel'] = iEventSelector()
1155  return self._evtsel
1156 

◆ evtsvc()

def GaudiPython.Bindings.AppMgr.evtsvc (   self)

Definition at line 1141 of file Bindings.py.

1141  def evtsvc(self):
1142  return self.datasvc('EventDataSvc')
1143 

◆ execute()

def GaudiPython.Bindings.AppMgr.execute (   self)

Definition at line 1349 of file Bindings.py.

1349  def execute(self):
1350  return self._evtpro.executeEvent()
1351 
executeEvent
Helpers for re-entrant interfaces.

◆ executeEvent()

def GaudiPython.Bindings.AppMgr.executeEvent (   self)

Definition at line 1346 of file Bindings.py.

1346  def executeEvent(self):
1347  return self._evtpro.executeEvent()
1348 
executeEvent
Helpers for re-entrant interfaces.

◆ exit()

def GaudiPython.Bindings.AppMgr.exit (   self)

Definition at line 1392 of file Bindings.py.

1392  def exit(self):
1393  # Protection against multiple calls to exit() if the finalization fails
1394  if not self._exit_called:
1395  self.__dict__['_exit_called'] = True
1396  Gaudi = self._gaudi_ns
1397  if self.FSMState() == Gaudi.StateMachine.RUNNING:
1398  self._appmgr.stop().ignore()
1399  if self.FSMState() == Gaudi.StateMachine.INITIALIZED:
1400  self._appmgr.finalize().ignore()
1401  if self.FSMState() == Gaudi.StateMachine.CONFIGURED:
1402  self._appmgr.terminate()
1403  return SUCCESS
1404 

◆ filerecordsvc()

def GaudiPython.Bindings.AppMgr.filerecordsvc (   self)

Definition at line 1147 of file Bindings.py.

1147  def filerecordsvc(self):
1148  return self.datasvc('FileRecordDataSvc')
1149 

◆ FSMState()

def GaudiPython.Bindings.AppMgr.FSMState (   self)

Definition at line 1090 of file Bindings.py.

1090  def FSMState(self):
1091  return self._isvc.FSMState()
1092 

◆ histsvc()

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

Definition at line 1157 of file Bindings.py.

1157  def histsvc(self, name='HistogramDataSvc'):
1158  svc = Helper.service(self._svcloc, name)
1159  return iHistogramSvc(name, svc)
1160 

◆ ntuplesvc()

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

Definition at line 1161 of file Bindings.py.

1161  def ntuplesvc(self, name='NTupleSvc'):
1162  if name not in self.ExtSvc:
1163  self.ExtSvc += [name]
1164 # if self.HistogramPersistency == 'NONE' : self.HistogramPersistency = 'ROOT'
1165  svc = Helper.service(self._svcloc, name, True)
1166  return iNTupleSvc(name, svc)
1167 

◆ optSvc()

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

Definition at line 1178 of file Bindings.py.

1178  def optSvc(self, name='JobOptionsSvc'):
1179  svc = Helper.service(self._svcloc, name, True)
1180  return iJobOptSvc(name, svc)
1181 

◆ partsvc()

def GaudiPython.Bindings.AppMgr.partsvc (   self)

Definition at line 1168 of file Bindings.py.

1168  def partsvc(self):
1169  if self.FSMState() == Gaudi.StateMachine.CONFIGURED:
1170  self.initialize()
1171  svc = Helper.service(self._svcloc, 'ParticlePropertySvc')
1172  return InterfaceCast(gbl.IParticlePropertySvc)(svc)
1173 

◆ printAlgsSequences()

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

Definition at line 1229 of file Bindings.py.

1229  def printAlgsSequences(self):
1230  """
1231  Print the sequence of Algorithms.
1232  """
1233 
1234  def printAlgo(algName, appMgr, prefix=' '):
1235  print(prefix + algName)
1236  alg = appMgr.algorithm(algName.split("/")[-1])
1237  prop = alg.properties()
1238  if "Members" in prop:
1239  subs = prop["Members"].value()
1240  for i in subs:
1241  printAlgo(i.strip('"'), appMgr, prefix + " ")
1242 
1243  mp = self.properties()
1244  prefix = 'ApplicationMgr SUCCESS '
1245  print(
1246  prefix +
1247  "****************************** Algorithm Sequence ****************************"
1248  )
1249  for i in mp["TopAlg"].value():
1250  printAlgo(i, self, prefix)
1251  print(
1252  prefix +
1253  "******************************************************************************"
1254  )
1255 

◆ property()

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

Definition at line 1127 of file Bindings.py.

1127  def property(self, name):
1128  if name in self.algorithms():
1129  return self.algorithm(name)
1130  elif name in self.services():
1131  return self.service(name)
1132  else:
1133  return iProperty(name)
1134 

◆ readOptions()

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

Definition at line 1182 of file Bindings.py.

1182  def readOptions(self, file):
1183  return self._optsvc.readOptions(file)
1184 

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

1217  def removeAlgorithm(self, alg):
1218  """ Remove an Algorithm to the list of Top algorithms. It can be either a instance of
1219  an Algorithm class or it name """
1220  tmp = self.topAlg
1221  if type(alg) is str:
1222  tmp.remove(alg)
1223  else:
1224  tmp.remove(alg.name())
1225  self.pyalgorithms.remove(alg)
1226  setOwnership(alg, 1)
1227  self.topAlg = tmp
1228 

◆ run()

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

Definition at line 1335 of file Bindings.py.

1335  def run(self, n):
1336  if self.FSMState() == Gaudi.StateMachine.CONFIGURED:
1337  sc = self.initialize()
1338  if sc.isFailure() or self.ReturnCode != 0:
1339  return sc
1340  if self.FSMState() == Gaudi.StateMachine.INITIALIZED:
1341  sc = self.start()
1342  if sc.isFailure() or self.ReturnCode != 0:
1343  return sc
1344  return self._evtpro.executeRun(n)
1345 
return ep &&ep executeRun(maxevt).isSuccess()

◆ runSelectedEvents()

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

Definition at line 1352 of file Bindings.py.

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

◆ service()

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

Definition at line 1096 of file Bindings.py.

1096  def service(self, name, interface=None):
1097  svc = Helper.service(self._svcloc, name)
1098  if interface:
1099  return InterfaceCast(interface)(svc)
1100  else:
1101  return iService(name, svc)
1102 

◆ services()

def GaudiPython.Bindings.AppMgr.services (   self)

Definition at line 1109 of file Bindings.py.

1109  def services(self):
1110  l = self._svcloc.getServices()
1111  return [s.name() for s in l]
1112 

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

1199  def setAlgorithms(self, algs):
1200  """ Set the list of Top Algorithms.
1201  It can be an individual of a list of algorithms names or instances """
1202  if type(algs) is not list:
1203  algs = [algs]
1204  names = []
1205  for alg in algs:
1206  if type(alg) is str:
1207  names.append(alg)
1208  else:
1209  self.pyalgorithms.append(alg)
1210  if self.targetFSMState() >= Gaudi.StateMachine.INITIALIZED:
1211  alg.sysInitialize()
1212  if self.targetFSMState() == Gaudi.StateMachine.RUNNING:
1213  alg.sysStart()
1214  names.append(alg.name())
1215  self.topAlg = names
1216 

◆ start()

def GaudiPython.Bindings.AppMgr.start (   self)

Reimplemented from GaudiPython.Bindings.iService.

Definition at line 1329 of file Bindings.py.

1329  def start(self):
1330  return self._appmgr.start()
1331 
def start
Definition: IOTest.py:98

◆ state()

def GaudiPython.Bindings.AppMgr.state (   self)

Definition at line 1087 of file Bindings.py.

1087  def state(self):
1088  return self._isvc.FSMState()
1089 

◆ targetFSMState()

def GaudiPython.Bindings.AppMgr.targetFSMState (   self)

Definition at line 1093 of file Bindings.py.

1093  def targetFSMState(self):
1094  return self._isvc.targetFSMState()
1095 

◆ terminate()

def GaudiPython.Bindings.AppMgr.terminate (   self)

Definition at line 1332 of file Bindings.py.

1332  def terminate(self):
1333  return self._appmgr.terminate()
1334 

◆ tool()

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

Definition at line 1124 of file Bindings.py.

1124  def tool(self, name):
1125  return iAlgTool(name)
1126 

◆ toolsvc()

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

Definition at line 1174 of file Bindings.py.

1174  def toolsvc(self, name='ToolSvc'):
1175  svc = Helper.service(self._svcloc, name, True)
1176  return iToolSvc(name, svc)
1177 

Member Data Documentation

◆ detSvc

def GaudiPython.Bindings.AppMgr.detSvc = detsvc
static

Definition at line 1414 of file Bindings.py.

◆ evtSel

def GaudiPython.Bindings.AppMgr.evtSel = evtsel
static

Definition at line 1413 of file Bindings.py.

◆ evtSvc

def GaudiPython.Bindings.AppMgr.evtSvc = evtsvc
static

Definition at line 1410 of file Bindings.py.

◆ histSvc

def GaudiPython.Bindings.AppMgr.histSvc = histsvc
static

Definition at line 1411 of file Bindings.py.

◆ JobOptionsType

GaudiPython.Bindings.AppMgr.JobOptionsType

Definition at line 978 of file Bindings.py.

◆ ntupleSvc

def GaudiPython.Bindings.AppMgr.ntupleSvc = ntuplesvc
static

Definition at line 1412 of file Bindings.py.

◆ OutputLevel

GaudiPython.Bindings.AppMgr.OutputLevel

Definition at line 988 of file Bindings.py.

◆ partSvc

def GaudiPython.Bindings.AppMgr.partSvc = partsvc
static

Definition at line 1416 of file Bindings.py.

◆ toolSvc

def GaudiPython.Bindings.AppMgr.toolSvc = toolsvc
static

Definition at line 1415 of file Bindings.py.

◆ topAlg

GaudiPython.Bindings.AppMgr.topAlg

Definition at line 1215 of file Bindings.py.


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