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