ATLAS Offline Software
TVirtualEvent.h
Go to the documentation of this file.
1 // Dear emacs, this is -*- c++ -*-
2 //
3 // Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
4 //
5 #ifndef XAODROOTACCESSINTERFACES_TVIRTUALEVENT_H
6 #define XAODROOTACCESSINTERFACES_TVIRTUALEVENT_H
7 
8 // Project include(s).
9 #include "CxxUtils/sgkey_t.h"
10 
11 // Forward declaration(s):
12 namespace std {
13  class type_info;
14 }
15 
16 namespace xAOD {
17 
26  class TVirtualEvent {
27 
28  public:
30 
32  virtual ~TVirtualEvent() = default;
33 
35  static constexpr sgkey_t DEFAULT_KEY = ~static_cast<sgkey_t>(0);
37  static constexpr sgkey_t KEY_MASK = DEFAULT_KEY >> 2;
38 
40  template< typename T >
41  bool retrieve( const T*& obj, sgkey_t key = DEFAULT_KEY,
42  bool silent = false );
44  template< typename T >
45  bool retrieve( const T*& obj, const std::string& key,
46  bool silent = false );
47 
49  virtual sgkey_t getHash( const std::string& key ) const = 0;
51  virtual sgkey_t getKey( const void* obj ) const = 0;
53  virtual const std::string& getName( const void* obj ) const = 0;
55  virtual const std::string& getName( sgkey_t hash ) const = 0;
56 
57  protected:
59  virtual void* getOutputObject( sgkey_t key,
60  const std::type_info& ti ) = 0;
62  virtual const void* getInputObject( sgkey_t key,
63  const std::type_info& ti,
64  bool silent = false ) = 0;
65 
66  }; // class TVirtualEvent
67 
68 } // namespace xAOD
69 
70 // Include the template implementation:
71 #include "TVirtualEvent.icc"
72 
73 #endif // XAODROOTACCESSINTERFACES_TVIRTUALEVENT_H
xAOD::TVirtualEvent::DEFAULT_KEY
static constexpr sgkey_t DEFAULT_KEY
Key for retrieving the "default" object of a given type.
Definition: TVirtualEvent.h:35
xAOD::TVirtualEvent
Base interface for getting objects out of the input file.
Definition: TVirtualEvent.h:26
xAOD::TVirtualEvent::getInputObject
virtual const void * getInputObject(sgkey_t key, const std::type_info &ti, bool silent=false)=0
Function for retrieving an input object in a non-template way.
xAOD::TVirtualEvent::getName
virtual const std::string & getName(const void *obj) const =0
Function returning the key describing a known object.
xAOD::TVirtualEvent::KEY_MASK
static constexpr sgkey_t KEY_MASK
Mask for the keys, used mostly internally.
Definition: TVirtualEvent.h:37
xAOD::TVirtualEvent::getHash
virtual sgkey_t getHash(const std::string &key) const =0
Function returning the hash describing an object's name/key.
xAOD
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
Definition: ICaloAffectedTool.h:24
xAOD::TVirtualEvent::getKey
virtual sgkey_t getKey(const void *obj) const =0
Function returning the hash describing a known object.
xAOD::TVirtualEvent::~TVirtualEvent
virtual ~TVirtualEvent()=default
Virtual destructor to make vtable happy.
SG::sgkey_t
uint32_t sgkey_t
Type used for hashed StoreGate key+CLID pairs.
Definition: CxxUtils/CxxUtils/sgkey_t.h:32
xAOD::TVirtualEvent::getOutputObject
virtual void * getOutputObject(sgkey_t key, const std::type_info &ti)=0
Function for retrieving an output object in a non-template way.
xAOD::TVirtualEvent::retrieve
bool retrieve(const T *&obj, sgkey_t key=DEFAULT_KEY, bool silent=false)
Function retrieving an object from the event (constant version)
xAOD::TVirtualEvent::retrieve
bool retrieve(const T *&obj, const std::string &key, bool silent=false)
Function retrieving an object from the event (constant version)
xAOD::TVirtualEvent::sgkey_t
SG::sgkey_t sgkey_t
Definition: TVirtualEvent.h:29
sgkey_t.h
Define the type used for hashed StoreGate key+CLID pairs.
python.trfDecorators.silent
def silent(func)
Redirect stdout/err to /dev/null Useful wrapper to get rid of ROOT verbosity...
Definition: trfDecorators.py:24
CaloCondBlobAlgs_fillNoiseFromASCII.hash
dictionary hash
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:108
TVirtualEvent.icc
python.PyAthena.obj
obj
Definition: PyAthena.py:132
xAOD::TVirtualEvent::getName
virtual const std::string & getName(sgkey_t hash) const =0
Function returning the key describing a known object.
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37