ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Control
DataModelTest
DataModelTestDataCommon
src
xAODTestWriteFwdLink2.cxx
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration.
3
*/
10
11
12
#include "
xAODTestWriteFwdLink2.h
"
13
#include "
DataModelTestDataCommon/C.h
"
14
#include "
DataModelTestDataCommon/CVec.h
"
15
#include "
StoreGate/WriteHandleKey.h
"
16
#include "AthLinks/DataLink.h"
17
#include "
AthContainersInterfaces/IAuxStore.h
"
18
19
20
namespace
DMTest
{
21
22
23
StatusCode
xAODTestWriteFwdLink2::initialize
()
24
{
25
ATH_CHECK
(
m_cvecAuxKey
.initialize() );
26
return
StatusCode::SUCCESS;
27
}
28
29
30
StatusCode
xAODTestWriteFwdLink2::execute
(
const
EventContext& ctx)
const
31
{
32
unsigned
int
count
= ctx.eventID().event_number() + 1;
33
34
auto
cvecaux = std::make_unique<DMTest::CAuxContainer>();
35
DataVector<DMTest::C>
cvec;
36
cvec.setStore (cvecaux.get());
37
for
(
size_t
i = 0; i < 10; i++) {
38
DMTest::C
* c = cvec.
push_back
(std::make_unique<DMTest::C>());
39
c->setAnInt (
count
*100 + 10+i);
40
c->setAFloat (
count
*100 + 20.5+i);
41
}
42
SG::WriteHandle<DMTest::CAuxContainer>
cvecaux_h (
m_cvecAuxKey
, ctx);
43
ATH_CHECK
( cvecaux_h.
record
(std::move (cvecaux)) );
44
return
StatusCode::SUCCESS;
45
}
46
47
48
}
// namespace DMTest
49
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
CVec.h
Class used for testing xAOD data reading/writing.
C.h
Class used for testing xAOD data reading/writing.
IAuxStore.h
Interface for non-const operations on an auxiliary store.
WriteHandleKey.h
Property holding a SG store/key/clid from which a WriteHandle is made.
DMTest::xAODTestWriteFwdLink2::initialize
virtual StatusCode initialize() override
Definition
xAODTestWriteFwdLink2.cxx:23
DMTest::xAODTestWriteFwdLink2::m_cvecAuxKey
SG::WriteHandleKey< DMTest::CAuxContainer > m_cvecAuxKey
Definition
xAODTestWriteFwdLink2.h:37
DMTest::xAODTestWriteFwdLink2::execute
virtual StatusCode execute(const EventContext &ctx) const override
Definition
xAODTestWriteFwdLink2.cxx:30
DataVector
Derived DataVector<T>.
Definition
DataVector.h:795
DataVector::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
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
xAODTestWriteFwdLink2.h
Generated on
for ATLAS Offline Software by
1.17.0