The Gaudi Framework  v29r0 (ff2e7097)
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 {
96 public:
97  // ==========================================================================
103  StatusCode initialize() override;
104  // ==========================================================================
110  StatusCode execute() override;
111  // ==========================================================================
117  StatusCode finalize() override;
118  // ==========================================================================
125  StatusCode sysExecute( const EventContext& ctx ) override;
126  // ==========================================================================
127 public:
128  // following methods cannot go in GaudiCommon since they use methods ( evtSvc()
129  // and detDvc() ) that are not members of AlgTool.
130  // Also some methods seem which are members of the base class do not seem
131  // to be found unless forwarding methods are put here ??
132 
165  inline void put( IDataProviderSvc* svc, DataObject* object, const std::string& address,
166  const bool useRootInTES = true ) const
167  {
168  GaudiCommon<Algorithm>::put( svc, object, address, useRootInTES );
169  }
170 
202  inline void put( DataObject* object, const std::string& address, const bool useRootInTES = true ) const
203  {
204  GaudiCommon<Algorithm>::put( evtSvc(), object, address, useRootInTES );
205  }
206 
239  template <class TYPE>
241  const bool useRootInTES = true ) const
242  {
243  return GaudiCommon<Algorithm>::get<TYPE>( svc, location, useRootInTES );
244  }
245 
279  template <class TYPE>
281  getIfExists( IDataProviderSvc* svc, const std::string& location, const bool useRootInTES = true ) const
282  {
283  return GaudiCommon<Algorithm>::getIfExists<TYPE>( svc, location, useRootInTES );
284  }
285 
312  template <class TYPE>
314  const bool useRootInTES = true ) const
315  {
316  return GaudiCommon<Algorithm>::get<TYPE>( evtSvc(), location, useRootInTES );
317  }
318 
351  template <class TYPE>
353  const bool useRootInTES = true ) const
354  {
355  return GaudiCommon<Algorithm>::getIfExists<TYPE>( evtSvc(), location, useRootInTES );
356  }
357 
376  template <class TYPE>
377  inline TYPE* getDet( IDataProviderSvc* svc, const std::string& location ) const
378  {
379  return GaudiCommon<Algorithm>::get<TYPE>( svc, location, false );
380  }
381 
404  template <class TYPE>
406  const std::string& location ) const
407  {
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  {
431  return GaudiCommon<Algorithm>::get<TYPE>( detSvc(), location, false );
432  }
433 
455  template <class TYPE>
456  inline typename Gaudi::Utils::GetData<TYPE>::return_type getDetIfExists( const std::string& location ) const
457  {
458  return GaudiCommon<Algorithm>::getIfExists<TYPE>( detSvc(), location, false );
459  }
460 
487  template <class TYPE>
488  inline bool exist( IDataProviderSvc* svc, const std::string& location, const bool useRootInTES = true ) const
489  {
490  return GaudiCommon<Algorithm>::exist<TYPE>( svc, location, useRootInTES );
491  }
492 
518  template <class TYPE>
519  inline bool exist( const std::string& location, const bool useRootInTES = true ) const
520  {
521  return GaudiCommon<Algorithm>::exist<TYPE>( evtSvc(), location, useRootInTES );
522  }
523 
540  template <class TYPE>
541  inline bool existDet( IDataProviderSvc* svc, const std::string& location ) const
542  {
543  return GaudiCommon<Algorithm>::exist<TYPE>( svc, location, false );
544  }
545 
561  template <class TYPE>
562  inline bool existDet( const std::string& location ) const
563  {
564  return GaudiCommon<Algorithm>::exist<TYPE>( detSvc(), location, false );
565  }
566 
594  template <class TYPE, class TYPE2>
596  getOrCreate( IDataProviderSvc* svc, const std::string& location, const bool useRootInTES = true ) const
597  {
598  return GaudiCommon<Algorithm>::getOrCreate<TYPE, TYPE2>( svc, location, useRootInTES );
599  }
600 
627  template <class TYPE, class TYPE2>
629  const bool useRootInTES = true ) const
630  {
631  return GaudiCommon<Algorithm>::getOrCreate<TYPE, TYPE2>( evtSvc(), location, useRootInTES );
632  }
633 
634 public:
635  // ==========================================================================
641  GaudiAlgorithm( const std::string& name, ISvcLocator* pSvcLocator );
642  // ==========================================================================
644  ~GaudiAlgorithm() override = default;
645  // ==========================================================================
646 public:
647  // ==========================================================================
651  SmartIF<INTupleSvc>& evtColSvc() const;
652  // ==========================================================================
653  // no default/copy constructor, no assignment -- except that ROOT really
654  // wants a default constructor declared. So we define it, and don't implement
655  // it...
656  GaudiAlgorithm( const GaudiAlgorithm& ) = delete;
657  GaudiAlgorithm& operator=( const GaudiAlgorithm& ) = delete;
658 
659 private:
660  GaudiAlgorithm();
661  // ==========================================================================
662 private:
663  // ==========================================================================
664  // Pointer to the Event Tag Collection Service
666 
668  this, "VetoObjects", {}, "skip execute if one or more of these TES objects exist"};
670  this, "RequireObjects", {}, "execute only if one or more of these TES objects exist"};
671  // ==========================================================================
672 };
673 // ============================================================================
674 // The END
675 // ============================================================================
676 #endif // GAUDIALG_GaudiAlgorithm_H
677 // ============================================================================
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
DataObject * put(IDataProviderSvc *svc, DataObject *object, const std::string &location, const bool useRootInTES=true) const
Register a data object or container into Gaudi Event Transient Store.
Implementation of property with value of concrete type.
Definition: Property.h:319
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:41
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:24
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:28
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.
void put(DataObject *object, const std::string &address, const bool useRootInTES=true) const
Register a data object or container into Gaudi Event Transient Store.
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.
GaudiCommon & operator=(const GaudiCommon &)=delete
Implements the common functionality between GaudiTools and GaudiAlgorithms.
Definition: GaudiCommon.h:80
#define GAUDI_API
Definition: Kernel.h:110
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:29
SmartIF< SERVICE > svc(const std::string &name, const bool create=true) const
A useful method for the easy location of services.