ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Control
DataModelTest
DataModelTestDataWrite
src
xAODTestWriteHVec.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3
*/
10
11
12
#include "
xAODTestWriteHVec.h
"
13
#include "
xAODTestWriteHelper.h
"
14
#include "
DataModelTestDataWrite/HVec.h
"
15
#include "
DataModelTestDataWrite/HView.h
"
16
#include "
DataModelTestDataWrite/H.h
"
17
#include "
DataModelTestDataWrite/HAuxContainer.h
"
18
19
20
namespace
DMTest
{
21
22
26
StatusCode
xAODTestWriteHVec::initialize
()
27
{
28
ATH_CHECK
(
m_hvecKey
.initialize() );
29
ATH_CHECK
(
m_hviewKey
.initialize(
SG::AllowEmpty
) );
30
return
StatusCode::SUCCESS;
31
}
32
33
37
StatusCode
xAODTestWriteHVec::execute
(
const
EventContext& ctx)
const
38
{
39
unsigned
int
count
= ctx.eventID().event_number() + 1;
40
41
auto
hvec = std::make_unique<DMTest::HVec>();
42
auto
store = std::make_unique<DMTest::HAuxContainer>();
43
hvec->setStore (store.get());
44
45
for
(
int
i = 0; i < 20; i++) {
46
hvec->push_back (
new
DMTest::H
);
47
hvec->back()->setAnInt (i+1 +
count
* 400);
48
}
49
50
std::unique_ptr<DMTest::HView> hview;
51
if
(!
m_hviewKey
.empty()) {
52
hview = std::make_unique<DMTest::HView>();
53
for
(
int
i = 0; i < 20; i++) {
54
hview->push_back (hvec->at (19-i));
55
}
56
}
57
58
ATH_CHECK
(
SG::makeHandle
(
m_hvecKey
, ctx).record (std::move(hvec),
59
std::move(store)) );
60
61
if
(!
m_hviewKey
.empty()) {
62
SG::WriteHandle<DMTest::HView>
hviewH (
m_hviewKey
, ctx);
63
ATH_CHECK
(
DMTest::recordView2
(hviewH, std::move(hview)) );
64
}
65
66
return
StatusCode::SUCCESS;
67
}
68
69
70
}
// namespace DMTest
71
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
HAuxContainer.h
Test for xAOD schema evolution.
HVec.h
HView.h
H.h
Test for xAOD schema evolution.
DMTest::xAODTestWriteHVec::m_hvecKey
SG::WriteHandleKey< DMTest::HVec > m_hvecKey
Definition
xAODTestWriteHVec.h:52
DMTest::xAODTestWriteHVec::m_hviewKey
SG::WriteHandleKey< DMTest::HView > m_hviewKey
Definition
xAODTestWriteHVec.h:54
DMTest::xAODTestWriteHVec::initialize
virtual StatusCode initialize() override
Algorithm initialization; called at the beginning of the job.
Definition
xAODTestWriteHVec.cxx:26
DMTest::xAODTestWriteHVec::execute
virtual StatusCode execute(const EventContext &ctx) const override
Algorithm event processing.
Definition
xAODTestWriteHVec.cxx:37
SG::WriteHandle
Definition
StoreGate/StoreGate/WriteHandle.h:73
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::recordView2
StatusCode recordView2(SG::WriteHandle< ViewVector< DMTest::HVec > > &h, std::unique_ptr< ViewVector< DMTest::HVec > > view)
Definition
xAODTestWriteHelper.cxx:28
DMTest::H
H_v2 H
Definition
DataModelTestDataRead/DataModelTestDataRead/H.h:26
SG::AllowEmpty
@ AllowEmpty
Definition
StoreGate/StoreGate/VarHandleKey.h:27
SG::makeHandle
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Definition
ReadCondHandle.h:269
xAODTestWriteHVec.h
Algorithm to test writing xAOD classes for schema evolution (hvec/hview).
xAODTestWriteHelper.h
Test recording ViewVector w/o having CLASS_DEF visible in compilation unit.
Generated on
for ATLAS Offline Software by
1.17.0