13 """ GaudiPython.Bindings module.
14 This module provides the basic bindings of the main Gaudi
15 components to Python. It is itself based on the ROOT cppyy
16 Python extension module.
50 from GaudiKernel
import ROOT6WorkAroundEnabled
53 with warnings.catch_warnings():
54 warnings.simplefilter(
"ignore")
65 from GaudiKernel.Proxy.Configurable
import Configurable, getNeededConfigurables
67 from .
import Pythonizations
76 gbl.gInterpreter.Declare(
'#include "Gaudi/Property.h"')
77 Helper = gbl.GaudiPython.Helper
78 StringProperty = gbl.Gaudi.Property(
"std::string")
79 StringPropertyRef = gbl.Gaudi.Property(
"std::string&")
80 GaudiHandleProperty = gbl.GaudiHandleProperty
81 GaudiHandleArrayProperty = gbl.GaudiHandleArrayProperty
82 DataObject = gbl.DataObject
83 SUCCESS = gbl.StatusCode(gbl.StatusCode.SUCCESS)
84 FAILURE = gbl.StatusCode(gbl.StatusCode.FAILURE)
86 if hasattr(cppyy,
"nullptr"):
87 nullptr = cppyy.nullptr
88 elif hasattr(gbl,
"nullptr"):
93 cppyy.gbl.gInterpreter.Declare(
96 namespace GaudiPython { namespace Helpers {
97 void setProperty(ISvcLocator* svcLoc, std::string key, std::string value) {
98 if ( !svcLoc ) throw std::runtime_error( "invalid ISvcLocator pointer" );
99 svcLoc->getOptsSvc().set(key, value);
106 for l
in [l
for l
in dir(Helper)
if re.match(
"^to.*Array$", l)]:
107 exec(
"%s = Helper.%s" % (l, l))
111 if hasattr(Helper,
"toArray"):
115 return getattr(Helper,
"toArray")
120 return getattr(Helper,
"toArray<%s>" % typ)
125 if hasattr(cppyy,
"libPyROOT"):
126 ROOT = cppyy.libPyROOT
129 makeNullPointer = ROOT.MakeNullPointer
130 setOwnership = ROOT.SetOwnership
134 warnings.warn(
"GaudiPython: " + message, DeprecationWarning, stacklevel=3)
141 """Helper class to obtain the adequate interface from a component
142 by using the Gaudi queryInterface() mechanism"""
153 if obj.queryInterface(self.
type.interfaceID(), ip).isSuccess():
157 "ERROR: queryInterface failed for", obj,
"interface:", self.
type
159 except Exception
as e:
163 "caught when retrieving interface",
170 traceback.print_stack()
182 InterfaceCast.__init__(self, t)
192 """Load an LCG dictionary"""
193 loadlib_return_code = Helper.loadDynamicLib(dict)
194 if loadlib_return_code == 1:
197 f
"Failed to load dictionary library {dict} (return code {loadlib_return_code})"
206 Function to retrieve a certain C++ class by name and to load dictionary if requested
210 from gaudimodule import getClass
211 # one knows that class is already loaded
212 AppMgr = getClass( 'ApplicationMgr' )
213 # one knows where to look for class, if not loaded yet
214 MCParticle = getClass( 'MCParticle' , 'EventDict' )
215 # one knows where to look for class, if not loaded yet
216 Vertex = getClass( 'Vertex' , ['EventDict', 'PhysEventDict'] )
219 if hasattr(gbl, name):
220 return getattr(gbl, name)
222 if type(libs)
is not list:
226 if hasattr(gbl, name):
227 return getattr(gbl, name)
236 """holds the value and the documentation string of a property"""
242 if issubclass(
type(prop), GaudiHandleProperty):
244 elif issubclass(
type(prop), GaudiHandleArrayProperty):
245 self.
_value = prop.value()
249 self.
_value = eval(prop.toString(), {}, {})
251 if hasattr(prop,
"value"):
252 self.
_value = prop.value()
254 self.
_value = prop.toString()
256 self.
__doc__ +=
" --- Default value = " + str(self.
_value) +
" --- "
257 if prop.documentation() !=
"none":
269 "Return the underlying property itself"
283 """Python equivalent to the C++ Property interface"""
287 self.__dict__[
"_svcloc"] = gbl.Gaudi.svcLocator()
288 self.__dict__[
"_name"] = name
299 if not getattr(self, ifname):
300 self.retrieveInterface()
301 return getattr(getattr(self, ifname), method)(*args)
305 The method which is used for setting the property from the given value.
306 - In the case of the valid instance it sets the property through IProperty interface
307 - In the case of placeholder the property is added to JobOptionsCatalogue
309 if hasattr(value,
"toStringProperty"):
311 value = str(value.toStringProperty())
312 elif hasattr(value,
"toString"):
313 value = str(value.toString())
319 if not gbl.Gaudi.Utils.hasProperty(ip, name):
320 raise AttributeError(
"property %s does not exist" % name)
321 ip.setPropertyRepr(name, value)
323 gbl.GaudiPython.Helpers.setProperty(
324 self._svcloc,
".".join([self._name, name]), value
329 The method which returns the value for the given property
330 - In the case of the valid instance it returns the valid property value through IProperty interface
331 - In the case of placeholder the property value is retrieved from JobOptionsCatalogue
335 if not gbl.Gaudi.Utils.hasProperty(ip, name):
336 raise AttributeError(
"property %s does not exist" % name)
337 prop = ip.getProperty(name)
338 if StringProperty ==
type(prop):
340 elif StringPropertyRef ==
type(prop):
343 return eval(prop.toString(), {}, {})
347 opts = self._svcloc.getOptsSvc()
348 if opts.has(
"{}.{}".
format(self._name, name)):
350 return eval(opts.get(
"{}.{}".
format(self._name, name)), {}, {})
351 raise AttributeError(
"property %s does not exist" % name)
358 props = ip.getProperties()
359 propsFrom = self._name
361 raise NotImplementedError(
"rely on IJobOptionsSvc")
362 props = self._optsvc.getProperties(self._name)
363 propsFrom =
"jobOptionsSvc"
368 except (ValueError, TypeError)
as e:
370 "gaudimodule.iProperty.properties(): %s%s processing property %s.%s = %s"
371 % (e.__class__.__name__, e.args, propsFrom, p.name(), p.value())
383 """Python equivalent to IProperty interface"""
386 iProperty.__init__(self, name, isvc)
390 isvc = Helper.service(self._svcloc, self._name)
392 iService.__init__(self, self._name, isvc)
423 """Python equivalent to IAlgorithm interface"""
426 iProperty.__init__(self, name, ialg)
430 ialg = Helper.algorithm(
434 iAlgorithm.__init__(self, self._name, ialg)
483 """Python equivalent to IAlgTool interface (not completed yet)"""
486 iProperty.__init__(self, name, itool)
487 self.__dict__[
"_itool"] = itool
488 svc = Helper.service(self._svcloc,
"ToolSvc",
True)
489 self.__dict__[
"_toolsvc"] =
iToolSvc(
"ToolSvc", svc)
492 itool = self._toolsvc._retrieve(self._name)
494 iAlgTool.__init__(self, self._name, itool)
507 return self._itool.
name()
517 iService.__init__(self, name, idp)
518 self.__dict__[
"_idp"] =
InterfaceCast(gbl.IDataProviderSvc)(idp)
519 self.__dict__[
"_idm"] =
InterfaceCast(gbl.IDataManagerSvc)(idp)
521 self.__dict__[
"_ihwb"] =
None
523 if idp.queryInterface(gbl.IHiveWhiteBoard.interfaceID(), ip).isSuccess():
524 self.__dict__[
"_ihwb"] = ip
528 raise AttributeError(
529 "C++ service %s does not exist" % self.__dict__[
"_name"]
531 return Helper.registerObject(self._idp, path, obj)
535 raise AttributeError(
536 "C++ service %s does not exist" % self.__dict__[
"_name"]
538 return Helper.unregisterObject(self._idp, path)
543 return Helper.dataobject(self._idp, path)
550 Get the existing object in TransientStore for the given location
552 - loading of object from persistency is NOT triggered
553 - 'data-on-demand' action is NOT triggered
555 >>> svc = ... ## get the service
556 >>> path = ... ## get the path in Transient Store
557 >>> data = svc.findObject ( path ) ## use the method
561 raise IndexError(
"C++ service %s does not exist" % self.__dict__[
"_name"])
562 return Helper.findobject(self._idp, path)
567 Get object from Transient Store for the given location
570 - path : Location of object in Transient Store
571 - retrieve (bool) True : retrieve versus find
572 - disable on-demand (bool) False : temporary disable 'on-demand' actions
574 >>> svc = ... ## get the service
575 >>> path = ... ## get the path
577 >>> data = svc.getObject ( path , False ) ## find object in Transient Store
579 ## find object in Transient Store
580 # load form tape or use 'on-demand' action for missing objects :
581 >>> data = svc.getObject ( path , True )
583 ## find object in Transient Store
584 # load from tape or for missing objects, disable 'on-demand'-actions
585 >>> data = svc.getObject ( path , True , True )
589 raise IndexError(
"C++ service %s does not exist" % self.__dict__[
"_name"])
590 return Helper.getobject(self._idp, path, *args)
594 raise IndexError(
"C++ service %s does not exist" % self.__dict__[
"_name"])
595 return Helper.dataobject(self._idp, path)
599 raise IndexError(
"C++ service %s does not exist" % self.__dict__[
"_name"])
604 raise IndexError(
"C++ service %s does not exist" % self.__dict__[
"_name"])
608 if node == cppyy.nullptr:
610 ll = gbl.std.vector(
"IRegistry*")()
611 if isinstance(node, str):
613 if self._idm.objectLeaves(node, ll).isSuccess():
616 def dump(self, node=cppyy.nullptr):
617 if node == cppyy.nullptr:
620 node = root.registry()
623 print(node.identifier())
625 for l
in self.
leaves(node):
628 def getList(self, node=cppyy.nullptr, lst=[], rootFID=None):
629 if node == cppyy.nullptr:
632 node = root.registry()
633 rootFID = node.address().
par()
637 Helper.dataobject(self._idp, node.identifier())
639 lst.append(node.identifier())
640 for l
in self.
leaves(node):
641 if l.address()
and l.address().
par() == rootFID:
648 if node == cppyy.nullptr:
651 node = root.registry()
656 Helper.dataobject(self._idp, node.identifier())
658 lst.append(node.identifier())
659 for l
in self.
leaves(node):
668 raise IndexError(
"C++ service %s does not exist" % self.__dict__[
"_name"])
669 return self._idm.
setRoot(name, obj)
676 if self._ihwb.getNumberOfStores() > 1:
678 "Several stores available in Gaudihive mode, unable to figure out which one to use.\nPlease call selectStore instead of selectSingleStore\nIf you're only using GaudiPython, make sure you configure a single thread"
685 raise IndexError(
"C++ service %s does not exist" % self.__dict__[
"_name"])
690 raise IndexError(
"C++ service %s does not exist" % self.__dict__[
"_name"])
697 self.__dict__[
"_ihs"] =
InterfaceCast(gbl.IHistogramSvc)(ihs)
698 iDataSvc.__init__(self, name, ihs)
701 return Helper.histo1D(self._ihs, path)
704 return Helper.histo2D(self._ihs, path)
707 return Helper.histo3D(self._ihs, path)
710 return Helper.profile1D(self._ihs, path)
713 return Helper.profile2D(self._ihs, path)
717 Retrieve AIDA histogram or AIDA profile histogram by path in Histogram Transient Store
719 >>> histo = svc.retrieve ( 'path/to/my/histogram' )
734 Book the histograms(1D,2D&3D) , see IHistogramSvc::book
736 >>> histo = svc.book( .... )
738 return self._ihs.
book(*args)
742 Book the profile(1D&2D) histograms, see IHistogramSvc::bookProf
744 >>> histo = svc.bookProf( .... )
750 Retrieve the object from Histogram Transient Store (by path)
751 The reference to AIDA histogram is returned (if possible)
753 >>> histo = svc['path/to/my/histogram']
758 return iDataSvc.__getitem__(self, path)
762 Retrieve the histogram from Histogram Transient Store (by path)
763 The reference to AIDA histogram is returned (if possible)
765 >>> histo = svc.getAsAIDA ( 'path/to/my/histogram' )
771 Retrieve the histogram from Histogram Transient Store (by path)
772 The Underlying native ROOT object is returned (if possible)
774 >>> histo = svc.getAsROOT ( 'path/to/my/histogram' )
776 fun = gbl.Gaudi.Utils.Aida2ROOT.aida2root
789 iDataSvc.__init__(self, name, ints)
792 return self._ints.
book(*args)
795 """Defines the mapping between logical names and the output file
797 defineOutput({'LUN1':'MyFile1.root', 'LUN2':'Myfile2.root'}, svc='Gaudi::RootCnvSvc')
799 from .
import Persistency
as prs
801 helper = prs.get(typ)
802 helper.configure(
AppMgr())
803 self.
Output = [helper.formatOutput(files[lun], lun=lun)
for lun
in files]
804 if AppMgr().HistogramPersistency ==
"NONE":
805 AppMgr().HistogramPersistency =
"ROOT"
808 return iDataSvc.__getitem__(self, path)
815 iService.__init__(self, name, its)
818 sol = _gaudi.OutputLevel
821 if name.rfind(
".") == -1:
822 itool = Helper.tool(self._its,
"", name, nullptr,
False)
823 elif name[0:8] ==
"ToolSvc.":
824 itool = Helper.tool(self._its,
"", name[8:], nullptr,
False)
825 elif name.count(
".") > 1:
826 ptool = self.
_retrieve(name[: name.rfind(
".")])
828 self._its,
"", name[name.rfind(
".") + 1 :], ptool,
False
831 prop = _gaudi.property(name[: name.rfind(
".")])
833 self._its,
"", name[name.rfind(
".") + 1 :], prop._ip,
False
842 def create(self, typ, name=None, parent=nullptr, interface=None):
845 itool = Helper.tool(self._its, typ, name, parent,
True)
852 if type(itool)
is iAlgTool:
853 self._its.releaseTool(itool._itool)
864 Helper.service(gbl.Gaudi.svcLocator(),
"EventSelector"),
866 self.__dict__[
"g"] =
AppMgr()
868 def open(self, stream, typ="Gaudi::RootCnvSvc
", **kwargs):
869 from .
import Persistency
as prs
871 helper = prs.get(typ)
872 helper.configure(self.g)
873 self.
Input = helper.formatInput(stream, **kwargs)
888 newobj = object.__new__(cls)
889 cls.
__init__(newobj, *args, **kwargs)
921 self.__dict__[
"_exit_called"] =
False
923 self.__dict__[
"_gaudi_ns"] = Gaudi
925 from GaudiKernel.Proxy.Configurable
import expandvars
931 if dllname
and factname:
932 self.__dict__[
"_appmgr"] = gbl.Gaudi.createApplicationMgr(dllname, factname)
934 self.__dict__[
"_appmgr"] = gbl.Gaudi.createApplicationMgr(dllname)
936 self.__dict__[
"_appmgr"] = gbl.Gaudi.createApplicationMgr()
937 self.__dict__[
"_svcloc"] = gbl.Gaudi.svcLocator()
939 self.__dict__[
"_evtpro"] =
InterfaceCast(gbl.IEventProcessor)(self._appmgr)
940 self.__dict__[
"_svcmgr"] =
InterfaceCast(gbl.ISvcManager)(self._appmgr)
941 self.__dict__[
"pyalgorithms"] = []
942 iService.__init__(self,
"ApplicationMgr", self._appmgr)
944 if self.
FSMState() < Gaudi.StateMachine.CONFIGURED:
951 import GaudiKernel.Proxy.Configurable
953 if hasattr(GaudiKernel.Proxy.Configurable,
"applyConfigurableUsers"):
954 GaudiKernel.Proxy.Configurable.applyConfigurableUsers()
958 appMgr = Configurable.allConfigurables[
"ApplicationMgr"]
959 selfprops =
expandvars(appMgr.getValuedProperties())
962 for p, v
in selfprops.items():
964 for p, v
in selfoptions.items():
967 if outputlevel != -1:
971 ms = self.
service(
"MessageSvc")
972 if "MessageSvc" in Configurable.allConfigurables:
973 msprops = Configurable.allConfigurables[
"MessageSvc"]
974 ms = self.
service(
"MessageSvc")
975 if hasattr(msprops,
"getValuedProperties"):
976 msprops =
expandvars(msprops.getValuedProperties())
977 for p, v
in msprops.items():
979 if outputlevel != -1:
980 ms.OutputLevel = outputlevel
983 c = Configurable.allConfigurables[n]
984 if n
in [
"ApplicationMgr",
"MessageSvc"]:
986 for p, v
in c.getValuedProperties().items():
989 if hasattr(Configurable,
"PropertyReference")
and isinstance(
990 v, Configurable.PropertyReference
995 if isinstance(v, str):
997 gbl.GaudiPython.Helpers.setProperty(
998 self._svcloc,
".".join([n, p]), str(v)
1000 if hasattr(Configurable,
"_configurationLocked"):
1001 Configurable._configurationLocked =
True
1006 atexit.register(self.
exit)
1012 orig_register = atexit.register
1014 def register(func, *targs, **kargs):
1015 orig_register(func, *targs, **kargs)
1016 if hasattr(func,
"__module__")
and func.__module__ ==
"ROOT":
1017 orig_register(self.
exit)
1021 register.__doc__ = (
1022 orig_register.__doc__
1023 +
"\nNote: version hacked by GaudiPython to work "
1024 +
"around a problem with the ROOT exit handler"
1026 atexit.register = register
1030 if "_svcloc" in self.__dict__:
1031 return self._svcloc.getOptsSvc()
1044 svc = Helper.service(self._svcloc, name)
1051 self._svcmgr.declareSvcType(svcname, svctype)
1054 return Helper.service(self._svcloc, name,
True)
1057 l = self._svcloc.getServices()
1058 return [s.name()
for s
in l]
1061 alg = Helper.algorithm(self._algmgr, name, createIf)
1068 l = self._algmgr.getAlgorithms()
1069 return [a.name()
for a
in l]
1083 if self.
state() == Gaudi.StateMachine.CONFIGURED:
1085 svc = Helper.service(self._svcloc, name)
1089 svc = self.
datasvc(
"EventDataSvc")
1090 svc.selectOnlyStore()
1094 return self.
datasvc(
"DetectorDataSvc")
1097 return self.
datasvc(
"FileRecordDataSvc")
1100 if self.
state() == Gaudi.StateMachine.CONFIGURED:
1102 if not hasattr(self,
"_evtsel"):
1107 svc = Helper.service(self._svcloc, name)
1111 if name
not in self.ExtSvc:
1112 self.ExtSvc += [name]
1114 svc = Helper.service(self._svcloc, name,
True)
1118 if self.
FSMState() == Gaudi.StateMachine.CONFIGURED:
1120 svc = Helper.service(self._svcloc,
"ParticlePropertySvc")
1124 svc = Helper.service(self._svcloc, name,
True)
1131 """Add an Algorithm to the list of Top algorithms. It can be either a instance of
1132 an Algorithm class or it name"""
1133 if type(alg)
is str:
1136 self.pyalgorithms.append(alg)
1142 self.
topAlg += [alg.name()]
1145 """Set the list of Top Algorithms.
1146 It can be an individual of a list of algorithms names or instances"""
1147 if type(algs)
is not list:
1151 if type(alg)
is str:
1154 self.pyalgorithms.append(alg)
1159 names.append(alg.name())
1163 """Remove an Algorithm to the list of Top algorithms. It can be either a instance of
1164 an Algorithm class or it name"""
1166 if type(alg)
is str:
1169 tmp.remove(alg.name())
1170 self.pyalgorithms.remove(alg)
1176 Print the sequence of Algorithms.
1179 def printAlgo(algName, appMgr, prefix=" "):
1180 print(prefix + algName)
1181 alg = appMgr.algorithm(algName.split(
"/")[-1])
1182 prop = alg.properties()
1183 if "Members" in prop:
1184 subs = prop[
"Members"].value()
1186 printAlgo(i.strip(
'"'), appMgr, prefix +
" ")
1189 prefix =
"ApplicationMgr SUCCESS "
1192 +
"****************************** Algorithm Sequence ****************************"
1194 for i
in mp[
"TopAlg"].value():
1195 printAlgo(i, self, prefix)
1198 +
"******************************************************************************"
1203 Simple utility to perform the configuration of Gaudi application.
1204 It reads the set of input job-options files, and set few
1205 additional parameters 'options' through the usage of temporary *.opts file
1207 gaudi.config( files = [ '$GAUSSOPTS/Gauss.opts' ,
1208 '$DECFILESROOT/options/10022_010.0GeV.opts' ] ,
1209 options = [ 'EventSelector.PrintFreq = 5 ' ] )
1211 files = args.get(
"files", [])
1215 raise RuntimeError(
' Unable to read file "' + file +
'" ')
1216 options = args.get(
"options",
None)
1220 tmpfilename = tempfile.mktemp()
1221 tmpfile = open(tmpfilename,
"w")
1222 tmpfile.write(
"#pragma print on \n")
1224 '/// File "' + tmpfilename +
'" generated by GaudiPython \n\n'
1227 if type(options)
is dict:
1233 +
" ; // added by GaudiPython \n"
1236 tmpfile.write(
" \t " + opt +
" ; // added by GaudiPython \n")
1238 '/// End of file "' + tmpfilename +
'" generated by GaudiPython \n\n'
1243 raise RuntimeError(
' Unable to read file "' + tmpfilename +
'" ')
1244 os.remove(tmpfilename)
1252 return self._appmgr.
start()
1258 if self.
FSMState() == Gaudi.StateMachine.CONFIGURED:
1260 if sc.isFailure()
or self.ReturnCode != 0:
1262 if self.
FSMState() == Gaudi.StateMachine.INITIALIZED:
1264 if sc.isFailure()
or self.ReturnCode != 0:
1266 return self._evtpro.executeRun(n)
1275 if self.
FSMState() == Gaudi.StateMachine.CONFIGURED:
1279 if self.
FSMState() == Gaudi.StateMachine.INITIALIZED:
1284 if not hasattr(self,
"_perssvc"):
1285 self.__dict__[
"_perssvc"] = self.
service(
1286 "EventPersistencySvc",
"IAddressCreator"
1288 if not hasattr(self,
"_filecat"):
1289 self.__dict__[
"_filecat"] = self.
service(
1290 "FileCatalog",
"Gaudi::IFileCatalog"
1292 if not hasattr(self,
"_evtmgr"):
1293 self.__dict__[
"_evtmgr"] = self.
service(
"EventDataSvc",
"IDataManagerSvc")
1295 if pfn.find(
"PFN:") == 0:
1299 if not self._filecat.existsFID(fid):
1300 self._filecat.registerPFN(fid, pfn,
"")
1302 if type(events)
is not list:
1306 gadd = gbl.GenericAddress(0x02, 1, fid,
"/Event", 0, evt)
1308 self._perssvc.createAddress(
1309 gadd.svcType(), gadd.clID(), gadd.par(), gadd.ipar(), oadd
1312 self._evtmgr.clearStore()
1313 self._evtmgr.setRoot(
"/Event", oadd)
1318 if not self._exit_called:
1319 self.__dict__[
"_exit_called"] =
True
1320 Gaudi = self._gaudi_ns
1321 if self.
FSMState() == Gaudi.StateMachine.RUNNING:
1322 self._appmgr.
stop().ignore()
1323 if self.
FSMState() == Gaudi.StateMachine.INITIALIZED:
1325 if self.
FSMState() == Gaudi.StateMachine.CONFIGURED:
1336 ntupleSvc = ntuplesvc
1347 tfile = gbl.TFile.Open(pfn)
1349 raise IOError(
"Cannot open ROOT file {0}".
format(pfn))
1350 tree = tfile.Get(
"##Params")
1352 text = tree.db_string
1353 if "NAME=FID" in text:
1354 fid = text[text.rfind(
"VALUE=") + 6 : -1]
1355 nevt = tfile.Get(
"_Event").GetEntries()
1364 """Get all the properties of a component as a Python dictionary.
1365 The component is instantiated using the component library
1368 if name ==
"GaudiCoreSvc":
1369 if Helper.loadDynamicLib(name) != 1:
1370 raise ImportError(
"Error loading component library " + name)
1371 factorylist = gbl.FactoryTable.instance().getEntries()
1373 _ =
AppMgr(outputlevel=7)
1375 _ =
AppMgr(outputlevel=7)
1376 if Helper.loadDynamicLib(name) != 1:
1377 raise ImportError(
"Error loading component library " + name)
1378 factorylist = gbl.FactoryTable.instance().getEntries()
1380 svcloc = gbl.Gaudi.svcLocator()
1381 dummysvc = gbl.Service(
"DummySvc", svcloc)
1382 for factory
in factories:
1389 elif factory.ident() ==
"ApplicationMgr":
1390 ctype =
"ApplicationMgr"
1393 cname = factory.ident().split()[-1]
1394 if ctype
in (
"Algorithm",
"Service",
"AlgTool",
"ApplicationMgr"):
1396 if ctype ==
"AlgTool":
1397 obj = factory.instantiate(dummysvc)
1399 obj = factory.instantiate(svcloc)
1400 except RuntimeError
as text:
1401 print(
"Error instantiating", cname,
" from ", name)
1405 properties[cname] = [ctype, prop.properties()]
1415 for i
in range(factories.size()):
1416 factory = factories.front()
1417 result.append(factory)
1418 factories.pop_front()
1419 for factory
in result:
1420 factories.push_back(factory)
1426 _CallbackStreamBufBase = gbl.GaudiPython.CallbackStreamBuf
1431 _CallbackStreamBufBase.__init__(self, self)
1443 _PyAlgorithm = gbl.GaudiPython.PyAlgorithm
1449 name = self.__class__.__name__
1450 _PyAlgorithm.__init__(self, self, name)
1453 sc = self.
_algmgr.addAlgorithm(self)
1455 raise RuntimeError(
"Unable to add Algorithm")
1458 sc = self.
_algmgr.removeAlgorithm(self)
1483 readline.parse_and_bind(
"tab: complete")