ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Control
DataModelTest
DataModelTestDataRead
src
xAODTestReadCView.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 "
xAODTestReadCView.h
"
13
#include "
DataModelTestDataCommon/CView.h
"
14
#include "
DataModelTestDataCommon/C.h
"
15
#include "
StoreGate/ReadHandle.h
"
16
#include "
StoreGate/WriteHandle.h
"
17
#include <memory>
18
#include <print>
19
#include <sstream>
20
21
22
namespace
DMTest
{
23
24
30
xAODTestReadCView::xAODTestReadCView
(
const
std::string &name,
31
ISvcLocator *pSvcLocator)
32
:
AthReentrantAlgorithm
(name, pSvcLocator),
33
m_cviewKey
(
"cview"
),
34
m_writeKey
(
""
)
35
{
36
declareProperty
(
"CViewKey"
,
m_cviewKey
);
37
declareProperty
(
"WriteKey"
,
m_writeKey
);
38
}
39
40
44
StatusCode
xAODTestReadCView::initialize
()
45
{
46
ATH_CHECK
(
m_cviewKey
.initialize() );
47
if
(!
m_writeKey
.key().empty())
48
ATH_CHECK
(
m_writeKey
.initialize() );
49
return
StatusCode::SUCCESS;
50
}
51
52
56
StatusCode
xAODTestReadCView::execute
(
const
EventContext& ctx)
const
57
{
58
SG::ReadHandle<DMTest::CView>
cview (
m_cviewKey
, ctx);
59
60
static
const
C::Accessor<int> anInt10 (
"anInt10"
);
61
std::ostringstream ost;
62
std::print (ost,
"{}:"
,
m_cviewKey
.key());
63
for
(
const
C
* c : *cview) {
64
std::print (ost,
" {}"
, c->anInt());
65
if
(anInt10.isAvailable(*c))
66
std::print (ost,
"({})"
, anInt10(*c));
67
}
68
ATH_MSG_INFO
(ost.str());
69
70
if
(!
m_writeKey
.key().empty()) {
71
SG::WriteHandle<DMTest::CView>
writeview (
m_writeKey
, ctx);
72
ATH_CHECK
( writeview.
record
(std::make_unique<DMTest::CView> (*cview)) );
73
}
74
75
return
StatusCode::SUCCESS;
76
}
77
78
82
StatusCode
xAODTestReadCView::finalize
()
83
{
84
return
StatusCode::SUCCESS;
85
}
86
87
88
}
// namespace DMTest
89
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:45
CView.h
Class used for testing ViewVector reading/writing.
C.h
Class used for testing xAOD data reading/writing.
ReadHandle.h
Handle class for reading from StoreGate.
WriteHandle.h
Handle class for recording to StoreGate.
AthCommonAlgorithm< Gaudi::Algorithm >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
Definition
AthCommonDataStore.h:145
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition
AthReentrantAlgorithm.h:74
DMTest::xAODTestReadCView::finalize
virtual StatusCode finalize() override
Algorithm finalization; called at the end of the job.
Definition
xAODTestReadCView.cxx:82
DMTest::xAODTestReadCView::xAODTestReadCView
xAODTestReadCView(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Definition
xAODTestReadCView.cxx:30
DMTest::xAODTestReadCView::m_cviewKey
SG::ReadHandleKey< DMTest::CView > m_cviewKey
Definition
xAODTestReadCView.h:63
DMTest::xAODTestReadCView::initialize
virtual StatusCode initialize() override
Algorithm initialization; called at the beginning of the job.
Definition
xAODTestReadCView.cxx:44
DMTest::xAODTestReadCView::m_writeKey
SG::WriteHandleKey< DMTest::CView > m_writeKey
Definition
xAODTestReadCView.h:64
DMTest::xAODTestReadCView::execute
virtual StatusCode execute(const EventContext &ctx) const override
Algorithm event processing.
Definition
xAODTestReadCView.cxx:56
SG::ReadHandle
Definition
StoreGate/StoreGate/ReadHandle.h:66
SG::WriteHandle
Definition
StoreGate/StoreGate/WriteHandle.h:71
SG::WriteHandle::record
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
DMTest
Definition
B.h:23
DMTest::C
C_v1 C
Definition
C.h:26
xAODTestReadCView.h
Algorithm to test reading xAOD data (CView).
Generated on
for ATLAS Offline Software by
1.17.0