ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Control
AthenaExamples
AthExHive
src
loopTest
HiveTool.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 "
HiveTool.h
"
6
7
#include "
StoreGate/ReadHandle.h
"
8
#include "
StoreGate/WriteHandle.h
"
9
10
#include <memory>
11
12
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
13
14
HiveTool::HiveTool
(
const
std::string&
type
,
const
std::string& name,
15
const
IInterface* parent)
16
: base_class(
type
, name, parent )
17
{}
18
19
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
20
21
HiveTool::~HiveTool
() {
22
}
23
24
StatusCode
25
HiveTool::initialize
() {
26
ATH_MSG_INFO
(
"initialize"
);
27
28
if
(
m_rdh1
.key() !=
""
) {
29
ATH_CHECK
(
m_rdh1
.initialize() );
30
ATH_MSG_INFO
(
"read key: "
<<
m_rdh1
.key());
31
}
else
{
32
ATH_MSG_INFO
(
"RH key is blank. not initializing"
);
33
}
34
35
if
(
m_wrh1
.key() !=
""
) {
36
ATH_CHECK
(
m_wrh1
.initialize() );
37
ATH_MSG_INFO
(
"write key: "
<<
m_wrh1
.key());
38
}
else
{
39
ATH_MSG_INFO
(
"WH key is blank. not initializing"
);
40
}
41
42
return
StatusCode::SUCCESS;
43
}
44
45
StatusCode
46
HiveTool::finalize
() {
47
ATH_MSG_INFO
(
"finalize"
);
48
49
return
StatusCode::SUCCESS;
50
}
51
52
StatusCode
HiveTool::doSomething
(
const
EventContext& ctx)
const
{
53
ATH_MSG_INFO
(
"doSomething()"
);
54
55
int
val = 0;
56
57
if
(
m_rdh1
.key() ==
""
) {
58
ATH_MSG_INFO
(
"RH not valid - not retrieving"
);
59
}
else
{
60
SG::ReadHandle<HiveDataObj>
rh(
m_rdh1
, ctx );
61
ATH_MSG_INFO
(
" read: "
<< rh.
key
() <<
" = "
<< rh->val() );
62
val = rh->val();
63
}
64
65
if
(
m_wrh1
.key() ==
""
) {
66
ATH_MSG_INFO
(
"WH not valid - not writing"
);
67
}
else
{
68
SG::WriteHandle<HiveDataObj>
wrh1(
m_wrh1
, ctx );
69
ATH_CHECK
(wrh1.
record
(std::make_unique< HiveDataObj >(val + 666)));
70
71
ATH_MSG_INFO
(
" write: "
<< wrh1.
key
() <<
" = "
<< wrh1->val() );
72
}
73
74
return
StatusCode::SUCCESS;
75
}
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition
AthMsgStreamMacros.h:31
HiveTool.h
ReadHandle.h
Handle class for reading from StoreGate.
WriteHandle.h
Handle class for recording to StoreGate.
HiveTool::HiveTool
HiveTool(const std::string &, const std::string &, const IInterface *)
Definition
HiveTool.cxx:14
HiveTool::m_wrh1
SG::WriteHandleKey< HiveDataObj > m_wrh1
Definition
HiveTool.h:29
HiveTool::doSomething
virtual StatusCode doSomething(const EventContext &ctx) const
Definition
HiveTool.cxx:52
HiveTool::m_rdh1
SG::ReadHandleKey< HiveDataObj > m_rdh1
Definition
HiveTool.h:28
HiveTool::finalize
virtual StatusCode finalize()
Definition
HiveTool.cxx:46
HiveTool::~HiveTool
virtual ~HiveTool()
Definition
HiveTool.cxx:21
HiveTool::initialize
virtual StatusCode initialize()
Definition
HiveTool.cxx:25
SG::ReadHandle
Definition
StoreGate/StoreGate/ReadHandle.h:67
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
SG::WriteHandle
Definition
StoreGate/StoreGate/WriteHandle.h:73
SG::WriteHandle::record
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
type
Generated on
for ATLAS Offline Software by
1.17.0