Gaudi Framework, version v23r5

Home   Generated: Wed Nov 28 2012
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
GaudiAlgorithm.h
Go to the documentation of this file.
1 // $Id: GaudiAlgorithm.h,v 1.19 2008/11/04 22:49:25 marcocle Exp $
2 // ============================================================================
3 #ifndef GAUDIALG_GaudiAlgorithm_H
4 #define GAUDIALG_GaudiAlgorithm_H 1
5 // ============================================================================
6 // Include files
7 // ============================================================================
8 #include <vector>
9 #include <string>
10 // ============================================================================
11 // GaudiKernel
12 // ============================================================================
13 #include "GaudiKernel/Algorithm.h"
14 // ============================================================================
15 // GaudiAlg
16 // ============================================================================
17 #include "GaudiAlg/GaudiAlg.h"
18 #include "GaudiAlg/GaudiCommon.h"
19 // ============================================================================
20 // forward declarations:
21 // ============================================================================
22 class INTupleSvc ; // GaudiKernel
23 template<class T> class AlgFactory ; // GaudiKernel
24 // ============================================================================
25 /* @file GaudiAlgorithm.h
26  *
27  * Header file for class GaudiAlgorithm.
28  * The actual code is mainly imported from
29  * - LHCb Calorimeter software and
30  * - LHCb C++ toolkit for smart and friendly physics analysis "LoKi"
31  *
32  * This base class allows "easy"(=="1 line") access to tools
33  * and services. This access is safe in the sense that there
34  * is no need to worry about the reference counts for tools
35  * and services.
36  *
37  * The base class allows "easy" (=="1 line") access to data in
38  * Gaudi Transient Stores. The functionality includes the checking
39  * of the presence of the data at the given location, checking the
40  * validity of the data, retrieval of valid data and "forced" retrieve
41  * of valid data (create if there is no data).
42  *
43  * The base class allows to perform an easy error, warning and exception
44  * treatments, including the accumulated statistics of exceptions, errors
45  * and warnings.
46  *
47  * The base class also includes utilities for general statistical counters.
48  *
49  * It has been reported that usage of this base class results in
50  * significant shrinkage of existing code lines.
51  *
52  * @attention
53  * See also the class GaudiCommon, which implements some of the common
54  * functionality between GaudiTool and GaudiAlgorithm.
55  *
56  * @author Vanya BELYAEV Ivan.Belyaev@itep.ru
57  * @author Chris Jones Christopher.Rob.Jones@cern.ch
58  * @date 30/06/2001
59  */
60 // ============================================================================
94 // ============================================================================
95 class GAUDI_API GaudiAlgorithm: public GaudiCommon<Algorithm>
96 {
97  // friend factory for instantiation
98  friend class AlgFactory<GaudiAlgorithm>;
99 public:
100  // ==========================================================================
106  virtual StatusCode initialize();
107  // ==========================================================================
113  virtual StatusCode execute ();
114  // ==========================================================================
120  virtual StatusCode finalize ();
121  // ==========================================================================
128  virtual StatusCode sysExecute () ;
129  // ==========================================================================
130 public:
131 
132  // following methods cannot go in GaudiCommon since they use methods ( evtSvc()
133  // and detDvc() ) that are not members of AlgTool.
134  // Also some methods seem which are members of the base class do not seem
135  // to be found unless forwarding methods are put here ??
136 
169  inline void put ( IDataProviderSvc* svc ,
170  DataObject* object ,
171  const std::string& address ,
172  const bool useRootInTES = true ) const
173  {
174  GaudiCommon<Algorithm>::put ( svc , object , address , useRootInTES ) ;
175  }
176 
208  inline void put ( DataObject* object ,
209  const std::string& address ,
210  const bool useRootInTES = true ) const
211  {
212  GaudiCommon<Algorithm>::put ( evtSvc() , object , address , useRootInTES ) ;
213  }
214 
247  template < class TYPE >
248  inline typename Gaudi::Utils::GetData<TYPE>::return_type
250  const std::string& location ,
251  const bool useRootInTES = true ) const
252  {
253  return GaudiCommon<Algorithm>::get<TYPE> ( svc , location , useRootInTES ) ;
254  }
255 
289  template < class TYPE >
290  inline typename Gaudi::Utils::GetData<TYPE>::return_type
292  const std::string& location ,
293  const bool useRootInTES = true ) const
294  {
295  return GaudiCommon<Algorithm>::getIfExists<TYPE> ( svc , location , useRootInTES ) ;
296  }
297 
324  template < class TYPE >
325  inline typename Gaudi::Utils::GetData<TYPE>::return_type
326  get ( const std::string& location,
327  const bool useRootInTES = true ) const
328  {
329  return GaudiCommon<Algorithm>::get<TYPE> ( evtSvc() , location , useRootInTES ) ;
330  }
331 
364  template < class TYPE >
365  inline typename Gaudi::Utils::GetData<TYPE>::return_type
366  getIfExists ( const std::string& location ,
367  const bool useRootInTES = true ) const
368  {
369  return GaudiCommon<Algorithm>::getIfExists<TYPE> ( evtSvc() , location , useRootInTES ) ;
370  }
371 
390  template < class TYPE >
391  inline TYPE* getDet ( IDataProviderSvc* svc ,
392  const std::string& location ) const
393  {
394  return GaudiCommon<Algorithm>::get<TYPE> ( svc , location , false ) ;
395  }
396 
419  template < class TYPE >
420  inline typename Gaudi::Utils::GetData<TYPE>::return_type
421  getDetIfExists ( IDataProviderSvc* svc ,
422  const std::string& location ) const
423  {
424  return GaudiCommon<Algorithm>::getIfExists<TYPE> ( svc , location , false ) ;
425  }
426 
444  template < class TYPE >
445  inline TYPE* getDet ( const std::string& location ) const
446  {
447  return GaudiCommon<Algorithm>::get<TYPE> ( detSvc() , location , false ) ;
448  }
449 
471  template < class TYPE >
472  inline typename Gaudi::Utils::GetData<TYPE>::return_type
473  getDetIfExists ( const std::string& location ) const
474  {
475  return GaudiCommon<Algorithm>::getIfExists<TYPE> ( detSvc() , location , false ) ;
476  }
477 
504  template < class TYPE >
505  inline bool exist ( IDataProviderSvc* svc ,
506  const std::string& location ,
507  const bool useRootInTES = true ) const
508  {
509  return GaudiCommon<Algorithm>::exist<TYPE> ( svc , location , useRootInTES ) ;
510  }
511 
537  template < class TYPE >
538  inline bool exist ( const std::string& location ,
539  const bool useRootInTES = true ) const
540  {
541  return GaudiCommon<Algorithm>::exist<TYPE> ( evtSvc() , location , useRootInTES ) ;
542  }
543 
560  template < class TYPE >
561  inline bool existDet ( IDataProviderSvc* svc ,
562  const std::string& location ) const
563  {
564  return GaudiCommon<Algorithm>::exist<TYPE> ( svc , location , false ) ;
565  }
566 
582  template < class TYPE >
583  inline bool existDet ( const std::string& location ) const
584  {
585  return GaudiCommon<Algorithm>::exist<TYPE> ( detSvc() , location , false ) ;
586  }
587 
615  template < class TYPE , class TYPE2 >
616  inline typename Gaudi::Utils::GetData<TYPE>::return_type
618  const std::string& location ,
619  const bool useRootInTES = true ) const
620  {
621  return GaudiCommon<Algorithm>::getOrCreate<TYPE,TYPE2> ( svc , location , useRootInTES ) ;
622  }
623 
650  template < class TYPE , class TYPE2 >
651  inline typename Gaudi::Utils::GetData<TYPE>::return_type
652  getOrCreate ( const std::string& location ,
653  const bool useRootInTES = true ) const
654  {
655  return GaudiCommon<Algorithm>::getOrCreate<TYPE,TYPE2> ( evtSvc() , location , useRootInTES ) ;
656  }
657 public:
658  // ==========================================================================
664  GaudiAlgorithm ( const std::string& name ,
665  ISvcLocator* pSvcLocator );
666  // ==========================================================================
668  virtual ~GaudiAlgorithm();
669  // ==========================================================================
670 public:
671  // ==========================================================================
675  SmartIF<INTupleSvc>& evtColSvc () const;
676  // ==========================================================================
677 private:
678  // ==========================================================================
679  // no public default constructor
680  GaudiAlgorithm();
681  // ==========================================================================
682  // no public copy constructor
683  GaudiAlgorithm ( const GaudiAlgorithm& );
684  // ==========================================================================
685  // no public assignment operator
687  // ==========================================================================
688 private:
689  // ==========================================================================
690  // Pointer to the Event Tag Collection Service
692 
696  // ==========================================================================
697 };
698 // ============================================================================
699 // The END
700 // ============================================================================
701 #endif // GAUDIALG_GaudiAlgorithm_H
702 // ============================================================================
703 
704 

Generated at Wed Nov 28 2012 12:17:09 for Gaudi Framework, version v23r5 by Doxygen version 1.8.2 written by Dimitri van Heesch, © 1997-2004