ATLAS Offline Software
TVirtualEvent.h
Go to the documentation of this file.
1 // Dear emacs, this is -*- c++ -*-
2 //
3 // Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
4 //
5 #ifndef XAODROOTACCESSINTERFACES_TVIRTUALEVENT_H
6 #define XAODROOTACCESSINTERFACES_TVIRTUALEVENT_H
7 
8 #include "CxxUtils/sgkey_t.h"
9 
10 // System include(s):
11 extern "C" {
12 # include <stdint.h>
13 }
14 #include <string>
15 #include <vector>
16 
17 // Forward declaration(s):
18 namespace std {
19  class type_info;
20 }
21 
22 namespace xAOD {
23 
32  class TVirtualEvent {
33 
34  public:
36 
38  virtual ~TVirtualEvent() = default;
39 
41  static constexpr sgkey_t DEFAULT_KEY = ~static_cast<sgkey_t>(0);
43  static constexpr sgkey_t KEY_MASK = DEFAULT_KEY >> 2;
44 
46  template< typename T >
47  bool retrieve( const T*& obj, sgkey_t key = DEFAULT_KEY,
48  bool silent = false );
50  template< typename T >
51  bool retrieve( const T*& obj, const std::string& key,
52  bool silent = false );
53 
58  template< typename T >
59  void keys( std::vector< std::string >& vkeys,
60  bool metadata = false ) const;
61 
63  virtual sgkey_t getHash( const std::string& key ) const = 0;
65  virtual sgkey_t getKey( const void* obj ) const = 0;
67  virtual const std::string& getName( const void* obj ) const = 0;
69  virtual const std::string& getName( sgkey_t hash ) const = 0;
70 
71  protected:
73  virtual void* getOutputObject( sgkey_t key,
74  const std::type_info& ti ) = 0;
76  virtual const void* getInputObject( sgkey_t key,
77  const std::type_info& ti,
78  bool silent = false ) = 0;
80  virtual void getNames( const std::string& targetClassName,
81  std::vector<std::string>& vkeys,
82  bool metadata) const = 0;
83 
84  }; // class TVirtualEvent
85 
86 } // namespace xAOD
87 
88 // Include the template implementation:
89 #include "TVirtualEvent.icc"
90 
91 #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:41
xAOD::TVirtualEvent
Base interface for getting objects out of the input file.
Definition: TVirtualEvent.h:32
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:43
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
python.checkMetadata.metadata
metadata
Definition: checkMetadata.py:175
xAOD::TVirtualEvent::getNames
virtual void getNames(const std::string &targetClassName, std::vector< std::string > &vkeys, bool metadata) const =0
Function to retrieve list of keys describing a type name.
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.
xAOD::TVirtualEvent::keys
void keys(std::vector< std::string > &vkeys, bool metadata=false) const
provide list of all keys associated with provided type.
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:35
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:109
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