00001
00002
00003 #ifndef GAUDIALG_GaudiAlgorithm_H
00004 #define GAUDIALG_GaudiAlgorithm_H 1
00005
00006
00007
00008 #include <vector>
00009 #include <string>
00010
00011
00012
00013 #include "GaudiKernel/Algorithm.h"
00014
00015
00016
00017 #include "GaudiAlg/GaudiAlg.h"
00018 #include "GaudiAlg/GaudiCommon.h"
00019
00020
00021
00022 class INTupleSvc ;
00023 template<class T> class AlgFactory ;
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00094
00095 class GAUDI_API GaudiAlgorithm: public GaudiCommon<Algorithm>
00096 {
00097
00098 friend class AlgFactory<GaudiAlgorithm>;
00099 public:
00100
00106 virtual StatusCode initialize();
00107
00113 virtual StatusCode execute ();
00114
00120 virtual StatusCode finalize ();
00121
00128 virtual StatusCode sysExecute () ;
00129
00130 public:
00131
00132
00133
00134
00135
00136
00169 inline void put ( IDataProviderSvc* svc ,
00170 DataObject* object ,
00171 const std::string& address ,
00172 const bool useRootInTES = true ) const
00173 {
00174 GaudiCommon<Algorithm>::put ( svc , object , address , useRootInTES ) ;
00175 }
00176
00208 inline void put ( DataObject* object ,
00209 const std::string& address ,
00210 const bool useRootInTES = true ) const
00211 {
00212 GaudiCommon<Algorithm>::put ( evtSvc() , object , address , useRootInTES ) ;
00213 }
00214
00247 template < class TYPE >
00248 inline typename Gaudi::Utils::GetData<TYPE>::return_type
00249 get ( IDataProviderSvc* svc ,
00250 const std::string& location ,
00251 const bool useRootInTES = true ) const
00252 {
00253 return GaudiCommon<Algorithm>::get<TYPE> ( svc , location , useRootInTES ) ;
00254 }
00255
00289 template < class TYPE >
00290 inline typename Gaudi::Utils::GetData<TYPE>::return_type
00291 getIfExists ( IDataProviderSvc* svc ,
00292 const std::string& location ,
00293 const bool useRootInTES = true ) const
00294 {
00295 return GaudiCommon<Algorithm>::getIfExists<TYPE> ( svc , location , useRootInTES ) ;
00296 }
00297
00324 template < class TYPE >
00325 inline typename Gaudi::Utils::GetData<TYPE>::return_type
00326 get ( const std::string& location,
00327 const bool useRootInTES = true ) const
00328 {
00329 return GaudiCommon<Algorithm>::get<TYPE> ( evtSvc() , location , useRootInTES ) ;
00330 }
00331
00364 template < class TYPE >
00365 inline typename Gaudi::Utils::GetData<TYPE>::return_type
00366 getIfExists ( const std::string& location ,
00367 const bool useRootInTES = true ) const
00368 {
00369 return GaudiCommon<Algorithm>::getIfExists<TYPE> ( evtSvc() , location , useRootInTES ) ;
00370 }
00371
00390 template < class TYPE >
00391 inline TYPE* getDet ( IDataProviderSvc* svc ,
00392 const std::string& location ) const
00393 {
00394 return GaudiCommon<Algorithm>::get<TYPE> ( svc , location , false ) ;
00395 }
00396
00419 template < class TYPE >
00420 inline typename Gaudi::Utils::GetData<TYPE>::return_type
00421 getDetIfExists ( IDataProviderSvc* svc ,
00422 const std::string& location ) const
00423 {
00424 return GaudiCommon<Algorithm>::getIfExists<TYPE> ( svc , location , false ) ;
00425 }
00426
00444 template < class TYPE >
00445 inline TYPE* getDet ( const std::string& location ) const
00446 {
00447 return GaudiCommon<Algorithm>::get<TYPE> ( detSvc() , location , false ) ;
00448 }
00449
00471 template < class TYPE >
00472 inline typename Gaudi::Utils::GetData<TYPE>::return_type
00473 getDetIfExists ( const std::string& location ) const
00474 {
00475 return GaudiCommon<Algorithm>::getIfExists<TYPE> ( detSvc() , location , false ) ;
00476 }
00477
00504 template < class TYPE >
00505 inline bool exist ( IDataProviderSvc* svc ,
00506 const std::string& location ,
00507 const bool useRootInTES = true ) const
00508 {
00509 return GaudiCommon<Algorithm>::exist<TYPE> ( svc , location , useRootInTES ) ;
00510 }
00511
00537 template < class TYPE >
00538 inline bool exist ( const std::string& location ,
00539 const bool useRootInTES = true ) const
00540 {
00541 return GaudiCommon<Algorithm>::exist<TYPE> ( evtSvc() , location , useRootInTES ) ;
00542 }
00543
00560 template < class TYPE >
00561 inline bool existDet ( IDataProviderSvc* svc ,
00562 const std::string& location ) const
00563 {
00564 return GaudiCommon<Algorithm>::exist<TYPE> ( svc , location , false ) ;
00565 }
00566
00582 template < class TYPE >
00583 inline bool existDet ( const std::string& location ) const
00584 {
00585 return GaudiCommon<Algorithm>::exist<TYPE> ( detSvc() , location , false ) ;
00586 }
00587
00615 template < class TYPE , class TYPE2 >
00616 inline typename Gaudi::Utils::GetData<TYPE>::return_type
00617 getOrCreate ( IDataProviderSvc* svc ,
00618 const std::string& location ,
00619 const bool useRootInTES = true ) const
00620 {
00621 return GaudiCommon<Algorithm>::getOrCreate<TYPE,TYPE2> ( svc , location , useRootInTES ) ;
00622 }
00623
00650 template < class TYPE , class TYPE2 >
00651 inline typename Gaudi::Utils::GetData<TYPE>::return_type
00652 getOrCreate ( const std::string& location ,
00653 const bool useRootInTES = true ) const
00654 {
00655 return GaudiCommon<Algorithm>::getOrCreate<TYPE,TYPE2> ( evtSvc() , location , useRootInTES ) ;
00656 }
00657 public:
00658
00664 GaudiAlgorithm ( const std::string& name ,
00665 ISvcLocator* pSvcLocator );
00666
00668 virtual ~GaudiAlgorithm();
00669
00670 public:
00671
00675 SmartIF<INTupleSvc>& evtColSvc () const;
00676
00677 private:
00678
00679
00680 GaudiAlgorithm();
00681
00682
00683 GaudiAlgorithm ( const GaudiAlgorithm& );
00684
00685
00686 GaudiAlgorithm& operator = ( const GaudiAlgorithm& );
00687
00688 private:
00689
00690
00691 mutable SmartIF<INTupleSvc> m_evtColSvc ;
00692
00693 std::vector<std::string> m_vetoObjs;
00695 std::vector<std::string> m_requireObjs;
00696
00697 };
00698
00699
00700
00701 #endif // GAUDIALG_GaudiAlgorithm_H
00702
00703
00704