| # Gaudi Framework, version v20r2
Generated: 18 Jul 2008

- Main Page
- Namespaces
- Classes
- Files
- Directories
- Related Pages

- Search for |

- File List
- File Members

# GaudiTool.h

Go to the documentation of this file.

    00001 // $Id: GaudiTool.h,v 1.11 2007/09/25 16:12:41 marcocle Exp $
    00002 // ============================================================================
    00003 #ifndef GAUDIALG_GAUDITOOL_H
    00004 #define GAUDIALG_GAUDITOOL_H 1
    00005 // ============================================================================
    00006 // Include files
    00007 // ============================================================================
    00008 // GaudiKernel
    00009 // ============================================================================
    00010 #include "GaudiKernel/AlgTool.h"
    00011 #include "GaudiKernel/DataObject.h"
    00012 // ============================================================================
    00013 // GaudiAlg
    00014 // ============================================================================
    00015 #include "GaudiAlg/GaudiAlg.h"
    00016 #include "GaudiAlg/GaudiCommon.h"
    00017 // ============================================================================
    00018 // forward declarations
    00019 // ============================================================================
    00020 class          IDataProviderSvc ;
    00021 class          IChronoStatSvc   ;
    00022 class          IIncidentSvc     ;
    00023 class          IHistogramSvc    ;
    00024 class          GaudiException   ;
    00025 class          INTupleSvc       ;
    00026 class          IAlgContextSvc   ;
    00027 namespace std { class exception ; }
    00028 // ============================================================================
    00064 // ============================================================================
    00098 // ============================================================================
    00099 class GaudiTool: public GaudiCommon<AlgTool>
    00100 {
    00101 public:
    00102
    00108   virtual StatusCode    initialize ();
    00109
    00115   virtual StatusCode    finalize   ();
    00116
    00117 public: // accessors
    00118
    00122   INTupleSvc*          ntupleSvc () const;
    00123
    00127   INTupleSvc*          evtColSvc () const;
    00128
    00132   IDataProviderSvc*    detSvc    () const ;
    00133
    00137   IDataProviderSvc*    evtSvc    () const ;
    00138
    00142   IIncidentSvc*        incSvc    () const ;
    00143
    00147   IChronoStatSvc*      chronoSvc () const ;
    00148
    00152   IHistogramSvc*       histoSvc  () const ;
    00153
    00157   IAlgContextSvc*     contextSvc () const ;
    00158
    00159 public:
    00160
    00161   // following methods cannot go in GaudiCommon since they use methods ( evtSvc()
    00162   // and detDvc() ) that are not members of AlgTool.
    00163   // Also some methods seem which are members of the base class do not seem
    00164   // to be found unless forwarding methods are put here ??
    00165
    00196   inline void put ( IDataProviderSvc*  svc     ,
    00197                     DataObject*        object  ,
    00198                     const std::string& address ,
    00199                     const bool useRootInTES = true ) const
    00200   {
    00201     GaudiCommon<AlgTool>::put ( svc , object , address , useRootInTES ) ;
    00202   }
    00203
    00233   inline void put ( DataObject*        object   ,
    00234                     const std::string& address  ,
    00235                     const bool useRootInTES = true ) const
    00236   {
    00237     GaudiCommon<AlgTool>::put ( evtSvc() , object , address , useRootInTES ) ;
    00238   }
    00239
    00271   template < class TYPE  >
    00272   inline TYPE* get  (  IDataProviderSvc*  svc       ,
    00273                        const std::string& location  ,
    00274                        const bool useRootInTES = true ) const
    00275   {
    00276     return GaudiCommon<AlgTool>::get<TYPE> ( svc , location , useRootInTES ) ;
    00277   }
    00278
    00304   template < class TYPE  >
    00305   inline TYPE* get  ( const std::string& location  ,
    00306                       const bool useRootInTES = true ) const
    00307   {
    00308     return GaudiCommon<AlgTool>::get<TYPE> ( evtSvc() , location , useRootInTES ) ;
    00309   }
    00310
    00329   template < class TYPE  >
    00330   inline TYPE* getDet ( IDataProviderSvc*  svc        ,
    00331                         const std::string& location   ) const
    00332   {
    00333     return GaudiCommon<AlgTool>::get<TYPE> ( svc , location , false ) ;
    00334   }
    00335
    00353   template < class TYPE  >
    00354   inline TYPE* getDet ( const std::string& location   ) const
    00355   {
    00356     return GaudiCommon<AlgTool>::get<TYPE> ( detSvc() , location , false ) ;
    00357   }
    00358
    00384   template < class TYPE  >
    00385   inline bool  exist    ( IDataProviderSvc*  svc      ,
    00386                           const std::string& location ,
    00387                           const bool useRootInTES = true ) const
    00388   {
    00389     return GaudiCommon<AlgTool>::exist<TYPE> ( svc , location , useRootInTES ) ;
    00390   }
    00391
    00414   template < class TYPE  >
    00415   inline bool  exist    ( const std::string& location ,
    00416                           const bool useRootInTES = true ) const
    00417   {
    00418     return GaudiCommon<AlgTool>::exist<TYPE> ( evtSvc() , location , useRootInTES ) ;
    00419   }
    00420
    00437   template < class TYPE  >
    00438   inline bool  existDet    ( IDataProviderSvc*  svc      ,
    00439                              const std::string& location ) const
    00440   {
    00441     return GaudiCommon<AlgTool>::exist<TYPE> ( svc , location , false ) ;
    00442   }
    00443
    00459   template < class TYPE  >
    00460   inline bool  existDet    ( const std::string& location ) const
    00461   {
    00462     return GaudiCommon<AlgTool>::exist<TYPE> ( detSvc() , location , false ) ;
    00463   }
    00464
    00491   template < class TYPE , class TYPE2 >
    00492   inline TYPE* getOrCreate ( IDataProviderSvc*  svc      ,
    00493                              const std::string& location ,
    00494                              const bool useRootInTES = true ) const
    00495   {
    00496     return GaudiCommon<AlgTool>::getOrCreate<TYPE,TYPE2> ( svc , location , useRootInTES ) ;
    00497   }
    00498
    00524   template < class TYPE , class TYPE2 >
    00525   inline TYPE* getOrCreate ( const std::string& location ,
    00526                              const bool useRootInTES = true ) const
    00527   {
    00528     return GaudiCommon<AlgTool>::getOrCreate<TYPE,TYPE2> ( evtSvc() , location , useRootInTES ) ;
    00529   }
    00530
    00531 protected:
    00532
    00539   GaudiTool ( const std::string& type   ,
    00540               const std::string& name   ,
    00541               const IInterface*  parent );
    00542
    00544   virtual ~GaudiTool();
    00545
    00546 private:
    00547
    00549   GaudiTool();
    00550
    00552   GaudiTool             ( const GaudiTool& );
    00553
    00555   GaudiTool& operator = ( const GaudiTool& );
    00556
    00557 private:
    00558
    00560   mutable INTupleSvc*    m_ntupleSvc          ;
    00562   mutable INTupleSvc*    m_evtColSvc          ;
    00564   mutable IDataProviderSvc* m_evtSvc          ;
    00566   mutable IDataProviderSvc* m_detSvc          ;
    00568   mutable IChronoStatSvc*   m_chronoSvc       ;
    00570   mutable IIncidentSvc*     m_incSvc          ;
    00572   mutable IHistogramSvc *  m_histoSvc         ;
    00573   // Pointer to the Algorithm Context Service
    00574   mutable IAlgContextSvc* m_contextSvc     ;
    00575   // The name of the Algorithm Context Service
    00576   std::string             m_contextSvcName ;
    00577
    00578 private:
    00579
    00581   const std::string m_local ;
    00582
    00583 };
    00584 // ============================================================================
    00585
    00586 // ============================================================================
    00587 // The END
    00588 // ============================================================================
    00589 #endif  // GAUDIALG_GAUDITOOL_H
    00590 // ============================================================================
    00591
    00592