00001
00002
00003 #ifndef GAUDIALG_GAUDITOOL_H
00004 #define GAUDIALG_GAUDITOOL_H 1
00005
00006
00007
00008
00009
00010 #include "GaudiKernel/AlgTool.h"
00011 #include "GaudiKernel/DataObject.h"
00012
00013
00014
00015 #include "GaudiAlg/GaudiAlg.h"
00016 #include "GaudiAlg/GaudiCommon.h"
00017
00018
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 ();
00114 virtual StatusCode finalize ();
00115
00116 public:
00117
00121 INTupleSvc* ntupleSvc () const;
00125 INTupleSvc* evtColSvc () const;
00129 IDataProviderSvc* detSvc () const ;
00133 IDataProviderSvc* evtSvc () const ;
00137 IIncidentSvc* incSvc () const ;
00141 IChronoStatSvc* chronoSvc () const ;
00145 IHistogramSvc* histoSvc () const ;
00149 IAlgContextSvc* contextSvc () const ;
00150
00151 public:
00152
00153
00154
00155
00156
00157
00158
00189 inline DataObject* put ( IDataProviderSvc* svc ,
00190 DataObject* object ,
00191 const std::string& address ,
00192 const bool useRootInTES = true ) const
00193 {
00194 return GaudiCommon<AlgTool>::put ( svc , object , address , useRootInTES ) ;
00195 }
00196
00225 inline DataObject* put ( DataObject* object ,
00226 const std::string& address ,
00227 const bool useRootInTES = true ) const
00228 {
00229 return GaudiCommon<AlgTool>::put ( evtSvc() , object , address , useRootInTES ) ;
00230 }
00231
00263 template < class TYPE >
00264 inline typename Gaudi::Utils::GetData<TYPE>::return_type
00265 get ( IDataProviderSvc* svc ,
00266 const std::string& location ,
00267 const bool useRootInTES = true ) const
00268 {
00269 return GaudiCommon<AlgTool>::get<TYPE> ( svc , location , useRootInTES ) ;
00270 }
00271
00305 template < class TYPE >
00306 inline typename Gaudi::Utils::GetData<TYPE>::return_type
00307 getIfExists ( IDataProviderSvc* svc ,
00308 const std::string& location ,
00309 const bool useRootInTES = true ) const
00310 {
00311 return GaudiCommon<AlgTool>::getIfExists<TYPE> ( svc , location , useRootInTES ) ;
00312 }
00313
00339 template < class TYPE >
00340 inline typename Gaudi::Utils::GetData<TYPE>::return_type
00341 get ( const std::string& location ,
00342 const bool useRootInTES = true ) const
00343 {
00344 return GaudiCommon<AlgTool>::get<TYPE> ( evtSvc() , location , useRootInTES ) ;
00345 }
00346
00379 template < class TYPE >
00380 inline typename Gaudi::Utils::GetData<TYPE>::return_type
00381 getIfExists ( const std::string& location ,
00382 const bool useRootInTES = true ) const
00383 {
00384 return GaudiCommon<AlgTool>::getIfExists<TYPE> ( evtSvc() , location , useRootInTES ) ;
00385 }
00386
00405 template < class TYPE >
00406 inline TYPE* getDet ( IDataProviderSvc* svc ,
00407 const std::string& location ) const
00408 {
00409 return GaudiCommon<AlgTool>::get<TYPE> ( svc , location , false ) ;
00410 }
00411
00434 template < class TYPE >
00435 inline typename Gaudi::Utils::GetData<TYPE>::return_type
00436 getDetIfExists ( IDataProviderSvc* svc ,
00437 const std::string& location ) const
00438 {
00439 return GaudiCommon<AlgTool>::getIfExists<TYPE> ( svc , location , false ) ;
00440 }
00441
00459 template < class TYPE >
00460 inline TYPE* getDet ( const std::string& location ) const
00461 {
00462 return GaudiCommon<AlgTool>::get<TYPE> ( detSvc() , location , false ) ;
00463 }
00464
00486 template < class TYPE >
00487 inline typename Gaudi::Utils::GetData<TYPE>::return_type
00488 getDetIfExists ( const std::string& location ) const
00489 {
00490 return GaudiCommon<AlgTool>::getIfExists<TYPE> ( detSvc() , location , false ) ;
00491 }
00492
00518 template < class TYPE >
00519 inline bool exist ( IDataProviderSvc* svc ,
00520 const std::string& location ,
00521 const bool useRootInTES = true ) const
00522 {
00523 return GaudiCommon<AlgTool>::exist<TYPE> ( svc , location , useRootInTES ) ;
00524 }
00525
00548 template < class TYPE >
00549 inline bool exist ( const std::string& location ,
00550 const bool useRootInTES = true ) const
00551 {
00552 return GaudiCommon<AlgTool>::exist<TYPE> ( evtSvc() , location , useRootInTES ) ;
00553 }
00554
00571 template < class TYPE >
00572 inline bool existDet ( IDataProviderSvc* svc ,
00573 const std::string& location ) const
00574 {
00575 return GaudiCommon<AlgTool>::exist<TYPE> ( svc , location , false ) ;
00576 }
00577
00593 template < class TYPE >
00594 inline bool existDet ( const std::string& location ) const
00595 {
00596 return GaudiCommon<AlgTool>::exist<TYPE> ( detSvc() , location , false ) ;
00597 }
00598
00625 template < class TYPE , class TYPE2 >
00626 inline typename Gaudi::Utils::GetData<TYPE>::return_type
00627 getOrCreate ( IDataProviderSvc* svc ,
00628 const std::string& location ,
00629 const bool useRootInTES = true ) const
00630 {
00631 return GaudiCommon<AlgTool>::getOrCreate<TYPE,TYPE2> ( svc , location , useRootInTES ) ;
00632 }
00633
00659 template < class TYPE , class TYPE2 >
00660 inline typename Gaudi::Utils::GetData<TYPE>::return_type
00661 getOrCreate ( const std::string& location ,
00662 const bool useRootInTES = true ) const
00663 {
00664 return GaudiCommon<AlgTool>::getOrCreate<TYPE,TYPE2> ( evtSvc() , location , useRootInTES ) ;
00665 }
00666
00667
00668 public:
00669
00671 static bool enableSummary ( bool ) ;
00673 static bool summaryEnabled ( ) ;
00674
00675 protected:
00676
00683 GaudiTool ( const std::string& type ,
00684 const std::string& name ,
00685 const IInterface* parent );
00686
00688 virtual ~GaudiTool();
00689
00690 private:
00691
00693 GaudiTool();
00695 GaudiTool ( const GaudiTool& );
00697 GaudiTool& operator = ( const GaudiTool& );
00698
00699 private:
00700
00702 mutable INTupleSvc* m_ntupleSvc ;
00704 mutable INTupleSvc* m_evtColSvc ;
00706 mutable IDataProviderSvc* m_evtSvc ;
00708 mutable IDataProviderSvc* m_detSvc ;
00710 mutable IChronoStatSvc* m_chronoSvc ;
00712 mutable IIncidentSvc* m_incSvc ;
00714 mutable IHistogramSvc * m_histoSvc ;
00715
00716 mutable IAlgContextSvc* m_contextSvc ;
00717
00718 std::string m_contextSvcName ;
00719
00720 private:
00721
00723 const std::string m_local ;
00724
00725 private:
00726
00728 static bool s_enableSummary ;
00729
00730 };
00731
00732
00733
00734
00735
00736 #endif // GAUDIALG_GAUDITOOL_H
00737
00738
00739