ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Control
AthenaExamples
AthExHive
src
condEx
AlgA.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 "
AlgA.h
"
6
#include "
StoreGate/ReadHandle.h
"
7
#include "
StoreGate/WriteHandle.h
"
8
9
#include <memory>
10
11
//---------------------------------------------------------------------------
12
13
StatusCode
AlgA::initialize
() {
14
ATH_MSG_DEBUG
(
"initialize "
<< name());
15
16
ATH_CHECK
(
m_wrh1
.initialize() );
17
ATH_CHECK
(
m_wrh2
.initialize() );
18
ATH_CHECK
(
m_evt
.initialize() );
19
20
return
StatusCode::SUCCESS;
21
}
22
23
//---------------------------------------------------------------------------
24
25
StatusCode
AlgA::execute
(
const
EventContext& ctx)
const
{
26
27
ATH_MSG_DEBUG
(
"execute "
<< name());
28
29
SG::ReadHandle<xAOD::EventInfo>
evt(
m_evt
, ctx);
30
ATH_MSG_INFO
(
" EventInfo: r: "
<< evt->runNumber()
31
<<
" e: "
<< evt->eventNumber()
32
<<
" evt: "
<< ctx.evt() );
33
34
35
const
unsigned
int
i = ctx.evt() + 1;
36
37
SG::WriteHandle<HiveDataObj>
wh1(
m_wrh1
, ctx);
38
ATH_CHECK
( wh1.
record
( std::make_unique<HiveDataObj>
39
( 10000 +
40
evt->eventNumber()*100 +
41
i) )
42
);
43
ATH_MSG_INFO
(
" write: "
<< wh1.
key
() <<
" = "
<< wh1->val() );
44
45
46
SG::WriteHandle<HiveDataObj>
wh2(
m_wrh2
, ctx);
47
ATH_CHECK
( wh2.
record
( std::make_unique< HiveDataObj >( 10050+i ) ) );
48
ATH_MSG_INFO
(
" write: "
<< wh2.
key
() <<
" = "
<< wh2->val() );
49
50
return
StatusCode::SUCCESS;
51
52
}
53
AlgA.h
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
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.
AlgA::m_wrh2
SG::WriteHandleKey< HiveDataObj > m_wrh2
Definition
AlgA.h:25
AlgA::m_evt
SG::ReadHandleKey< xAOD::EventInfo > m_evt
Definition
AlgA.h:26
AlgA::m_wrh1
SG::WriteHandleKey< HiveDataObj > m_wrh1
Definition
AlgA.h:24
AlgA::execute
virtual StatusCode execute(const EventContext &ctx) const override
Definition
AlgA.cxx:25
AlgA::initialize
virtual StatusCode initialize() override
Definition
AlgA.cxx:13
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.
Generated on
for ATLAS Offline Software by
1.17.0