ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Control
DataModelTest
DataModelTestDataRead
src
xAODTestShallowCopyHVec.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 "
xAODTestShallowCopyHVec.h
"
13
#include "
DataModelTestDataRead/HVec.h
"
14
#include "
DataModelTestDataRead/H.h
"
15
#include "
DataModelTestDataRead/HAuxContainer.h
"
16
#include "
xAODCore/ShallowCopy.h
"
17
#include "
StoreGate/ReadHandle.h
"
18
#include "
StoreGate/WriteHandle.h
"
19
#include "
StoreGate/WriteDecorHandle.h
"
20
#include "
AthContainers/AuxTypeRegistry.h
"
21
#include "
AthenaKernel/errorcheck.h
"
22
23
24
namespace
DMTest
{
25
26
30
StatusCode
xAODTestShallowCopyHVec::initialize
()
31
{
32
ATH_CHECK
(
m_readKey
.initialize() );
33
ATH_CHECK
(
m_writeKey
.initialize() );
34
ATH_CHECK
(
m_aFloat20Key
.initialize() );
35
return
StatusCode::SUCCESS;
36
}
37
38
42
StatusCode
xAODTestShallowCopyHVec::execute
(
const
EventContext& ctx)
const
43
{
44
size_t
count
= ctx.evt() + 1;
45
46
{
47
SG::ReadHandle<DMTest::HVec>
vec
(
m_readKey
, ctx);
48
auto
ret =
xAOD::shallowCopy
(*
vec
, ctx);
49
50
SG::WriteHandle<DMTest::HVec>
copy (
m_writeKey
, ctx);
51
ATH_CHECK
( copy.record (std::move(ret.first), std::move(ret.second)) );
52
53
SG::WriteDecorHandle<DMTest::HVec, float>
aFloat20 (
m_aFloat20Key
, ctx);
54
for
(
H
*
h
: *copy)
55
aFloat20(*
h
) =
count
* 20000 +
h
->aFloat();
56
}
57
58
return
StatusCode::SUCCESS;
59
}
60
61
62
}
// namespace DMTest
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
AuxTypeRegistry.h
Handle mappings between names and auxid_t.
vec
std::vector< size_t > vec
Definition
CombinationsGeneratorTest.cxx:9
errorcheck.h
Helpers for checking error return status codes and reporting errors.
HAuxContainer.h
Test for xAOD schema evolution.
HVec.h
H.h
Test for xAOD schema evolution.
ShallowCopy.h
ReadHandle.h
Handle class for reading from StoreGate.
WriteDecorHandle.h
Handle class for adding a decoration to an object.
WriteHandle.h
Handle class for recording to StoreGate.
h
Header file for AthHistogramAlgorithm.
DMTest::xAODTestShallowCopyHVec::m_aFloat20Key
SG::WriteDecorHandleKey< DMTest::HVec > m_aFloat20Key
Definition
xAODTestShallowCopyHVec.h:58
DMTest::xAODTestShallowCopyHVec::execute
virtual StatusCode execute(const EventContext &ctx) const override
Algorithm event processing.
Definition
xAODTestShallowCopyHVec.cxx:42
DMTest::xAODTestShallowCopyHVec::m_writeKey
SG::WriteHandleKey< DMTest::HVec > m_writeKey
Definition
xAODTestShallowCopyHVec.h:55
DMTest::xAODTestShallowCopyHVec::initialize
virtual StatusCode initialize() override
Algorithm initialization; called at the beginning of the job.
Definition
xAODTestShallowCopyHVec.cxx:30
DMTest::xAODTestShallowCopyHVec::m_readKey
SG::ReadHandleKey< DMTest::HVec > m_readKey
Definition
xAODTestShallowCopyHVec.h:52
SG::ReadHandle
Definition
StoreGate/StoreGate/ReadHandle.h:67
SG::WriteDecorHandle
Handle class for adding a decoration to an object.
Definition
StoreGate/StoreGate/WriteDecorHandle.h:100
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::H
H_v2 H
Definition
DataModelTestDataRead/DataModelTestDataRead/H.h:26
xAOD::shallowCopy
ShallowCopyResult_t< T > shallowCopy(const T &cont, const EventContext &ctx)
Create a shallow copy of an existing container.
xAODTestShallowCopyHVec.h
Algorithm to test shallow-copy of xAOD data.
Generated on
for ATLAS Offline Software by
1.17.0