ATLAS Offline Software
Loading...
Searching...
No Matches
SgTEvent.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_SGTEVENT_H
6#define ASGTOOLS_SGTEVENT_H
7
8// System include(s):
9#include <memory>
10#include <string>
11#include <vector>
12
13// Local include(s):
15
16// Complain if we try using this header in Athena:
17#if !defined(XAOD_STANDALONE) && !defined(__CPPCHECK__)
18# error( "This header should only be used for standalone ASG" )
19#endif
20
21// Forward declaration(s):
22namespace xAOD {
23 class TEvent;
24 class TStore;
25} // namespace xAOD
26
27namespace asg {
28
44 class SgTEvent {
45
46 public:
48 SgTEvent( xAOD::TEvent* pevm = 0, xAOD::TStore* ptds = 0 );
49
51 xAOD::TEvent* event() const;
52
54 xAOD::TStore* tds() const;
55
58
60 template< typename T >
61 bool contains( const std::string& name ) const;
63 template< typename T >
64 bool transientContains( const std::string& name ) const;
65
67 template< typename T >
68 T* retrieve( const std::string& name ) const;
69
71 template< typename T >
72 StatusCode retrieve( T*& pobj, const std::string& name );
74 template< typename T >
75 StatusCode retrieve( const T*& pobj, const std::string& name ) const;
76
78 template< typename T >
79 StatusCode record( std::unique_ptr<T> pobj, const std::string& cname );
80
82 template< typename T >
83 StatusCode record( T* pobj, const std::string& cname );
84
86 template< typename T >
87 StatusCode overwrite( T* pobj, const std::string& name,
88 bool allowMods, bool resetOnly = true,
89 bool noHist = false );
90
95 template< typename T >
96 void keys( std::vector< std::string >& vkeys ) const;
97
99
100 private:
102 StatusCode initialize() const;
103
108
109 }; // class SgTEvent
110
111} // namespace asg
112
113// Include the template implementation:
114#include "AsgTools/SgTEvent.icc"
115
116#endif // ASGTOOLS_SGTEVENT_H
StatusCode retrieve(T *&pobj, const std::string &name)
Retrieve a container from memory.
xAOD::TEvent * event() const
Return the underlying event manager.
Definition SgTEvent.cxx:24
StatusCode overwrite(T *pobj, const std::string &name, bool allowMods, bool resetOnly=true, bool noHist=false)
Overwrite an object/container in the transient store.
StatusCode initialize() const
Function initialising the object.
Definition SgTEvent.cxx:44
void keys(std::vector< std::string > &vkeys) const
provide list of all keys associated with an object.
StatusCode retrieve(const T *&pobj, const std::string &name) const
Retrieve a container from the input file or the memory.
bool contains(const std::string &name) const
Check if an object is available for constant access.
xAOD::TStore * m_ptds
Pointer to the TStore that this object interacts with.
Definition SgTEvent.h:107
StatusCode record(std::unique_ptr< T > pobj, const std::string &cname)
Record an object/container using a smart pointer for ownership.
T * retrieve(const std::string &name) const
Function retrieving a constant or non-constant object.
StatusCode record(T *pobj, const std::string &cname)
Record an object/container.
xAOD::TStore * tds() const
Return the underlying transient data store.
Definition SgTEvent.cxx:33
xAOD::TEvent * m_pevm
Pointer to the TEvent that this object interacts with.
Definition SgTEvent.h:105
bool transientContains(const std::string &name) const
Check if an object is available for non-constant access.
SgTEvent(xAOD::TEvent *pevm=0, xAOD::TStore *ptds=0)
Constructor specifying concrete TEvent and TStore objects.
Definition SgTEvent.cxx:19
Tool for accessing xAOD files outside of Athena.
A relatively simple transient store for objects created in analysis.
Definition TStore.h:45
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.