ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Control
DataModelTest
DataModelTestDataCommon
src
CondAlg1.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
*/
10
11
12
#include "
CondAlg1.h
"
13
14
15
namespace
DMTest
{
16
17
23
CondAlg1::CondAlg1
(
const
std::string &name, ISvcLocator *pSvcLocator)
24
:
AthCondAlgorithm
(name, pSvcLocator),
25
m_attrListKey
(
"/DMTest/TestAttrList"
),
26
m_scondKey
(
"scond"
,
"DMTest"
)
27
{
28
declareProperty
(
"AttrListKey"
,
m_attrListKey
);
29
declareProperty
(
"SCondKey"
,
m_scondKey
);
30
}
31
32
36
StatusCode
CondAlg1::initialize
()
37
{
38
ATH_CHECK
(
m_attrListKey
.initialize() );
39
ATH_CHECK
(
m_scondKey
.initialize() );
40
return
StatusCode::SUCCESS;
41
}
42
43
47
StatusCode
CondAlg1::execute
(
const
EventContext& ctx)
const
48
{
49
SG::ReadCondHandle<AthenaAttributeList>
attrList (
m_attrListKey
, ctx);
50
int
xint = (**attrList)[
"xint"
].data<
int
>();
51
52
EventIDRange range;
53
ATH_CHECK
( attrList.
range
(range) );
54
55
SG::WriteCondHandle<DMTest::S2>
scond (
m_scondKey
, ctx);
56
auto
s2 = std::make_unique<DMTest::S2> (xint*100);
57
ATH_CHECK
( scond.
record
(range, std::move(s2) ) );
58
59
ATH_MSG_DEBUG
(
"Recorded '{}' with range {}"
,
60
scond.
key
(),
static_cast<
std::string
>
(range));
61
62
return
StatusCode::SUCCESS;
63
}
64
65
66
}
// namespace DMTest
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x,...)
Definition
AthMsgStreamMacros.h:43
CondAlg1.h
Testing conditions algorithms.
AthCommonAlgorithm< Gaudi::Algorithm >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
Definition
AthCommonDataStore.h:145
AthCondAlgorithm
Base class for conditions algorithms.
Definition
AthCondAlgorithm.h:22
DMTest::CondAlg1::m_attrListKey
SG::ReadCondHandleKey< AthenaAttributeList > m_attrListKey
Definition
CondAlg1.h:51
DMTest::CondAlg1::m_scondKey
SG::WriteCondHandleKey< DMTest::S2 > m_scondKey
Definition
CondAlg1.h:52
DMTest::CondAlg1::execute
virtual StatusCode execute(const EventContext &ctx) const override
Algorithm event processing.
Definition
CondAlg1.cxx:47
DMTest::CondAlg1::initialize
virtual StatusCode initialize() override
Algorithm initialization; called at the beginning of the job.
Definition
CondAlg1.cxx:36
DMTest::CondAlg1::CondAlg1
CondAlg1(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Definition
CondAlg1.cxx:23
SG::ReadCondHandle
Definition
ReadCondHandle.h:39
SG::ReadCondHandle::range
bool range(EventIDRange &r)
Definition
ReadCondHandle.h:222
SG::WriteCondHandle
Definition
WriteCondHandle.h:26
SG::WriteCondHandle::key
const std::string & key() const
Definition
WriteCondHandle.h:44
SG::WriteCondHandle::record
StatusCode record(const EventIDRange &range, T *t)
record handle, with explicit range DEPRECATED
Definition
WriteCondHandle.h:161
DMTest
Definition
B.h:23
Generated on
for ATLAS Offline Software by
1.17.0