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-2019 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
// $Id$
12
13
14
#include "
xAODTestReadCView.h
"
15
#include "
DataModelTestDataCommon/CView.h
"
16
#include "
DataModelTestDataCommon/C.h
"
17
#include "
StoreGate/ReadHandle.h
"
18
#include "
StoreGate/WriteHandle.h
"
19
#include <memory>
20
#include <sstream>
21
22
23
namespace
DMTest
{
24
25
31
xAODTestReadCView::xAODTestReadCView
(
const
std::string &name,
32
ISvcLocator *pSvcLocator)
33
:
AthReentrantAlgorithm
(name, pSvcLocator),
34
m_cviewKey
(
"cview"
),
35
m_writeKey
(
""
)
36
{
37
declareProperty
(
"CViewKey"
,
m_cviewKey
);
38
declareProperty
(
"WriteKey"
,
m_writeKey
);
39
}
40
41
45
StatusCode
xAODTestReadCView::initialize
()
46
{
47
ATH_CHECK
(
m_cviewKey
.initialize() );
48
if
(!
m_writeKey
.key().empty())
49
ATH_CHECK
(
m_writeKey
.initialize() );
50
return
StatusCode::SUCCESS;
51
}
52
53
57
StatusCode
xAODTestReadCView::execute
(
const
EventContext& ctx)
const
58
{
59
SG::ReadHandle<DMTest::CView>
cview (
m_cviewKey
, ctx);
60
61
static
const
C::Accessor<int> anInt10 (
"anInt10"
);
62
std::ostringstream ost;
63
ost <<
m_cviewKey
.key() <<
":"
;
64
for
(
const
C
* c : *cview) {
65
ost <<
" "
<< c->anInt();
66
if
(anInt10.isAvailable(*c))
67
ost <<
"("
<< anInt10(*c) <<
")"
;
68
}
69
ATH_MSG_INFO
(ost.str());
70
71
if
(!
m_writeKey
.key().empty()) {
72
SG::WriteHandle<DMTest::CView>
writeview (
m_writeKey
, ctx);
73
ATH_CHECK
( writeview.
record
(std::make_unique<DMTest::CView> (*cview)) );
74
}
75
76
return
StatusCode::SUCCESS;
77
}
78
79
83
StatusCode
xAODTestReadCView::finalize
()
84
{
85
return
StatusCode::SUCCESS;
86
}
87
88
89
}
// namespace DMTest
90
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
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:83
DMTest::xAODTestReadCView::xAODTestReadCView
xAODTestReadCView(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Definition
xAODTestReadCView.cxx:31
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:45
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:57
SG::ReadHandle
Definition
StoreGate/StoreGate/ReadHandle.h:67
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.
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