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.
18 from __future__
import absolute_import, print_function
21 'gbl',
'InterfaceCast',
'Interface',
'PropertyEntry',
'AppMgr',
22 'PyAlgorithm',
'CallbackStreamBuf',
'iAlgorithm',
'iDataSvc',
23 'iHistogramSvc',
'iNTupleSvc',
'iService',
'iAlgTool',
'Helper',
'SUCCESS',
24 'FAILURE',
'toArray',
'ROOT',
'makeNullPointer',
'setOwnership',
25 'getClass',
'loaddict',
'deprecation'
28 from GaudiKernel
import ROOT6WorkAroundEnabled
37 with warnings.catch_warnings():
38 warnings.simplefilter(
"ignore")
41 if sys.version_info >= (3, ):
51 from .
import Pythonizations
54 from GaudiKernel.Proxy.Configurable
import Configurable, getNeededConfigurables
63 gbl.gInterpreter.Declare(
'#include "Gaudi/Property.h"')
64 Helper = gbl.GaudiPython.Helper
65 StringProperty = gbl.Gaudi.Property(
'std::string')
66 StringPropertyRef = gbl.Gaudi.Property(
'std::string&')
67 GaudiHandleProperty = gbl.GaudiHandleProperty
68 GaudiHandleArrayProperty = gbl.GaudiHandleArrayProperty
69 DataObject = gbl.DataObject
70 SUCCESS = gbl.StatusCode(gbl.StatusCode.SUCCESS,
True)
71 FAILURE = gbl.StatusCode(gbl.StatusCode.FAILURE,
True)
73 if hasattr(cppyy,
'nullptr'):
74 nullptr = cppyy.nullptr
75 elif hasattr(gbl,
'nullptr'):
80 cppyy.gbl.gInterpreter.Declare(
'''
82 namespace GaudiPython { namespace Helpers {
83 void setProperty(ISvcLocator* svcLoc, std::string key, std::string value) {
84 if ( !svcLoc ) throw std::runtime_error( "invalid ISvcLocator pointer" );
85 svcLoc->getOptsSvc().set(key, value);
91 for l
in [l
for l
in dir(Helper)
if re.match(
"^to.*Array$", l)]:
92 exec(
"%s = Helper.%s" % (l, l))
96 if hasattr(Helper,
"toArray"):
100 return getattr(Helper,
"toArray")
104 return getattr(Helper,
"toArray<%s>" % typ)
109 if hasattr(cppyy,
'libPyROOT'):
110 ROOT = cppyy.libPyROOT
113 makeNullPointer = ROOT.MakeNullPointer
114 setOwnership = ROOT.SetOwnership
118 warnings.warn(
'GaudiPython: ' + message, DeprecationWarning, stacklevel=3)
125 """ Helper class to obtain the adequate interface from a component
126 by using the Gaudi queryInterface() mechanism """
137 if obj.queryInterface(self.
type.interfaceID(), ip).isSuccess():
140 print(
"ERROR: queryInterface failed for", obj,
141 "interface:", self.
type)
142 except Exception
as e:
143 print(
"ERROR: exception", e,
144 "caught when retrieving interface", self.
type,
147 traceback.print_stack()
159 InterfaceCast.__init__(self, t)
169 """ Load a LCG dictionary using various mechanisms"""
170 if Helper.loadDynamicLib(dict) == 1:
176 raise ImportError(
'Error loading dictionary library')
184 Function to retrieve a certain C++ class by name and to load dictionary if requested
188 from gaudimodule import getClass
189 # one knows that class is already loaded
190 AppMgr = getClass( 'ApplicationMgr' )
191 # one knows where to look for class, if not loaded yet
192 MCParticle = getClass( 'MCParticle' , 'EventDict' )
193 # one knows where to look for class, if not loaded yet
194 Vertex = getClass( 'Vertex' , ['EventDict', 'PhysEventDict'] )
197 if hasattr(gbl, name):
198 return getattr(gbl, name)
200 if type(libs)
is not list:
204 if hasattr(gbl, name):
205 return getattr(gbl, name)
214 """ holds the value and the documentation string of a property """
220 if issubclass(
type(prop), GaudiHandleProperty):
222 elif issubclass(
type(prop), GaudiHandleArrayProperty):
223 self.
_value = prop.value()
227 self.
_value = eval(prop.toString(), {}, {})
229 if hasattr(prop,
'value'):
230 self.
_value = prop.value()
232 self.
_value = prop.toString()
234 self.
__doc__ +=
" --- Default value = " + str(self.
_value) +
" --- "
235 if prop.documentation() !=
'none':
247 "Return the underlying property itself "
261 """ Python equivalent to the C++ Property interface """
265 self.__dict__[
'_svcloc'] = gbl.Gaudi.svcLocator()
266 self.__dict__[
'_name'] = name
277 if not getattr(self, ifname):
278 self.retrieveInterface()
279 return getattr(getattr(self, ifname), method)(*args)
283 The method which is used for setting the property from the given value.
284 - In the case of the valid instance it sets the property through IProperty interface
285 - In the case of placeholder the property is added to JobOptionsCatalogue
287 if hasattr(value,
'toStringProperty'):
289 value = str(value.toStringProperty())
290 elif hasattr(value,
'toString'):
291 value = str(value.toString())
292 elif type(value) == long:
299 if not gbl.Gaudi.Utils.hasProperty(ip, name):
300 raise AttributeError(
'property %s does not exist' % name)
301 ip.setPropertyRepr(name, value)
303 gbl.GaudiPython.Helpers.setProperty(self._svcloc,
'.'.join(
304 [self._name, name]), value)
308 The method which returns the value for the given property
309 - In the case of the valid instance it returns the valid property value through IProperty interface
310 - In the case of placeholder the property value is retrieved from JobOptionsCatalogue
314 if not gbl.Gaudi.Utils.hasProperty(ip, name):
315 raise AttributeError(
'property %s does not exist' % name)
316 prop = ip.getProperty(name)
317 if StringProperty ==
type(prop):
319 elif StringPropertyRef ==
type(prop):
322 return eval(prop.toString(), {}, {})
326 opts = self._svcloc.getOptsSvc()
327 if opts.has(
"{}.{}".
format(self._name, name)):
329 return eval(opts.get(
"{}.{}".
format(self._name, name)), {}, {})
330 raise AttributeError(
'property %s does not exist' % name)
337 props = ip.getProperties()
338 propsFrom = self._name
340 raise NotImplementedError(
"rely on IJobOptionsSvc")
341 props = self._optsvc.getProperties(self._name)
342 propsFrom =
"jobOptionsSvc"
347 except (ValueError, TypeError)
as e:
348 raise ValueError(
"gaudimodule.iProperty.properties(): %s%s processing property %s.%s = %s" % \
349 (e.__class__.__name__, e.args,
350 propsFrom, p.name(), p.value()))
361 """ Python equivalent to IProperty interface """
364 iProperty.__init__(self, name, isvc)
368 isvc = Helper.service(self._svcloc, self._name)
370 iService.__init__(self, self._name, isvc)
401 """ Python equivalent to IAlgorithm interface """
404 iProperty.__init__(self, name, ialg)
408 ialg = Helper.algorithm(
411 iAlgorithm.__init__(self, self._name, ialg)
460 """ Python equivalent to IAlgTool interface (not completed yet) """
463 iProperty.__init__(self, name, itool)
464 self.__dict__[
'_itool'] = itool
465 svc = Helper.service(self._svcloc,
'ToolSvc',
True)
466 self.__dict__[
'_toolsvc'] =
iToolSvc(
'ToolSvc', svc)
469 itool = self._toolsvc._retrieve(self._name)
471 iAlgTool.__init__(self, self._name, itool)
484 return self._itool.
name()
494 iService.__init__(self, name, idp)
495 self.__dict__[
'_idp'] =
InterfaceCast(gbl.IDataProviderSvc)(idp)
496 self.__dict__[
'_idm'] =
InterfaceCast(gbl.IDataManagerSvc)(idp)
500 raise AttributeError(
501 'C++ service %s does not exist' % self.__dict__[
'_name'])
502 return Helper.registerObject(self._idp, path, obj)
506 raise AttributeError(
507 'C++ service %s does not exist' % self.__dict__[
'_name'])
508 return Helper.unregisterObject(self._idp, path)
513 return Helper.dataobject(self._idp, path)
520 Get the existing object in TransientStore for the given location
522 - loading of object from persistency is NOT triggered
523 - 'data-on-demand' action is NOT triggered
525 >>> svc = ... ## get the service
526 >>> path = ... ## get the path in Transient Store
527 >>> data = svc.findObject ( path ) ## use the method
532 'C++ service %s does not exist' % self.__dict__[
'_name'])
533 return Helper.findobject(self._idp, path)
538 Get object from Transient Store for the given location
541 - path : Location of object in Transient Store
542 - retrieve (bool) True : retrieve versus find
543 - disable on-demand (bool) False : temporary disable 'on-demand' actions
545 >>> svc = ... ## get the service
546 >>> path = ... ## get the path
548 >>> data = svc.getObject ( path , False ) ## find object in Transient Store
550 ## find object in Transient Store
551 # load form tape or use 'on-demand' action for missing objects :
552 >>> data = svc.getObject ( path , True )
554 ## find object in Transient Store
555 # load from tape or for missing objects, disable 'on-demand'-actions
556 >>> data = svc.getObject ( path , True , True )
561 'C++ service %s does not exist' % self.__dict__[
'_name'])
562 return Helper.getobject(self._idp, path, *args)
567 'C++ service %s does not exist' % self.__dict__[
'_name'])
568 return Helper.dataobject(self._idp, path)
573 'C++ service %s does not exist' % self.__dict__[
'_name'])
579 'C++ service %s does not exist' % self.__dict__[
'_name'])
583 if node == cppyy.nullptr:
585 ll = gbl.std.vector(
'IRegistry*')()
586 if type(node)
is str:
590 if self._idm.objectLeaves(node, ll).isSuccess():
593 def dump(self, node=cppyy.nullptr):
594 if node == cppyy.nullptr:
597 node = root.registry()
600 print(node.identifier())
602 for l
in self.
leaves(node):
605 def getList(self, node=cppyy.nullptr, lst=[], rootFID=None):
606 if node == cppyy.nullptr:
609 node = root.registry()
610 rootFID = node.address().
par()
614 Helper.dataobject(self._idp, node.identifier())
616 lst.append(node.identifier())
617 for l
in self.
leaves(node):
618 if l.address()
and l.address().
par() == rootFID:
625 if node == cppyy.nullptr:
628 node = root.registry()
633 Helper.dataobject(self._idp, node.identifier())
635 lst.append(node.identifier())
636 for l
in self.
leaves(node):
646 'C++ service %s does not exist' % self.__dict__[
'_name'])
647 return self._idm.
setRoot(name, obj)
652 'C++ service %s does not exist' % self.__dict__[
'_name'])
659 self.__dict__[
'_ihs'] =
InterfaceCast(gbl.IHistogramSvc)(ihs)
660 iDataSvc.__init__(self, name, ihs)
663 return Helper.histo1D(self._ihs, path)
666 return Helper.histo2D(self._ihs, path)
669 return Helper.histo3D(self._ihs, path)
672 return Helper.profile1D(self._ihs, path)
675 return Helper.profile2D(self._ihs, path)
679 Retrieve AIDA histogram or AIDA profile histogram by path in Histogram Transient Store
681 >>> histo = svc.retrieve ( 'path/to/my/histogram' )
696 Book the histograms(1D,2D&3D) , see IHistogramSvc::book
698 >>> histo = svc.book( .... )
700 return self._ihs.
book(*args)
704 Book the profile(1D&2D) histograms, see IHistogramSvc::bookProf
706 >>> histo = svc.bookProf( .... )
712 Retrieve the object from Histogram Transient Store (by path)
713 The reference to AIDA histogram is returned (if possible)
715 >>> histo = svc['path/to/my/histogram']
720 return iDataSvc.__getitem__(self, path)
724 Retrieve the histogram from Histogram Transient Store (by path)
725 The reference to AIDA histogram is returned (if possible)
727 >>> histo = svc.getAsAIDA ( 'path/to/my/histogram' )
733 Retrieve the histogram from Histogram Transient Store (by path)
734 The Underlying native ROOT object is returned (if possible)
736 >>> histo = svc.getAsROOT ( 'path/to/my/histogram' )
738 fun = gbl.Gaudi.Utils.Aida2ROOT.aida2root
751 iDataSvc.__init__(self, name, ints)
754 return self._ints.
book(*args)
757 """ Defines the mapping between logical names and the output file
759 defineOutput({'LUN1':'MyFile1.root', 'LUN2':'Myfile2.root'}, svc='Gaudi::RootCnvSvc')
761 from .
import Persistency
as prs
762 helper = prs.get(typ)
763 helper.configure(
AppMgr())
765 helper.formatOutput(files[lun], lun=lun)
for lun
in files
767 if AppMgr().HistogramPersistency ==
'NONE':
768 AppMgr().HistogramPersistency =
"ROOT"
771 return iDataSvc.__getitem__(self, path)
778 iService.__init__(self, name, its)
781 sol = _gaudi.OutputLevel
784 if name.rfind(
'.') == -1:
785 itool = Helper.tool(self._its,
'', name, nullptr,
False)
786 elif name[0:8] ==
'ToolSvc.':
787 itool = Helper.tool(self._its,
'', name[8:], nullptr,
False)
788 elif name.count(
'.') > 1:
789 ptool = self.
_retrieve(name[:name.rfind(
'.')])
790 itool = Helper.tool(self._its,
'', name[name.rfind(
'.') + 1:],
793 prop = _gaudi.property(name[:name.rfind(
'.')])
794 itool = Helper.tool(self._its,
'', name[name.rfind(
'.') + 1:],
803 def create(self, typ, name=None, parent=nullptr, interface=None):
806 itool = Helper.tool(self._its, typ, name, parent,
True)
813 if type(itool)
is iAlgTool:
814 self._its.releaseTool(itool._itool)
823 self,
'EventSelector',
824 Helper.service(gbl.Gaudi.svcLocator(),
'EventSelector'))
825 self.__dict__[
'g'] =
AppMgr()
827 def open(self, stream, typ='Gaudi::RootCnvSvc
', **kwargs):
828 from .
import Persistency
as prs
829 helper = prs.get(typ)
830 helper.configure(self.g)
831 self.
Input = helper.formatInput(stream, **kwargs)
846 newobj = object.__new__(cls)
847 cls.
__init__(newobj, *args, **kwargs)
877 self.__dict__[
'_exit_called'] =
False
879 self.__dict__[
'_gaudi_ns'] = Gaudi
881 from GaudiKernel.Proxy.Configurable
import expandvars
887 if dllname
and factname:
888 self.__dict__[
'_appmgr'] = gbl.Gaudi.createApplicationMgr(
891 self.__dict__[
'_appmgr'] = gbl.Gaudi.createApplicationMgr(dllname)
893 self.__dict__[
'_appmgr'] = gbl.Gaudi.createApplicationMgr()
894 self.__dict__[
'_svcloc'] = gbl.Gaudi.svcLocator()
895 self.__dict__[
'_algmgr'] =
InterfaceCast(gbl.IAlgManager)(self._appmgr)
896 self.__dict__[
'_evtpro'] =
InterfaceCast(gbl.IEventProcessor)(
898 self.__dict__[
'_svcmgr'] =
InterfaceCast(gbl.ISvcManager)(self._appmgr)
899 self.__dict__[
'pyalgorithms'] = []
900 iService.__init__(self,
'ApplicationMgr', self._appmgr)
903 ) < Gaudi.StateMachine.CONFIGURED:
909 import GaudiKernel.Proxy.Configurable
910 if hasattr(GaudiKernel.Proxy.Configurable,
911 "applyConfigurableUsers"):
912 GaudiKernel.Proxy.Configurable.applyConfigurableUsers()
916 appMgr = Configurable.allConfigurables[
'ApplicationMgr']
917 selfprops =
expandvars(appMgr.getValuedProperties())
920 for p, v
in selfprops.items():
922 for p, v
in selfoptions.items():
925 if outputlevel != -1:
929 ms = self.
service(
'MessageSvc')
930 if 'MessageSvc' in Configurable.allConfigurables:
931 msprops = Configurable.allConfigurables[
'MessageSvc']
932 ms = self.
service(
'MessageSvc')
933 if hasattr(msprops,
"getValuedProperties"):
934 msprops =
expandvars(msprops.getValuedProperties())
935 for p, v
in msprops.items():
937 if outputlevel != -1:
938 ms.OutputLevel = outputlevel
941 c = Configurable.allConfigurables[n]
942 if n
in [
'ApplicationMgr',
'MessageSvc']:
944 for p, v
in c.getValuedProperties().
items():
947 if hasattr(Configurable,
"PropertyReference")
and type(
948 v) == Configurable.PropertyReference:
956 gbl.GaudiPython.Helpers.setProperty(self._svcloc,
957 '.'.join([n, p]), str(v))
958 if hasattr(Configurable,
"_configurationLocked"):
959 Configurable._configurationLocked =
True
963 atexit.register(self.
exit)
969 orig_register = atexit.register
971 def register(func, *targs, **kargs):
972 orig_register(func, *targs, **kargs)
973 if hasattr(func,
"__module__")
and func.__module__ ==
"ROOT":
974 orig_register(self.
exit)
978 register.__doc__ = (orig_register.__doc__ +
979 "\nNote: version hacked by GaudiPython to work " +
980 "around a problem with the ROOT exit handler")
981 atexit.register = register
985 if "_svcloc" in self.__dict__:
986 return self._svcloc.getOptsSvc()
999 svc = Helper.service(self._svcloc, name)
1006 self._svcmgr.declareSvcType(svcname, svctype)
1009 return Helper.service(self._svcloc, name,
True)
1012 l = self._svcloc.getServices()
1013 return [s.name()
for s
in l]
1016 alg = Helper.algorithm(self._algmgr, name, createIf)
1023 l = self._algmgr.getAlgorithms()
1024 return [a.name()
for a
in l]
1038 if self.
state() == Gaudi.StateMachine.CONFIGURED:
1040 svc = Helper.service(self._svcloc, name)
1044 return self.
datasvc(
'EventDataSvc')
1047 return self.
datasvc(
'DetectorDataSvc')
1050 return self.
datasvc(
'FileRecordDataSvc')
1053 if self.
state() == Gaudi.StateMachine.CONFIGURED:
1055 if not hasattr(self,
'_evtsel'):
1060 svc = Helper.service(self._svcloc, name)
1064 if name
not in self.ExtSvc:
1065 self.ExtSvc += [name]
1067 svc = Helper.service(self._svcloc, name,
True)
1071 if self.
FSMState() == Gaudi.StateMachine.CONFIGURED:
1073 svc = Helper.service(self._svcloc,
'ParticlePropertySvc')
1077 svc = Helper.service(self._svcloc, name,
True)
1084 """ Add an Algorithm to the list of Top algorithms. It can be either a instance of
1085 an Algorithm class or it name """
1086 if type(alg)
is str:
1089 self.pyalgorithms.append(alg)
1095 self.
topAlg += [alg.name()]
1098 """ Set the list of Top Algorithms.
1099 It can be an individual of a list of algorithms names or instances """
1100 if type(algs)
is not list:
1104 if type(alg)
is str:
1107 self.pyalgorithms.append(alg)
1112 names.append(alg.name())
1116 """ Remove an Algorithm to the list of Top algorithms. It can be either a instance of
1117 an Algorithm class or it name """
1119 if type(alg)
is str:
1122 tmp.remove(alg.name())
1123 self.pyalgorithms.remove(alg)
1129 Print the sequence of Algorithms.
1132 def printAlgo(algName, appMgr, prefix=' '):
1133 print(prefix + algName)
1134 alg = appMgr.algorithm(algName.split(
"/")[-1])
1135 prop = alg.properties()
1136 if "Members" in prop:
1137 subs = prop[
"Members"].value()
1139 printAlgo(i.strip(
'"'), appMgr, prefix +
" ")
1142 prefix =
'ApplicationMgr SUCCESS '
1145 "****************************** Algorithm Sequence ****************************"
1147 for i
in mp[
"TopAlg"].value():
1148 printAlgo(i, self, prefix)
1151 "******************************************************************************"
1156 Simple utility to perform the configuration of Gaudi application.
1157 It reads the set of input job-options files, and set few
1158 additional parameters 'options' through the usage of temporary *.opts file
1160 gaudi.config( files = [ '$GAUSSOPTS/Gauss.opts' ,
1161 '$DECFILESROOT/options/10022_010.0GeV.opts' ] ,
1162 options = [ 'EventSelector.PrintFreq = 5 ' ] )
1164 files = args.get(
'files', [])
1168 raise RuntimeError(
' Unable to read file "' + file +
'" ')
1169 options = args.get(
'options',
None)
1172 tmpfilename = tempfile.mktemp()
1173 tmpfile = open(tmpfilename,
'w')
1174 tmpfile.write(
'#pragma print on \n')
1175 tmpfile.write(
'/// File "' + tmpfilename +
1176 '" generated by GaudiPython \n\n')
1178 if type(options)
is dict:
1179 tmpfile.write(
' \t ' + opt +
' = ' + options[opt] +
1180 ' ; // added by GaudiPython \n')
1182 tmpfile.write(
' \t ' + opt +
1183 ' ; // added by GaudiPython \n')
1184 tmpfile.write(
'/// End of file "' + tmpfilename +
1185 '" generated by GaudiPython \n\n')
1189 raise RuntimeError(
' Unable to read file "' + tmpfilename +
1191 os.remove(tmpfilename)
1199 return self._appmgr.
start()
1205 if self.
FSMState() == Gaudi.StateMachine.CONFIGURED:
1207 if sc.isFailure()
or self.ReturnCode != 0:
1209 if self.
FSMState() == Gaudi.StateMachine.INITIALIZED:
1211 if sc.isFailure()
or self.ReturnCode != 0:
1213 return self._evtpro.executeRun(n)
1222 if self.
FSMState() == Gaudi.StateMachine.CONFIGURED:
1226 if self.
FSMState() == Gaudi.StateMachine.INITIALIZED:
1231 if not hasattr(self,
'_perssvc'):
1232 self.__dict__[
'_perssvc'] = self.
service(
'EventPersistencySvc',
1234 if not hasattr(self,
'_filecat'):
1235 self.__dict__[
'_filecat'] = self.
service(
'FileCatalog',
1236 'Gaudi::IFileCatalog')
1237 if not hasattr(self,
'_evtmgr'):
1238 self.__dict__[
'_evtmgr'] = self.
service(
'EventDataSvc',
1241 if pfn.find(
'PFN:') == 0:
1245 if not self._filecat.existsFID(fid):
1246 self._filecat.registerPFN(fid, pfn,
'')
1248 if type(events)
is not list:
1252 gadd = gbl.GenericAddress(0x02, 1, fid,
'/Event', 0, evt)
1254 self._perssvc.createAddress(gadd.svcType(), gadd.clID(),
1255 gadd.par(), gadd.ipar(), oadd)
1257 self._evtmgr.clearStore()
1258 self._evtmgr.setRoot(
'/Event', oadd)
1263 if not self._exit_called:
1264 self.__dict__[
'_exit_called'] =
True
1265 Gaudi = self._gaudi_ns
1266 if self.
FSMState() == Gaudi.StateMachine.RUNNING:
1267 self._appmgr.
stop().ignore()
1268 if self.
FSMState() == Gaudi.StateMachine.INITIALIZED:
1270 if self.
FSMState() == Gaudi.StateMachine.CONFIGURED:
1281 ntupleSvc = ntuplesvc
1292 tfile = gbl.TFile.Open(pfn)
1294 raise IOError(
'Cannot open ROOT file {0}'.
format(pfn))
1295 tree = tfile.Get(
'##Params')
1297 text = tree.db_string
1298 if 'NAME=FID' in text:
1299 fid = text[text.rfind(
'VALUE=') + 6:-1]
1300 nevt = tfile.Get(
'_Event').GetEntries()
1309 """ Get all the properties of a component as a Python dictionary.
1310 The component is instantiated using the component library
1313 if name ==
'GaudiCoreSvc':
1314 if Helper.loadDynamicLib(name) != 1:
1315 raise ImportError(
'Error loading component library ' + name)
1316 factorylist = gbl.FactoryTable.instance().getEntries()
1318 g =
AppMgr(outputlevel=7)
1320 g =
AppMgr(outputlevel=7)
1321 if Helper.loadDynamicLib(name) != 1:
1322 raise ImportError(
'Error loading component library ' + name)
1323 factorylist = gbl.FactoryTable.instance().getEntries()
1325 svcloc = gbl.Gaudi.svcLocator()
1326 dummysvc = gbl.Service(
'DummySvc', svcloc)
1327 for factory
in factories:
1334 elif factory.ident() ==
'ApplicationMgr':
1335 ctype =
'ApplicationMgr'
1338 cname = factory.ident().split()[-1]
1339 if ctype
in (
'Algorithm',
'Service',
'AlgTool',
'ApplicationMgr'):
1341 if ctype ==
'AlgTool':
1342 obj = factory.instantiate(dummysvc)
1344 obj = factory.instantiate(svcloc)
1345 except RuntimeError
as text:
1346 print(
'Error instantiating', cname,
' from ', name)
1350 properties[cname] = [ctype, prop.properties()]
1360 for i
in range(factories.size()):
1361 factory = factories.front()
1362 result.append(factory)
1363 factories.pop_front()
1364 for factory
in result:
1365 factories.push_back(factory)
1371 _CallbackStreamBufBase = gbl.GaudiPython.CallbackStreamBuf
1376 _CallbackStreamBufBase.__init__(self, self)
1388 _PyAlgorithm = gbl.GaudiPython.PyAlgorithm
1394 name = self.__class__.__name__
1395 _PyAlgorithm.__init__(self, self, name)
1398 sc = self.
_algmgr.addAlgorithm(self)
1400 raise RuntimeError(
'Unable to add Algorithm')
1403 sc = self.
_algmgr.removeAlgorithm(self)
1427 readline.parse_and_bind(
"tab: complete")