Loading [MathJax]/jax/input/TeX/config.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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 #include "xAODRootAccess/TEvent.h"
11 
12 // Complain if we try using this header in Athena:
13 #if !defined(XAOD_STANDALONE) && !defined(__CPPCHECK__)
14 # error "This header should not be used in Athena"
15 #endif // XAOD_STANDALONE
16 
17 #include <memory>
18 #include <vector>
19 
20 // Forward declaration(s):
21 namespace xAOD {
22  class TEvent;
23 } // namespace xAOD
24 
25 namespace asg {
26 
45  class SgTEventMeta {
46 
47  public:
49  enum StoreType {
50  InputStore = 0,
51  OutputStore = 1
52  }; // enum StoreType
53 
56 
58  SgTEventMeta(SgTEventMeta&& other) noexcept;
59 
62 
65 
66  // Prevent copying
67  SgTEventMeta(const SgTEventMeta&) = delete;
68  SgTEventMeta& operator=(const SgTEventMeta&) = delete;
69 
72 
74  template< typename T >
75  bool contains( const std::string& name );
77  template< typename T >
78  bool transientContains( const std::string& name ) const;
79 
81  template< typename T >
82  StatusCode retrieve( T*& obj, const std::string& name );
84  template< typename T >
85  StatusCode retrieve( const T*& obj, const std::string& name );
86 
88  template< typename T >
89  StatusCode record( std::unique_ptr<T> obj, const std::string& cname );
90 
92  template< typename T >
93  StatusCode record( T* obj, const std::string& name );
94 
98  template< typename T >
99  void keys( std::vector<std::string>& vkeys ) const;
100 
102 
103  private:
105  StatusCode initialize() const;
106 
110  mutable std::atomic<xAOD::TEvent*> m_event;
111 
112  }; // class SgTEventMeta
113 
114 } // namespace asg
115 
116 // Include the template implementation:
117 #include "AsgTools/SgTEventMeta.icc"
118 
119 #endif // ASGTOOLS_SGTEVENTMETA_H
asg::SgTEventMeta::OutputStore
@ OutputStore
This store is used to access the output metadata.
Definition: SgTEventMeta.h:51
asg::SgTEventMeta::record
StatusCode record(T *obj, const std::string &name)
Record an object into the store.
SgTEventMeta.icc
asg::SgTEventMeta::SgTEventMeta
SgTEventMeta(const SgTEventMeta &)=delete
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
python.CaloAddPedShiftConfig.type
type
Definition: CaloAddPedShiftConfig.py:42
asg::SgTEventMeta::StoreType
StoreType
Type of the store that this object implements.
Definition: SgTEventMeta.h:49
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:46
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.
TEvent.h
asg::SgTEventMeta::operator=
SgTEventMeta & operator=(SgTEventMeta &&other) noexcept
Move assignment operator.
Definition: SgTEventMeta.cxx:26
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:228
asg::SgTEventMeta::m_type
StoreType m_type
Type of this store.
Definition: SgTEventMeta.h:108
asg::SgTEventMeta::operator=
SgTEventMeta & operator=(const SgTEventMeta &)=delete
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:50
InDetDD::other
@ other
Definition: InDetDD_Defs.h:16
asg::SgTEventMeta
Wrapper class providing StoreGate-like access to metadata in ROOT.
Definition: SgTEventMeta.h:45
asg::SgTEventMeta::transientContains
bool transientContains(const std::string &name) const
Check if an object is available for non-constant access.
asg::SgTEventMeta::m_event
std::atomic< xAOD::TEvent * > m_event
Pointer to the xAOD::TEvent object in use.
Definition: SgTEventMeta.h:110
python.PyAthena.obj
obj
Definition: PyAthena.py:132
xAOD::TEvent
Tool for accessing xAOD files outside of Athena.
Definition: Control/xAODRootAccess/xAODRootAccess/TEvent.h:85