ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Control
DataModelTest
DataModelTestDataWrite
src
xAODTestWriteCVecConst.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 "
xAODTestWriteCVecConst.h
"
15
#include "
DataModelTestDataCommon/CVec.h
"
16
#include "
DataModelTestDataCommon/C.h
"
17
#include "
DataModelTestDataCommon/CAuxContainer.h
"
18
#include "
AthContainersInterfaces/AuxDataOption.h
"
19
#include "
AthenaKernel/errorcheck.h
"
20
21
22
namespace
DMTest
{
23
24
30
xAODTestWriteCVecConst::xAODTestWriteCVecConst
(
const
std::string &name,
31
ISvcLocator *pSvcLocator)
32
:
AthReentrantAlgorithm
(name, pSvcLocator),
33
m_cvecKey
(
"cvecConst"
)
34
{
35
declareProperty
(
"CVecKey"
,
m_cvecKey
);
36
}
37
38
42
StatusCode
xAODTestWriteCVecConst::initialize
()
43
{
44
ATH_CHECK
(
m_cvecKey
.initialize() );
45
return
StatusCode::SUCCESS;
46
}
47
48
52
StatusCode
xAODTestWriteCVecConst::execute
(
const
EventContext& ctx)
const
53
{
54
auto
coll = std::make_unique<DMTest::CVec>();
55
auto
store = std::make_unique<DMTest::CAuxContainer>();
56
coll->setStore (store.get());
57
58
SG::WriteHandle<DMTest::CVec>
cvec (
m_cvecKey
, ctx);
59
CHECK
( cvec.
record
(std::move(coll), std::move(store)) );
60
61
size_t
count
= ctx.evt();
62
for
(
int
i=0; i < 10; i++) {
63
cvec->push_back (
new
DMTest::C
);
64
C
& c = *cvec->back();
65
c.setAnInt (
count
* 100 + i+1);
66
c.setAFloat (
count
* 200 + (
float
)i*0.1);
67
}
68
69
return
StatusCode::SUCCESS;
70
}
71
72
76
StatusCode
xAODTestWriteCVecConst::finalize
()
77
{
78
return
StatusCode::SUCCESS;
79
}
80
81
82
}
// namespace DMTest
83
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
AuxDataOption.h
Hold information about an option setting request.
CAuxContainer.h
Class used for testing xAOD data reading/writing.
CVec.h
Class used for testing xAOD data reading/writing.
C.h
Class used for testing xAOD data reading/writing.
errorcheck.h
Helpers for checking error return status codes and reporting errors.
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition
Control/AthenaKernel/AthenaKernel/errorcheck.h:422
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::xAODTestWriteCVecConst::m_cvecKey
SG::WriteHandleKey< DMTest::CVec > m_cvecKey
Definition
xAODTestWriteCVecConst.h:62
DMTest::xAODTestWriteCVecConst::execute
virtual StatusCode execute(const EventContext &ctx) const override
Algorithm event processing.
Definition
xAODTestWriteCVecConst.cxx:52
DMTest::xAODTestWriteCVecConst::finalize
virtual StatusCode finalize() override
Algorithm finalization; called at the end of the job.
Definition
xAODTestWriteCVecConst.cxx:76
DMTest::xAODTestWriteCVecConst::initialize
virtual StatusCode initialize() override
Algorithm initialization; called at the beginning of the job.
Definition
xAODTestWriteCVecConst.cxx:42
DMTest::xAODTestWriteCVecConst::xAODTestWriteCVecConst
xAODTestWriteCVecConst(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Definition
xAODTestWriteCVecConst.cxx:30
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.
count
int count(std::string s, const std::string ®x)
count how many occurances of a regx are in a string
Definition
hcg.cxx:148
DMTest
Definition
B.h:23
DMTest::C
C_v1 C
Definition
C.h:26
xAODTestWriteCVecConst.h
Test recording a const aux obj via WriteHandle.
Generated on
for ATLAS Offline Software by
1.17.0