The Gaudi Framework  master (750c24bb)
Loading...
Searching...
No Matches
Bindings.py
Go to the documentation of this file.
13"""GaudiPython.Bindings module.
14This module provides the basic bindings of the main Gaudi
15components to Python. It is itself based on the ROOT cppyy
16Python extension module.
17"""
18
19__all__ = [
20 "gbl",
21 "InterfaceCast",
22 "Interface",
23 "PropertyEntry",
24 "AppMgr",
25 "PyAlgorithm",
26 "CallbackStreamBuf",
27 "iAlgorithm",
28 "iDataSvc",
29 "iHistogramSvc",
30 "iNTupleSvc",
31 "iService",
32 "iAlgTool",
33 "Helper",
34 "SUCCESS",
35 "FAILURE",
36 "toArray",
37 "ROOT",
38 "makeNullPointer",
39 "setOwnership",
40 "getClass",
41 "loaddict",
42 "deprecation",
43]
44
45import re
46import sys
47import warnings
48
49from GaudiKernel import ROOT6WorkAroundEnabled
50
51# Workaround for ROOT-10769
52with warnings.catch_warnings():
53 warnings.simplefilter("ignore")
54 import cppyy
55
56if ROOT6WorkAroundEnabled("ROOT-5478"):
57 # Trigger the loading of GaudiKernelDict
58 cppyy.gbl.DataObject
59 # Trigger the loading of GaudiPythonDict
60 cppyy.gbl.Chrono
61
62# Import Configurable from AthenaCommon or GaudiKernel if the first is not
63# available.
64from GaudiKernel.Proxy.Configurable import Configurable, getNeededConfigurables
65
66from . import Pythonizations # noqa: F401 (side-effects)
67
68# namespaces
69gbl = cppyy.gbl
70Gaudi = gbl.Gaudi
71
72_gaudi = None
73
74# ---- Useful shortcuts for classes -------------------------------------------
75gbl.gInterpreter.Declare('#include "Gaudi/Property.h"')
76Helper = gbl.GaudiPython.Helper
77StringProperty = gbl.Gaudi.Property("std::string")
78StringPropertyRef = gbl.Gaudi.Property("std::string&")
79GaudiHandleProperty = gbl.GaudiHandleProperty
80GaudiHandleArrayProperty = gbl.GaudiHandleArrayProperty
81DataObject = gbl.DataObject
82SUCCESS = gbl.StatusCode(gbl.StatusCode.SUCCESS)
83FAILURE = gbl.StatusCode(gbl.StatusCode.FAILURE)
84# Workaround for ROOT-10770
85if hasattr(cppyy, "nullptr"):
86 nullptr = cppyy.nullptr
87elif hasattr(gbl, "nullptr"):
88 nullptr = gbl.nullptr
89else:
90 nullptr = None
91# Helper to create a StringProperty
92cppyy.gbl.gInterpreter.Declare(
93 """
94#include <stdexcept>
95namespace GaudiPython { namespace Helpers {
96 void setProperty(ISvcLocator* svcLoc, std::string key, std::string value) {
97 if ( !svcLoc ) throw std::runtime_error( "invalid ISvcLocator pointer" );
98 svcLoc->getOptsSvc().set(key, value);
99 }
100}}
101"""
102)
103
104# toIntArray, toShortArray, etc.
105for l in [l for l in dir(Helper) if re.match("^to.*Array$", l)]:
106 exec(f"{l} = Helper.{l}")
107 __all__.append(l)
108
109# FIXME: (MCl) Hack to handle ROOT 5.18 and ROOT >= 5.20
110if hasattr(Helper, "toArray"):
111 # This is not backward compatible, but allows to use the same signature
112 # with all the versions of ROOT.
113 def toArray(typ):
114 return getattr(Helper, "toArray")
115
116else:
117 # forward to the actual implementation of GaudiPython::Helper::toArray<T>
118 def toArray(typ):
119 return getattr(Helper, f"toArray<{typ}>")
120
121
122# ----Convenient accessors to PyROOT functionality ----------------------------
123# See https://sft.its.cern.ch/jira/browse/ROOT-10771
124if hasattr(cppyy, "libPyROOT"):
125 ROOT = cppyy.libPyROOT
126else:
127 import ROOT
128makeNullPointer = ROOT.MakeNullPointer
129setOwnership = ROOT.SetOwnership
130
131
132def deprecation(message):
133 warnings.warn("GaudiPython: " + message, DeprecationWarning, stacklevel=3)
134
135
136# ----InterfaceCast class -----------------------------------------------------
137
138
140 """Helper class to obtain the adequate interface from a component
141 by using the Gaudi queryInterface() mechanism"""
142
143 def __init__(self, t):
144 if isinstance(t, str):
145 t = getattr(gbl, t)
146 self.type = t
147
148 def __call__(self, obj):
149 if obj:
150 ip = makeNullPointer(self.type)
151 try:
152 if obj.queryInterface(self.type.interfaceID(), ip).isSuccess():
153 return ip
154 else:
155 print(
156 "ERROR: queryInterface failed for", obj, "interface:", self.type
157 )
158 except Exception as e:
159 print(
160 "ERROR: exception",
161 e,
162 "caught when retrieving interface",
163 self.type,
164 "for object",
165 obj,
166 )
167 import traceback
168
169 traceback.print_stack()
170 return cppyy.nullptr
171
172 cast = __call__
173
174
175# ---Interface class (for backward compatibility)------------------------------
176
177
179 def __init__(self, t):
180 deprecation("Use InterfaceCast class instead")
181 InterfaceCast.__init__(self, t)
182
183 def cast(self, obj):
184 return self(obj)
185
186
187# ----load dictionary function using Gaudi function----------------------------
188
189
190def loaddict(dict):
191 """Load an LCG dictionary"""
192 loadlib_return_code = Helper.loadDynamicLib(dict)
193 if loadlib_return_code == 1:
194 return
195 raise RuntimeError(
196 f"Failed to load dictionary library {dict} (return code {loadlib_return_code})"
197 )
198
199
200# ---get a class (by loading modules if needed)--------------------------------
201
202
203def getClass(name, libs=[]):
204 """
205 Function to retrieve a certain C++ class by name and to load dictionary if requested
206
207 Usage:
208
209 from gaudimodule import getClass
210 # one knows that class is already loaded
211 AppMgr = getClass( 'ApplicationMgr' )
212 # one knows where to look for class, if not loaded yet
213 MCParticle = getClass( 'MCParticle' , 'EventDict' )
214 # one knows where to look for class, if not loaded yet
215 Vertex = getClass( 'Vertex' , ['EventDict', 'PhysEventDict'] )
216 """
217 # see if class is already loaded
218 if hasattr(gbl, name):
219 return getattr(gbl, name)
220 # try to load dictionaries and look for the required class
221 if not isinstance(libs, list):
222 libs = [libs]
223 for lib in libs:
224 loaddict(lib)
225 if hasattr(gbl, name):
226 return getattr(gbl, name)
227 # return None ( or raise exception? I do not know... )
228 return None
229
230
231# ----PropertyEntry class------------------------------------------------------
232
233
235 """holds the value and the documentation string of a property"""
236
237 def __init__(self, prop):
238 self._type = type(prop).__name__
239 self.__doc__ = " --- Property type is " + self.ptype()
240
241 if isinstance(prop, GaudiHandleProperty):
242 self._value = prop.value() # do nothing for ATLAS' handles
243 elif isinstance(prop, GaudiHandleArrayProperty):
244 self._value = prop.value() # do nothing for ATLAS' handles
245 else:
246 # for all other types try to extract the native python type
247 try:
248 self._value = eval(prop.toString(), {}, {})
249 except Exception:
250 if hasattr(prop, "value"):
251 self._value = prop.value()
252 else:
253 self._value = prop.toString()
254
255 self.__doc__ += " --- Default value = " + str(self._value) + " --- "
256 if prop.documentation() != "none":
257 self.__doc__ = prop.documentation() + "\\n" + self.__doc__
258 # keep the original property
259 self._property = prop # property itself
260
261 def value(self):
262 return self._value
263
264 def ptype(self):
265 return self._type
266
267 def property(self):
268 "Return the underlying property itself"
269 return self._property
270
271 def documentation(self):
272 return self.__doc__
273
274 def hasDoc(self):
275 return len(self.__doc__) > 0 and self.__doc__ != "none"
276
277
278# ----iProperty class----------------------------------------------------------
279
280
282 """Python equivalent to the C++ Property interface"""
283
284 def __init__(self, name, ip=cppyy.nullptr):
285 self.__dict__["_ip"] = InterfaceCast(gbl.IProperty)(ip)
286 self.__dict__["_svcloc"] = gbl.Gaudi.svcLocator()
287 self.__dict__["_name"] = name
288
289 def getInterface(self):
290 if not self._ip:
291 self.retrieveInterface()
292 return self._ip
293
295 pass
296
297 def __call_interface_method__(self, ifname, method, *args):
298 if not getattr(self, ifname):
299 self.retrieveInterface()
300 return getattr(getattr(self, ifname), method)(*args)
301
302 def __setattr__(self, name, value):
303 """
304 The method which is used for setting the property from the given value.
305 - In the case of the valid instance it sets the property through IProperty interface
306 - In the case of placeholder the property is added to JobOptionsCatalogue
307 """
308 if hasattr(value, "toStringProperty"):
309 # user defined behaviour
310 value = str(value.toStringProperty())
311 elif hasattr(value, "toString"):
312 value = str(value.toString())
313 elif isinstance(value, set) and value:
314 # We want a reproducible (sorted) representation in the catalogue
315 value = "{" + repr(sorted(value))[1:-1] + "}"
316 else:
317 value = str(value)
318
319 ip = self.getInterface()
320 if ip:
321 if not gbl.Gaudi.Utils.hasProperty(ip, name):
322 raise AttributeError(f"property {name} does not exist")
323 ip.setPropertyRepr(name, value)
324 else:
325 gbl.GaudiPython.Helpers.setProperty(
326 self._svcloc, ".".join([self._name, name]), value
327 )
328
329 def __getattr__(self, name):
330 """
331 The method which returns the value for the given property
332 - In the case of the valid instance it returns the valid property value through IProperty interface
333 - In the case of placeholder the property value is retrieved from JobOptionsCatalogue
334 """
335 ip = self.getInterface()
336 if ip:
337 if not gbl.Gaudi.Utils.hasProperty(ip, name):
338 raise AttributeError(f"property {name} does not exist")
339 prop = ip.getProperty(name)
340 if isinstance(prop, StringProperty):
341 return prop.value()
342 elif isinstance(prop, StringPropertyRef):
343 return prop.value()
344 try:
345 return eval(prop.toString(), {}, {})
346 except Exception:
347 return prop.value()
348 else:
349 opts = self._svcloc.getOptsSvc()
350 if opts.has(f"{self._name}.{name}"):
351 # from JobOptionsSvc we always have only strings
352 return eval(opts.get(f"{self._name}.{name}"), {}, {})
353 raise AttributeError(f"property {name} does not exist")
354
355 def properties(self):
356 dct = {}
357 props = None
358 ip = self.getInterface()
359 if ip:
360 props = ip.getProperties()
361 propsFrom = self._name # "interface"
362 else:
363 raise NotImplementedError("rely on IJobOptionsSvc")
364 props = self._optsvc.getProperties(self._name)
365 propsFrom = "jobOptionsSvc"
366 if props:
367 for p in props:
368 try:
369 dct[p.name()] = PropertyEntry(p)
370 except (ValueError, TypeError) as e:
371 raise ValueError(
372 f"gaudimodule.iProperty.properties(): {e.__class__.__name__}{e.args} processing property {propsFrom}.{p.name()} = {p.value()}"
373 )
374 return dct
375
376 def name(self):
377 return self._name
378
379
380# ----iService class-----------------------------------------------------------
381
382
384 """Python equivalent to IProperty interface"""
385
386 def __init__(self, name, isvc=cppyy.nullptr):
387 iProperty.__init__(self, name, isvc)
388 self.__dict__["_isvc"] = InterfaceCast(gbl.IService)(isvc)
389
391 isvc = Helper.service(self._svcloc, self._name)
392 if isvc:
393 iService.__init__(self, self._name, isvc)
394
395 def initialize(self):
396 return self.__call_interface_method__("_isvc", "initialize")
397
398 def start(self):
399 return self.__call_interface_method__("_isvc", "start")
400
401 def stop(self):
402 return self.__call_interface_method__("_isvc", "stop")
403
404 def finalize(self):
405 return self.__call_interface_method__("_isvc", "finalize")
406
407 def reinitialize(self):
408 return self.__call_interface_method__("_isvc", "reinitialize")
409
410 def restart(self):
411 return self.__call_interface_method__("_isvc", "restart")
412
413 def isValid(self):
414 if self._isvc:
415 return True
416 else:
417 return False
418
419
420# ----iAlgorithm class---------------------------------------------------------
421
422
424 """Python equivalent to IAlgorithm interface"""
425
426 def __init__(self, name, ialg=cppyy.nullptr):
427 iProperty.__init__(self, name, ialg)
428 self.__dict__["_ialg"] = InterfaceCast(gbl.IAlgorithm)(ialg)
429
431 ialg = Helper.algorithm(
432 InterfaceCast(gbl.IAlgManager)(self._svcloc), self._name
433 )
434 if ialg:
435 iAlgorithm.__init__(self, self._name, ialg)
436
437 def initialize(self):
438 return self.__call_interface_method__("_ialg", "initialize")
439
440 def start(self):
441 return self.__call_interface_method__("_ialg", "start")
442
443 def execute(self):
444 return self.__call_interface_method__("_ialg", "execute")
445
446 def stop(self):
447 return self.__call_interface_method__("_ialg", "stop")
448
449 def finalize(self):
450 return self.__call_interface_method__("_ialg", "finalize")
451
452 def reinitialize(self):
453 return self.__call_interface_method__("_ialg", "reinitialize")
454
455 def restart(self):
456 return self.__call_interface_method__("_ialg", "restart")
457
458 def sysInitialize(self):
459 return self.__call_interface_method__("_ialg", "sysInitialize")
460
461 def sysStart(self):
462 return self.__call_interface_method__("_ialg", "sysStart")
463
464 def sysExecute(self):
465 return self.__call_interface_method__("_ialg", "sysExecute")
466
467 def sysStop(self):
468 return self.__call_interface_method__("_ialg", "sysStop")
469
470 def sysFinalize(self):
471 return self.__call_interface_method__("_ialg", "sysFinalize")
472
474 return self.__call_interface_method__("_ialg", "sysReinitialize")
475
476 def sysRestart(self):
477 return self.__call_interface_method__("_ialg", "sysRestart")
478
479
480# ----iAlgTool class-----------------------------------------------------------
481
482
484 """Python equivalent to IAlgTool interface (not completed yet)"""
485
486 def __init__(self, name, itool=cppyy.nullptr):
487 iProperty.__init__(self, name, itool)
488 self.__dict__["_itool"] = itool
489 svc = Helper.service(self._svcloc, "ToolSvc", True)
490 self.__dict__["_toolsvc"] = iToolSvc("ToolSvc", svc)
491
493 itool = self._toolsvc._retrieve(self._name)
494 if itool:
495 iAlgTool.__init__(self, self._name, itool)
496
497 def start(self):
498 return self.__call_interface_method__("_itool", "start")
499
500 def stop(self):
501 return self.__call_interface_method__("_itool", "stop")
502
503 def type(self):
504 return self.__call_interface_method__("_itool", "type")
505
506 def name(self):
507 if self._itool:
508 return self._itool.name()
509 else:
510 return self._name
511
512
513# ----iDataSvc class-----------------------------------------------------------
514
515
517 def __init__(self, name, idp):
518 iService.__init__(self, name, idp)
519 self.__dict__["_idp"] = InterfaceCast(gbl.IDataProviderSvc)(idp)
520 self.__dict__["_idm"] = InterfaceCast(gbl.IDataManagerSvc)(idp)
521 # do not use InterfaceCast as it prints an error on failure
522 self.__dict__["_ihwb"] = None
523 ip = makeNullPointer(gbl.IHiveWhiteBoard)
524 if idp.queryInterface(gbl.IHiveWhiteBoard.interfaceID(), ip).isSuccess():
525 self.__dict__["_ihwb"] = ip
526
527 def registerObject(self, path, obj):
528 if not self._idp:
529 raise AttributeError(
530 "C++ service {} does not exist".format(self.__dict__["_name"])
531 )
532 return Helper.registerObject(self._idp, path, obj)
533
534 def unregisterObject(self, path):
535 if not self._idp:
536 raise AttributeError(
537 "C++ service {} does not exist".format(self.__dict__["_name"])
538 )
539 return Helper.unregisterObject(self._idp, path)
540
541 def retrieveObject(self, path):
542 if not self._idp:
543 return cppyy.nullptr
544 return Helper.dataobject(self._idp, path)
545
546 # get object from TES
547
548 def findObject(self, path):
549 """
550
551 Get the existing object in TransientStore for the given location
552
553 - loading of object from persistency is NOT triggered
554 - 'data-on-demand' action is NOT triggered
555
556 >>> svc = ... ## get the service
557 >>> path = ... ## get the path in Transient Store
558 >>> data = svc.findObject ( path ) ## use the method
559
560 """
561 if not self._idp:
562 raise IndexError(
563 "C++ service {} does not exist".format(self.__dict__["_name"])
564 )
565 return Helper.findobject(self._idp, path)
566
567 # get or retrieve object, possible switch-off 'on-demand' actions
568 def getObject(self, path, *args):
569 """
570 Get object from Transient Store for the given location
571
572 arguments :
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
576
577 >>> svc = ... ## get the service
578 >>> path = ... ## get the path
579
580 >>> data = svc.getObject ( path , False ) ## find object in Transient Store
581
582 ## find object in Transient Store
583 # load form tape or use 'on-demand' action for missing objects :
584 >>> data = svc.getObject ( path , True )
585
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 )
589
590 """
591 if not self._idp:
592 raise IndexError(
593 "C++ service {} does not exist".format(self.__dict__["_name"])
594 )
595 return Helper.getobject(self._idp, path, *args)
596
597 def __getitem__(self, path):
598 if not self._idp:
599 raise IndexError(
600 "C++ service {} does not exist".format(self.__dict__["_name"])
601 )
602 return Helper.dataobject(self._idp, path)
603
604 def __setitem__(self, path, obj):
605 if not self._idp:
606 raise IndexError(
607 "C++ service {} does not exist".format(self.__dict__["_name"])
608 )
609 return self.registerObject(path, obj)
610
611 def __delitem__(self, path):
612 if not self._idp:
613 raise IndexError(
614 "C++ service {} does not exist".format(self.__dict__["_name"])
615 )
616 return self.unregisterObject(path)
617
618 def leaves(self, node=cppyy.nullptr):
619 if node == cppyy.nullptr:
620 node = self.retrieveObject("")
621 ll = gbl.std.vector("IRegistry*")()
622 if isinstance(node, str):
623 _ = self.retrieveObject(node)
624 if self._idm.objectLeaves(node, ll).isSuccess():
625 return ll
626
627 def dump(self, node=cppyy.nullptr):
628 if node == cppyy.nullptr:
629 root = self.retrieveObject("")
630 if root:
631 node = root.registry()
632 else:
633 return
634 print(node.identifier())
635 if node.object():
636 for l in self.leaves(node):
637 self.dump(l)
638
639 def getList(self, node=cppyy.nullptr, lst=[], rootFID=None):
640 if node == cppyy.nullptr:
641 root = self.retrieveObject("")
642 if root:
643 node = root.registry()
644 rootFID = node.address().par()
645 lst = []
646 else:
647 return
648 Helper.dataobject(self._idp, node.identifier())
649 if node.object():
650 lst.append(node.identifier())
651 for l in self.leaves(node):
652 if l.address() and l.address().par() == rootFID:
653 self.getList(l, lst, rootFID)
654 else:
655 continue
656 return lst
657
658 def getHistoNames(self, node=cppyy.nullptr, lst=[]):
659 if node == cppyy.nullptr:
660 root = self.retrieveObject("")
661 if root:
662 node = root.registry()
663 # rootFID = node.address().par()
664 lst = []
665 else:
666 return
667 Helper.dataobject(self._idp, node.identifier())
668 if node.object():
669 lst.append(node.identifier())
670 for l in self.leaves(node):
671 if l.name(): # and l.address().par() == rootFID :
672 self.getHistoNames(l, lst)
673 else:
674 continue
675 return lst
676
677 def setRoot(self, name, obj):
678 if not self._idm:
679 raise IndexError(
680 "C++ service {} does not exist".format(self.__dict__["_name"])
681 )
682 return self._idm.setRoot(name, obj)
683
685 # nothing to do if GaudiHive is not used
686 if not self._ihwb:
687 return
688 # check we have a single store raise an error if it' not the case
689 if self._ihwb.getNumberOfStores() > 1:
690 raise IndexError(
691 "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"
692 )
693 # select the only store
694 self.selectStore(0)
695
696 def selectStore(self, n):
697 if not self._ihwb:
698 raise IndexError(
699 "C++ service {} does not exist".format(self.__dict__["_name"])
700 )
701 return self._ihwb.selectStore(n)
702
703 def clearStore(self):
704 if not self._idm:
705 raise IndexError(
706 "C++ service {} does not exist".format(self.__dict__["_name"])
707 )
708 return self._idm.clearStore()
709
710
711# ----iHistogramSvc class------------------------------------------------------
713 def __init__(self, name, ihs):
714 self.__dict__["_ihs"] = InterfaceCast(gbl.IHistogramSvc)(ihs)
715 iDataSvc.__init__(self, name, ihs)
716
717 def retrieve1D(self, path):
718 return Helper.histo1D(self._ihs, path)
719
720 def retrieve2D(self, path):
721 return Helper.histo2D(self._ihs, path)
722
723 def retrieve3D(self, path):
724 return Helper.histo3D(self._ihs, path)
725
726 def retrieveProfile1D(self, path):
727 return Helper.profile1D(self._ihs, path)
728
729 def retrieveProfile2D(self, path):
730 return Helper.profile2D(self._ihs, path)
731
732 def retrieve(self, path):
733 """
734 Retrieve AIDA histogram or AIDA profile histogram by path in Histogram Transient Store
735 >>> svc = ...
736 >>> histo = svc.retrieve ( 'path/to/my/histogram' )
737 """
738 h = self.retrieve1D(path)
739 if not h:
740 h = self.retrieve2D(path)
741 if not h:
742 h = self.retrieve3D(path)
743 if not h:
744 h = self.retrieveProfile1D(path)
745 if not h:
746 h = self.retrieveProfile2D(path)
747 return h
748
749 def book(self, *args):
750 """
751 Book the histograms(1D,2D&3D) , see IHistogramSvc::book
752 >>> svc = ...
753 >>> histo = svc.book( .... )
754 """
755 return self._ihs.book(*args)
756
757 def bookProf(self, *args):
758 """
759 Book the profile(1D&2D) histograms, see IHistogramSvc::bookProf
760 >>> svc = ...
761 >>> histo = svc.bookProf( .... )
762 """
763 return self._ihs.bookProf(*args)
764
765 def __getitem__(self, path):
766 """
767 Retrieve the object from Histogram Transient Store (by path)
768 The reference to AIDA histogram is returned (if possible)
769 >>> svc = ...
770 >>> histo = svc['path/to/my/histogram']
771 """
772 h = self.retrieve(path)
773 if h:
774 return h
775 return iDataSvc.__getitem__(self, path)
776
777 def getAsAIDA(self, path):
778 """
779 Retrieve the histogram from Histogram Transient Store (by path)
780 The reference to AIDA histogram is returned (if possible)
781 >>> svc = ...
782 >>> histo = svc.getAsAIDA ( 'path/to/my/histogram' )
783 """
784 return self.__getitem__(path)
785
786 def getAsROOT(self, path):
787 """
788 Retrieve the histogram from Histogram Transient Store (by path)
789 The Underlying native ROOT object is returned (if possible)
790 >>> svc = ...
791 >>> histo = svc.getAsROOT ( 'path/to/my/histogram' )
792 """
793 fun = gbl.Gaudi.Utils.Aida2ROOT.aida2root
794 return fun(self.getAsAIDA(path))
795
796
797# ----iNTupleSvc class---------------------------------------------------------
798
799
801 RowWiseTuple = 42
802 ColumnWiseTuple = 43
803
804 def __init__(self, name, ints):
805 self.__dict__["_ints"] = InterfaceCast(gbl.INTupleSvc)(ints)
806 iDataSvc.__init__(self, name, ints)
807
808 def book(self, *args):
809 return self._ints.book(*args)
810
811 def defineOutput(self, files, typ="Gaudi::RootCnvSvc"):
812 """Defines the mapping between logical names and the output file
813 Usage:
814 defineOutput({'LUN1':'MyFile1.root', 'LUN2':'Myfile2.root'}, svc='Gaudi::RootCnvSvc')
815 """
816 from . import Persistency as prs
817
818 helper = prs.get(typ)
819 helper.configure(AppMgr())
820 self.Output = [helper.formatOutput(files[lun], lun=lun) for lun in files]
821 if AppMgr().HistogramPersistency == "NONE":
822 AppMgr().HistogramPersistency = "ROOT"
823
824 def __getitem__(self, path):
825 return iDataSvc.__getitem__(self, path)
826
827
828# ----iToolSvc class-----------------------------------------------------------
830 def __init__(self, name, its):
831 self.__dict__["_its"] = InterfaceCast(gbl.IToolSvc)(its)
832 iService.__init__(self, name, its)
833
834 def _retrieve(self, name, quiet=True):
835 sol = _gaudi.OutputLevel
836 if quiet:
837 self.OutputLevel = 6
838 if name.rfind(".") == -1:
839 itool = Helper.tool(self._its, "", name, nullptr, False)
840 elif name[0:8] == "ToolSvc.":
841 itool = Helper.tool(self._its, "", name[8:], nullptr, False)
842 elif name.count(".") > 1:
843 ptool = self._retrieve(name[: name.rfind(".")])
844 itool = Helper.tool(
845 self._its, "", name[name.rfind(".") + 1 :], ptool, False
846 )
847 elif _gaudi:
848 prop = _gaudi.property(name[: name.rfind(".")])
849 itool = Helper.tool(
850 self._its, "", name[name.rfind(".") + 1 :], prop._ip, False
851 )
852 if quiet:
853 self.OutputLevel = sol
854 return itool
855
856 def retrieve(self, name):
857 return iAlgTool(name, self._retrieve(name, quiet=False))
858
859 def create(self, typ, name=None, parent=nullptr, interface=None):
860 if not name:
861 name = typ
862 itool = Helper.tool(self._its, typ, name, parent, True)
863 if interface:
864 return InterfaceCast(interface)(itool)
865 else:
866 return iAlgTool(name, itool)
867
868 def release(self, itool):
869 if isinstance(itool, iAlgTool):
870 self._its.releaseTool(itool._itool)
871
872
873# ----iEventSelector class-----------------------------------------------------
874
875
877 def __init__(self):
878 iService.__init__(
879 self,
880 "EventSelector",
881 Helper.service(gbl.Gaudi.svcLocator(), "EventSelector"),
882 )
883 self.__dict__["g"] = AppMgr()
884
885 def open(self, stream, typ="Gaudi::RootCnvSvc", **kwargs):
886 from . import Persistency as prs
887
888 helper = prs.get(typ)
889 helper.configure(self.g)
890 self.Input = helper.formatInput(stream, **kwargs)
891 self.reinitialize()
892
893 def rewind(self):
894 # It is not possible to reinitialize EventSelector only
895 self.g.service("EventLoopMgr").reinitialize()
896
897
898# ----AppMgr class-------------------------------------------------------------
899
900
902 def __new__(cls, *args, **kwargs):
903 global _gaudi
904 if not _gaudi:
905 newobj = object.__new__(cls)
906 cls.__init__(newobj, *args, **kwargs)
907 _gaudi = newobj
908 return _gaudi
909
910 def __reset__(self):
911 global _gaudi
912 # Stop, Finalize and Terminate the current AppMgr
913 self.exit()
914 # release interfaces
915 self._evtpro.release()
916 self._svcloc.release()
917 self._appmgr.release()
918 # Reset the C++ globals
919 gbl.Gaudi.setInstance(makeNullPointer("ISvcLocator"))
920 gbl.Gaudi.setInstance(makeNullPointer("IAppMgrUI"))
921 # Reset the Python global
922 _gaudi = None
923
925 self,
926 outputlevel=-1,
927 joboptions=None,
928 selfoptions={},
929 dllname=None,
930 factname=None,
931 ):
932 global _gaudi
933 if _gaudi:
934 return
935 # Make sure the python stdout buffer is flushed before c++ runs
936 sys.stdout.flush()
937 # Protection against multiple calls to exit() if the finalization fails
938 self.__dict__["_exit_called"] = False
939 # keep the Gaudi namespace around (so it is still available during atexit shutdown)...
940 self.__dict__["_gaudi_ns"] = Gaudi
941 try:
942 from GaudiKernel.Proxy.Configurable import expandvars
943 except ImportError:
944 # pass-through implementation if expandvars is not defined (AthenaCommon)
945 def expandvars(data):
946 return data
947
948 if dllname and factname:
949 self.__dict__["_appmgr"] = gbl.Gaudi.createApplicationMgr(dllname, factname)
950 elif dllname:
951 self.__dict__["_appmgr"] = gbl.Gaudi.createApplicationMgr(dllname)
952 else:
953 self.__dict__["_appmgr"] = gbl.Gaudi.createApplicationMgr()
954 self.__dict__["_svcloc"] = gbl.Gaudi.svcLocator()
955 self.__dict__["_algmgr"] = InterfaceCast(gbl.IAlgManager)(self._appmgr)
956 self.__dict__["_evtpro"] = InterfaceCast(gbl.IEventProcessor)(self._appmgr)
957 self.__dict__["_svcmgr"] = InterfaceCast(gbl.ISvcManager)(self._appmgr)
958 self.__dict__["pyalgorithms"] = []
959 iService.__init__(self, "ApplicationMgr", self._appmgr)
960 # ------python specific initialization-------------------------------------
961 if self.FSMState() < Gaudi.StateMachine.CONFIGURED: # Not yet configured
962 self.JobOptionsType = "NONE"
963 if joboptions:
964 from GaudiKernel.ProcessJobOptions import importOptions
965
966 importOptions(joboptions)
967 # Ensure that the ConfigurableUser instances have been applied
968 import GaudiKernel.Proxy.Configurable
969
970 if hasattr(GaudiKernel.Proxy.Configurable, "applyConfigurableUsers"):
971 GaudiKernel.Proxy.Configurable.applyConfigurableUsers()
972 # This is the default and could be overridden with "selfopts"
973 self.OutputLevel = 3
974 try:
975 appMgr = Configurable.allConfigurables["ApplicationMgr"]
976 selfprops = expandvars(appMgr.getValuedProperties())
977 except KeyError:
978 selfprops = {}
979 for p, v in selfprops.items():
980 setattr(self, p, v)
981 for p, v in selfoptions.items():
982 setattr(self, p, v)
983 # Override job options
984 if outputlevel != -1:
985 self.OutputLevel = outputlevel
986 self.configure()
987 # ---MessageSvc------------------------------------------------------------
988 ms = self.service("MessageSvc")
989 if "MessageSvc" in Configurable.allConfigurables:
990 msprops = Configurable.allConfigurables["MessageSvc"]
991 ms = self.service("MessageSvc")
992 if hasattr(msprops, "getValuedProperties"):
993 msprops = expandvars(msprops.getValuedProperties())
994 for p, v in msprops.items():
995 setattr(ms, p, v)
996 if outputlevel != -1:
997 ms.OutputLevel = outputlevel
998 # ------Configurables initialization (part2)-------------------------------
999 for n in getNeededConfigurables():
1000 c = Configurable.allConfigurables[n]
1001 if n in ["ApplicationMgr", "MessageSvc"]:
1002 continue # These are already done---
1003 for p, v in c.getValuedProperties().items():
1004 v = expandvars(v)
1005 # Note: AthenaCommon.Configurable does not have Configurable.PropertyReference
1006 if hasattr(Configurable, "PropertyReference") and isinstance(
1007 v, Configurable.PropertyReference
1008 ):
1009 # this is done in "getFullName", but the exception is ignored,
1010 # so we do it again to get it
1011 v = v.__resolve__()
1012 if isinstance(v, str):
1013 v = repr(v) # need double quotes
1014 gbl.GaudiPython.Helpers.setProperty(
1015 self._svcloc, ".".join([n, p]), str(v)
1016 )
1017 if hasattr(Configurable, "_configurationLocked"):
1018 Configurable._configurationLocked = True
1019
1020 # Ensure that the exit method is called when exiting from Python
1021 import atexit
1022
1023 atexit.register(self.exit)
1024
1025 # ---Hack to avoid bad interactions with the ROOT exit handler
1026 # let's install a private version of atexit.register that detects when
1027 # the ROOT exit handler is installed and adds our own after it to ensure
1028 # it is called before.
1029 orig_register = atexit.register
1030
1031 def register(func, *targs, **kargs):
1032 orig_register(func, *targs, **kargs)
1033 if hasattr(func, "__module__") and func.__module__ == "ROOT":
1034 orig_register(self.exit)
1035 # we do not need to remove out handler from the list because
1036 # it can be safely called more than once
1037
1038 register.__doc__ = (
1039 orig_register.__doc__
1040 + "\nNote: version hacked by GaudiPython to work "
1041 + "around a problem with the ROOT exit handler"
1042 )
1043 atexit.register = register
1044
1045 @property
1046 def opts(self):
1047 if "_svcloc" in self.__dict__:
1048 return self._svcloc.getOptsSvc()
1049 return None
1050
1051 def state(self):
1052 return self._isvc.FSMState()
1053
1054 def FSMState(self):
1055 return self._isvc.FSMState()
1056
1058 return self._isvc.targetFSMState()
1059
1060 def service(self, name, interface=None):
1061 svc = Helper.service(self._svcloc, name)
1062 if interface:
1063 return InterfaceCast(interface)(svc)
1064 else:
1065 return iService(name, svc)
1066
1067 def declSvcType(self, svcname, svctype):
1068 self._svcmgr.declareSvcType(svcname, svctype)
1069
1070 def createSvc(self, name):
1071 return Helper.service(self._svcloc, name, True)
1072
1073 def services(self):
1074 l = self._svcloc.getServices()
1075 return [s.name() for s in l]
1076
1077 def algorithm(self, name, createIf=False):
1078 alg = Helper.algorithm(self._algmgr, name, createIf)
1079 if not alg:
1080 return iAlgorithm(name, alg)
1081 else:
1082 return iAlgorithm(alg.name(), alg)
1083
1084 def algorithms(self):
1085 l = self._algmgr.getAlgorithms()
1086 return [a.name() for a in l]
1087
1088 def tool(self, name):
1089 return iAlgTool(name)
1090
1091 def property(self, name):
1092 if name in self.algorithms():
1093 return self.algorithm(name)
1094 elif name in self.services():
1095 return self.service(name)
1096 else:
1097 return iProperty(name)
1098
1099 def datasvc(self, name):
1100 if self.state() == Gaudi.StateMachine.CONFIGURED:
1101 self.initialize()
1102 svc = Helper.service(self._svcloc, name)
1103 return iDataSvc(name, svc)
1104
1105 def evtsvc(self):
1106 svc = self.datasvc("EventDataSvc")
1107 svc.selectOnlyStore() # in case of GaudiHive, check there is a single store and selects it
1108 return svc
1109
1110 def detsvc(self):
1111 return self.datasvc("DetectorDataSvc")
1112
1113 def filerecordsvc(self):
1114 return self.datasvc("FileRecordDataSvc")
1115
1116 def evtsel(self):
1117 if self.state() == Gaudi.StateMachine.CONFIGURED:
1118 self.initialize()
1119 if not hasattr(self, "_evtsel"):
1120 self.__dict__["_evtsel"] = iEventSelector()
1121 return self._evtsel
1122
1123 def histsvc(self, name="HistogramDataSvc"):
1124 svc = Helper.service(self._svcloc, name)
1125 return iHistogramSvc(name, svc)
1126
1127 def ntuplesvc(self, name="NTupleSvc"):
1128 if name not in self.ExtSvc:
1129 self.ExtSvc += [name]
1130 # if self.HistogramPersistency == 'NONE' : self.HistogramPersistency = 'ROOT'
1131 svc = Helper.service(self._svcloc, name, True)
1132 return iNTupleSvc(name, svc)
1133
1134 def partsvc(self):
1135 if self.FSMState() == Gaudi.StateMachine.CONFIGURED:
1136 self.initialize()
1137 svc = Helper.service(self._svcloc, "ParticlePropertySvc")
1138 return InterfaceCast(gbl.IParticlePropertySvc)(svc)
1139
1140 def toolsvc(self, name="ToolSvc"):
1141 svc = Helper.service(self._svcloc, name, True)
1142 return iToolSvc(name, svc)
1143
1144 def addAlgorithm(self, alg):
1145 """Add an Algorithm to the list of Top algorithms. It can be either a instance of
1146 an Algorithm class or it name"""
1147 if isinstance(alg, str):
1148 self.topAlg += [alg]
1149 else:
1150 self.pyalgorithms.append(alg)
1151 setOwnership(alg, 0)
1152 if self.targetFSMState() >= Gaudi.StateMachine.INITIALIZED:
1153 alg.sysInitialize()
1154 if self.targetFSMState() == Gaudi.StateMachine.RUNNING:
1155 alg.sysStart()
1156 self.topAlg += [alg.name()]
1157
1158 def setAlgorithms(self, algs):
1159 """Set the list of Top Algorithms.
1160 It can be an individual of a list of algorithms names or instances"""
1161 if not isinstance(algs, list):
1162 algs = [algs]
1163 names = []
1164 for alg in algs:
1165 if isinstance(alg, str):
1166 names.append(alg)
1167 else:
1168 self.pyalgorithms.append(alg)
1169 if self.targetFSMState() >= Gaudi.StateMachine.INITIALIZED:
1170 alg.sysInitialize()
1171 if self.targetFSMState() == Gaudi.StateMachine.RUNNING:
1172 alg.sysStart()
1173 names.append(alg.name())
1174 self.topAlg = names
1175
1176 def removeAlgorithm(self, alg):
1177 """Remove an Algorithm to the list of Top algorithms. It can be either a instance of
1178 an Algorithm class or it name"""
1179 tmp = self.topAlg
1180 if isinstance(alg, str):
1181 tmp.remove(alg)
1182 else:
1183 tmp.remove(alg.name())
1184 self.pyalgorithms.remove(alg)
1185 setOwnership(alg, 1)
1186 self.topAlg = tmp
1187
1189 """
1190 Print the sequence of Algorithms.
1191 """
1192
1193 def printAlgo(algName, appMgr, prefix=" "):
1194 print(prefix + algName)
1195 alg = appMgr.algorithm(algName.split("/")[-1])
1196 prop = alg.properties()
1197 if "Members" in prop:
1198 subs = prop["Members"].value()
1199 for i in subs:
1200 printAlgo(i.strip('"'), appMgr, prefix + " ")
1201
1202 mp = self.properties()
1203 prefix = "ApplicationMgr SUCCESS "
1204 print(
1205 prefix
1206 + "****************************** Algorithm Sequence ****************************"
1207 )
1208 for i in mp["TopAlg"].value():
1209 printAlgo(i, self, prefix)
1210 print(
1211 prefix
1212 + "******************************************************************************"
1213 )
1214
1215 def configure(self):
1216 return self._appmgr.configure()
1217
1218 def start(self):
1219 return self._appmgr.start()
1220
1221 def terminate(self):
1222 return self._appmgr.terminate()
1223
1224 def run(self, n):
1225 if self.FSMState() == Gaudi.StateMachine.CONFIGURED:
1226 sc = self.initialize()
1227 if sc.isFailure() or self.ReturnCode != 0:
1228 return sc
1229 if self.FSMState() == Gaudi.StateMachine.INITIALIZED:
1230 sc = self.start()
1231 if sc.isFailure() or self.ReturnCode != 0:
1232 return sc
1233 return self._evtpro.executeRun(n)
1234
1235 def executeEvent(self):
1236 return self._evtpro.executeEvent()
1237
1238 def execute(self):
1239 return self._evtpro.executeEvent()
1240
1241 def runSelectedEvents(self, pfn, events):
1242 if self.FSMState() == Gaudi.StateMachine.CONFIGURED:
1243 sc = self.initialize()
1244 if sc.isFailure():
1245 return sc
1246 if self.FSMState() == Gaudi.StateMachine.INITIALIZED:
1247 sc = self.start()
1248 if sc.isFailure():
1249 return sc
1250 # --- Access a number of services ----
1251 if not hasattr(self, "_perssvc"):
1252 self.__dict__["_perssvc"] = self.service(
1253 "EventPersistencySvc", "IAddressCreator"
1254 )
1255 if not hasattr(self, "_filecat"):
1256 self.__dict__["_filecat"] = self.service(
1257 "FileCatalog", "Gaudi::IFileCatalog"
1258 )
1259 if not hasattr(self, "_evtmgr"):
1260 self.__dict__["_evtmgr"] = self.service("EventDataSvc", "IDataManagerSvc")
1261 # --- Get FID from PFN and number of events in file
1262 if pfn.find("PFN:") == 0:
1263 pfn = pfn[4:]
1264 fid, maxevt = _getFIDandEvents(pfn)
1265 # --- Add FID into catalog if needed ---
1266 if not self._filecat.existsFID(fid):
1267 self._filecat.registerPFN(fid, pfn, "")
1268 # --- Loop over events
1269 if not isinstance(events, list):
1270 events = (events,)
1271 for evt in events:
1272 # --- Create IOpaqueAddress Address from Generic Address
1273 gadd = gbl.GenericAddress(0x02, 1, fid, "/Event", 0, evt)
1274 oadd = makeNullPointer("IOpaqueAddress")
1275 self._perssvc.createAddress(
1276 gadd.svcType(), gadd.clID(), gadd.par(), gadd.ipar(), oadd
1277 )
1278 # --- Clear TES, set root and run all algorithms
1279 self._evtmgr.clearStore()
1280 self._evtmgr.setRoot("/Event", oadd)
1281 self._evtpro.executeEvent()
1282
1283 def exit(self):
1284 # Protection against multiple calls to exit() if the finalization fails
1285 if not self._exit_called:
1286 self.__dict__["_exit_called"] = True
1287 Gaudi = self._gaudi_ns
1288 if self.FSMState() == Gaudi.StateMachine.RUNNING:
1289 self._appmgr.stop().ignore()
1290 if self.FSMState() == Gaudi.StateMachine.INITIALIZED:
1291 self._appmgr.finalize().ignore()
1292 if self.FSMState() == Gaudi.StateMachine.CONFIGURED:
1293 self._appmgr.terminate()
1294 return SUCCESS
1295
1296 # Custom destructor to ensure that the application is correctly finalized when exiting from python.
1297
1298 def __del__(self):
1299 self.exit()
1300
1301 evtSvc = evtsvc
1302 histSvc = histsvc
1303 ntupleSvc = ntuplesvc
1304 evtSel = evtsel
1305 detSvc = detsvc
1306 toolSvc = toolsvc
1307 partSvc = partsvc
1308
1309
1310# -----------------------------------------------------------------------------
1311
1312
1314 tfile = gbl.TFile.Open(pfn)
1315 if not tfile:
1316 raise OSError(f"Cannot open ROOT file {pfn}")
1317 tree = tfile.Get("##Params")
1318 tree.GetEvent(0)
1319 text = tree.db_string
1320 if "NAME=FID" in text:
1321 fid = text[text.rfind("VALUE=") + 6 : -1]
1322 nevt = tfile.Get("_Event").GetEntries()
1323 tfile.Close()
1324 return fid, nevt
1325
1326
1327# -----------------------------------------------------------------------------
1328
1329
1331 """Get all the properties of a component as a Python dictionary.
1332 The component is instantiated using the component library
1333 """
1334 properties = {}
1335 if name == "GaudiCoreSvc":
1336 if Helper.loadDynamicLib(name) != 1:
1337 raise ImportError("Error loading component library " + name)
1338 factorylist = gbl.FactoryTable.instance().getEntries()
1339 factories = _copyFactoriesFromList(factorylist)
1340 _ = AppMgr(outputlevel=7)
1341 else:
1342 _ = AppMgr(outputlevel=7)
1343 if Helper.loadDynamicLib(name) != 1:
1344 raise ImportError("Error loading component library " + name)
1345 factorylist = gbl.FactoryTable.instance().getEntries()
1346 factories = _copyFactoriesFromList(factorylist)
1347 svcloc = gbl.Gaudi.svcLocator()
1348 dummysvc = gbl.Service("DummySvc", svcloc)
1349 for factory in factories:
1350 if InterfaceCast(gbl.IAlgFactory)(factory):
1351 ctype = "Algorithm"
1352 elif InterfaceCast(gbl.ISvcFactory)(factory):
1353 ctype = "Service"
1354 elif InterfaceCast(gbl.IToolFactory)(factory):
1355 ctype = "AlgTool"
1356 elif factory.ident() == "ApplicationMgr":
1357 ctype = "ApplicationMgr"
1358 else:
1359 ctype = "Unknown"
1360 cname = factory.ident().split()[-1]
1361 if ctype in ("Algorithm", "Service", "AlgTool", "ApplicationMgr"):
1362 try:
1363 if ctype == "AlgTool":
1364 obj = factory.instantiate(dummysvc)
1365 else:
1366 obj = factory.instantiate(svcloc)
1367 except RuntimeError as text:
1368 print("Error instantiating", cname, " from ", name)
1369 print(text)
1370 continue
1371 prop = iProperty("dummy", obj)
1372 properties[cname] = [ctype, prop.properties()]
1373 try:
1374 obj.release()
1375 except Exception:
1376 pass
1377 return properties
1378
1379
1381 result = []
1382 for i in range(factories.size()):
1383 factory = factories.front()
1384 result.append(factory)
1385 factories.pop_front()
1386 for factory in result:
1387 factories.push_back(factory)
1388 return result
1389
1390
1391# ----CallbackStreamBuf--------------------------------------------------------
1392# Used for redirecting C++ messages to python
1393_CallbackStreamBufBase = gbl.GaudiPython.CallbackStreamBuf
1394
1395
1396class CallbackStreamBuf(_CallbackStreamBufBase):
1397 def __init__(self, callback):
1398 _CallbackStreamBufBase.__init__(self, self)
1399 self.callback = callback
1400
1401 def _sync(self, string=None):
1402 if not string:
1403 return 0
1404 self.callback(string)
1405 return 0
1406
1407
1408# ----PyAlgorithm--------------------------------------------------------------
1409# Used to implement Algorithms in Python
1410_PyAlgorithm = gbl.GaudiPython.PyAlgorithm
1411
1412
1413class PyAlgorithm(_PyAlgorithm):
1414 def __init__(self, name=None):
1415 if not name:
1416 name = self.__class__.__name__
1417 _PyAlgorithm.__init__(self, self, name)
1418 self._svcloc = gbl.Gaudi.svcLocator()
1419 self._algmgr = InterfaceCast(gbl.IAlgManager)(self._svcloc)
1420 sc = self._algmgr.addAlgorithm(self)
1421 if sc.isFailure():
1422 raise RuntimeError("Unable to add Algorithm")
1423
1424 def __del__(self):
1425 sc = self._algmgr.removeAlgorithm(self)
1426 if sc.isFailure():
1427 pass
1428
1429 def initialize(self):
1430 return 1
1431
1432 def start(self):
1433 return 1
1434
1435 def execute(self):
1436 return 1
1437
1438 def stop(self):
1439 return 1
1440
1441 def finalize(self):
1442 return 1
1443
1444
1445# ----Enable tab completion----------------------------------------------------
1446try:
1447 import readline
1448 import rlcompleter # noqa: F401
1449
1450 readline.parse_and_bind("tab: complete")
1451except Exception:
1452 pass
GAUDI_API std::string format(const char *,...)
MsgStream format utility "a la sprintf(...)".
Definition MsgStream.cpp:93
histsvc(self, name="HistogramDataSvc")
Definition Bindings.py:1123
__new__(cls, *args, **kwargs)
Definition Bindings.py:902
runSelectedEvents(self, pfn, events)
Definition Bindings.py:1241
algorithm(self, name, createIf=False)
Definition Bindings.py:1077
__init__(self, outputlevel=-1, joboptions=None, selfoptions={}, dllname=None, factname=None)
Definition Bindings.py:931
declSvcType(self, svcname, svctype)
Definition Bindings.py:1067
service(self, name, interface=None)
Definition Bindings.py:1060
ntuplesvc(self, name="NTupleSvc")
Definition Bindings.py:1127
toolsvc(self, name="ToolSvc")
Definition Bindings.py:1140
Definition Bindings.py:234
_property
Definition Bindings.py:259
value(self)
Definition Bindings.py:261
_value
Definition Bindings.py:242
documentation(self)
Definition Bindings.py:271
hasDoc(self)
Definition Bindings.py:274
_type
Definition Bindings.py:238
property(self)
Definition Bindings.py:267
__init__(self, prop)
Definition Bindings.py:237
str __doc__
Definition Bindings.py:239
ptype(self)
Definition Bindings.py:264
__init__(self, name, itool=cppyy.nullptr)
Definition Bindings.py:486
__init__(self, name, ialg=cppyy.nullptr)
Definition Bindings.py:426
leaves(self, node=cppyy.nullptr)
Definition Bindings.py:618
registerObject(self, path, obj)
Definition Bindings.py:527
__init__(self, name, idp)
Definition Bindings.py:517
getObject(self, path, *args)
Definition Bindings.py:568
getList(self, node=cppyy.nullptr, lst=[], rootFID=None)
Definition Bindings.py:639
setRoot(self, name, obj)
Definition Bindings.py:677
dump(self, node=cppyy.nullptr)
Definition Bindings.py:627
getHistoNames(self, node=cppyy.nullptr, lst=[])
Definition Bindings.py:658
open(self, stream, typ="Gaudi::RootCnvSvc", **kwargs)
Definition Bindings.py:885
defineOutput(self, files, typ="Gaudi::RootCnvSvc")
Definition Bindings.py:811
__init__(self, name, ints)
Definition Bindings.py:804
__setattr__(self, name, value)
Definition Bindings.py:302
__call_interface_method__(self, ifname, method, *args)
Definition Bindings.py:297
__init__(self, name, ip=cppyy.nullptr)
Definition Bindings.py:284
__init__(self, name, isvc=cppyy.nullptr)
Definition Bindings.py:386
_retrieve(self, name, quiet=True)
Definition Bindings.py:834
create(self, typ, name=None, parent=nullptr, interface=None)
Definition Bindings.py:859
__init__(self, name, its)
Definition Bindings.py:830
_copyFactoriesFromList(factories)
Definition Bindings.py:1380
getClass(name, libs=[])
Definition Bindings.py:203
executeEvent
Helpers for re-entrant interfaces.