ATLAS Offline Software
VP1SGAccessHelper.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 
7 // //
8 // Header file for class VP1SGAccessHelper //
9 // //
10 // Description: Helper class for safe StoreGate retrieval //
11 // //
12 // Author: Thomas H. Kittelmann (Thomas.Kittelmann@cern.ch) //
13 // Initial version: March 2008 //
14 // //
16 
17 #ifndef VP1SGACCESSHELPER_H
18 #define VP1SGACCESSHELPER_H
19 
21 #include "StoreGate/StoreGateSvc.h"
22 #include <stdexcept>
24 
26 public:
27 
28  VP1SGAccessHelper( IVP1System *, const bool detStore = false );//For messages in gui (detStore=true takes detector rather than event store)
30  virtual ~VP1SGAccessHelper();
31 
33  //Retrieve objects by type and key:
34  template <typename T>
35  bool retrieve( const T* &, const QString& key ) const;//returns false and sets to null pointer in case of errors
36 
37  template <typename T>
38  const T* retrieve( const QString& key ) const;//returns a null pointer in case of errors
39 
40 
42  // Retrieve all objects of type T
43  template <typename T>
44  bool retrieve(SG::ConstIterator<T>& begin, SG::ConstIterator<T>& end, bool silent = false );//Returns false in case of errors.
45  //silent = true means all output will be redirected to verbose level
46  // -> NB: This DataHandle retrieval is something we should avoid in VP1!!!
47  // -> If you absolutely need to use it (due to bad implementations
48  // -> in upstream data providers), please use VP1SGContentsHelper
49  // -> to check that there is not more than one collection of the
50  // -> type you re trying to retrieve. If there is, abort!
51 
52 private:
53 
56 
57  class Imp;
58  Imp * m_d;
59 
60  StoreGateSvc * storeGate() const;
61  bool contains(const CLID& id, const QString&) const;
62 };
63 
65 
66 #endif
VP1SGAccessHelper::storeGate
StoreGateSvc * storeGate() const
Definition: VP1SGAccessHelper.cxx:58
VP1SGAccessHelper::operator=
VP1SGAccessHelper & operator=(const VP1SGAccessHelper &)
VP1SGAccessHelper::retrieve
const T * retrieve(const QString &key) const
VP1SGAccessHelper::Imp
Definition: VP1SGAccessHelper.cxx:20
VP1SGAccessHelper::~VP1SGAccessHelper
virtual ~VP1SGAccessHelper()
Definition: VP1SGAccessHelper.cxx:52
VP1SGAccessHelper::retrieve
bool retrieve(SG::ConstIterator< T > &begin, SG::ConstIterator< T > &end, bool silent=false)
PlotCalibFromCool.begin
begin
Definition: PlotCalibFromCool.py:94
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
StoreGateSvc
The Athena Transient Store API.
Definition: StoreGateSvc.h:128
IVP1System
Definition: IVP1System.h:36
VP1SGAccessHelper::VP1SGAccessHelper
VP1SGAccessHelper(const VP1SGAccessHelper &)
CLID
uint32_t CLID
The Class ID type.
Definition: Event/xAOD/xAODCore/xAODCore/ClassID_traits.h:47
VP1HelperClassBase
Definition: VP1HelperClassBase.h:28
VP1SGAccessHelper::retrieve
bool retrieve(const T *&, const QString &key) const
python.PyKernel.detStore
detStore
Definition: PyKernel.py:41
VP1SGAccessHelper::m_d
Imp * m_d
Definition: VP1SGAccessHelper.h:57
VP1HelperClassBase.h
VP1SGContentsHelper
Definition: VP1SGContentsHelper.h:26
python.trfDecorators.silent
def silent(func)
Redirect stdout/err to /dev/null Useful wrapper to get rid of ROOT verbosity...
Definition: trfDecorators.py:24
VP1SGAccessHelper.icc
VP1SGAccessHelper::contains
bool contains(const CLID &id, const QString &) const
Definition: VP1SGAccessHelper.cxx:64
VP1SGAccessHelper
Definition: VP1SGAccessHelper.h:25
StoreGateSvc.h
SG::ConstIterator
Definition: SGIterator.h:163
TSU::T
unsigned long long T
Definition: L1TopoDataTypes.h:35
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37
VP1SGAccessHelper::VP1SGAccessHelper
VP1SGAccessHelper(IVP1System *, const bool detStore=false)
Definition: VP1SGAccessHelper.cxx:33