ATLAS Offline Software
Loading...
Searching...
No Matches
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):
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):
21namespace xAOD {
22 class TEvent;
23} // namespace xAOD
24
25namespace asg {
26
46
47 public:
49 enum StoreType {
52 }; // enum StoreType
53
56
58 SgTEventMeta(SgTEventMeta&& other) noexcept;
59
61 SgTEventMeta& operator=(SgTEventMeta&& other) noexcept;
62
65
66 // Prevent copying
67 SgTEventMeta(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:
118
119#endif // ASGTOOLS_SGTEVENTMETA_H
Wrapper class providing StoreGate-like access to metadata in ROOT.
StatusCode record(T *obj, const std::string &name)
Record an object into the store.
SgTEventMeta & operator=(SgTEventMeta &&other) noexcept
Move assignment operator.
StoreType
Type of the store that this object implements.
@ OutputStore
This store is used to access the output metadata.
@ InputStore
This store is used to access the input metadata.
StatusCode retrieve(const T *&obj, const std::string &name)
Retrieve a constant pointer to an object in the store.
SgTEventMeta & operator=(const SgTEventMeta &)=delete
StatusCode initialize() const
Function initialising the object.
StoreType m_type
Type of this store.
StatusCode retrieve(T *&obj, const std::string &name)
Retrieve a non-constant pointer to an object in the store.
SgTEventMeta(StoreType type, xAOD::TEvent *event=0)
Constructor with a type and an optional TEvent pointer.
void keys(std::vector< std::string > &vkeys) const
provide list of all keys associated with a type.
SgTEventMeta(const SgTEventMeta &)=delete
std::atomic< xAOD::TEvent * > m_event
Pointer to the xAOD::TEvent object in use.
bool contains(const std::string &name)
Check if an object is available for constant access.
bool transientContains(const std::string &name) const
Check if an object is available for non-constant access.
StatusCode record(std::unique_ptr< T > obj, const std::string &cname)
Record an object/container using a smart pointer for ownership.
Tool for accessing xAOD files outside of Athena.
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.