| The Gaudi Framework v32r1 (f65d50dc)

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"
17 #include "GaudiKernel/DataObjectHandle.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>
246 typename Gaudi::Utils::GetData<TYPE>::return_type get( IDataProviderSvc* svc, const std::string& location,
247 const bool useRootInTES = true ) const {
248 return GaudiCommon<Algorithm>::get<TYPE>( svc, location, useRootInTES );
249 }
250
284 template <class TYPE>
285 typename Gaudi::Utils::GetData<TYPE>::return_type getIfExists( IDataProviderSvc* svc, const std::string& location,
286 const bool useRootInTES = true ) const {
287 return GaudiCommon<Algorithm>::getIfExists<TYPE>( svc, location, useRootInTES );
288 }
289
316 template <class TYPE>
317 typename Gaudi::Utils::GetData<TYPE>::return_type get( const std::string& location,
318 const bool useRootInTES = true ) const {
319 return GaudiCommon<Algorithm>::get<TYPE>( evtSvc(), location, useRootInTES );
320 }
321
354 template <class TYPE>
355 typename Gaudi::Utils::GetData<TYPE>::return_type getIfExists( const std::string& location,
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>
406 typename Gaudi::Utils::GetData<TYPE>::return_type getDetIfExists( IDataProviderSvc* svc,
407 const std::string& location ) const {
408 return GaudiCommon<Algorithm>::getIfExists<TYPE>( svc, location, false );
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>
455 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 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>
589 typename Gaudi::Utils::GetData<TYPE>::return_type getOrCreate( IDataProviderSvc* svc, const std::string& location,
590 const bool useRootInTES = true ) const {
591 return GaudiCommon<Algorithm>::getOrCreate<TYPE, TYPE2>( svc, location, useRootInTES );
592 }
593
620 template <class TYPE, class TYPE2>
621 typename Gaudi::Utils::GetData<TYPE>::return_type getOrCreate( const std::string& location,
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
652 mutable SmartIF<INTupleSvc> m_evtColSvc;
653
654 Gaudi::Property<std::vector<std::string>> m_vetoObjs{
655 this, "VetoObjects", {}, "skip execute if one or more of these TES objects exist"};
656 Gaudi::Property<std::vector<std::string>> m_requireObjs{
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
GaudiAlgorithm::put
void put(IDataProviderSvc *svc, std::unique_ptr< DataObject > object, const std::string &address, const bool useRootInTES=true) const
Definition: GaudiAlgorithm.h:169
Algorithm.h
SmartIF< INTupleSvc >
GaudiAlgorithm::get
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.
Definition: GaudiAlgorithm.h:317
GaudiAlgorithm::m_evtColSvc
SmartIF< INTupleSvc > m_evtColSvc
Event Tag Collection Service.
Definition: GaudiAlgorithm.h:652
ISvcLocator
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition: ISvcLocator.h:25
gaudiComponentHelp.name
name
Definition: gaudiComponentHelp.py:41
Gaudi::Property
Implementation of property with value of concrete type.
Definition: Property.h:352
GaudiAlgorithm::getDetIfExists
Gaudi::Utils::GetData< TYPE >::return_type getDetIfExists(const std::string &location) const
Templated access to the detector data from the Gaudi Detector Transient Store.
Definition: GaudiAlgorithm.h:455
GaudiAlgorithm::getDetIfExists
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.
Definition: GaudiAlgorithm.h:406
GaudiAlgorithm::put
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.
Definition: GaudiAlgorithm.h:205
GaudiPython.HistoUtils.location
location
Definition: HistoUtils.py:936
Gaudi::Utils::GetData
Helper structure for implementation of "get"-functions for GaudiCommon<BASE>
Definition: GaudiCommon.h:53
GaudiCommon::put
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.
Definition: GaudiCommon.icpp:486
GaudiAlgorithm::getIfExists
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.
Definition: GaudiAlgorithm.h:355
GaudiCommon::finalize
StatusCode finalize() override
standard finalization method
Definition: GaudiCommon.icpp:131
IDataProviderSvc
Data provider interface definition.
Definition: IDataProviderSvc.h:43
EventContext
This class represents an entry point to all the event specific data.
Definition: EventContext.h:24
GaudiCommon.h
std::string
STL class.
GaudiAlgorithm::exist
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.
Definition: GaudiAlgorithm.h:486
INTupleSvc
Definition: INTupleSvc.h:36
GaudiAlgorithm::existDet
bool existDet(const std::string &location) const
Check the existence of detector objects in the Gaudi Transient Detector Store.
Definition: GaudiAlgorithm.h:557
GaudiAlgorithm::getOrCreate
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.
Definition: GaudiAlgorithm.h:621
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
GaudiAlgorithm::existDet
bool existDet(IDataProviderSvc *svc, const std::string &location) const
Check the existence of detector objects in the Gaudi Transient Detector Store.
Definition: GaudiAlgorithm.h:537
GaudiAlgorithm
The useful base class for data processing algorithms.
Definition: GaudiAlgorithm.h:94
std::move
T move(T... args)
GaudiAlg.h
GaudiCommon::initialize
StatusCode initialize() override
standard initialization method
Definition: GaudiCommon.icpp:95
GaudiAlgorithm::exist
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.
Definition: GaudiAlgorithm.h:516
std::unique_ptr
STL class.
GaudiCommon::operator=
GaudiCommon & operator=(const GaudiCommon &)=delete
GaudiAlgorithm::get
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.
Definition: GaudiAlgorithm.h:246
GaudiAlgorithm::getDet
TYPE * getDet(IDataProviderSvc *svc, const std::string &location) const
Templated access to the detector data from the Gaudi Detector Transient Store.
Definition: GaudiAlgorithm.h:379
GaudiCommon
Implements the common functionality between GaudiTools and GaudiAlgorithms.
Definition: GaudiCommon.h:91
GaudiAlgorithm::put
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.
Definition: GaudiAlgorithm.h:165
GAUDI_API
#define GAUDI_API
Definition: Kernel.h:71
DataObject
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30
GaudiAlgorithm::getIfExists
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.
Definition: GaudiAlgorithm.h:285
GaudiAlgorithm::put
const DataObject * put(std::unique_ptr< DataObject > object, const std::string &address, const bool useRootInTES=true) const
Definition: GaudiAlgorithm.h:208
GaudiAlgorithm::getDet
TYPE * getDet(const std::string &location) const
Templated access to the detector data from the Gaudi Detector Transient Store.
Definition: GaudiAlgorithm.h:429
GaudiAlgorithm::getOrCreate
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.
Definition: GaudiAlgorithm.h:589
DataObjectHandle.h