ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Control
AthenaExamples
AthExHive
src
condEx
AlgB.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
AlgB.h
"
6
#include "
StoreGate/ReadHandle.h
"
7
#include "
StoreGate/WriteHandle.h
"
8
9
#include <memory>
10
11
AlgB::AlgB
(
const
std::string& name,
12
ISvcLocator* pSvcLocator ) :
13
::
AthAlgorithm
( name, pSvcLocator )
14
{
15
}
16
17
StatusCode
AlgB::initialize
() {
18
ATH_MSG_DEBUG
(
"initialize "
<< name());
19
20
ATH_CHECK
(
m_rdh1
.initialize() );
21
ATH_CHECK
(
m_wrh1
.initialize() );
22
23
return
StatusCode::SUCCESS;
24
}
25
26
StatusCode
AlgB::execute
(
const
EventContext& ctx) {
27
ATH_MSG_DEBUG
(
"execute "
<< name());
28
29
SG::ReadHandle<HiveDataObj>
rh1(
m_rdh1
, ctx);
30
if
(!rh1.
isValid
()) {
31
ATH_MSG_ERROR
(
"Could not retrieve HiveDataObj with key "
<<
m_rdh1
.key());
32
return
StatusCode::FAILURE;
33
}
34
35
ATH_MSG_INFO
(
" read: "
<< rh1.
key
() <<
" = "
<< rh1->val() );
36
37
SG::WriteHandle<HiveDataObj>
wh1(
m_wrh1
, ctx);
38
ATH_CHECK
( wh1.
record
( std::make_unique< HiveDataObj >
39
( 3300 + rh1->val() ) ) );
40
41
ATH_MSG_INFO
(
" write: "
<< wh1.
key
() <<
" = "
<< wh1->val() );
42
ATH_CHECK
(wh1.
isValid
());
43
44
return
StatusCode::SUCCESS;
45
46
}
47
AlgB.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
ReadHandle.h
Handle class for reading from StoreGate.
WriteHandle.h
Handle class for recording to StoreGate.
AlgB::m_rdh1
SG::ReadHandleKey< HiveDataObj > m_rdh1
Definition
AlgB.h:27
AlgB::initialize
virtual StatusCode initialize() override
Definition
AlgB.cxx:17
AlgB::AlgB
AlgB(const std::string &name, ISvcLocator *pSvcLocator)
Definition
AlgB.cxx:11
AlgB::execute
virtual StatusCode execute(const EventContext &ctx) override
Execute method.
Definition
AlgB.cxx:26
AlgB::m_wrh1
SG::WriteHandleKey< HiveDataObj > m_wrh1
Definition
AlgB.h:28
AthAlgorithm::AthAlgorithm
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Definition
AthAlgorithm.cxx:10
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.
SG::WriteHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
Generated on
for ATLAS Offline Software by
1.17.0