ATLAS Offline Software
SgTEventMeta.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef ASGTOOLS_SGTEVENTMETA_H
6 #define ASGTOOLS_SGTEVENTMETA_H
7 
8 // Local include(s):
10 
11 // Complain if we try using this header in Athena:
12 #if !defined(XAOD_STANDALONE) && !defined(__CPPCHECK__)
13 # error "This header should not be used in Athena"
14 #endif // XAOD_STANDALONE
15 
16 #include <memory>
17 #include <vector>
18 
19 // Forward declaration(s):
20 namespace xAOD {
21  class TEvent;
22 } // namespace xAOD
23 
24 namespace asg {
25 
44  class SgTEventMeta {
45 
46  public:
48  enum StoreType {
49  InputStore = 0,
50  OutputStore = 1
51  }; // enum StoreType
52 
55 
58 
60  template< typename T >
61  bool contains( const std::string& name );
63  template< typename T >
64  bool transientContains( const std::string& name ) const;
65 
67  template< typename T >
68  StatusCode retrieve( T*& obj, const std::string& name );
70  template< typename T >
71  StatusCode retrieve( const T*& obj, const std::string& name );
72 
74  template< typename T >
75  StatusCode record( std::unique_ptr<T> obj, const std::string& cname );
76 
78  template< typename T >
79  StatusCode record( T* obj, const std::string& name );
80 
84  template< typename T >
85  void keys( std::vector<std::string>& vkeys ) const;
86 
88 
89  private:
91  StatusCode initialize() const;
92 
97 
98  }; // class SgTEventMeta
99 
100 } // namespace asg
101 
102 // Include the template implementation:
103 #include "AsgTools/SgTEventMeta.icc"
104 
105 #endif // ASGTOOLS_SGTEVENTMETA_H
asg::SgTEventMeta::OutputStore
@ OutputStore
This store is used to access the output metadata.
Definition: SgTEventMeta.h:50
asg::SgTEventMeta::record
StatusCode record(T *obj, const std::string &name)
Record an object into the store.
SgTEventMeta.icc
asg
Definition: DataHandleTestTool.h:28
xAOD
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
Definition: ICaloAffectedTool.h:24
asg::SgTEventMeta::StoreType
StoreType
Type of the store that this object implements.
Definition: SgTEventMeta.h:48
asg::SgTEventMeta::keys
void keys(std::vector< std::string > &vkeys) const
provide list of all keys associated with a type.
asg::SgTEventMeta::retrieve
StatusCode retrieve(T *&obj, const std::string &name)
Retrieve a non-constant pointer to an object in the store.
event
POOL::TEvent event(POOL::TEvent::kClassAccess)
asg::SgTEventMeta::initialize
StatusCode initialize() const
Function initialising the object.
Definition: SgTEventMeta.cxx:28
asg::SgTEventMeta::SgTEventMeta
SgTEventMeta(StoreType type, xAOD::TEvent *event=0)
Constructor with a type and an optional TEvent pointer.
Definition: SgTEventMeta.cxx:16
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
asg::SgTEventMeta::record
StatusCode record(std::unique_ptr< T > obj, const std::string &cname)
Record an object/container using a smart pointer for ownership.
asg::SgTEventMeta::m_event
xAOD::TEvent * m_event
Pointer to the xAOD::TEvent object in use.
Definition: SgTEventMeta.h:96
asg::SgTEventMeta::contains
bool contains(const std::string &name)
Check if an object is available for constant access.
StatusCode.h
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
asg::SgTEventMeta::m_type
StoreType m_type
Type of this store.
Definition: SgTEventMeta.h:94
asg::SgTEventMeta::retrieve
StatusCode retrieve(const T *&obj, const std::string &name)
Retrieve a constant pointer to an object in the store.
asg::SgTEventMeta::InputStore
@ InputStore
This store is used to access the input metadata.
Definition: SgTEventMeta.h:49
asg::SgTEventMeta
Wrapper class providing StoreGate-like access to metadata in ROOT.
Definition: SgTEventMeta.h:44
asg::SgTEventMeta::transientContains
bool transientContains(const std::string &name) const
Check if an object is available for non-constant access.
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
python.PyAthena.obj
obj
Definition: PyAthena.py:135
xAOD::TEvent
Tool for accessing xAOD files outside of Athena.
Definition: Control/xAODRootAccess/xAODRootAccess/TEvent.h:81