ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Control
AthenaExamples
AthExHive
src
HiveAlgC.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 "
HiveAlgC.h
"
6
7
HiveAlgC::HiveAlgC
(
const
std::string& name,
8
ISvcLocator* pSvcLocator ) :
9
::
HiveAlgBase
( name, pSvcLocator )
10
{
11
}
12
13
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
14
HiveAlgC::~HiveAlgC
() =
default
;
15
16
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
17
StatusCode
HiveAlgC::initialize
() {
18
ATH_MSG_DEBUG
(
"initialize "
<< name());
19
20
ATH_CHECK
(
m_rdh1
.initialize() );
21
ATH_CHECK
(
m_wrh1
.initialize() );
22
ATH_CHECK
(
m_wrh2
.initialize() );
23
24
// initialize base class
25
return
HiveAlgBase::initialize
();
26
}
27
28
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
29
StatusCode
HiveAlgC::execute
(
const
EventContext& ctx)
const
{
30
31
ATH_MSG_DEBUG
(
"execute "
<< name());
32
33
sleep
(ctx);
34
35
SG::ReadHandle<HiveDataObj>
rdh1{
m_rdh1
, ctx};
36
if
(!rdh1.
isValid
()) {
37
ATH_MSG_ERROR
(
"Could not retrieve HiveDataObj with key "
<< rdh1.
key
());
38
return
StatusCode::FAILURE;
39
}
40
41
ATH_MSG_INFO
(
" read: "
<< rdh1.
key
() <<
" = "
<< rdh1->val() );
42
43
SG::WriteHandle<HiveDataObj>
wrh1{
m_wrh1
, ctx};
44
ATH_CHECK
(wrh1.
record
(std::make_unique< HiveDataObj >(30000 + rdh1->val() )));
45
46
SG::WriteHandle<HiveDataObj>
wrh2{
m_wrh2
, ctx};
47
ATH_CHECK
(wrh2.
record
(std::make_unique< HiveDataObj >(30001)));
48
49
ATH_MSG_INFO
(
" write: "
<< wrh1.
key
() <<
" = "
<< wrh1->val() );
50
ATH_MSG_INFO
(
" write: "
<< wrh2.
key
() <<
" = "
<< wrh2->val() );
51
52
return
StatusCode::SUCCESS;
53
54
}
55
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
HiveAlgC.h
Simple Algorithm that reads an object created by HiveAlgA, and writes two more.
HiveAlgBase::HiveAlgBase
HiveAlgBase(const std::string &name, ISvcLocator *pSvcLocator)
Definition
HiveAlgBase.cxx:12
HiveAlgBase::sleep
unsigned int sleep(const EventContext &ctx) const
Definition
HiveAlgBase.cxx:40
HiveAlgBase::initialize
virtual StatusCode initialize() override
Definition
HiveAlgBase.cxx:23
HiveAlgC::HiveAlgC
HiveAlgC(const std::string &name, ISvcLocator *pSvcLocator)
Definition
HiveAlgC.cxx:7
HiveAlgC::m_wrh1
SG::WriteHandleKey< HiveDataObj > m_wrh1
Definition
HiveAlgC.h:40
HiveAlgC::execute
virtual StatusCode execute(const EventContext &ctx) const override
Definition
HiveAlgC.cxx:29
HiveAlgC::~HiveAlgC
~HiveAlgC()
HiveAlgC::initialize
virtual StatusCode initialize() override
Definition
HiveAlgC.cxx:17
HiveAlgC::m_rdh1
SG::ReadHandleKey< HiveDataObj > m_rdh1
Definition
HiveAlgC.h:38
HiveAlgC::m_wrh2
SG::WriteHandleKey< HiveDataObj > m_wrh2
Definition
HiveAlgC.h:41
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
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.
Generated on
for ATLAS Offline Software by
1.17.0