Loading [MathJax]/extensions/tex2jax.js
The Gaudi Framework  v31r0 (aeb156f0)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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  inline 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  inline 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  inline 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  inline 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  getIfExists( IDataProviderSvc* svc, const std::string& location, 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  inline 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 {
408  return GaudiCommon<Algorithm>::getIfExists<TYPE>( svc, location, false );
409  }
410 
428  template <class TYPE>
429  inline TYPE* getDet( const std::string& location ) const {
430  return GaudiCommon<Algorithm>::get<TYPE>( detSvc(), location, false );
431  }
432 
454  template <class TYPE>
455  inline typename Gaudi::Utils::GetData<TYPE>::return_type getDetIfExists( const std::string& location ) const {
456  return GaudiCommon<Algorithm>::getIfExists<TYPE>( detSvc(), location, false );
457  }
458 
485  template <class TYPE>
486  inline 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  inline 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  inline 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  inline 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  getOrCreate( IDataProviderSvc* svc, const std::string& location, 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
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.
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.
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 getOrCreate(const std::string &location, const bool useRootInTES=true) const
Get the existing data object from Gaudi Event Transient store.
StatusCode execute() override final
TYPE * getDet(IDataProviderSvc *svc, const std::string &location) const
Templated access to the detector data from the Gaudi Detector Transient Store.
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.
TYPE * getDet(const std::string &location) const
Templated access to the detector data from the Gaudi Detector Transient Store.
Helper structure for implementation of "get"-functions for GaudiCommon<BASE>
Definition: GaudiCommon.h:54
StatusCode finalize() override
standard finalization method
Data provider interface definition.
bool existDet(const std::string &location) const
Check the existence of detector objects in the Gaudi Transient Detector Store.
This class represents an entry point to all the event specific data.
Definition: EventContext.h:31
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.
bool existDet(IDataProviderSvc *svc, const std::string &location) const
Check the existence of detector objects in the Gaudi Transient Detector 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.
STL class.
Gaudi::Utils::GetData< TYPE >::return_type getDetIfExists(const std::string &location) const
Templated access to the detector data from the Gaudi Detector Transient Store.
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
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(IDataProviderSvc *svc, const std::string &location, const bool useRootInTES=true) const
Templated access to the data in Gaudi Transient Store.
The useful base class for data processing algorithms.
const DataObject * put(std::unique_ptr< DataObject > object, const std::string &address, const bool useRootInTES=true) const
T move(T...args)
StatusCode initialize() override
standard initialization method
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.
STL class.
GaudiCommon & operator=(const GaudiCommon &)=delete
void put(IDataProviderSvc *svc, std::unique_ptr< DataObject > object, const std::string &address, const bool useRootInTES=true) const
Implements the common functionality between GaudiTools and GaudiAlgorithms.
Definition: GaudiCommon.h:92
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.
#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
SmartIF< SERVICE > svc(const std::string &name, const bool create=true) const
A useful method for the easy location of services.