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"""
145 if isinstance(t, str):
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 not isinstance(libs, list):
226 if hasattr(gbl, name):
227 return getattr(gbl, name)
236 """holds the value and the documentation string of a property"""
242 if isinstance(prop, GaudiHandleProperty):
244 elif isinstance(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())
314 elif isinstance(value, set)
and value:
316 value =
"{" + repr(sorted(value))[1:-1] +
"}"
322 if not gbl.Gaudi.Utils.hasProperty(ip, name):
323 raise AttributeError(
"property %s does not exist" % name)
324 ip.setPropertyRepr(name, value)
326 gbl.GaudiPython.Helpers.setProperty(
327 self._svcloc,
".".join([self._name, name]), value
332 The method which returns the value for the given property
333 - In the case of the valid instance it returns the valid property value through IProperty interface
334 - In the case of placeholder the property value is retrieved from JobOptionsCatalogue
338 if not gbl.Gaudi.Utils.hasProperty(ip, name):
339 raise AttributeError(
"property %s does not exist" % name)
340 prop = ip.getProperty(name)
341 if isinstance(prop, StringProperty):
343 elif isinstance(prop, StringPropertyRef):
346 return eval(prop.toString(), {}, {})
350 opts = self._svcloc.getOptsSvc()
351 if opts.has(
"{}.{}".
format(self._name, name)):
353 return eval(opts.get(
"{}.{}".
format(self._name, name)), {}, {})
354 raise AttributeError(
"property %s does not exist" % name)
361 props = ip.getProperties()
362 propsFrom = self._name
364 raise NotImplementedError(
"rely on IJobOptionsSvc")
365 props = self._optsvc.getProperties(self._name)
366 propsFrom =
"jobOptionsSvc"
371 except (ValueError, TypeError)
as e:
373 "gaudimodule.iProperty.properties(): %s%s processing property %s.%s = %s"
374 % (e.__class__.__name__, e.args, propsFrom, p.name(), p.value())
386 """Python equivalent to IProperty interface"""
389 iProperty.__init__(self, name, isvc)
393 isvc = Helper.service(self._svcloc, self._name)
395 iService.__init__(self, self._name, isvc)
426 """Python equivalent to IAlgorithm interface"""
429 iProperty.__init__(self, name, ialg)
433 ialg = Helper.algorithm(
437 iAlgorithm.__init__(self, self._name, ialg)
486 """Python equivalent to IAlgTool interface (not completed yet)"""
489 iProperty.__init__(self, name, itool)
490 self.__dict__[
"_itool"] = itool
491 svc = Helper.service(self._svcloc,
"ToolSvc",
True)
492 self.__dict__[
"_toolsvc"] =
iToolSvc(
"ToolSvc", svc)
495 itool = self._toolsvc._retrieve(self._name)
497 iAlgTool.__init__(self, self._name, itool)
510 return self._itool.
name()
520 iService.__init__(self, name, idp)
521 self.__dict__[
"_idp"] =
InterfaceCast(gbl.IDataProviderSvc)(idp)
522 self.__dict__[
"_idm"] =
InterfaceCast(gbl.IDataManagerSvc)(idp)
524 self.__dict__[
"_ihwb"] =
None
526 if idp.queryInterface(gbl.IHiveWhiteBoard.interfaceID(), ip).isSuccess():
527 self.__dict__[
"_ihwb"] = ip
531 raise AttributeError(
532 "C++ service %s does not exist" % self.__dict__[
"_name"]
534 return Helper.registerObject(self._idp, path, obj)
538 raise AttributeError(
539 "C++ service %s does not exist" % self.__dict__[
"_name"]
541 return Helper.unregisterObject(self._idp, path)
546 return Helper.dataobject(self._idp, path)
553 Get the existing object in TransientStore for the given location
555 - loading of object from persistency is NOT triggered
556 - 'data-on-demand' action is NOT triggered
558 >>> svc = ... ## get the service
559 >>> path = ... ## get the path in Transient Store
560 >>> data = svc.findObject ( path ) ## use the method
564 raise IndexError(
"C++ service %s does not exist" % self.__dict__[
"_name"])
565 return Helper.findobject(self._idp, path)
570 Get object from Transient Store for the given location
573 - path : Location of object in Transient Store
574 - retrieve (bool) True : retrieve versus find
575 - disable on-demand (bool) False : temporary disable 'on-demand' actions
577 >>> svc = ... ## get the service
578 >>> path = ... ## get the path
580 >>> data = svc.getObject ( path , False ) ## find object in Transient Store
582 ## find object in Transient Store
583 # load form tape or use 'on-demand' action for missing objects :
584 >>> data = svc.getObject ( path , True )
586 ## find object in Transient Store
587 # load from tape or for missing objects, disable 'on-demand'-actions
588 >>> data = svc.getObject ( path , True , True )
592 raise IndexError(
"C++ service %s does not exist" % self.__dict__[
"_name"])
593 return Helper.getobject(self._idp, path, *args)
597 raise IndexError(
"C++ service %s does not exist" % self.__dict__[
"_name"])
598 return Helper.dataobject(self._idp, path)
602 raise IndexError(
"C++ service %s does not exist" % self.__dict__[
"_name"])
607 raise IndexError(
"C++ service %s does not exist" % self.__dict__[
"_name"])
611 if node == cppyy.nullptr:
613 ll = gbl.std.vector(
"IRegistry*")()
614 if isinstance(node, str):
616 if self._idm.objectLeaves(node, ll).isSuccess():
619 def dump(self, node=cppyy.nullptr):
620 if node == cppyy.nullptr:
623 node = root.registry()
626 print(node.identifier())
628 for l
in self.
leaves(node):
631 def getList(self, node=cppyy.nullptr, lst=[], rootFID=None):
632 if node == cppyy.nullptr:
635 node = root.registry()
636 rootFID = node.address().
par()
640 Helper.dataobject(self._idp, node.identifier())
642 lst.append(node.identifier())
643 for l
in self.
leaves(node):
644 if l.address()
and l.address().
par() == rootFID:
651 if node == cppyy.nullptr:
654 node = root.registry()
659 Helper.dataobject(self._idp, node.identifier())
661 lst.append(node.identifier())
662 for l
in self.
leaves(node):
671 raise IndexError(
"C++ service %s does not exist" % self.__dict__[
"_name"])
672 return self._idm.
setRoot(name, obj)
679 if self._ihwb.getNumberOfStores() > 1:
681 "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"
688 raise IndexError(
"C++ service %s does not exist" % self.__dict__[
"_name"])
693 raise IndexError(
"C++ service %s does not exist" % self.__dict__[
"_name"])
700 self.__dict__[
"_ihs"] =
InterfaceCast(gbl.IHistogramSvc)(ihs)
701 iDataSvc.__init__(self, name, ihs)
704 return Helper.histo1D(self._ihs, path)
707 return Helper.histo2D(self._ihs, path)
710 return Helper.histo3D(self._ihs, path)
713 return Helper.profile1D(self._ihs, path)
716 return Helper.profile2D(self._ihs, path)
720 Retrieve AIDA histogram or AIDA profile histogram by path in Histogram Transient Store
722 >>> histo = svc.retrieve ( 'path/to/my/histogram' )
737 Book the histograms(1D,2D&3D) , see IHistogramSvc::book
739 >>> histo = svc.book( .... )
741 return self._ihs.
book(*args)
745 Book the profile(1D&2D) histograms, see IHistogramSvc::bookProf
747 >>> histo = svc.bookProf( .... )
753 Retrieve the object from Histogram Transient Store (by path)
754 The reference to AIDA histogram is returned (if possible)
756 >>> histo = svc['path/to/my/histogram']
761 return iDataSvc.__getitem__(self, path)
765 Retrieve the histogram from Histogram Transient Store (by path)
766 The reference to AIDA histogram is returned (if possible)
768 >>> histo = svc.getAsAIDA ( 'path/to/my/histogram' )
774 Retrieve the histogram from Histogram Transient Store (by path)
775 The Underlying native ROOT object is returned (if possible)
777 >>> histo = svc.getAsROOT ( 'path/to/my/histogram' )
779 fun = gbl.Gaudi.Utils.Aida2ROOT.aida2root
792 iDataSvc.__init__(self, name, ints)
795 return self._ints.
book(*args)
798 """Defines the mapping between logical names and the output file
800 defineOutput({'LUN1':'MyFile1.root', 'LUN2':'Myfile2.root'}, svc='Gaudi::RootCnvSvc')
802 from .
import Persistency
as prs
804 helper = prs.get(typ)
805 helper.configure(
AppMgr())
806 self.
Output = [helper.formatOutput(files[lun], lun=lun)
for lun
in files]
807 if AppMgr().HistogramPersistency ==
"NONE":
808 AppMgr().HistogramPersistency =
"ROOT"
811 return iDataSvc.__getitem__(self, path)
818 iService.__init__(self, name, its)
821 sol = _gaudi.OutputLevel
824 if name.rfind(
".") == -1:
825 itool = Helper.tool(self._its,
"", name, nullptr,
False)
826 elif name[0:8] ==
"ToolSvc.":
827 itool = Helper.tool(self._its,
"", name[8:], nullptr,
False)
828 elif name.count(
".") > 1:
829 ptool = self.
_retrieve(name[: name.rfind(
".")])
831 self._its,
"", name[name.rfind(
".") + 1 :], ptool,
False
834 prop = _gaudi.property(name[: name.rfind(
".")])
836 self._its,
"", name[name.rfind(
".") + 1 :], prop._ip,
False
845 def create(self, typ, name=None, parent=nullptr, interface=None):
848 itool = Helper.tool(self._its, typ, name, parent,
True)
855 if isinstance(itool, iAlgTool):
856 self._its.releaseTool(itool._itool)
867 Helper.service(gbl.Gaudi.svcLocator(),
"EventSelector"),
869 self.__dict__[
"g"] =
AppMgr()
871 def open(self, stream, typ="Gaudi::RootCnvSvc
", **kwargs):
872 from .
import Persistency
as prs
874 helper = prs.get(typ)
875 helper.configure(self.g)
876 self.
Input = helper.formatInput(stream, **kwargs)
891 newobj = object.__new__(cls)
892 cls.
__init__(newobj, *args, **kwargs)
924 self.__dict__[
"_exit_called"] =
False
926 self.__dict__[
"_gaudi_ns"] = Gaudi
928 from GaudiKernel.Proxy.Configurable
import expandvars
934 if dllname
and factname:
935 self.__dict__[
"_appmgr"] = gbl.Gaudi.createApplicationMgr(dllname, factname)
937 self.__dict__[
"_appmgr"] = gbl.Gaudi.createApplicationMgr(dllname)
939 self.__dict__[
"_appmgr"] = gbl.Gaudi.createApplicationMgr()
940 self.__dict__[
"_svcloc"] = gbl.Gaudi.svcLocator()
942 self.__dict__[
"_evtpro"] =
InterfaceCast(gbl.IEventProcessor)(self._appmgr)
943 self.__dict__[
"_svcmgr"] =
InterfaceCast(gbl.ISvcManager)(self._appmgr)
944 self.__dict__[
"pyalgorithms"] = []
945 iService.__init__(self,
"ApplicationMgr", self._appmgr)
947 if self.
FSMState() < Gaudi.StateMachine.CONFIGURED:
954 import GaudiKernel.Proxy.Configurable
956 if hasattr(GaudiKernel.Proxy.Configurable,
"applyConfigurableUsers"):
957 GaudiKernel.Proxy.Configurable.applyConfigurableUsers()
961 appMgr = Configurable.allConfigurables[
"ApplicationMgr"]
962 selfprops =
expandvars(appMgr.getValuedProperties())
965 for p, v
in selfprops.items():
967 for p, v
in selfoptions.items():
970 if outputlevel != -1:
974 ms = self.
service(
"MessageSvc")
975 if "MessageSvc" in Configurable.allConfigurables:
976 msprops = Configurable.allConfigurables[
"MessageSvc"]
977 ms = self.
service(
"MessageSvc")
978 if hasattr(msprops,
"getValuedProperties"):
979 msprops =
expandvars(msprops.getValuedProperties())
980 for p, v
in msprops.items():
982 if outputlevel != -1:
983 ms.OutputLevel = outputlevel
986 c = Configurable.allConfigurables[n]
987 if n
in [
"ApplicationMgr",
"MessageSvc"]:
989 for p, v
in c.getValuedProperties().items():
992 if hasattr(Configurable,
"PropertyReference")
and isinstance(
993 v, Configurable.PropertyReference
998 if isinstance(v, str):
1000 gbl.GaudiPython.Helpers.setProperty(
1001 self._svcloc,
".".join([n, p]), str(v)
1003 if hasattr(Configurable,
"_configurationLocked"):
1004 Configurable._configurationLocked =
True
1009 atexit.register(self.
exit)
1015 orig_register = atexit.register
1017 def register(func, *targs, **kargs):
1018 orig_register(func, *targs, **kargs)
1019 if hasattr(func,
"__module__")
and func.__module__ ==
"ROOT":
1020 orig_register(self.
exit)
1024 register.__doc__ = (
1025 orig_register.__doc__
1026 +
"\nNote: version hacked by GaudiPython to work "
1027 +
"around a problem with the ROOT exit handler"
1029 atexit.register = register
1033 if "_svcloc" in self.__dict__:
1034 return self._svcloc.getOptsSvc()
1047 svc = Helper.service(self._svcloc, name)
1054 self._svcmgr.declareSvcType(svcname, svctype)
1057 return Helper.service(self._svcloc, name,
True)
1060 l = self._svcloc.getServices()
1061 return [s.name()
for s
in l]
1064 alg = Helper.algorithm(self._algmgr, name, createIf)
1071 l = self._algmgr.getAlgorithms()
1072 return [a.name()
for a
in l]
1086 if self.
state() == Gaudi.StateMachine.CONFIGURED:
1088 svc = Helper.service(self._svcloc, name)
1092 svc = self.
datasvc(
"EventDataSvc")
1093 svc.selectOnlyStore()
1097 return self.
datasvc(
"DetectorDataSvc")
1100 return self.
datasvc(
"FileRecordDataSvc")
1103 if self.
state() == Gaudi.StateMachine.CONFIGURED:
1105 if not hasattr(self,
"_evtsel"):
1110 svc = Helper.service(self._svcloc, name)
1114 if name
not in self.ExtSvc:
1115 self.ExtSvc += [name]
1117 svc = Helper.service(self._svcloc, name,
True)
1121 if self.
FSMState() == Gaudi.StateMachine.CONFIGURED:
1123 svc = Helper.service(self._svcloc,
"ParticlePropertySvc")
1127 svc = Helper.service(self._svcloc, name,
True)
1134 """Add an Algorithm to the list of Top algorithms. It can be either a instance of
1135 an Algorithm class or it name"""
1136 if isinstance(alg, str):
1139 self.pyalgorithms.append(alg)
1145 self.
topAlg += [alg.name()]
1148 """Set the list of Top Algorithms.
1149 It can be an individual of a list of algorithms names or instances"""
1150 if not isinstance(algs, list):
1154 if isinstance(alg, str):
1157 self.pyalgorithms.append(alg)
1162 names.append(alg.name())
1166 """Remove an Algorithm to the list of Top algorithms. It can be either a instance of
1167 an Algorithm class or it name"""
1169 if isinstance(alg, str):
1172 tmp.remove(alg.name())
1173 self.pyalgorithms.remove(alg)
1179 Print the sequence of Algorithms.
1182 def printAlgo(algName, appMgr, prefix=" "):
1183 print(prefix + algName)
1184 alg = appMgr.algorithm(algName.split(
"/")[-1])
1185 prop = alg.properties()
1186 if "Members" in prop:
1187 subs = prop[
"Members"].value()
1189 printAlgo(i.strip(
'"'), appMgr, prefix +
" ")
1192 prefix =
"ApplicationMgr SUCCESS "
1195 +
"****************************** Algorithm Sequence ****************************"
1197 for i
in mp[
"TopAlg"].value():
1198 printAlgo(i, self, prefix)
1201 +
"******************************************************************************"
1206 Simple utility to perform the configuration of Gaudi application.
1207 It reads the set of input job-options files, and set few
1208 additional parameters 'options' through the usage of temporary *.opts file
1210 gaudi.config( files = [ '$GAUSSOPTS/Gauss.opts' ,
1211 '$DECFILESROOT/options/10022_010.0GeV.opts' ] ,
1212 options = [ 'EventSelector.PrintFreq = 5 ' ] )
1214 files = args.get(
"files", [])
1218 raise RuntimeError(
' Unable to read file "' + file +
'" ')
1219 options = args.get(
"options",
None)
1223 tmpfilename = tempfile.mktemp()
1224 tmpfile = open(tmpfilename,
"w")
1225 tmpfile.write(
"#pragma print on \n")
1227 '/// File "' + tmpfilename +
'" generated by GaudiPython \n\n'
1230 if isinstance(options, dict):
1236 +
" ; // added by GaudiPython \n"
1239 tmpfile.write(
" \t " + opt +
" ; // added by GaudiPython \n")
1241 '/// End of file "' + tmpfilename +
'" generated by GaudiPython \n\n'
1246 raise RuntimeError(
' Unable to read file "' + tmpfilename +
'" ')
1247 os.remove(tmpfilename)
1255 return self._appmgr.
start()
1261 if self.
FSMState() == Gaudi.StateMachine.CONFIGURED:
1263 if sc.isFailure()
or self.ReturnCode != 0:
1265 if self.
FSMState() == Gaudi.StateMachine.INITIALIZED:
1267 if sc.isFailure()
or self.ReturnCode != 0:
1269 return self._evtpro.executeRun(n)
1278 if self.
FSMState() == Gaudi.StateMachine.CONFIGURED:
1282 if self.
FSMState() == Gaudi.StateMachine.INITIALIZED:
1287 if not hasattr(self,
"_perssvc"):
1288 self.__dict__[
"_perssvc"] = self.
service(
1289 "EventPersistencySvc",
"IAddressCreator"
1291 if not hasattr(self,
"_filecat"):
1292 self.__dict__[
"_filecat"] = self.
service(
1293 "FileCatalog",
"Gaudi::IFileCatalog"
1295 if not hasattr(self,
"_evtmgr"):
1296 self.__dict__[
"_evtmgr"] = self.
service(
"EventDataSvc",
"IDataManagerSvc")
1298 if pfn.find(
"PFN:") == 0:
1302 if not self._filecat.existsFID(fid):
1303 self._filecat.registerPFN(fid, pfn,
"")
1305 if not isinstance(events, list):
1309 gadd = gbl.GenericAddress(0x02, 1, fid,
"/Event", 0, evt)
1311 self._perssvc.createAddress(
1312 gadd.svcType(), gadd.clID(), gadd.par(), gadd.ipar(), oadd
1315 self._evtmgr.clearStore()
1316 self._evtmgr.setRoot(
"/Event", oadd)
1321 if not self._exit_called:
1322 self.__dict__[
"_exit_called"] =
True
1323 Gaudi = self._gaudi_ns
1324 if self.
FSMState() == Gaudi.StateMachine.RUNNING:
1325 self._appmgr.
stop().ignore()
1326 if self.
FSMState() == Gaudi.StateMachine.INITIALIZED:
1328 if self.
FSMState() == Gaudi.StateMachine.CONFIGURED:
1339 ntupleSvc = ntuplesvc
1350 tfile = gbl.TFile.Open(pfn)
1352 raise IOError(
"Cannot open ROOT file {0}".
format(pfn))
1353 tree = tfile.Get(
"##Params")
1355 text = tree.db_string
1356 if "NAME=FID" in text:
1357 fid = text[text.rfind(
"VALUE=") + 6 : -1]
1358 nevt = tfile.Get(
"_Event").GetEntries()
1367 """Get all the properties of a component as a Python dictionary.
1368 The component is instantiated using the component library
1371 if name ==
"GaudiCoreSvc":
1372 if Helper.loadDynamicLib(name) != 1:
1373 raise ImportError(
"Error loading component library " + name)
1374 factorylist = gbl.FactoryTable.instance().getEntries()
1376 _ =
AppMgr(outputlevel=7)
1378 _ =
AppMgr(outputlevel=7)
1379 if Helper.loadDynamicLib(name) != 1:
1380 raise ImportError(
"Error loading component library " + name)
1381 factorylist = gbl.FactoryTable.instance().getEntries()
1383 svcloc = gbl.Gaudi.svcLocator()
1384 dummysvc = gbl.Service(
"DummySvc", svcloc)
1385 for factory
in factories:
1392 elif factory.ident() ==
"ApplicationMgr":
1393 ctype =
"ApplicationMgr"
1396 cname = factory.ident().split()[-1]
1397 if ctype
in (
"Algorithm",
"Service",
"AlgTool",
"ApplicationMgr"):
1399 if ctype ==
"AlgTool":
1400 obj = factory.instantiate(dummysvc)
1402 obj = factory.instantiate(svcloc)
1403 except RuntimeError
as text:
1404 print(
"Error instantiating", cname,
" from ", name)
1408 properties[cname] = [ctype, prop.properties()]
1418 for i
in range(factories.size()):
1419 factory = factories.front()
1420 result.append(factory)
1421 factories.pop_front()
1422 for factory
in result:
1423 factories.push_back(factory)
1429 _CallbackStreamBufBase = gbl.GaudiPython.CallbackStreamBuf
1434 _CallbackStreamBufBase.__init__(self, self)
1446 _PyAlgorithm = gbl.GaudiPython.PyAlgorithm
1452 name = self.__class__.__name__
1453 _PyAlgorithm.__init__(self, self, name)
1456 sc = self.
_algmgr.addAlgorithm(self)
1458 raise RuntimeError(
"Unable to add Algorithm")
1461 sc = self.
_algmgr.removeAlgorithm(self)
1486 readline.parse_and_bind(
"tab: complete")