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
00259 template < class TYPE >
00260 inline typename Gaudi::Utils::GetData<TYPE>::return_type
00261 getIfExists ( IDataProviderSvc* svc ,
00262 const std::string& location ,
00263 const bool useRootInTES = true ) const
00264 {
00265 return GaudiCommon<Algorithm>::getIfExists<TYPE> ( svc , location , useRootInTES ) ;
00266 }
00267
00294 template < class TYPE >
00295 inline typename Gaudi::Utils::GetData<TYPE>::return_type
00296 get ( const std::string& location,
00297 const bool useRootInTES = true ) const
00298 {
00299 return GaudiCommon<Algorithm>::get<TYPE> ( evtSvc() , location , useRootInTES ) ;
00300 }
00301
00305 template < class TYPE >
00306 inline typename Gaudi::Utils::GetData<TYPE>::return_type
00307 getIfExists ( const std::string& location ,
00308 const bool useRootInTES = true ) const
00309 {
00310 return GaudiCommon<Algorithm>::getIfExists<TYPE> ( evtSvc() , location , useRootInTES ) ;
00311 }
00312
00331 template < class TYPE >
00332 inline TYPE* getDet ( IDataProviderSvc* svc ,
00333 const std::string& location ) const
00334 {
00335 return GaudiCommon<Algorithm>::get<TYPE> ( svc , location , false ) ;
00336 }
00337
00341 template < class TYPE >
00342 inline typename Gaudi::Utils::GetData<TYPE>::return_type
00343 getDetIfExists ( IDataProviderSvc* svc ,
00344 const std::string& location ) const
00345 {
00346 return GaudiCommon<Algorithm>::getIfExists<TYPE> ( svc , location , false ) ;
00347 }
00348
00366 template < class TYPE >
00367 inline TYPE* getDet ( const std::string& location ) const
00368 {
00369 return GaudiCommon<Algorithm>::get<TYPE> ( detSvc() , location , false ) ;
00370 }
00371
00375 template < class TYPE >
00376 inline typename Gaudi::Utils::GetData<TYPE>::return_type
00377 getDetIfExists ( const std::string& location ) const
00378 {
00379 return GaudiCommon<Algorithm>::getIfExists<TYPE> ( detSvc() , location , false ) ;
00380 }
00381
00408 template < class TYPE >
00409 inline bool exist ( IDataProviderSvc* svc ,
00410 const std::string& location ,
00411 const bool useRootInTES = true ) const
00412 {
00413 return GaudiCommon<Algorithm>::exist<TYPE> ( svc , location , useRootInTES ) ;
00414 }
00415
00441 template < class TYPE >
00442 inline bool exist ( const std::string& location ,
00443 const bool useRootInTES = true ) const
00444 {
00445 return GaudiCommon<Algorithm>::exist<TYPE> ( evtSvc() , location , useRootInTES ) ;
00446 }
00447
00464 template < class TYPE >
00465 inline bool existDet ( IDataProviderSvc* svc ,
00466 const std::string& location ) const
00467 {
00468 return GaudiCommon<Algorithm>::exist<TYPE> ( svc , location , false ) ;
00469 }
00470
00486 template < class TYPE >
00487 inline bool existDet ( const std::string& location ) const
00488 {
00489 return GaudiCommon<Algorithm>::exist<TYPE> ( detSvc() , location , false ) ;
00490 }
00491
00519 template < class TYPE , class TYPE2 >
00520 inline typename Gaudi::Utils::GetData<TYPE>::return_type
00521 getOrCreate ( IDataProviderSvc* svc ,
00522 const std::string& location ,
00523 const bool useRootInTES = true ) const
00524 {
00525 return GaudiCommon<Algorithm>::getOrCreate<TYPE,TYPE2> ( svc , location , useRootInTES ) ;
00526 }
00527
00554 template < class TYPE , class TYPE2 >
00555 inline typename Gaudi::Utils::GetData<TYPE>::return_type
00556 getOrCreate ( const std::string& location ,
00557 const bool useRootInTES = true ) const
00558 {
00559 return GaudiCommon<Algorithm>::getOrCreate<TYPE,TYPE2> ( evtSvc() , location , useRootInTES ) ;
00560 }
00561 public:
00562
00568 GaudiAlgorithm ( const std::string& name ,
00569 ISvcLocator* pSvcLocator );
00570
00572 virtual ~GaudiAlgorithm();
00573
00574 public:
00575
00579 SmartIF<INTupleSvc>& evtColSvc () const;
00580
00581 private:
00582
00583
00584 GaudiAlgorithm();
00585
00586
00587 GaudiAlgorithm ( const GaudiAlgorithm& );
00588
00589
00590 GaudiAlgorithm& operator = ( const GaudiAlgorithm& );
00591
00592 private:
00593
00594
00595 mutable SmartIF<INTupleSvc> m_evtColSvc ;
00596
00597 std::vector<std::string> m_vetoObjs;
00599 std::vector<std::string> m_requireObjs;
00600
00601 };
00602
00603
00604
00605 #endif // GAUDIALG_GaudiAlgorithm_H
00606
00607
00608