| The Gaudi Framework v29r0 (ff2e7097)

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

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 {
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>
240 inline typename Gaudi::Utils::GetData<TYPE>::return_type get( IDataProviderSvc* svc, const std::string& location,
241 const bool useRootInTES = true ) const
242 {
243 return GaudiCommon<Algorithm>::get<TYPE>( svc, location, useRootInTES );
244 }
245
279 template <class TYPE>
280 inline typename Gaudi::Utils::GetData<TYPE>::return_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>
313 inline typename Gaudi::Utils::GetData<TYPE>::return_type get( const std::string& location,
314 const bool useRootInTES = true ) const
315 {
316 return GaudiCommon<Algorithm>::get<TYPE>( evtSvc(), location, useRootInTES );
317 }
318
351 template <class TYPE>
352 inline typename Gaudi::Utils::GetData<TYPE>::return_type getIfExists( const std::string& location,
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>
405 inline typename Gaudi::Utils::GetData<TYPE>::return_type getDetIfExists( IDataProviderSvc* svc,
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>
595 inline typename Gaudi::Utils::GetData<TYPE>::return_type
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>
628 inline typename Gaudi::Utils::GetData<TYPE>::return_type getOrCreate( const std::string& location,
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
665 mutable SmartIF<INTupleSvc> m_evtColSvc;
666
667 Gaudi::Property<std::vector<std::string>> m_vetoObjs{
668 this, "VetoObjects", {}, "skip execute if one or more of these TES objects exist"};
669 Gaudi::Property<std::vector<std::string>> m_requireObjs{
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 // ============================================================================
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:519
Algorithm.h
SmartIF< INTupleSvc >
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
GaudiAlgorithm::m_evtColSvc
SmartIF< INTupleSvc > m_evtColSvc
Event Tag Collection Service.
Definition: GaudiAlgorithm.h:665
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:32
GaudiCommon::put
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.
Definition: GaudiCommon.icpp:597
Gaudi::Property
Implementation of property with value of concrete type.
Definition: Property.h:319
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:628
Gaudi::Functional::execute
StatusCode execute() override final
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:377
GaudiPython.HistoUtils.location
location
Definition: HistoUtils.py:899
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:488
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
Gaudi::Utils::GetData
Helper structure for implementation of "get"-functions for GaudiCommon<BASE>
Definition: GaudiCommon.h:41
GaudiCommon::finalize
StatusCode finalize() override
standard finalization method
Definition: GaudiCommon.icpp:208
IDataProviderSvc
Data provider interface definition.
Definition: IDataProviderSvc.h:45
GaudiAlgorithm::existDet
bool existDet(const std::string &location) const
Check the existence of detector objects in the Gaudi Transient Detector Store.
Definition: GaudiAlgorithm.h:562
EventContext
This class represents an entry point to all the event specific data.
Definition: EventContext.h:24
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:352
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:541
GaudiCommon.h
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:405
std::string
STL class.
INTupleSvc
Definition: INTupleSvc.h:37
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:456
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:28
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:281
GaudiAlgorithm
The useful base class for data processing algorithms.
Definition: GaudiAlgorithm.h:94
GaudiAlgorithm::put
void 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:202
GaudiAlg.h
GaudiCommon::initialize
StatusCode initialize() override
standard initialization method
Definition: GaudiCommon.icpp:114
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:596
GaudiCommon::operator=
GaudiCommon & operator=(const GaudiCommon &)=delete
GaudiCommon
Implements the common functionality between GaudiTools and GaudiAlgorithms.
Definition: GaudiCommon.h:80
GAUDI_API
#define GAUDI_API
Definition: Kernel.h:110
DataObject
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:29
GaudiCommon::svc
SmartIF< SERVICE > svc(const std::string &name, const bool create=true) const
A useful method for the easy location of services.
Definition: GaudiCommonImp.h:158
DataObjectHandle.h