Loading [MathJax]/extensions/tex2jax.js
The Gaudi Framework  v36r11 (bdb84f5f)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
GaudiAlgorithm.h
Go to the documentation of this file.
1 /***********************************************************************************\
2 * (c) Copyright 1998-2019 CERN for the benefit of the LHCb and ATLAS collaborations *
3 * *
4 * This software is distributed under the terms of the Apache version 2 licence, *
5 * copied verbatim in the file "LICENSE". *
6 * *
7 * In applying this licence, CERN does not waive the privileges and immunities *
8 * granted to it by virtue of its status as an Intergovernmental Organization *
9 * or submit itself to any jurisdiction. *
10 \***********************************************************************************/
11 #ifndef GAUDIALG_GaudiAlgorithm_H
12 #define GAUDIALG_GaudiAlgorithm_H 1
13 // ============================================================================
14 // Include files
15 // ============================================================================
16 #include <string>
17 #include <vector>
18 // ============================================================================
19 // GaudiKernel
20 // ============================================================================
21 #include "GaudiKernel/Algorithm.h"
22 // ============================================================================
23 // GaudiAlg
24 // ============================================================================
25 #include "GaudiAlg/GaudiAlg.h"
26 #include "GaudiAlg/GaudiCommon.h"
28 // ============================================================================
29 // forward declarations:
30 // ============================================================================
31 class INTupleSvc;
32 
33 // ============================================================================
69 // ============================================================================
103 // ============================================================================
104 class GAUDI_API GaudiAlgorithm : public GaudiCommon<Algorithm> {
105 public:
106  // ==========================================================================
112  StatusCode initialize() override;
113  // ==========================================================================
119  StatusCode execute() override;
120  // ==========================================================================
126  StatusCode finalize() override;
127  // ==========================================================================
134  StatusCode sysExecute( const EventContext& ctx ) override;
135  // ==========================================================================
136 public:
137  // following methods cannot go in GaudiCommon since they use methods ( evtSvc()
138  // and detDvc() ) that are not members of AlgTool.
139  // Also some methods seem which are members of the base class do not seem
140  // to be found unless forwarding methods are put here ??
141 
174  // [[deprecated( "please pass a std::unique_ptr as 2nd argument" )]]
175  void put( IDataProviderSvc* svc, DataObject* object, const std::string& address,
176  const bool useRootInTES = true ) const {
177  put( svc, std::unique_ptr<DataObject>( object ), address, useRootInTES );
178  }
179  void put( IDataProviderSvc* svc, std::unique_ptr<DataObject> object, const std::string& address,
180  const bool useRootInTES = true ) const {
181  GaudiCommon<Algorithm>::put( svc, std::move( object ), address, useRootInTES );
182  }
183 
215  const DataObject* put( DataObject* object, const std::string& address, const bool useRootInTES = true ) const {
216  return put( std::unique_ptr<DataObject>( object ), address, useRootInTES );
217  }
218  const DataObject* put( std::unique_ptr<DataObject> object, const std::string& address,
219  const bool useRootInTES = true ) const {
220  return GaudiCommon<Algorithm>::put( evtSvc(), std::move( object ), address, useRootInTES );
221  }
222 
255  template <class TYPE>
257  const bool useRootInTES = true ) const {
258  return GaudiCommon<Algorithm>::get<TYPE>( svc, location, useRootInTES );
259  }
260 
294  template <class TYPE>
296  const bool useRootInTES = true ) const {
297  return GaudiCommon<Algorithm>::getIfExists<TYPE>( svc, location, useRootInTES );
298  }
299 
326  template <class TYPE>
328  const bool useRootInTES = true ) const {
329  return GaudiCommon<Algorithm>::get<TYPE>( evtSvc(), location, useRootInTES );
330  }
331 
364  template <class TYPE>
366  const bool useRootInTES = true ) const {
367  return GaudiCommon<Algorithm>::getIfExists<TYPE>( evtSvc(), location, useRootInTES );
368  }
369 
388  template <class TYPE>
389  TYPE* getDet( IDataProviderSvc* svc, const std::string& location ) const {
390  return GaudiCommon<Algorithm>::get<TYPE>( svc, location, false );
391  }
392 
415  template <class TYPE>
417  const std::string& location ) const {
419  }
420 
438  template <class TYPE>
439  TYPE* getDet( const std::string& location ) const {
440  return GaudiCommon<Algorithm>::get<TYPE>( detSvc(), location, false );
441  }
442 
464  template <class TYPE>
466  return GaudiCommon<Algorithm>::getIfExists<TYPE>( detSvc(), location, false );
467  }
468 
495  template <class TYPE>
496  bool exist( IDataProviderSvc* svc, const std::string& location, const bool useRootInTES = true ) const {
497  return GaudiCommon<Algorithm>::exist<TYPE>( svc, location, useRootInTES );
498  }
499 
525  template <class TYPE>
526  bool exist( const std::string& location, const bool useRootInTES = true ) const {
527  return GaudiCommon<Algorithm>::exist<TYPE>( evtSvc(), location, useRootInTES );
528  }
529 
546  template <class TYPE>
547  bool existDet( IDataProviderSvc* svc, const std::string& location ) const {
548  return GaudiCommon<Algorithm>::exist<TYPE>( svc, location, false );
549  }
550 
566  template <class TYPE>
567  bool existDet( const std::string& location ) const {
568  return GaudiCommon<Algorithm>::exist<TYPE>( detSvc(), location, false );
569  }
570 
598  template <class TYPE, class TYPE2>
600  const bool useRootInTES = true ) const {
601  return GaudiCommon<Algorithm>::getOrCreate<TYPE, TYPE2>( svc, location, useRootInTES );
602  }
603 
630  template <class TYPE, class TYPE2>
632  const bool useRootInTES = true ) const {
633  return GaudiCommon<Algorithm>::getOrCreate<TYPE, TYPE2>( evtSvc(), location, useRootInTES );
634  }
635 
636  // ==========================================================================
642  GaudiAlgorithm( std::string name, ISvcLocator* pSvcLocator );
643  // ==========================================================================
644  //
645  // no default/copy constructor, no assignment -- except that ROOT really
646  // wants a default constructor declared. So we define it, and don't implement
647  // it...
648  GaudiAlgorithm( const GaudiAlgorithm& ) = delete;
650  // ==========================================================================
651 public:
652  // ==========================================================================
656  SmartIF<INTupleSvc>& evtColSvc() const;
657 
658  // ==========================================================================
659 private:
660  // ==========================================================================
661  // Pointer to the Event Tag Collection Service
663 
665  this, "VetoObjects", {}, "skip execute if one or more of these TES objects exist" };
667  this, "RequireObjects", {}, "execute only if one or more of these TES objects exist" };
668  // ==========================================================================
669 };
670 // ============================================================================
671 // The END
672 // ============================================================================
673 #endif // GAUDIALG_GaudiAlgorithm_H
GaudiCommon.h
GaudiAlg.h
GaudiPython.HistoUtils.location
location
Definition: HistoUtils.py:965
std::string
STL class.
std::move
T move(T... args)
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:389
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:547
ISvcLocator
Definition: ISvcLocator.h:46
Algorithm.h
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:256
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:295
GaudiAlgorithm::put
const DataObject * put(std::unique_ptr< DataObject > object, const std::string &address, const bool useRootInTES=true) const
Definition: GaudiAlgorithm.h:218
GaudiAlgorithm::operator=
GaudiAlgorithm & operator=(const GaudiAlgorithm &)=delete
GaudiAlgorithm::getDet
TYPE * getDet(const std::string &location) const
Templated access to the detector data from the Gaudi Detector Transient Store.
Definition: GaudiAlgorithm.h:439
TimingHistograms.name
name
Definition: TimingHistograms.py:25
GaudiPython.Pythonizations.ctx
ctx
Definition: Pythonizations.py:588
StatusCode
Definition: StatusCode.h:65
GaudiPython.Pythonizations.execute
execute
Definition: Pythonizations.py:588
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:175
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:465
GaudiAlgorithm
Definition: GaudiAlgorithm.h:104
GaudiAlgorithm::put
void put(IDataProviderSvc *svc, std::unique_ptr< DataObject > object, const std::string &address, const bool useRootInTES=true) const
Definition: GaudiAlgorithm.h:179
GaudiAlgorithm::m_evtColSvc
SmartIF< INTupleSvc > m_evtColSvc
Event Tag Collection Service.
Definition: GaudiAlgorithm.h:662
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:416
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:327
GaudiCommon::put
DataObject * put(IDataProviderSvc *svc, std::unique_ptr< DataObject > object, std::string_view location, const bool useRootInTES=true) const
Register a data object or container into Gaudi Event Transient Store.
Definition: GaudiCommon.icpp:425
GaudiCommon::initialize
StatusCode initialize() override
standard initialization method
Definition: GaudiCommon.icpp:76
GaudiAlgorithm::GaudiAlgorithm
GaudiAlgorithm(const GaudiAlgorithm &)=delete
GaudiCommon::finalize
StatusCode finalize() override
standard finalization method
Definition: GaudiCommon.icpp:112
GaudiAlgorithm::getOrCreate
Gaudi::Utils::GetData< TYPE >::return_type getOrCreate(IDataProviderSvc *svc, std::string_view location, const bool useRootInTES=true) const
Get the existing data object from Gaudi Event Transient store.
Definition: GaudiAlgorithm.h:599
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:215
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:365
EventContext
Definition: EventContext.h:34
Gaudi::Utils::GetData::return_type
_GetType< Type >::return_type return_type
the actual return type
Definition: GetData.h:120
DataObject
Definition: DataObject.h:40
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:631
IDataProviderSvc
Definition: IDataProviderSvc.h:53
INTupleSvc
Definition: INTupleSvc.h:46
std::unique_ptr
STL class.
DataObjectHandle.h
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:496
GAUDI_API
#define GAUDI_API
Definition: Kernel.h:81
Gaudi::Property
Implementation of property with value of concrete type.
Definition: Property.h:39
GaudiAlgorithm::existDet
bool existDet(const std::string &location) const
Check the existence of detector objects in the Gaudi Transient Detector Store.
Definition: GaudiAlgorithm.h:567
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:526
GaudiCommon
Definition: GaudiCommon.h:95