| # Gaudi Framework, version v21r6 |

Home |  | Generated: 11 Nov 2009

# GaudiTool.h

Go to the documentation of this file.

    00001 // $Id: GaudiTool.h,v 1.13 2008/10/10 13:38:28 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 GAUDI_API 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 DataObject* put ( IDataProviderSvc*  svc     ,
    00197                     DataObject*        object  ,
    00198                     const std::string& address ,
    00199                     const bool useRootInTES = true ) const
    00200   {
    00201     return GaudiCommon<AlgTool>::put ( svc , object , address , useRootInTES ) ;
    00202   }
    00203
    00232   inline DataObject* put ( DataObject*        object   ,
    00233                     const std::string& address  ,
    00234                     const bool useRootInTES = true ) const
    00235   {
    00236     return GaudiCommon<AlgTool>::put ( evtSvc() , object , address , useRootInTES ) ;
    00237   }
    00238
    00270   template < class TYPE  >
    00271   inline typename Gaudi::Utils::GetData<TYPE>::return_type
    00272   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 typename Gaudi::Utils::GetData<TYPE>::return_type
    00306   get  ( const std::string& location  ,
    00307          const bool useRootInTES = true ) const
    00308   {
    00309     return GaudiCommon<AlgTool>::get<TYPE> ( evtSvc() , location , useRootInTES ) ;
    00310   }
    00311
    00330   template < class TYPE  >
    00331   inline TYPE* getDet ( IDataProviderSvc*  svc        ,
    00332                         const std::string& location   ) const
    00333   {
    00334     return GaudiCommon<AlgTool>::get<TYPE> ( svc , location , false ) ;
    00335   }
    00336
    00354   template < class TYPE  >
    00355   inline TYPE* getDet ( const std::string& location   ) const
    00356   {
    00357     return GaudiCommon<AlgTool>::get<TYPE> ( detSvc() , location , false ) ;
    00358   }
    00359
    00385   template < class TYPE  >
    00386   inline bool  exist    ( IDataProviderSvc*  svc      ,
    00387                           const std::string& location ,
    00388                           const bool useRootInTES = true ) const
    00389   {
    00390     return GaudiCommon<AlgTool>::exist<TYPE> ( svc , location , useRootInTES ) ;
    00391   }
    00392
    00415   template < class TYPE  >
    00416   inline bool  exist    ( const std::string& location ,
    00417                           const bool useRootInTES = true ) const
    00418   {
    00419     return GaudiCommon<AlgTool>::exist<TYPE> ( evtSvc() , location , useRootInTES ) ;
    00420   }
    00421
    00438   template < class TYPE  >
    00439   inline bool  existDet    ( IDataProviderSvc*  svc      ,
    00440                              const std::string& location ) const
    00441   {
    00442     return GaudiCommon<AlgTool>::exist<TYPE> ( svc , location , false ) ;
    00443   }
    00444
    00460   template < class TYPE  >
    00461   inline bool  existDet    ( const std::string& location ) const
    00462   {
    00463     return GaudiCommon<AlgTool>::exist<TYPE> ( detSvc() , location , false ) ;
    00464   }
    00465
    00492   template < class TYPE , class TYPE2 >
    00493   inline TYPE* getOrCreate ( IDataProviderSvc*  svc      ,
    00494                              const std::string& location ,
    00495                              const bool useRootInTES = true ) const
    00496   {
    00497     return GaudiCommon<AlgTool>::getOrCreate<TYPE,TYPE2> ( svc , location , useRootInTES ) ;
    00498   }
    00499
    00525   template < class TYPE , class TYPE2 >
    00526   inline TYPE* getOrCreate ( const std::string& location ,
    00527                              const bool useRootInTES = true ) const
    00528   {
    00529     return GaudiCommon<AlgTool>::getOrCreate<TYPE,TYPE2> ( evtSvc() , location , useRootInTES ) ;
    00530   }
    00531
    00532 protected:
    00533
    00540   GaudiTool ( const std::string& type   ,
    00541               const std::string& name   ,
    00542               const IInterface*  parent );
    00543
    00545   virtual ~GaudiTool();
    00546
    00547 private:
    00548
    00550   GaudiTool();
    00551
    00553   GaudiTool             ( const GaudiTool& );
    00554
    00556   GaudiTool& operator = ( const GaudiTool& );
    00557
    00558 private:
    00559
    00561   mutable INTupleSvc*    m_ntupleSvc          ;
    00563   mutable INTupleSvc*    m_evtColSvc          ;
    00565   mutable IDataProviderSvc* m_evtSvc          ;
    00567   mutable IDataProviderSvc* m_detSvc          ;
    00569   mutable IChronoStatSvc*   m_chronoSvc       ;
    00571   mutable IIncidentSvc*     m_incSvc          ;
    00573   mutable IHistogramSvc *  m_histoSvc         ;
    00574   // Pointer to the Algorithm Context Service
    00575   mutable IAlgContextSvc* m_contextSvc     ;
    00576   // The name of the Algorithm Context Service
    00577   std::string             m_contextSvcName ;
    00578
    00579 private:
    00580
    00582   const std::string m_local ;
    00583
    00584 };
    00585 // ============================================================================
    00586
    00587 // ============================================================================
    00588 // The END
    00589 // ============================================================================
    00590 #endif  // GAUDIALG_GAUDITOOL_H
    00591 // ============================================================================
    00592
    00593