ATLAS Offline Software
TPyStore.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 // ROOT include(s):
6 #include <TClass.h>
7 #include <TError.h>
8 
9 // Local include(s):
12 
13 namespace xAOD {
14 
27  ::Bool_t TPyStore::contains( const std::string& key,
28  const std::string& type ) const {
29 
30  // Try to access the dictionary of this type:
31  ::TClass* cl = ::TClass::GetClass( type.c_str() );
32  if( ! cl ) {
33  ::Warning( "xAOD::TPyStore::contains",
34  "Type name \"%s\" not known", type.c_str() );
35  return kFALSE;
36  }
37 
38  // Check if the dictionary can return a type_info:
39  const std::type_info* ti = cl->GetTypeInfo();
40  if( ! ti ) {
41  ::Warning( "xAOD::TPyStore::contains",
42  "Type \"%s\" doesn't have a proper dictionary",
43  type.c_str() );
44  return kFALSE;
45  }
46 
47  // Use the base class to answer the question:
48  return TStore::contains( key, *ti );
49  }
50 
63  ::Bool_t TPyStore::isConst( const std::string& key,
64  const std::string& type ) const {
65 
66  // Try to access the dictionary of this type:
67  ::TClass* cl = ::TClass::GetClass( type.c_str() );
68  if( ! cl ) {
69  ::Warning( "xAOD::TPyStore::isConst",
70  "Type name \"%s\" not known", type.c_str() );
71  return kFALSE;
72  }
73 
74  // Check if the dictionary can return a type_info:
75  const std::type_info* ti = cl->GetTypeInfo();
76  if( ! ti ) {
77  ::Warning( "xAOD::TPyStore::isConst",
78  "Type \"%s\" doesn't have a proper dictionary",
79  type.c_str() );
80  return kFALSE;
81  }
82 
83  // Use the base class to answer the question:
84  return TStore::isConst( key, *ti );
85  }
86 
104  StatusCode TPyStore::record( void* obj, const std::string& key,
105  const std::string& type ) {
106 
107  // Simply forward the call to the appropriate function from the base
108  // class:
109  RETURN_CHECK( "xAOD::TPyStore::record",
111  /*isOwner*/kFALSE, /*isConst*/kFALSE ) );
112 
113  // Return gracefully:
114  return StatusCode::SUCCESS;
115  }
116 
121  void TPyStore::dump() const {
122 
123  print();
124  return;
125  }
126 
127 } // namespace xAOD
RETURN_CHECK
#define RETURN_CHECK(CONTEXT, EXP)
Helper macro for checking return codes in a compact form in the code.
Definition: ReturnCheck.h:26
xAOD::TPyStore::dump
void dump() const
Print the contents of the store using a Python friendly function.
Definition: TPyStore.cxx:121
xAOD
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
Definition: ICaloAffectedTool.h:24
xAOD::TPyStore::isConst
::Bool_t isConst(const std::string &key, const std::string &type) const
Function checking if an object with a given key and type is constant.
Definition: TPyStore.cxx:63
xAOD::TPyStore::contains
::Bool_t contains(const std::string &key, const std::string &type) const
Function checking if an object with a given key and type is available.
Definition: TPyStore.cxx:27
ReturnCheck.h
xAOD::TStore::contains
::Bool_t contains(const std::string &key) const
Function checking if an object is available from the store.
xAOD::TStore::isConst
::Bool_t isConst(const std::string &key) const
Function checking if an object with a given type is constant.
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
TPyStore.h
xAOD::TStore::print
void print() const
Print the current contents of the transient store.
Definition: TStore.cxx:124
xAOD::TStore::record
StatusCode record(T *obj, const std::string &key)
Add an object to the store.
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
xAOD::TPyStore::record
StatusCode record(void *obj, const std::string &key, const std::string &type)
Record an object into the store in a typeless way.
Definition: TPyStore.cxx:104
python.PyAthena.obj
obj
Definition: PyAthena.py:135
dq_make_web_display.cl
cl
print [x.__class__ for x in toList(dqregion.getSubRegions()) ]
Definition: dq_make_web_display.py:26
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37