Loading [MathJax]/extensions/tex2jax.js
The Gaudi Framework  v36r16 (ea80daf8)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
GaudiAlgs.py
Go to the documentation of this file.
1 #!/usr/bin/env python3
2 
28 """
29 *******************************************************************************
30 * * 'Physisics do not like it, *
31 * * physisics do not need it, *
32 * * physisics do not use it' *
33 * * ****************************
34 * *
35 * Helper module, which effectively 'imports' few useful C++ algorithmic *
36 * base classes into Python *
37 * *
38 *******************************************************************************
39 * The major imported classes are : *
40 * *
41 * (1) GaudiAlgo - analogue for GaudiAlgorithm C++ class from GaudiAlg package *
42 * (2) HistoAlgo - analogue for GaudiHistoAlg C++ class from GaudiAlg package *
43 * (3) TupleAlgo - analogue for GaudiTupleAlg C++ class from GaudiAlg package *
44 *******************************************************************************
45 """
46 from __future__ import print_function
47 
48 # =============================================================================
49 __author__ = "Vanya BELYAEV Ivan.Belyaev@lapp.in2p3.fr"
50 # =============================================================================
51 # list of "public" symbols
52 # =============================================================================
53 __all__ = (
54  "GaudiAlgo", # base class for algorithms
55  "HistoAlgo", # base class for histo-related algorithms
56  "TupleAlgo", # base class for tuple-related algorithms
57  "Tuple", # N-Tuple
58  "HistoID", # ID for N-tuples
59  "TupleID", # ID for Histograms
60  "aida2root", # AIDA -> ROOT converter
61  "SUCCESS", # status code
62 )
63 # =============================================================================
64 # import core of Gaudi
65 import GaudiPython.Bindings # The basic module
66 
67 iAlgorithm = GaudiPython.Bindings.iAlgorithm # Algorithm interface
68 iAlgTool = GaudiPython.Bindings.iAlgTool # Tool interface
69 
70 from GaudiPython.Bindings import SUCCESS # status code
71 from GaudiPython.Bindings import AppMgr # Application Manager
72 from GaudiPython.Bindings import InterfaceCast # "queryInterface"
73 from GaudiPython.Bindings import iDataSvc # Data Service
74 from GaudiPython.Bindings import iHistogramSvc # Histogram Service
75 from GaudiPython.Bindings import iNTupleSvc # N-Tuple service
76 from GaudiPython.Bindings import gbl as cpp # global C++ namepspace
77 from GaudiPython.HistoUtils import aida2root # AIDA -> ROTO converter
78 
79 from GaudiKernel import ROOT6WorkAroundEnabled
80 
81 # =============================================================================
82 # std C++ namespace
83 std = cpp.std # std C++ namespace
84 
85 # "typedef" for GaudiPython::Vector
86 Vector = std.vector("double")
87 # "typedef" for GaudiPython::Matrix
88 Matrix = std.vector("std::vector<double>")
89 
90 # histogram and N-Tuple universal identifier
91 HID = cpp.GaudiAlg.ID
92 HistoID = HID
93 TID = HID
94 TupleID = TID
95 
96 # get the decorator:
97 AlgDecorator = cpp.GaudiPython.AlgDecorator
98 HistoDecorator = cpp.GaudiPython.HistoDecorator
99 TupleAlgDecorator = cpp.GaudiPython.TupleAlgDecorator
100 TupleDecorator = cpp.GaudiPython.TupleDecorator
101 
102 # =============================================================================
103 # Useful method to locate the tool a certain
104 #
105 # Usage:
106 #
107 # @code
108 #
109 # # locate public tool
110 # t1 = self.tool(ITrExtrapolator,'TrParabolicExtrapolator')
111 # # locate private tool
112 # t2 = self.tool(ITrExtrapolator,'TrParabolicExtrapolator',parent=self)
113 # # locate public tool with defined name
114 # t3 = self.tool(ITrExtrapolator,'TrParabolicExtrapolator/MyExt1')
115 # # locate private tool with defined name
116 # t4 = self.tool(ITrExtrapolator,'TrParabolicExtrapolator/MyExt2',parent=self)
117 # # locate public tool with defined name
118 # t5 = self.tool(ITrExtrapolator,'TrParabolicExtrapolator','MyExt3')
119 # # locate private tool with defined name
120 # t6 = self.tool(ITrExtrapolator,'TrParabolicExtrapolator','MyExt4',parent=self)
121 #
122 # @endcode
123 #
124 # @author Vanya BELYAEV ibelyaev@physics.syr.edu
125 # @date 2006-11-26
126 
127 
128 def _tool_(self, interface, typename, name=None, parent=None, create=True):
129  """
130  Useful method to locate the tool a certain
131 
132  Usage:
133 
134  # locate public tool
135  t1 = self.tool(ITrExtrapolator,'TrParabolicExtrapolator')
136  # locate private tool
137  t2 = self.tool(ITrExtrapolator,'TrParabolicExtrapolator',parent=self)
138  # locate public tool with defined name
139  t3 = self.tool(ITrExtrapolator,'TrParabolicExtrapolator/MyExt1')
140  # locate private tool with defined name
141  t4 = self.tool(ITrExtrapolator,'TrParabolicExtrapolator/MyExt2',parent=self)
142  # locate public tool with defined name
143  t5 = self.tool(ITrExtrapolator,'TrParabolicExtrapolator','MyExt3')
144  # locate private tool with defined name
145  t6 = self.tool(ITrExtrapolator,'TrParabolicExtrapolator','MyExt4',parent=self)
146 
147  """
148  if not interface:
149  interface = cpp.IAlgTool
150  if not parent:
151  parent = self
152  if name:
153  typename += "/" + name
154  _tool = AlgDecorator.tool_(self, typename, parent, create)
155  if not _tool:
156  return None
157  _tool = InterfaceCast(interface)(_tool)
158  if not _tool:
159  self.Warning("Invalid cast to interface %s" % interface)
160  return None
161  return _tool
162 
163 
164 # =============================================================================
165 # Useful method to locate a service:
166 #
167 # Usage:
168 #
169 # @code
170 #
171 # ntsvc = self.svc( INTupleSvc , 'NTUpleSvc' )
172 #
173 # @endcode
174 #
175 # @author Vanya BELYAEV ibelyaev@physics.syr.edu
176 # @date 2006-11-26
177 
178 
179 def _service_(self, interface, name, create=True):
180  """
181  Useful method to locate a service:
182 
183  Usage:
184 
185  ntsvc = self.svc( INTupleSvc , 'NTUpleSvc' )
186 
187  """
188  if not interface:
189  interface = cpp.IInterface
190  _svc = AlgDecorator.svc_(self, name, create)
191  if not _svc:
192  return None
193  _svc = InterfaceCast(interface)(_svc)
194  if not _svc:
195  self.Warning("Invalid cast to interface %s" % interface)
196  return None
197  return _svc
198 
199 
200 # =============================================================================
201 # The constructor from unique algorithm instance name,
202 #
203 # @author Vanya BELYAEV ibelyaev@physics.syr.edu
204 # @date 2006-11-26
205 
206 
207 def _init_(self, name, **args):
208  """
209  The constructor from unique algorithm instance name & parameters
210  """
211  self._Base.__init__(self, self, name)
212  appMgr = AppMgr()
213  algMgr = appMgr._algmgr
214  status = algMgr.addAlgorithm(self)
215  if status.isFailure():
216  raise RuntimeError('Unable to add Algorithm "' + name + '"')
217  self._ialg = iAlgorithm(name, self)
218  for key in args:
219  setattr(self, key, args[key])
220  # take some care about the ownership of the algorithms
221  if "GaudiPythonAlgos" not in appMgr.__dict__:
222  appMgr.__dict__["GaudiPythonAlgos"] = []
223  appMgr.__dict__["GaudiPythonAlgos"].append(self)
224 
225 
226 # =============================================================================
227 # The default initialization (initialization of base C++ class + data
228 #
229 # @author Vanya BELYAEV ibelyaev@physics.syr.edu
230 # @date 2006-11-26
231 
232 
233 def _initialize_(self):
234  """
235  The default initialization (initialization of base C++ class + data)
236  """
237  status = self._Base.initialize_(self)
238  if status.isFailure():
239  return status
240 
241  # set the basic services
242  _e = self._Base.evtSvc(self)
243  _s = InterfaceCast(cpp.IService)(_e)
244  self._evtSvc_ = iDataSvc(_s.name(), _e)
245 
246  _d = self._Base.detSvc(self)
247  _s = InterfaceCast(cpp.IService)(_d)
248  self._detSvc_ = iDataSvc(_s.name(), _d)
249 
250  return status
251 
252 
253 # =============================================================================
254 # The default initialization (initialization of base C++ class + data members)
255 #
256 # @author Vanya BELYAEV ibelyaev@physics.syr.edu
257 # @date 2006-11-26
258 
259 
261  """
262  The default initialization (initialization of base C++ class + data members)
263  """
264  status = _initialize_(self)
265  if status.isFailure():
266  return status
267 
268  # set the basic services
269  _h = self._Base.histoSvc(self)
270  _s = InterfaceCast(cpp.IService)(_h)
271  self._histoSvc_ = iHistogramSvc(_s.name(), _h)
272 
273  return status
274 
275 
276 # =============================================================================
277 # The default initialization (initialization of base C++ class + data members)
278 #
279 # @author Vanya BELYAEV ibelyaev@physics.syr.edu
280 # @date 2006-11-26
281 
282 
284  """
285  The default initialization (initialization of base C++ class + data members)
286  """
287  status = _initialize_histo_(self)
288  if status.isFailure():
289  return status
290 
291  # set the basic services
292  if self.produceNTuples():
293  _n = self._Base.ntupleSvc(self)
294  _s = InterfaceCast(cpp.IService)(_n)
295  self._ntupleSvc_ = iNTupleSvc(_s.name(), _n)
296 
297  if self.produceEvtCols():
298  _n = self._Base.evtColSvc(self)
299  _s = InterfaceCast(cpp.IService)(_n)
300  self._evtcolSvc_ = iNTupleSvc(_s.name(), _n)
301 
302  return status
303 
304 
305 # =============================================================================
306 # Trivial helper function to access Event Data and Event Data Service
307 #
308 # Usage:
309 #
310 # @code
311 #
312 # # get event data service
313 # svc = self.evtSvc()
314 #
315 # # get the data
316 # hits = self.evtSvc('MC/Calo/Hits')
317 #
318 # @endcode
319 #
320 # @author Vanya BELYAEV ibelyaev@physics.syr.edu
321 # @date 2006-11-26
322 
323 
324 def _evtSvc(self, location=None):
325  """
326  Trivial helper function to access Event Data and Event Data Service
327 
328  Usage:
329 
330  # get event data service
331  svc = self.evtSvc()
332 
333  # get the data
334  hits = self.evtSvc('MC/Calo/Hits')
335  """
336  if not location:
337  return self._evtSvc_
338  return self._evtSvc_[location]
339 
340 
341 # =============================================================================
342 # Trivial helper function to access Detector Data and Detector Data Service
343 #
344 # Usage:
345 #
346 # @code
347 #
348 # # get detector data service
349 # svc = self.detSvc()
350 #
351 # # get the data
352 # lhcb = self.detSvc('/dd/Structure/LHCb')
353 #
354 # @endcode
355 #
356 # @author Vanya BELYAEV ibelyaev@physics.syr.edu
357 # @date 2006-11-26
358 
359 
360 def _detSvc(self, location=None):
361  """
362  Trivial helper function to access Detector Data and Event Data Service
363 
364  Usage:
365  # get detector data service
366  svc = self.detSvc()
367 
368  # get the data
369  lhcb = self.detSvc('/dd/Structure/LHCb')
370  """
371  if location is None:
372  return self._detSvc_
373  return self._detSvc_[location]
374 
375 
376 # =============================================================================
377 # Trivial helper function to access Histogram Data and Histogram Data Service
378 #
379 # Usage:
380 #
381 # @code
382 #
383 # # get histogram data service
384 # svc = self.histoSvc()
385 #
386 # # get the data
387 # histo = self.histoSvc('/stat/Calo/1')
388 #
389 # @endcode
390 #
391 # @author Vanya BELYAEV ibelyaev@physics.syr.edu
392 # @date 2006-11-26
393 
394 
395 def _histoSvc(self, address=None):
396  """
397  Trivial helper function to access Histogram Data and Histogram Data Service
398 
399  Usage:
400 
401  # get histogram data service
402  svc = self.histoSvc()
403 
404  # get the data
405  histo = self.histoSvc('/stat/Calo/1')
406  """
407  if not address:
408  return self._histoSvc_
409  return self._histoSvc_[address]
410 
411 
412 # =============================================================================
413 # Trivial function to access the data in TES
414 
415 
416 def _get(self, location):
417  """
418  Trivial function to access the data in TES using the data service
419  """
420  return self._evtSvc_[location]
421 
422 
423 # =============================================================================
424 # Trivial function to access the data in TDS
425 
426 
427 def _getDet(self, location):
428  """
429  Trivial function to access the data in TDS using data service
430  """
431  return self._detSvc_[location]
432 
433 
434 # =============================================================================
435 # get the data from TES using GaudiCommon methods, respecting RootInTES
436 
437 
438 def _get_(self, location, rootInTES=True):
439  """
440  Get the object from Transient Event Store using GaudiCommon machinery,
441  respecting RootInTES behaviour
442  """
443  return AlgDecorator.get_(self, location, rootInTES)
444 
445 
446 # =============================================================================
447 # check the data from TES using GaudiCommon methods, respecting RootInTES
448 
449 
450 def _exist_(self, location, rootInTES=True):
451  """
452  Check the object in Transient Event Store using GaudiCommon machinery,
453  respecting RootInTES behaviour
454  """
455  return AlgDecorator.exist_(self, location, rootInTES)
456 
457 
458 # =============================================================================
459 # Trivial helper function to access NTuple Service
460 
461 
462 def _ntupleSvc(self):
463  """
464  Trivial function to access N-Tuple Service
465  """
466  return self._ntupleSvc_
467 
468 
469 # =============================================================================
470 # Trivial helper function to access Event Collection Service
471 
472 
473 def _evtcolSvc(self):
474  """
475  Trivial function to access Event Collection Service
476  """
477  return self._evtcolSvc_
478 
479 
480 # =============================================================================
481 # The default finalization (finalization of base C++ class)
482 def _finalize_(self):
483  """
484  The default finalization : finalize the base C++ class
485  """
486  status = self._Base.finalize_(self)
487  return status
488 
489 
490 # =============================================================================
491 # Dummy method returning success
492 
493 
494 def _success_(self):
495  return SUCCESS
496 
497 
498 # =============================================================================
499 # check the existence of the property with the given name
500 def _hasProperty_(self, pname):
501  """
502  The trivial function which checks the existence of the property with given name
503  """
504  return cpp.Gaudi.Utils.hasProperty(self, pname)
505 
506 
507 # =============================================================================
508 # get the value of the given property
509 
510 
511 def _getProperty_(self, pname):
512  """
513  Get the property by name
514  """
515  if not self.hasProperty(pname):
516  raise AttributeError("property %s does not exist" % pname)
517  return self._ialg.__getattr__(pname)
518 
519 
520 # =============================================================================
521 # set the value for the given property
522 
523 
524 def _setProperty_(self, pname, pvalue):
525  """
526  Set the property from the value
527  """
528  if not self.hasProperty(pname):
529  raise AttributeError("property %s does not exist" % pname)
530  return self._ialg.__setattr__(pname, pvalue)
531 
532 
533 # =============================================================================
534 # get the attribute or property
535 
536 
537 def _get_attr_(self, pname):
538  """
539  Get the attribute (or property)
540  - if the attribute name corresponds to the property name, property value is returned
541  """
542  if self.hasProperty(pname):
543  return self._ialg.__getattr__(pname)
544  else:
545  # Since self does not inherit from iAlgorithm (see !1116, 4f05f03678),
546  # delegate attribute lookup to self._ialg.
547  try:
548  return getattr(self._ialg, pname)
549  except AttributeError:
550  pass
551  raise AttributeError("attribute/property %s does not exist" % pname)
552 
553 
554 # =============================================================================
555 # set the attribute or property
556 
557 
558 def _set_attr_(self, pname, pvalue):
559  """
560  Set the attribute (or property) :
561  - if the attribute name corresponds to the property name, the property is updated
562  """
563  if not self.hasProperty(pname):
564  self.__dict__[pname] = pvalue
565  else:
566  self._ialg.__setattr__(pname, pvalue)
567 
568 
569 _GaudiAlgorithm = cpp.GaudiPython.PyAlg("GaudiAlgorithm")
570 _GaudiHistoAlg = cpp.GaudiPython.PyAlg("GaudiHistoAlg")
571 _GaudiTupleAlg = cpp.GaudiPython.PyAlg("GaudiTupleAlg")
572 
573 # =============================================================================
574 # @class GaudiAlgo
575 # the base class for all algorithm
576 # Python-image of C++ clkass GaudiAlgorithm
577 #
578 # Usage:
579 #
580 # @code
581 #
582 # from GauidPython.GaudiAlgs import GaudiAlgo, SUCCESS
583 #
584 # class MyClass(GaudiAlgo) :
585 # """
586 # My specific Algorithm, derived from GaudiAlgo base class
587 # """
588 # def __init__( self , name , **args ) :
589 # """
590 # Constructor from algorithm instance name & parameters'
591 # """
592 # #invoke the constructor of base class
593 # GaudiAlgo.__init__(self , name , **args )
594 #
595 # def initialize ( self ) :
596 # 'Algorithm initialization'
597 # # initialize the base class
598 # status = GaudiAlgo.initialize( self )
599 # if status.isFailure() : return status
600 #
601 # # locate the services and tools
602 #
603 # # locate some tool:
604 # extrapolator = self.tool(ITrExtrapolator,'TrExtrapolator')
605 #
606 # # locate the service
607 # rndmSvc = self.svc(IRndmGenSvc, 'RndmGenSvc')
608 #
609 # return SUCCESS
610 #
611 #
612 # def execute ( self ) :
613 # 'Major method (from IAlgorithm interface)'
614 #
615 # # get some data from Transient Event Store
616 # tracks = self.get('/Event/Rec/Tracks')
617 #
618 # # use counters
619 # c1 = self.counter('#Tracks')
620 # c2 = self.counter('No Tracks')
621 # if tracks.empty :
622 # c2+=1
623 # c1 += tracks->size()
624 #
625 # if 1000 < tracks.size() :
626 # return self.Error('The event is *VERY* busy')
627 #
628 # return SUCCESS
629 #
630 # @endcode
631 #
632 # @see GaudiAlgorithm
633 #
634 # @author Vanya BELYAEV ibelyaev@physics.syr.edu
635 # @date 2006-11-26
636 
637 
639  """
640  *******************************************************************************
641  * * 'Physisics do not like it, *
642  * * physisics do not need it, *
643  * * physisics do not use it' *
644  * * ****************************
645  * Usage: *
646  * *
647  * from GaudiPython.GaudiAlgs import GaudiAlgo, SUCCESS *
648  * *
649  * class MyClass(GaudiAlgo) : *
650  * ' My specific Algorithm, derived from GaudiAlgo base class ' *
651  * def __init__( self , name , **args ) : *
652  * 'Constructor from algorithm instance name & parameters' *
653  * #invoke the constructor of base class *
654  * GaudiAlgo.__init__(self , name , **args ) *
655  * *
656  * def initialize ( self ) : *
657  * 'Algorithm initialization' *
658  * # initialize the base class *
659  * status = GaudiAlgo.initialize( self ) *
660  * if status.isFailure() : return status *
661  * *
662  * # locate the services and tools *
663  * *
664  * # locate some tool: *
665  * extrapolator = self.tool(ITrExtrapolator,'TrExtrapolator') *
666  * *
667  * # locate the service *
668  * rndmSvc = self.svc(IRndmGenSvc, 'RndmGenSvc') *
669  * *
670  * return SUCCESS *
671  * *
672  * *
673  * def execute ( self ) : *
674  * 'Major method (from IAlgorithm interface)' *
675  * *
676  * # get some data from Transient Event Store *
677  * tracks = self.get('/Event/Rec/Tracks') *
678  * *
679  * # use counters *
680  * c1 = self.counter('#Tracks') *
681  * c2 = self.counter('No Tracks') *
682  * if tracks.empty : *
683  * c2+=1 *
684  * c1 += tracks->size() *
685  * *
686  * if 1000 < tracks.size() : *
687  * return self.Error('The event is *VERY* busy') *
688  * *
689  * return SUCCESS *
690  * *
691  *******************************************************************************
692  """
693 
694  pass
695 
696 
697 # =============================================================================
698 # @class HistoAlgo
699 # The base class for easy histogramming
700 #
701 # Usage:
702 #
703 #
704 # @code
705 #
706 # from GaudiPython.GaudiAlgs import HistoAlgo, SUCCESS
707 #
708 # class MyClass(HistoAlgo) :
709 # ' My specific Algorithm, derived from GaudiAlgo base class '
710 # def __init__( self , name , **args ) :
711 # 'Constructor from algorithm instance name & parameters'
712 # #invoke the constructor of base class
713 # HistoAlgo.__init__(self , name , **args )
714 #
715 # def execute ( self ) :
716 # 'Major method (from IAlgorithm interface)'
717 #
718 # # get some data from Transient Event Store
719 # tracks = self.get('/Event/Rec/Tracks')
720 #
721 # self.plot1D ( tracks->size() , '#tracks' , 0 , 100 )
722 #
723 # return SUCCESS
724 #
725 # @endcode
726 #
727 # Alternatively the histogram could be booked in advance:
728 #
729 # @code
730 #
731 # class MyClass(HistoAlgo) :
732 # ' My specific Algorithm, derived from GaudiAlgo base class '
733 # def __init__( self , name ) :
734 # 'Constructor from algorithm instance name'
735 # #invoke the constructor of base class
736 # HistoAlgo.__init__(self , name )
737 #
738 # def initialize ( self ) :
739 # 'Algorithm initialization'
740 # # initialize the base class
741 # status = HistoAlgo.initialize( self )
742 # if status.isFailure() : return status
743 #
744 # # book the histogram
745 # self.h1 = selff.book1D ( '#tracks' , 0 , 100 )
746 #
747 # return SUCCESS
748 #
749 #
750 # def execute ( self ) :
751 # 'Major method (from IAlgorithm interface)'
752 #
753 # # get some data from Transient Event Store
754 # tracks = self.get('/Event/Rec/Tracks')
755 #
756 # # fill the histogram
757 # self.h1.fill ( tracks->size() )
758 #
759 # return SUCCESS
760 # @endcode
761 #
762 # @see GaudiHistoAlg
763 #
764 # @author Vanya BELYAEV ibelyaev@physics.syr.edu
765 # @date 2006-11-26
766 
767 
769  """
770  *******************************************************************************
771  * * 'Physisics do not like it, *
772  * * physisics do not need it, *
773  * * physisics do not use it' *
774  * * ****************************
775  * Usage: *
776  * *
777  * from GaudiPython.GaudiAlgs import HistoAlgo, SUCCESS *
778  * *
779  * class MyClass(HistoAlgo) : *
780  * ' My specific Algorithm, derived from GaudiAlgo base class ' *
781  * def __init__( self , name , **args ) : *
782  * 'Constructor from algorithm instance name' *
783  * #invoke the constructor of base class *
784  * HistoAlgo.__init__(self , name , **args ) *
785  * *
786  * def execute ( self ) : *
787  * 'Major method (from IAlgorithm interface)' *
788  * *
789  * # get some data from Transient Event Store *
790  * tracks = self.get('/Event/Rec/Tracks') *
791  * *
792  * self.plot1D ( tracks->size() , '#tracks' , 0 , 100 ) *
793  * *
794  * return SUCCESS *
795  * *
796  * Alternatively the histogram could be booked in advance: *
797  * *
798  * class MyClass(HistoAlgo) : *
799  * ' My specific Algorithm, derived from GaudiAlgo base class ' *
800  * def __init__( self , name ) : *
801  * 'Constructor from algorithm instance name' *
802  * #invoke the constructor of base class *
803  * HistoAlgo.__init__(self , name ) *
804  * *
805  * def initialize ( self ) : *
806  * 'Algorithm initialization' *
807  * # initialize the base class *
808  * status = HistoAlgo.initialize( self ) *
809  * if status.isFailure() : return status *
810  * *
811  * # book the histogram *
812  * self.h1 = selff.book1D ( '#tracks' , 0 , 100 ) *
813  * *
814  * return SUCCESS *
815  * *
816  * *
817  * def execute ( self ) : *
818  * 'Major method (from IAlgorithm interface)' *
819  * *
820  * # get some data from Transient Event Store *
821  * tracks = self.get('/Event/Rec/Tracks') *
822  * *
823  * # fill the histogram *
824  * self.h1.fill ( tracks->size() ) *
825  * *
826  * return SUCCESS *
827  * *
828  *******************************************************************************
829  """
830 
831  pass
832 
833 
834 # =============================================================================
835 # @class TupleAlgo
836 # The base class for easy manupulations with N-Tuples
837 #
838 # Usage:
839 #
840 # @code
841 #
842 # from GaudiPython.GaudiAlgs import TupleAlgo, SUCCESS
843 #
844 # class MyClass(TupleAlgo) :
845 # ' My specific Algorithm, derived from TupleAlgo base class '
846 # def __init__( self , name , **args ) :
847 # 'Constructor from algorithm instance name& parameters'
848 # #invoke the constructor of base class
849 # TupleAlgo.__init__(self , name , **args )
850 #
851 # def execute ( self ) :
852 # 'Major method (from IAlgorithm interface)'
853 #
854 # # get some data from Transient Event Store
855 # tracks = self.get('/Event/Rec/Tracks')
856 #
857 # tup = self.nTuple('My N-Tuple')
858 #
859 # for track in tracks :
860 #
861 # pt = track.pt ()
862 # p = track.p ()
863 # chi2 = track.chi2 ()
864 #
865 # #fill N-tuple:
866 # tup.column ( 'pt' , pt )
867 # tup.column ( 'p' , p )
868 # tup.column ( 'chi2' , chi2 )
869 # #commit the row
870 # tup.write ()
871 #
872 # return SUCCESS
873 #
874 # @endcode
875 #
876 # @see GaudiTupleAlg
877 #
878 # @author Vanya BELYAEV ibelyaev@physics.syr.edu
879 # @date 2006-11-26
880 
881 
883  """
884  *******************************************************************************
885  * * 'Physisics do not like it, *
886  * * physisics do not need it, *
887  * * physisics do not use it' *
888  * * ****************************
889  * Usage: *
890  * *
891  * from GaudiPython.GaudiAlgs import TupleAlgo, SUCCESS *
892  * *
893  * class MyClass(TupleAlgo) : *
894  * ' My specific Algorithm, derived from TupleAlgo base class ' *
895  * def __init__( self , name , **args ) : *
896  * 'Constructor from algorithm instance name & parameters' *
897  * #invoke the constructor of base class *
898  * TupleAlgo.__init__(self , name , **args ) *
899  * *
900  * def execute ( self ) : *
901  * 'Major method (from IAlgorithm interface)' *
902  * *
903  * # get some data from Transient Event Store *
904  * tracks = self.get('/Event/Rec/Tracks') *
905  * *
906  * tup = self.nTuple('My N-Tuple') *
907  * *
908  * for track in tracks : *
909  * *
910  * pt = track.pt () *
911  * p = track.p () *
912  * chi2 = track.chi2 () *
913  * *
914  * #fill N-tuple: *
915  * tup.column ( 'pt' , pt ) *
916  * tup.column ( 'p' , p ) *
917  * tup.column ( 'chi2' , chi2 ) *
918  * #commit the row *
919  * tup.write () *
920  * *
921  * return SUCCESS *
922  * *
923  *******************************************************************************
924  """
925 
926  pass
927 
928 
929 class objectmethod(object):
930  def __init__(self, m):
931  self.method = m
932 
933  def __call__(self, *args):
934  print(args)
935  return self.method(*args)
936 
937 
938 GaudiAlgo._Base = _GaudiAlgorithm
939 HistoAlgo._Base = _GaudiHistoAlg
940 TupleAlgo._Base = _GaudiTupleAlg
941 
942 # initialize is 'unique' method :
943 GaudiAlgo.initialize = _initialize_
944 HistoAlgo.initialize = _initialize_histo_
945 TupleAlgo.initialize = _initialize_tuple_
946 
947 
948 def _start_(self):
949  """
950  The stub 'start' method needed by the internal implementation of PyAlg<>.
951  """
952  # return self._Base.start_(self)
953  return SUCCESS
954 
955 
956 GaudiAlgo.start = _start_
957 HistoAlgo.start = _start_
958 TupleAlgo.start = _start_
959 
960 
961 def _execute_(self):
962  """
963  The fictive 'execute' method, which MUST be overwitten by user
964  """
965  raise RuntimeError("Execute method is not implemented for %s" % self.name())
966 
967 
968 GaudiAlgo.execute = _execute_
969 HistoAlgo.execute = _execute_
970 TupleAlgo.execute = _execute_
971 
972 
973 def _stop_(self):
974  """
975  The stub 'stop' method needed by the internal implementation of PyAlg<>.
976  """
977  # return self._Base.stop_(self)
978  return SUCCESS
979 
980 
981 GaudiAlgo.stop = _stop_
982 HistoAlgo.stop = _stop_
983 TupleAlgo.stop = _stop_
984 
985 # =============================================================================
986 
987 
988 def _plot1D_(s, *a):
989  """
990  The basic method to fill (book-on-demand) 1D-histogram
991 
992  The histogram will be created/booked dautomatically according to the
993  specifications:
994 
995  - literal or numerical ID (optional)
996  - title
997  - low edge
998  - high edge
999  - number of bins (default is 100)
1000 
1001  The reference to the histogram is returned and could be used for later manipulations
1002 
1003  """
1004  return HistoDecorator.plot1D(s, *a)
1005 
1006 
1007 # =============================================================================
1008 
1009 
1010 def _plot2D_(s, *a):
1011  """
1012  The basic method to fill (book-on-demand) 2D-histogram
1013 
1014  The histogram will be created/booked dautomatically according to the
1015  specifications:
1016 
1017  - literal or numerical ID (optional)
1018  - title
1019  - low X-edge
1020  - high X-edge
1021  - low Y-edge
1022  - high Y-edge
1023  - number of X-bins (default is 50)
1024  - number of Y-bins (default is 50)
1025 
1026  The reference to the histogram is returned and could be used for later manipulations
1027 
1028  """
1029  return HistoDecorator.plot2D(s, *a)
1030 
1031 
1032 # =============================================================================
1033 
1034 
1035 def _plot3D_(s, *a):
1036  """
1037  The basic method to fill (book-on-demand) 3D-histogram
1038 
1039  The histogram will be created/booked dautomatically according to the
1040  specifications:
1041 
1042  - literal or numerical ID (optional)
1043  - title
1044  - low X-edge
1045  - high X-edge
1046  - low Y-edge
1047  - high Y-edge
1048  - low Z-edge
1049  - high Z-edge
1050  - number of X-bins (default is 10)
1051  - number of Y-bins (default is 10)
1052  - number of Y-bins (default is 10)
1053 
1054  The reference to the histogram is returned and could be used for later manipulations
1055 
1056  """
1057  return HistoDecorator.plot3D(s, *a)
1058 
1059 
1060 # =============================================================================
1061 
1062 
1063 def _profile1D_(s, *a):
1064  """
1065  The basic method to fill (book-on-demand) 1D profile histogram
1066 
1067  The profile histogram will be created/booked dautomatically
1068  according to the specifications:
1069 
1070  - literal or numerical ID (optional)
1071  - title
1072  - low X-edge
1073  - high X-edge
1074  - number of X-bins (default is 100)
1075 
1076  The reference to the histogram is returned and could be used for later manipulations
1077 
1078  """
1079  return HistoDecorator.profile1D(s, *a)
1080 
1081 
1082 # =============================================================================
1083 
1084 
1085 def _profile2D_(s, *a):
1086  """
1087  The basic method to fill (book-on-demand) 2D profile histiogram
1088 
1089  The profile histogram will be created/booked automatically
1090  according to the specifications:
1091 
1092  - literal or numerical ID (optional)
1093  - title
1094  - low X-edge
1095  - high X-edge
1096  - low Y-edge
1097  - high Y-edge
1098  - number of X-bins (default is 50)
1099  - number of Y-bins (default is 50)
1100 
1101  The reference to the histogram is returned and could be used for later manipulations
1102 
1103  """
1104  return HistoDecorator.profile2D(s, *a)
1105 
1106 
1107 # =============================================================================
1108 
1109 _plot1D_.__doc__ += "\n" + HistoDecorator.plot1D.__doc__
1110 _plot2D_.__doc__ += "\n" + HistoDecorator.plot2D.__doc__
1111 _plot3D_.__doc__ += "\n" + HistoDecorator.plot3D.__doc__
1112 _profile1D_.__doc__ += "\n" + HistoDecorator.profile1D.__doc__
1113 _profile2D_.__doc__ += "\n" + HistoDecorator.profile2D.__doc__
1114 
1115 
1116 def _decorate_plots_(klasses):
1117  t = type(klasses)
1118  if not issubclass(t, list) and not issubclass(t, tuple):
1119  klasses = [klasses]
1120  for klass in klasses:
1121  klass.plot = _plot1D_
1122  klass.plot1D = _plot1D_
1123  klass.plot2D = _plot2D_
1124  klass.plot3D = _plot3D_
1125  klass.profile1D = _profile1D_
1126  klass.profile2D = _profile2D_
1127 
1128 
1129 _decorate_plots_(HistoAlgo)
1130 _decorate_plots_(TupleAlgo)
1131 
1132 
1133 # =============================================================================
1134 def _nTuple_(s, *a):
1135  """
1136  Retrieve (book-on-demand) N-Tuple object
1137  """
1138  return TupleAlgDecorator.nTuple(s, *a)
1139 
1140 
1141 # =============================================================================
1142 
1143 
1144 def _evtCol_(s, *a):
1145  """
1146  Retrieve (book-on-demand) N-Tuple object for Event Tag Collections
1147  """
1148  return TupleAlgDecorator.evtCol(s, *a)
1149 
1150 
1151 _nTuple_.__doc__ += "\n" + TupleAlgDecorator.nTuple.__doc__
1152 _evtCol_.__doc__ += "\n" + TupleAlgDecorator.evtCol.__doc__
1153 
1154 
1155 def _decorate_tuples_(klasses):
1156  t = type(klasses)
1157  if not issubclass(t, list) and not issubclass(t, tuple):
1158  klasses = [klasses]
1159  for klass in klasses:
1160  klass.nTuple = _nTuple_
1161  klass.evtCol = _evtCol_
1162  klass.ntupleSvc = _ntupleSvc
1163  klass.tupleSvc = _ntupleSvc
1164  klass.ntupSvc = _ntupleSvc
1165  klass.tupSvc = _ntupleSvc
1166  klass.evtColSvc = _evtcolSvc
1167  klass.evtcolSvc = _evtcolSvc
1168 
1169 
1170 # ==========================================================
1171 _decorate_tuples_(TupleAlgo)
1172 
1173 # "decorate N-Tuple object
1174 Tuple = cpp.Tuples.Tuple
1175 _Dec = TupleDecorator
1176 
1177 
1179  """Helper decorator class to workaround ROOT-6697"""
1180 
1181  def __init__(self, func):
1182  self.func = func
1183  self.__doc__ = func.__doc__
1184  dispatcher = func.disp if hasattr(func, "disp") else func.__overload__
1185 
1186  mapping = {int: "int", bool: "bool", float: "double"}
1187  for k in mapping:
1188  signature = (
1189  "const Tuples::Tuple& tuple, const string& name, const %s value"
1190  % (mapping[k])
1191  )
1192  mapping[k] = dispatcher(signature)
1193  self.mapping = mapping
1194 
1195  def __call__(self, *a):
1196  """
1197  Explicitly call the explicit signature for the case with 3 arguments and
1198  the last one is 'int', 'bool' or 'float', for the other cases fall back
1199  on the default dispatcher.
1200  """
1201  if len(a) == 3:
1202  t = type(a[-1])
1203  try:
1204  return self.mapping[t](*a)
1205  except KeyError:
1206  pass
1207  return self.func(*a)
1208 
1209 
1210 if ROOT6WorkAroundEnabled("ROOT-6697") and (
1211  hasattr(_Dec.column, "disp") or hasattr(_Dec.column, "__overload__")
1212 ):
1213  _Dec.column = TupleDecColumnDispatcher(_Dec.column)
1214 
1215 
1216 def _t_nTuple_(s, *a):
1217  """
1218  Access to underlying INTuple object
1219  """
1220  return _Dec.nTuple(s, *a)
1221 
1222 
1223 def _t_ntuple_(s, *a):
1224  """
1225  Access to underlying NTuple::Tuple object
1226  """
1227  return _Dec.ntuple(s, *a)
1228 
1229 
1230 def _t_valid_(s, *a):
1231  """
1232  Valid NTuple::Tuple object?
1233  """
1234  return _Dec.valid(s, *a)
1235 
1236 
1237 def _t_write_(s, *a):
1238  """
1239  Commit the row/record to n-tuple
1240  """
1241  return _Dec.write(s, *a)
1242 
1243 
1244 def _t_column_(s, *a):
1245  """
1246  Fill the certain column to n-tuple
1247  """
1248  return _Dec.column(s, *a)
1249 
1250 
1251 def _t_column_ll_(s, *a):
1252  """
1253  Fill the 'long long' column
1254  """
1255  return _Dec.column_ll(s, *a)
1256 
1257 
1258 def _t_column_ull_(s, *a):
1259  """
1260  Fill the 'unsigned long long' column
1261  """
1262  return _Dec.column_ull(s, *a)
1263 
1264 
1265 def _t_array_(s, *a):
1266  """
1267  Fill the fixed-size array column
1268  """
1269  return _Dec.array(s, *a)
1270 
1271 
1272 def _t_matrix_(s, *a):
1273  """
1274  Fill the fixed-size matrix column
1275  """
1276  return _Dec.matrix(s, *a)
1277 
1278 
1279 def _t_farray_(s, *a):
1280  """
1281  Fill the floating-size array column
1282  """
1283  return _Dec.farray(s, *a)
1284 
1285 
1286 def _t_fmatrix_(s, *a):
1287  """
1288  Fill the floating-size matrix column
1289  """
1290  return _Dec.fmatrix(s, *a)
1291 
1292 
1293 _t_nTuple_.__doc__ += "\n" + _Dec.nTuple.__doc__
1294 _t_ntuple_.__doc__ += "\n" + _Dec.ntuple.__doc__
1295 _t_valid_.__doc__ += "\n" + _Dec.valid.__doc__
1296 _t_write_.__doc__ += "\n" + _Dec.write.__doc__
1297 _t_column_.__doc__ += "\n" + _Dec.column.__doc__
1298 _t_column_ll_.__doc__ += "\n" + _Dec.column_ll.__doc__
1299 _t_column_ull_.__doc__ += "\n" + _Dec.column_ull.__doc__
1300 _t_array_.__doc__ += "\n" + _Dec.array.__doc__
1301 _t_matrix_.__doc__ += "\n" + _Dec.matrix.__doc__
1302 _t_farray_.__doc__ += "\n" + _Dec.farray.__doc__
1303 _t_fmatrix_.__doc__ += "\n" + _Dec.fmatrix.__doc__
1304 
1305 Tuple.nTuple = _t_nTuple_
1306 Tuple.ntuple = _t_ntuple_
1307 Tuple.valid = _t_valid_
1308 Tuple.write = _t_write_
1309 Tuple.column = _t_column_
1310 Tuple.column_ll = _t_column_ll_
1311 Tuple.column_ull = _t_column_ull_
1312 Tuple.array = _t_array_
1313 Tuple.matrix = _t_matrix_
1314 Tuple.farray = _t_farray_
1315 Tuple.fmatrix = _t_fmatrix_
1316 
1317 _alg_map_ = {
1318  "__init__": _init_, # constructor
1319  "tool": _tool_, # service locator
1320  "svc": _service_, # tool locator
1321  "evtSvc": _evtSvc, # event data service
1322  "eventSvc": _evtSvc, # event data service
1323  "detSvc": _detSvc, # detector data service
1324  "histoSvc": _histoSvc, # histogram data service
1325  "histSvc": _histoSvc, # histogram data service
1326  "get": _get, # access to event data
1327  "get_": _get_, # access to event data
1328  "exist_": _exist_, # check the event data
1329  "getDet": _getDet, # access to detector data
1330  "finalize": _finalize_, # algorithm finalization
1331  #
1332  "hasProperty": _hasProperty_, # check the existence of property with given name
1333  "getProperty": _getProperty_, # get the property value with given name
1334  "setProperty": _setProperty_, # set the property with given name
1335  "__setattr__": _set_attr_, # set the attribute/property with given name
1336  "__getattr__": _get_attr_, # set the attribute/property with given name
1337 }
1338 
1339 
1340 # decorate the classes with the useful methods
1341 def _decorate_algs_(klasses):
1342  t = type(klasses)
1343  if not issubclass(t, list) and not issubclass(t, tuple):
1344  klasses = [klasses]
1345  for _alg in klasses:
1346  for key in _alg_map_:
1347  setattr(_alg, key, _alg_map_[key])
1348 
1349 
1350 # =
1351 _decorate_algs_(GaudiAlgo)
1352 _decorate_algs_(HistoAlgo)
1353 _decorate_algs_(TupleAlgo)
1354 
1355 # =============================================================================
1356 # Helper function to fill histogram/ntuple using 'map'-operation
1357 # =============================================================================
1358 
1359 
1360 def mapvct(func, sequence, ovct=None):
1361  """Helper function to fill histogram/ntuple using 'map'-operation"""
1362  if not ovct:
1363  vct = GaudiPython.Vector
1364  else:
1365  vct = ovct
1366  if hasattr(sequence, "size"):
1367  vct.reserve(vct.size() + sequence.size())
1368  elif hasattr(sequence, "__len__"):
1369  vct.reserve(vct.size() + len(sequence))
1370  for object in sequence:
1371  vct.push_back(func(object))
1372  if not ovct:
1373  return vct
1374 
1375 
1376 # =============================================================================
1377 
1378 
1379 # =============================================================================
1380 # get the list of tools
1381 # =============================================================================
1382 def _get_all_tools_(self, method):
1383  """
1384  Get all tools
1385  """
1386  _tools = std.vector("IAlgTool*")()
1387  _func = getattr(AlgDecorator, method)
1388  _num = _func(self, _tools)
1389  if _tools.size() != _num:
1390  raise RuntimeError("Unable to extract Tools")
1391  _res = []
1392  for _tool in _tools:
1393  _res += [iAlgTool(_tool.name(), _tool)]
1394  return _res
1395 
1396 
1397 # =============================================================================
1398 
1399 
1400 def _Tools_a_(self):
1401  """
1402  Retrieve the list of tools,
1403  aquired by component through GaudiCommon<TYPE> base:
1404 
1405  >>> alg = ... ## get the algorithm
1406  >>> tools = alg.Tools() ## get the tools
1407  >>> for tool in tools :
1408  ... print(tool)
1409 
1410  """
1411  _cmp = getattr(self, "_ialg")
1412  if not _cmp:
1413  self.retrieveInterface()
1414  _cmp = getattr(self, "_ialg")
1415  return _get_all_tools_(_cmp, "_tools_a_")
1416 
1417 
1418 # =============================================================================
1419 
1420 
1421 def _Tools_t_(self):
1422  """
1423  Retrieve the list of tools,
1424  aquired by component through GaudiCommon<TYPE> base:
1425 
1426  >>> tool = ... ## get the tool
1427  >>> tools = tool.Tools() ## get the tools
1428  >>> for t in tools :
1429  ... print(t)
1430 
1431  """
1432  _cmp = getattr(self, "_itool")
1433  if not _cmp:
1434  self.retrieveInterface()
1435  _cmp = getattr(self, "_itool")
1436  return _get_all_tools_(_cmp, "_tools_t_")
1437 
1438 
1439 # =============================================================================
1440 # get the counter
1441 # =============================================================================
1442 
1443 
1444 def _get_counter_(self, method, name):
1445  """
1446  get the counter
1447  """
1448  _func = getattr(AlgDecorator, method)
1449  return _func(self, name)
1450 
1451 
1452 # ==============================================================================
1453 
1454 
1455 def _Counter_a_(self, name):
1456  """
1457  Retrieve the counter managed GaudiCommon<TYPE> base by name:
1458 
1459  >>> alg = ... ## get the algorithm
1460  >>> cnt = alg.Counter('#accept') ## get the counter
1461  >>> print(cnt)
1462 
1463  """
1464  _cmp = getattr(self, "_ialg")
1465  if not _cmp:
1466  self.retrieveInterface()
1467  _cmp = getattr(self, "_ialg")
1468  return _get_counter_(_cmp, "_counter_a_", name)
1469 
1470 
1471 # ==============================================================================
1472 
1473 
1474 def _Counter_t_(self, name):
1475  """
1476  Retrieve the counter managed GaudiCommon<TYPE> base by name:
1477 
1478  >>> tool = ... ## get the tool
1479  >>> cnt = tool.Counter('#accept') ## get the counter
1480  >>> print(cnt)
1481 
1482  """
1483  _cmp = getattr(self, "_itool")
1484  if not _cmp:
1485  self.retrieveInterface()
1486  _cmp = getattr(self, "_itool")
1487  return _get_counter_(_cmp, "_counter_t_", name)
1488 
1489 
1490 # =============================================================================
1491 # get all histos
1492 # =============================================================================
1493 cpp.GaudiAlg.ID.__repr__ = cpp.GaudiAlg.ID.idAsString
1494 cpp.GaudiAlg.ID.__str__ = cpp.GaudiAlg.ID.idAsString
1495 cpp.StatEntity.__repr__ = cpp.StatEntity.toString
1496 cpp.StatEntity.__str__ = cpp.StatEntity.toString
1497 
1498 # =============================================================================
1499 
1500 
1501 def _get_all_histos_(component, method, name):
1502  """
1503  Get All histogram form the component
1504  """
1505  _res = {}
1506  for _his in (
1507  std.vector("AIDA::IProfile2D*"),
1508  std.vector("AIDA::IProfile1D*"),
1509  std.vector("AIDA::IHistogram3D*"),
1510  std.vector("AIDA::IHistogram2D*"),
1511  std.vector("AIDA::IHistogram1D*"),
1512  ):
1513  _his = _his()
1514  _ids = std.vector("GaudiAlg::ID")()
1515  _fun = getattr(HistoDecorator, method)
1516  _num = _fun(component, _ids, _his)
1517  if _ids.size() != _num or _his.size() != _num:
1518  raise RuntimeError("Unable to extract Histos!")
1519  for _i in range(0, _num):
1520  _id = _ids[_i]
1521  if _id.numeric():
1522  _id = _id.numericID()
1523  elif _id.literal():
1524  _id = _id.literalID()
1525  else:
1526  _id = _id.idAsString()
1527  _res[_id] = _his[_i]
1528 
1529  if not name:
1530  return _res # return the dictionary
1531 
1532  id = cpp.GaudiAlg.ID(name)
1533  for i in (name, id.literalID(), id.numericID(), id.idAsString(), id):
1534  h = _res.get(i, None)
1535  if not not h:
1536  return h # return the histogram
1537 
1538  return None
1539 
1540 
1541 # =============================================================================
1542 
1543 
1544 def _Histos_a_(self, name=None):
1545  """
1546  Retrieve all histograms & profiles, booked through GauydiHistos<TYPE> base:
1547 
1548  >>> alg = ... ## get the algorithm
1549  >>> histos = alg.Histos() ## get all histograms & profiles
1550  >>> for key in histos :
1551  ... print(key, histos[key])
1552 
1553  Retrive the histogram with the certain ID :
1554 
1555  >>> alg = ... ## get the algorithm
1556  >>> histo = alg.Histos('some histo ID') ## get the histo by ID
1557  >>> print(histo)
1558 
1559  """
1560  _cmp = getattr(self, "_ialg")
1561  if not _cmp:
1562  self.retrieveInterface()
1563  _cmp = getattr(self, "_ialg")
1564  return _get_all_histos_(_cmp, "_histos_a_", name)
1565 
1566 
1567 # =============================================================================
1568 
1569 
1570 def _Histos_t_(self, name=None):
1571  """
1572  Retrieve all histograms & profiles, booked through GauydiHistos<TYPE> base:
1573 
1574  >>> tool = ... ## get the tool
1575  >>> histos = tool.Histos() ## get all histograms & profiles
1576  >>> for key in histos :
1577  ... print(key, histos[key])
1578 
1579  Retrive the historgam with certain ID :
1580 
1581  >>> tool = ... ## get the tool
1582  >>> histo = tool.Histos('some histo ID') ## get the histo by ID
1583  >>> print(histo)
1584 
1585  """
1586  _cmp = getattr(self, "_itool")
1587  if not _cmp:
1588  self.retrieveInterface()
1589  _cmp = getattr(self, "_itool")
1590  return _get_all_histos_(_cmp, "_histos_t_", name)
1591 
1592 
1593 # =============================================================================
1594 
1595 _Tools_a_.__doc__ += "\n" + AlgDecorator._tools_a_.__doc__
1596 _Tools_t_.__doc__ += "\n" + AlgDecorator._tools_t_.__doc__
1597 _Counter_a_.__doc__ += "\n" + AlgDecorator._counter_a_.__doc__
1598 _Counter_t_.__doc__ += "\n" + AlgDecorator._counter_t_.__doc__
1599 _Histos_a_.__doc__ += "\n" + HistoDecorator._histos_a_.__doc__
1600 _Histos_t_.__doc__ += "\n" + HistoDecorator._histos_t_.__doc__
1601 
1602 iAlgorithm.Tools = _Tools_a_
1603 iAlgTool.Tools = _Tools_t_
1604 iAlgorithm.Counter = _Counter_a_
1605 iAlgTool.Counter = _Counter_t_
1606 iAlgorithm.Histos = _Histos_a_
1607 iAlgTool.Histos = _Histos_t_
1608 
1609 # finally add some decoration for histograms
1611 
1612 # =============================================================================
1613 # pseudo help
1614 # =============================================================================
1615 
1616 
1617 def _help_():
1618  print(__doc__, __author__)
1619  print("\t\t\tDoc-string for class GaudiAlgo \n", GaudiAlgo.__doc__)
1620  print("\t\t\tDoc-string for class HistoAlgo \n", HistoAlgo.__doc__)
1621  print("\t\t\tDoc-string for class TupleAlgo \n", TupleAlgo.__doc__)
1622 
1623 
1624 # =============================================================================
1625 # pseudo-test suite
1626 # =============================================================================
1627 if __name__ == "__main__":
1628  _help_()
1629 
1630 # =============================================================================
1631 # The END
1632 # =============================================================================
GaudiPython.GaudiAlgs.TupleAlgo
Definition: GaudiAlgs.py:882
GaudiPython.HistoUtils
Definition: HistoUtils.py:1
GaudiPython.GaudiAlgs._get_all_tools_
def _get_all_tools_(self, method)
Definition: GaudiAlgs.py:1382
GaudiPython.GaudiAlgs._evtCol_
def _evtCol_(s, *a)
Definition: GaudiAlgs.py:1144
GaudiPython.GaudiAlgs.HistoAlgo
Definition: GaudiAlgs.py:768
GaudiPython.Bindings.iDataSvc
Definition: Bindings.py:522
GaudiPython.GaudiAlgs._Tools_t_
def _Tools_t_(self)
Definition: GaudiAlgs.py:1421
GaudiPython.GaudiAlgs._plot2D_
def _plot2D_(s, *a)
Definition: GaudiAlgs.py:1010
GaudiPython.GaudiAlgs._stop_
def _stop_(self)
Definition: GaudiAlgs.py:973
GaudiPython.GaudiAlgs.objectmethod.method
method
Definition: GaudiAlgs.py:931
GaudiPython.GaudiAlgs._finalize_
def _finalize_(self)
Definition: GaudiAlgs.py:482
GaudiPython.GaudiAlgs._t_column_
def _t_column_(s, *a)
Definition: GaudiAlgs.py:1244
GaudiPython.GaudiAlgs.TupleDecColumnDispatcher
Definition: GaudiAlgs.py:1178
GaudiPython.GaudiAlgs._t_nTuple_
def _t_nTuple_(s, *a)
Definition: GaudiAlgs.py:1216
GaudiPython.GaudiAlgs._hasProperty_
def _hasProperty_(self, pname)
Definition: GaudiAlgs.py:500
std::vector
STL class.
GaudiPython.GaudiAlgs._detSvc
def _detSvc(self, location=None)
Definition: GaudiAlgs.py:360
GaudiPython.GaudiAlgs.objectmethod.__call__
def __call__(self, *args)
Definition: GaudiAlgs.py:933
GaudiPython.GaudiAlgs._decorate_algs_
def _decorate_algs_(klasses)
Definition: GaudiAlgs.py:1341
GaudiPython.GaudiAlgs._decorate_plots_
def _decorate_plots_(klasses)
Definition: GaudiAlgs.py:1116
GaudiPython.GaudiAlgs.mapvct
def mapvct(func, sequence, ovct=None)
Definition: GaudiAlgs.py:1360
GaudiKernel.ROOT6WorkAroundEnabled
def ROOT6WorkAroundEnabled(id=None)
Definition: __init__.py:14
GaudiPython.GaudiAlgs._ntupleSvc
def _ntupleSvc(self)
Definition: GaudiAlgs.py:462
GaudiPython.GaudiAlgs._get_attr_
def _get_attr_(self, pname)
Definition: GaudiAlgs.py:537
GaudiPython.GaudiAlgs._t_write_
def _t_write_(s, *a)
Definition: GaudiAlgs.py:1237
GaudiPython.GaudiAlgs._set_attr_
def _set_attr_(self, pname, pvalue)
Definition: GaudiAlgs.py:558
GaudiPython.GaudiAlgs._start_
def _start_(self)
Definition: GaudiAlgs.py:948
GaudiPython.GaudiAlgs._initialize_histo_
def _initialize_histo_(self)
Definition: GaudiAlgs.py:260
GaudiPython.Bindings.AppMgr
Definition: Bindings.py:869
GaudiPython.Bindings.iAlgorithm
Definition: Bindings.py:429
GaudiPython.GaudiAlgs._profile2D_
def _profile2D_(s, *a)
Definition: GaudiAlgs.py:1085
GaudiPython.GaudiAlgs._profile1D_
def _profile1D_(s, *a)
Definition: GaudiAlgs.py:1063
GaudiPython.GaudiAlgs._Counter_t_
def _Counter_t_(self, name)
Definition: GaudiAlgs.py:1474
GaudiPython.GaudiAlgs._get_counter_
def _get_counter_(self, method, name)
Definition: GaudiAlgs.py:1444
GaudiPython.GaudiAlgs._get_
def _get_(self, location, rootInTES=True)
Definition: GaudiAlgs.py:438
GaudiPython.GaudiAlgs.GaudiAlgo
Definition: GaudiAlgs.py:638
GaudiPython.GaudiAlgs.TupleDecColumnDispatcher.func
func
Definition: GaudiAlgs.py:1182
GaudiPython.Bindings
Definition: Bindings.py:1
GaudiPython.GaudiAlgs._t_ntuple_
def _t_ntuple_(s, *a)
Definition: GaudiAlgs.py:1223
GaudiPython.GaudiAlgs._decorate_tuples_
def _decorate_tuples_(klasses)
Definition: GaudiAlgs.py:1155
GaudiPython.GaudiAlgs._Histos_a_
def _Histos_a_(self, name=None)
Definition: GaudiAlgs.py:1544
GaudiPython.GaudiAlgs._success_
def _success_(self)
Definition: GaudiAlgs.py:494
GaudiPython.GaudiAlgs.objectmethod.__init__
def __init__(self, m)
Definition: GaudiAlgs.py:930
GaudiPython.GaudiAlgs.TupleDecColumnDispatcher.mapping
mapping
Definition: GaudiAlgs.py:1193
GaudiPython.GaudiAlgs._getDet
def _getDet(self, location)
Definition: GaudiAlgs.py:427
GaudiPython.GaudiAlgs._Counter_a_
def _Counter_a_(self, name)
Definition: GaudiAlgs.py:1455
GaudiPython.GaudiAlgs._t_valid_
def _t_valid_(s, *a)
Definition: GaudiAlgs.py:1230
GaudiPython.GaudiAlgs._Histos_t_
def _Histos_t_(self, name=None)
Definition: GaudiAlgs.py:1570
GaudiPython.GaudiAlgs._t_column_ull_
def _t_column_ull_(s, *a)
Definition: GaudiAlgs.py:1258
GaudiPluginService.cpluginsvc.func
func
Definition: cpluginsvc.py:236
GaudiPython.GaudiAlgs.objectmethod
Definition: GaudiAlgs.py:929
GaudiPython.GaudiAlgs._t_fmatrix_
def _t_fmatrix_(s, *a)
Definition: GaudiAlgs.py:1286
GaudiPython.GaudiAlgs._GaudiHistoAlg
_GaudiHistoAlg
Definition: GaudiAlgs.py:570
GaudiPython.GaudiAlgs._t_array_
def _t_array_(s, *a)
Definition: GaudiAlgs.py:1265
GaudiPython.GaudiAlgs._help_
def _help_()
Definition: GaudiAlgs.py:1617
GaudiPython.GaudiAlgs._service_
def _service_(self, interface, name, create=True)
Definition: GaudiAlgs.py:179
GaudiPython.GaudiAlgs._exist_
def _exist_(self, location, rootInTES=True)
Definition: GaudiAlgs.py:450
GaudiPython.Bindings.iHistogramSvc
Definition: Bindings.py:680
GaudiPython.GaudiAlgs._get_all_histos_
def _get_all_histos_(component, method, name)
Definition: GaudiAlgs.py:1501
GaudiPython.GaudiAlgs._plot3D_
def _plot3D_(s, *a)
Definition: GaudiAlgs.py:1035
gaudirun.type
type
Definition: gaudirun.py:162
GaudiPython.GaudiAlgs._initialize_tuple_
def _initialize_tuple_(self)
Definition: GaudiAlgs.py:283
GaudiPython.Bindings.iNTupleSvc
Definition: Bindings.py:768
GaudiPython.GaudiAlgs._t_farray_
def _t_farray_(s, *a)
Definition: GaudiAlgs.py:1279
GaudiPython.GaudiAlgs._t_matrix_
def _t_matrix_(s, *a)
Definition: GaudiAlgs.py:1272
GaudiPython.GaudiAlgs.TupleDecColumnDispatcher.__doc__
__doc__
Definition: GaudiAlgs.py:1183
GaudiPython.GaudiAlgs._init_
def _init_(self, name, **args)
Definition: GaudiAlgs.py:207
GaudiPython.GaudiAlgs._setProperty_
def _setProperty_(self, pname, pvalue)
Definition: GaudiAlgs.py:524
GaudiPython.GaudiAlgs._GaudiTupleAlg
_GaudiTupleAlg
Definition: GaudiAlgs.py:571
GaudiPython.Bindings.InterfaceCast
Definition: Bindings.py:145
GaudiPython.GaudiAlgs._getProperty_
def _getProperty_(self, pname)
Definition: GaudiAlgs.py:511
GaudiPython.GaudiAlgs.TupleDecColumnDispatcher.__call__
def __call__(self, *a)
Definition: GaudiAlgs.py:1195
GaudiPython.GaudiAlgs._execute_
def _execute_(self)
Definition: GaudiAlgs.py:961
GaudiPython.GaudiAlgs._histoSvc
def _histoSvc(self, address=None)
Definition: GaudiAlgs.py:395
GaudiPython.GaudiAlgs._Tools_a_
def _Tools_a_(self)
Definition: GaudiAlgs.py:1400
GaudiPython.GaudiAlgs._evtSvc
def _evtSvc(self, location=None)
Definition: GaudiAlgs.py:324
GaudiPython.GaudiAlgs._t_column_ll_
def _t_column_ll_(s, *a)
Definition: GaudiAlgs.py:1251
GaudiPython.GaudiAlgs._get
def _get(self, location)
Definition: GaudiAlgs.py:416
GaudiPython.GaudiAlgs._evtcolSvc
def _evtcolSvc(self)
Definition: GaudiAlgs.py:473
GaudiPython.GaudiAlgs._tool_
def _tool_(self, interface, typename, name=None, parent=None, create=True)
Definition: GaudiAlgs.py:128
GaudiPython.GaudiAlgs._plot1D_
def _plot1D_(s, *a)
Definition: GaudiAlgs.py:988
GaudiPython.GaudiAlgs.TupleDecColumnDispatcher.__init__
def __init__(self, func)
Definition: GaudiAlgs.py:1181
GaudiPython.GaudiAlgs._GaudiAlgorithm
_GaudiAlgorithm
Definition: GaudiAlgs.py:569
Gaudi::Functional::details::zip::range
decltype(auto) range(Args &&... args)
Zips multiple containers together to form a single range.
Definition: FunctionalDetails.h:102
GaudiPython.GaudiAlgs._initialize_
def _initialize_(self)
Definition: GaudiAlgs.py:233
GaudiPython.Bindings.iAlgTool
Definition: Bindings.py:489
GaudiPython.GaudiAlgs._nTuple_
def _nTuple_(s, *a)
Definition: GaudiAlgs.py:1134