The Gaudi Framework  v32r2 (46d42edc)
GaudiAlgorithm.h
Go to the documentation of this file.
1 #ifndef GAUDIALG_GaudiAlgorithm_H
2 #define GAUDIALG_GaudiAlgorithm_H 1
3 // ============================================================================
4 // Include files
5 // ============================================================================
6 #include <string>
7 #include <vector>
8 // ============================================================================
9 // GaudiKernel
10 // ============================================================================
11 #include "GaudiKernel/Algorithm.h"
12 // ============================================================================
13 // GaudiAlg
14 // ============================================================================
15 #include "GaudiAlg/GaudiAlg.h"
16 #include "GaudiAlg/GaudiCommon.h"
18 // ============================================================================
19 // forward declarations:
20 // ============================================================================
21 class INTupleSvc;
22 
23 // ============================================================================
59 // ============================================================================
93 // ============================================================================
94 class GAUDI_API GaudiAlgorithm : public GaudiCommon<Algorithm> {
95 public:
96  // ==========================================================================
102  StatusCode initialize() override;
103  // ==========================================================================
109  StatusCode execute() override;
110  // ==========================================================================
116  StatusCode finalize() override;
117  // ==========================================================================
124  StatusCode sysExecute( const EventContext& ctx ) override;
125  // ==========================================================================
126 public:
127  // following methods cannot go in GaudiCommon since they use methods ( evtSvc()
128  // and detDvc() ) that are not members of AlgTool.
129  // Also some methods seem which are members of the base class do not seem
130  // to be found unless forwarding methods are put here ??
131 
164  // [[deprecated( "please pass a std::unique_ptr as 2nd argument" )]]
165  void put( IDataProviderSvc* svc, DataObject* object, const std::string& address,
166  const bool useRootInTES = true ) const {
167  put( svc, std::unique_ptr<DataObject>( object ), address, useRootInTES );
168  }
169  void put( IDataProviderSvc* svc, std::unique_ptr<DataObject> object, const std::string& address,
170  const bool useRootInTES = true ) const {
171  GaudiCommon<Algorithm>::put( svc, std::move( object ), address, useRootInTES );
172  }
173 
205  const DataObject* put( DataObject* object, const std::string& address, const bool useRootInTES = true ) const {
206  return put( std::unique_ptr<DataObject>( object ), address, useRootInTES );
207  }
208  const DataObject* put( std::unique_ptr<DataObject> object, const std::string& address,
209  const bool useRootInTES = true ) const {
210  return GaudiCommon<Algorithm>::put( evtSvc(), std::move( object ), address, useRootInTES );
211  }
212 
245  template <class TYPE>
247  const bool useRootInTES = true ) const {
248  return GaudiCommon<Algorithm>::get<TYPE>( svc, location, useRootInTES );
249  }
250 
284  template <class TYPE>
286  const bool useRootInTES = true ) const {
287  return GaudiCommon<Algorithm>::getIfExists<TYPE>( svc, location, useRootInTES );
288  }
289 
316  template <class TYPE>
318  const bool useRootInTES = true ) const {
319  return GaudiCommon<Algorithm>::get<TYPE>( evtSvc(), location, useRootInTES );
320  }
321 
354  template <class TYPE>
356  const bool useRootInTES = true ) const {
357  return GaudiCommon<Algorithm>::getIfExists<TYPE>( evtSvc(), location, useRootInTES );
358  }
359 
378  template <class TYPE>
379  TYPE* getDet( IDataProviderSvc* svc, const std::string& location ) const {
380  return GaudiCommon<Algorithm>::get<TYPE>( svc, location, false );
381  }
382 
405  template <class TYPE>
407  const std::string& location ) const {
409  }
410 
428  template <class TYPE>
429  TYPE* getDet( const std::string& location ) const {
430  return GaudiCommon<Algorithm>::get<TYPE>( detSvc(), location, false );
431  }
432 
454  template <class TYPE>
456  return GaudiCommon<Algorithm>::getIfExists<TYPE>( detSvc(), location, false );
457  }
458 
485  template <class TYPE>
486  bool exist( IDataProviderSvc* svc, const std::string& location, const bool useRootInTES = true ) const {
487  return GaudiCommon<Algorithm>::exist<TYPE>( svc, location, useRootInTES );
488  }
489 
515  template <class TYPE>
516  bool exist( const std::string& location, const bool useRootInTES = true ) const {
517  return GaudiCommon<Algorithm>::exist<TYPE>( evtSvc(), location, useRootInTES );
518  }
519 
536  template <class TYPE>
537  bool existDet( IDataProviderSvc* svc, const std::string& location ) const {
538  return GaudiCommon<Algorithm>::exist<TYPE>( svc, location, false );
539  }
540 
556  template <class TYPE>
557  bool existDet( const std::string& location ) const {
558  return GaudiCommon<Algorithm>::exist<TYPE>( detSvc(), location, false );
559  }
560 
588  template <class TYPE, class TYPE2>
590  const bool useRootInTES = true ) const {
591  return GaudiCommon<Algorithm>::getOrCreate<TYPE, TYPE2>( svc, location, useRootInTES );
592  }
593 
620  template <class TYPE, class TYPE2>
622  const bool useRootInTES = true ) const {
623  return GaudiCommon<Algorithm>::getOrCreate<TYPE, TYPE2>( evtSvc(), location, useRootInTES );
624  }
625 
626  // ==========================================================================
632  GaudiAlgorithm( const std::string& name, ISvcLocator* pSvcLocator );
633  // ==========================================================================
634  //
635  // no default/copy constructor, no assignment -- except that ROOT really
636  // wants a default constructor declared. So we define it, and don't implement
637  // it...
638  GaudiAlgorithm( const GaudiAlgorithm& ) = delete;
639  GaudiAlgorithm& operator=( const GaudiAlgorithm& ) = delete;
640  // ==========================================================================
641 public:
642  // ==========================================================================
646  SmartIF<INTupleSvc>& evtColSvc() const;
647 
648  // ==========================================================================
649 private:
650  // ==========================================================================
651  // Pointer to the Event Tag Collection Service
653 
655  this, "VetoObjects", {}, "skip execute if one or more of these TES objects exist"};
657  this, "RequireObjects", {}, "execute only if one or more of these TES objects exist"};
658  // ==========================================================================
659 };
660 // ============================================================================
661 // The END
662 // ============================================================================
663 #endif // GAUDIALG_GaudiAlgorithm_H
void put(IDataProviderSvc *svc, std::unique_ptr< DataObject > object, const std::string &address, const bool useRootInTES=true) const
Gaudi::Utils::GetData< TYPE >::return_type get(const std::string &location, const bool useRootInTES=true) const
Templated access to the data from Gaudi Event Transient Store.
SmartIF< INTupleSvc > m_evtColSvc
Event Tag Collection Service.
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition: ISvcLocator.h:25
Implementation of property with value of concrete type.
Definition: Property.h:352
Gaudi::Utils::GetData< TYPE >::return_type getDetIfExists(const std::string &location) const
Templated access to the detector data from the Gaudi Detector Transient Store.
Gaudi::Utils::GetData< TYPE >::return_type getDetIfExists(IDataProviderSvc *svc, const std::string &location) const
Templated access to the detector data from the Gaudi Detector Transient Store.
const DataObject * put(DataObject *object, const std::string &address, const bool useRootInTES=true) const
Register a data object or container into Gaudi Event Transient Store.
Helper structure for implementation of "get"-functions for GaudiCommon<BASE>
Definition: GaudiCommon.h:53
DataObject * put(IDataProviderSvc *svc, std::unique_ptr< DataObject > object, const std::string &location, const bool useRootInTES=true) const
Register a data object or container into Gaudi Event Transient Store.
Gaudi::Utils::GetData< TYPE >::return_type getIfExists(const std::string &location, const bool useRootInTES=true) const
Templated access to the data in Gaudi Transient Store.
StatusCode finalize() override
standard finalization method
Data provider interface definition.
This class represents an entry point to all the event specific data.
Definition: EventContext.h:24
STL class.
bool exist(IDataProviderSvc *svc, const std::string &location, const bool useRootInTES=true) const
Check the existence of a data object or container in the Gaudi Transient Event Store.
bool existDet(const std::string &location) const
Check the existence of detector objects in the Gaudi Transient Detector Store.
Gaudi::Utils::GetData< TYPE >::return_type getOrCreate(const std::string &location, const bool useRootInTES=true) const
Get the existing data object from Gaudi Event Transient store.
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
bool existDet(IDataProviderSvc *svc, const std::string &location) const
Check the existence of detector objects in the Gaudi Transient Detector Store.
The useful base class for data processing algorithms.
T move(T... args)
StatusCode initialize() override
standard initialization method
bool exist(const std::string &location, const bool useRootInTES=true) const
Check the existence of a data object or container in the Gaudi Transient Event Store.
STL class.
GaudiCommon & operator=(const GaudiCommon &)=delete
Gaudi::Utils::GetData< TYPE >::return_type get(IDataProviderSvc *svc, const std::string &location, const bool useRootInTES=true) const
Templated access to the data in Gaudi Transient Store.
TYPE * getDet(IDataProviderSvc *svc, const std::string &location) const
Templated access to the detector data from the Gaudi Detector Transient Store.
Implements the common functionality between GaudiTools and GaudiAlgorithms.
Definition: GaudiCommon.h:91
void put(IDataProviderSvc *svc, DataObject *object, const std::string &address, const bool useRootInTES=true) const
Register a data object or container into Gaudi Event Transient Store.
#define GAUDI_API
Definition: Kernel.h:71
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30
Gaudi::Utils::GetData< TYPE >::return_type getIfExists(IDataProviderSvc *svc, const std::string &location, const bool useRootInTES=true) const
Templated access to the data in Gaudi Transient Store.
const DataObject * put(std::unique_ptr< DataObject > object, const std::string &address, const bool useRootInTES=true) const
TYPE * getDet(const std::string &location) const
Templated access to the detector data from the Gaudi Detector Transient Store.
Gaudi::Utils::GetData< TYPE >::return_type getOrCreate(IDataProviderSvc *svc, const std::string &location, const bool useRootInTES=true) const
Get the existing data object from Gaudi Event Transient store.