ATLAS Offline Software
TPyEvent.cxx
Go to the documentation of this file.
1 // Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
2 
3 // ROOT include(s):
4 #include <TClass.h>
5 #include <TError.h>
6 
7 // Local include(s):
10 
11 namespace xAOD {
12 
13  ::Bool_t TPyEvent::contains( const std::string& key,
14  const std::string& type ) {
15 
16  // Try to access the dictionary of this type:
17  ::TClass* cl = ::TClass::GetClass( type.c_str() );
18  if( ! cl ) {
19  ::Warning( "xAOD::TPyEvent::contains",
20  "Type name \"%s\" not known", type.c_str() );
21  return kFALSE;
22  }
23 
24  // Check if the dictionary can return a type_info:
25  const std::type_info* ti = cl->GetTypeInfo();
26  if( ! ti ) {
27  ::Warning( "xAOD::TPyEvent::contains",
28  "Type \"%s\" doesn't have a proper dictionary",
29  type.c_str() );
30  return kFALSE;
31  }
32 
33  // Let the base class do the work:
34  return TEvent::contains( key, *ti, kFALSE );
35  }
36 
37  ::Bool_t TPyEvent::transientContains( const std::string& key,
38  const std::string& type ) const {
39 
40  // Try to access the dictionary of this type:
41  ::TClass* cl = ::TClass::GetClass( type.c_str() );
42  if( ! cl ) {
43  ::Warning( "xAOD::TPyEvent::transientContains",
44  "Type name \"%s\" not known", type.c_str() );
45  return kFALSE;
46  }
47 
48  // Check if the dictionary can return a type_info:
49  const std::type_info* ti = cl->GetTypeInfo();
50  if( ! ti ) {
51  ::Warning( "xAOD::TPyEvent::transientContains",
52  "Type \"%s\" doesn't have a proper dictionary",
53  type.c_str() );
54  return kFALSE;
55  }
56 
57  // Let the base class do the work:
58  return TEvent::transientContains( key, *ti, kFALSE );
59  }
60 
79  StatusCode TPyEvent::record( int /*dummy*/, void* obj,
80  const std::string& key,
81  const std::string& type,
82  ::Int_t basketSize, ::Int_t splitLevel ) {
83 
84  // Simply forward the call to the base class:
85  RETURN_CHECK( "xAOD::TPyEvent::record",
86  TEvent::record( obj, type, key, basketSize, splitLevel,
87  kFALSE, kFALSE, kFALSE ) );
88  // Return gracefully:
89  return StatusCode::SUCCESS;
90  }
91 
92 } // 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
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
Definition: ICaloAffectedTool.h:24
ReturnCheck.h
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
xAOD::TPyEvent::record
StatusCode record(int dummy, void *obj, const std::string &key, const std::string &type, ::Int_t basketSize=32000, ::Int_t splitLevel=0)
Add an output object to the event.
Definition: TPyEvent.cxx:79
xAOD::TEvent::contains
::Bool_t contains(const std::string &key)
Function checking if an object is available from the store.
xAOD::TEvent::record
StatusCode record(T *obj, const std::string &key, ::Int_t basketSize=32000, ::Int_t splitLevel=0)
Add an output object to the event.
xAOD::TEvent::transientContains
::Bool_t transientContains(const std::string &key) const
Function checking if an object is already in memory.
xAOD::TPyEvent::transientContains
::Bool_t transientContains(const std::string &key, const std::string &type) const
Function checking if an object is already in memory.
Definition: TPyEvent.cxx:37
xAOD::TPyEvent::contains
::Bool_t contains(const std::string &key, const std::string &type)
Function checking if an object is available from the store.
Definition: TPyEvent.cxx:13
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
TPyEvent.h
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