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 class IAlgContextSvc ;
00024 template<class T> class AlgFactory ;
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
00061
00095
00096 class GaudiAlgorithm : public GaudiCommon<Algorithm>
00097 {
00098
00099 friend class AlgFactory<GaudiAlgorithm>;
00100 public:
00101
00107 virtual StatusCode initialize();
00108
00114 virtual StatusCode execute ();
00115
00121 virtual StatusCode finalize ();
00122
00129 virtual StatusCode sysExecute () ;
00130
00131 public:
00132
00133
00134
00135
00136
00137
00170 inline void put ( IDataProviderSvc* svc ,
00171 DataObject* object ,
00172 const std::string& address ,
00173 const bool useRootInTES = true ) const
00174 {
00175 GaudiCommon<Algorithm>::put ( svc , object , address , useRootInTES ) ;
00176 }
00177
00209 inline void put ( DataObject* object ,
00210 const std::string& address ,
00211 const bool useRootInTES = true ) const
00212 {
00213 GaudiCommon<Algorithm>::put ( evtSvc() , object , address , useRootInTES ) ;
00214 }
00215
00248 template < class TYPE >
00249 inline typename Gaudi::Utils::GetData<TYPE>::return_type
00250 get ( IDataProviderSvc* svc ,
00251 const std::string& location ,
00252 const bool useRootInTES = true ) const
00253 {
00254 return GaudiCommon<Algorithm>::get<TYPE> ( svc , location , useRootInTES ) ;
00255 }
00256
00283 template < class TYPE >
00284 inline typename Gaudi::Utils::GetData<TYPE>::return_type
00285 get ( const std::string& location,
00286 const bool useRootInTES = true ) const
00287 {
00288 return GaudiCommon<Algorithm>::get<TYPE> ( evtSvc() , location , useRootInTES ) ;
00289 }
00290
00309 template < class TYPE >
00310 inline TYPE* getDet ( IDataProviderSvc* svc ,
00311 const std::string& location ) const
00312 {
00313 return GaudiCommon<Algorithm>::get<TYPE> ( svc , location , false ) ;
00314 }
00315
00333 template < class TYPE >
00334 inline TYPE* getDet ( const std::string& location ) const
00335 {
00336 return GaudiCommon<Algorithm>::get<TYPE> ( detSvc() , location , false ) ;
00337 }
00338
00365 template < class TYPE >
00366 inline bool exist ( IDataProviderSvc* svc ,
00367 const std::string& location ,
00368 const bool useRootInTES = true ) const
00369 {
00370 return GaudiCommon<Algorithm>::exist<TYPE> ( svc , location , useRootInTES ) ;
00371 }
00372
00398 template < class TYPE >
00399 inline bool exist ( const std::string& location ,
00400 const bool useRootInTES = true ) const
00401 {
00402 return GaudiCommon<Algorithm>::exist<TYPE> ( evtSvc() , location , useRootInTES ) ;
00403 }
00404
00421 template < class TYPE >
00422 inline bool existDet ( IDataProviderSvc* svc ,
00423 const std::string& location ) const
00424 {
00425 return GaudiCommon<Algorithm>::exist<TYPE> ( svc , location , false ) ;
00426 }
00427
00443 template < class TYPE >
00444 inline bool existDet ( const std::string& location ) const
00445 {
00446 return GaudiCommon<Algorithm>::exist<TYPE> ( detSvc() , location , false ) ;
00447 }
00448
00476 template < class TYPE , class TYPE2 >
00477 inline TYPE* getOrCreate ( IDataProviderSvc* svc ,
00478 const std::string& location ,
00479 const bool useRootInTES = true ) const
00480 {
00481 return GaudiCommon<Algorithm>::getOrCreate<TYPE,TYPE2> ( svc , location , useRootInTES ) ;
00482 }
00483
00510 template < class TYPE , class TYPE2 >
00511 inline TYPE* getOrCreate ( const std::string& location ,
00512 const bool useRootInTES = true ) const
00513 {
00514 return GaudiCommon<Algorithm>::getOrCreate<TYPE,TYPE2> ( evtSvc() , location , useRootInTES ) ;
00515 }
00516 public:
00517
00523 GaudiAlgorithm ( const std::string& name ,
00524 ISvcLocator* pSvcLocator );
00525
00527 virtual ~GaudiAlgorithm();
00528
00529 public:
00530
00532 inline bool registerContext() const { return m_registerContext ; }
00533
00534 public:
00535
00539 INTupleSvc* evtColSvc () const;
00540
00544 IAlgContextSvc* contextSvc () const;
00545
00546 private:
00547
00548
00549 GaudiAlgorithm();
00550
00551
00552 GaudiAlgorithm ( const GaudiAlgorithm& );
00553
00554
00555 GaudiAlgorithm& operator = ( const GaudiAlgorithm& );
00556
00557 private:
00558
00559
00560 mutable INTupleSvc* m_evtColSvc ;
00561
00562 mutable IAlgContextSvc* m_contextSvc ;
00563
00564 std::string m_contextSvcName ;
00565
00566 bool m_registerContext ;
00567
00568 std::vector<std::string> m_vetoObjs;
00570 std::vector<std::string> m_requireObjs;
00571
00572
00573 };
00574
00575
00576
00577 #endif // GAUDIALG_GaudiAlgorithm_H
00578
00579
00580