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