ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Control
AthenaExamples
AthExHive
src
HiveAlgA.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 "
HiveAlgA.h
"
6
7
HiveAlgA::HiveAlgA
(
const
std::string& name,
8
ISvcLocator* pSvcLocator ) :
9
::
HiveAlgBase
( name, pSvcLocator )
10
{
11
}
12
13
HiveAlgA::~HiveAlgA
() =
default
;
14
15
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
16
17
StatusCode
HiveAlgA::initialize
() {
18
ATH_MSG_DEBUG
(
"initialize "
<< name());
19
20
ATH_CHECK
(
m_evt
.initialize() );
21
ATH_CHECK
(
m_wrh1
.initialize() );
22
ATH_CHECK
(
m_wrh2
.initialize() );
23
24
// make sure we initialize the base class
25
return
HiveAlgBase::initialize
();
26
}
27
28
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
29
30
StatusCode
HiveAlgA::execute
(
const
EventContext& ctx)
const
{
31
32
ATH_MSG_DEBUG
(
"execute "
<< name());
33
34
SG::ReadHandle<xAOD::EventInfo>
evt{
m_evt
, ctx};
35
if
(!evt.isValid()) {
36
ATH_MSG_ERROR
(
"Could not retrieve EventInfo"
);
37
return
StatusCode::FAILURE;
38
}
else
{
39
ATH_MSG_INFO
(
" EventInfo: r: "
<< evt->runNumber()
40
<<
" e: "
<< evt->eventNumber() );
41
}
42
43
sleep
(ctx);
44
45
unsigned
int
i = ctx.evt();
46
47
SG::WriteHandle<HiveDataObj>
wrh1{
m_wrh1
, ctx};
48
ATH_CHECK
(wrh1.
record
(std::make_unique< HiveDataObj >(10000 + evt->eventNumber()*100 + i)));
49
50
SG::WriteHandle<HiveDataObj>
wrh2{
m_wrh2
, ctx};
51
ATH_CHECK
(wrh2.
record
(std::make_unique< HiveDataObj >(10050+i)));
52
53
ATH_MSG_INFO
(
" write: "
<< wrh1.
key
() <<
" = "
<< wrh1->val() );
54
ATH_MSG_INFO
(
" write: "
<< wrh2.
key
() <<
" = "
<< wrh2->val() );
55
56
return
StatusCode::SUCCESS;
57
}
58
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
HiveAlgA.h
Simple Algorithm that reads the EventInfo obj, and writes two HiveDataObjs to the store.
HiveAlgA::m_wrh2
SG::WriteHandleKey< HiveDataObj > m_wrh2
Definition
HiveAlgA.h:42
HiveAlgA::execute
virtual StatusCode execute(const EventContext &ctx) const override
Definition
HiveAlgA.cxx:30
HiveAlgA::m_wrh1
SG::WriteHandleKey< HiveDataObj > m_wrh1
Definition
HiveAlgA.h:41
HiveAlgA::m_evt
SG::ReadHandleKey< xAOD::EventInfo > m_evt
Definition
HiveAlgA.h:39
HiveAlgA::HiveAlgA
HiveAlgA(const std::string &name, ISvcLocator *pSvcLocator)
Definition
HiveAlgA.cxx:7
HiveAlgA::initialize
virtual StatusCode initialize() override
Definition
HiveAlgA.cxx:17
HiveAlgA::~HiveAlgA
~HiveAlgA()
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
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