ATLAS Offline Software
|
Wrapper class providing StoreGate-like access to metadata in ROOT. More...
#include <SgTEventMeta.h>
Public Types | |
enum | StoreType { InputStore = 0, OutputStore = 1 } |
Type of the store that this object implements. More... | |
Public Member Functions | |
SgTEventMeta (StoreType type, xAOD::TEvent *event=0) | |
Constructor with a type and an optional TEvent pointer. More... | |
Functions providing access to the metadata payload | |
template<typename T > | |
bool | contains (const std::string &name) |
Check if an object is available for constant access. More... | |
template<typename T > | |
bool | transientContains (const std::string &name) const |
Check if an object is available for non-constant access. More... | |
template<typename T > | |
StatusCode | retrieve (T *&obj, const std::string &name) |
Retrieve a non-constant pointer to an object in the store. More... | |
template<typename T > | |
StatusCode | retrieve (const T *&obj, const std::string &name) |
Retrieve a constant pointer to an object in the store. More... | |
template<typename T > | |
StatusCode | record (std::unique_ptr< T > obj, const std::string &cname) |
Record an object/container using a smart pointer for ownership. More... | |
template<typename T > | |
StatusCode | record (T *obj, const std::string &name) |
Record an object into the store. More... | |
template<typename T > | |
void | keys (std::vector< std::string > &vkeys) const |
provide list of all keys associated with a type. More... | |
Private Member Functions | |
StatusCode | initialize () const |
Function initialising the object. More... | |
Private Attributes | |
StoreType | m_type |
Type of this store. More... | |
xAOD::TEvent * | m_event |
Pointer to the xAOD::TEvent object in use. More... | |
Wrapper class providing StoreGate-like access to metadata in ROOT.
In Athena we access the input and output metadata stores with two separate StoreGateSvc instances. In ROOT the access to the metadata content of the input/output files is provided using the same xAOD::TEvent object that we use to access the event content of these files as well. To emulate the same pattern for the dual-use tools that Athena provides, this wrapper is used.
It behaves pretty much like SgTEvent, but I didn't want to make that class even more complicated. Instead decided to implement the metadata access using this independent class.
Definition at line 44 of file SgTEventMeta.h.
Type of the store that this object implements.
Enumerator | |
---|---|
InputStore | This store is used to access the input metadata. |
OutputStore | This store is used to access the output metadata. |
Definition at line 48 of file SgTEventMeta.h.
asg::SgTEventMeta::SgTEventMeta | ( | StoreType | type, |
xAOD::TEvent * | event = 0 |
||
) |
bool asg::SgTEventMeta::contains | ( | const std::string & | name | ) |
Check if an object is available for constant access.
|
private |
Function initialising the object.
This function is used by the template functions to try to retrieve a valid pointer to the active TEvent object, if one is not available yet.
StatusCode::FAILURE
if TEvent can't be found, StatusCode::SUCCESS
otherwise Definition at line 28 of file SgTEventMeta.cxx.
void asg::SgTEventMeta::keys | ( | std::vector< std::string > & | vkeys | ) | const |
provide list of all keys associated with a type.
usage: store->keys< type >(vector_to_fill)
vkeys | will be filled with list of keys (may be empty) |
StatusCode asg::SgTEventMeta::record | ( | std::unique_ptr< T > | obj, |
const std::string & | cname | ||
) |
Record an object/container using a smart pointer for ownership.
StatusCode asg::SgTEventMeta::record | ( | T * | obj, |
const std::string & | name | ||
) |
Record an object into the store.
StatusCode asg::SgTEventMeta::retrieve | ( | const T *& | obj, |
const std::string & | name | ||
) |
Retrieve a constant pointer to an object in the store.
StatusCode asg::SgTEventMeta::retrieve | ( | T *& | obj, |
const std::string & | name | ||
) |
Retrieve a non-constant pointer to an object in the store.
bool asg::SgTEventMeta::transientContains | ( | const std::string & | name | ) | const |
Check if an object is available for non-constant access.
|
mutableprivate |
Pointer to the xAOD::TEvent object in use.
Definition at line 96 of file SgTEventMeta.h.
|
private |
Type of this store.
Definition at line 94 of file SgTEventMeta.h.