ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Control
AthenaExamples
AthExHive
src
condEx
AlgD.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
AlgD.h
"
6
#include "
StoreGate/ReadHandle.h
"
7
#include "
StoreGate/ReadCondHandle.h
"
8
9
//---------------------------------------------------------------------------
10
11
StatusCode
AlgD::initialize
() {
12
ATH_MSG_DEBUG
(
"initialize "
<< name());
13
14
ATH_CHECK
(
m_rdh1
.initialize() );
15
ATH_CHECK
(
m_rch1
.initialize() );
16
ATH_CHECK
(
m_rch2
.initialize() );
17
18
ATH_MSG_INFO
(
"m_rdh1 id: "
<<
m_rdh1
.fullKey() );
19
ATH_MSG_INFO
(
"m_rch1 id: "
<<
m_rch1
.fullKey() );
20
ATH_MSG_INFO
(
"m_rch2 id: "
<<
m_rch2
.fullKey() );
21
22
return
StatusCode::SUCCESS;
23
}
24
25
//---------------------------------------------------------------------------
26
27
StatusCode
AlgD::execute
(
const
EventContext& ctx)
const
{
28
ATH_MSG_DEBUG
(
"execute "
<< name());
29
30
SG::ReadHandle<HiveDataObj>
rh1(
m_rdh1
, ctx);
31
if
(!rh1.
isValid
()) {
32
ATH_MSG_ERROR
(
"Could not retrieve HiveDataObj with key "
<<
m_rdh1
.key());
33
return
StatusCode::FAILURE;
34
}
35
36
ATH_MSG_INFO
(
" read: "
<< rh1.
key
() <<
" = "
<< rh1->val() );
37
38
SG::ReadCondHandle<CondDataObj>
ch1(
m_rch1
, ctx);
39
SG::ReadCondHandle<CondDataObj>
ch2(
m_rch2
, ctx);
40
41
const
CondDataObj
*cdo = *ch1;
42
if
(cdo != 0) {
43
ATH_MSG_INFO
(
" CDO1: "
<< *cdo );
44
}
else
{
45
ATH_MSG_ERROR
(
" CDO1 ptr == zero"
);
46
}
47
48
cdo = *ch2;
49
if
(cdo != 0) {
50
ATH_MSG_INFO
(
" CDO2: "
<< *cdo );
51
}
else
{
52
ATH_MSG_ERROR
(
" CDO2 ptr == zero"
);
53
}
54
55
ATH_MSG_INFO
(
"test: "
<< ctx.eventID().event_number() <<
" "
56
<< rh1->val() <<
" "
<< **ch1 <<
" "
<< **ch2);
57
58
return
StatusCode::SUCCESS;
59
60
}
61
AlgD.h
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition
AthMsgStreamMacros.h:33
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition
AthMsgStreamMacros.h:31
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
ReadCondHandle.h
ReadHandle.h
Handle class for reading from StoreGate.
AlgD::execute
virtual StatusCode execute(const EventContext &ctx) const override
Definition
AlgD.cxx:27
AlgD::initialize
virtual StatusCode initialize() override
Definition
AlgD.cxx:11
AlgD::m_rch2
SG::ReadCondHandleKey< CondDataObj > m_rch2
Definition
AlgD.h:28
AlgD::m_rch1
SG::ReadCondHandleKey< CondDataObj > m_rch1
Definition
AlgD.h:27
AlgD::m_rdh1
SG::ReadHandleKey< HiveDataObj > m_rdh1
Definition
AlgD.h:25
CondDataObj
Definition
CondDataObj.h:8
SG::ReadCondHandle
Definition
ReadCondHandle.h:40
SG::ReadHandle
Definition
StoreGate/StoreGate/ReadHandle.h:67
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
SG::VarHandleBase::key
virtual const std::string & key() const override final
Return the StoreGate ID for the referenced object.
Definition
AthToolSupport/AsgDataHandles/Root/VarHandleBase.cxx:64
Generated on
for ATLAS Offline Software by
1.17.0