ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Control
DataModelTest
DataModelTestDataCommon
src
xAODTestReadPLinks.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
#include "
xAODTestReadPLinks.h
"
12
#include "
StoreGate/ReadHandle.h
"
13
#include "
StoreGate/ReadDecorHandle.h
"
14
#include "
AthContainers/PackedLink.h
"
15
#include <format>
16
#include <print>
17
#include <sstream>
18
19
20
namespace
{
21
22
26
std::string formEL (
const
DMTest::xAODTestReadPLinks::EL
& el)
27
{
28
return
std::format (
"({}:{})"
,
29
el
.dataID(),
30
static_cast<
int
>
(
el
.index()) == -1 ?
"inv"
: std::to_string(
el
.index()));
31
}
32
33
37
std::string formDL (
const
DMTest::xAODTestReadPLinks::DL
& dl)
38
{
39
return
std::format (
"({})"
,
dl
.dataID());
40
}
41
42
43
}
// anonymous namespace
44
45
46
namespace
DMTest
{
47
48
52
StatusCode
xAODTestReadPLinks::initialize
()
53
{
54
ATH_CHECK
(
m_plinksContainerKey
.initialize (
SG::AllowEmpty
) );
55
ATH_CHECK
(
m_plinksInfoKey
.initialize (
SG::AllowEmpty
) );
56
ATH_CHECK
(
m_plinksDecorLinkKey
.initialize (
SG::AllowEmpty
) );
57
ATH_CHECK
(
m_plinksDecorVLinksKey
.initialize (
SG::AllowEmpty
) );
58
ATH_CHECK
(
m_plinksInfoDecorLinkKey
.initialize (
SG::AllowEmpty
) );
59
ATH_CHECK
(
m_plinksInfoDecorVLinksKey
.initialize (
SG::AllowEmpty
) );
60
return
StatusCode::SUCCESS;
61
}
62
63
67
StatusCode
xAODTestReadPLinks::execute
(
const
EventContext& ctx)
const
68
{
69
static
const
SG::ConstAccessor< SG::PackedLink<CVec>
> acc_plink (
"plink"
);
70
71
if
(!
m_plinksContainerKey
.empty()) {
72
SG::ReadHandle<PLinksContainer>
plinkscont (
m_plinksContainerKey
, ctx);
73
ATH_MSG_INFO
(
m_plinksContainerKey
.key() );
74
75
std::ostringstream
ss
;
76
std::print (
ss
,
" plink_DLinks: "
);
77
for
(
const
DL
& dl : acc_plink.getDataLinkSpan (*plinkscont)) {
78
std::print (
ss
,
"{} "
, formDL (dl));
79
}
80
ATH_MSG_INFO
(
ss
.str() );
81
82
for
(
const
PLinks
* plinks : *plinkscont) {
83
ATH_CHECK
(
dumpPLinks
(*plinks) );
84
ATH_CHECK
(
dumpDecor
(ctx, *plinks) );
85
}
86
}
87
88
if
(!
m_plinksInfoKey
.empty()) {
89
SG::ReadHandle<PLinks>
plinksinfo (
m_plinksInfoKey
, ctx);
90
ATH_MSG_INFO
(
m_plinksInfoKey
.key() );
91
92
std::ostringstream
ss
;
93
std::print (
ss
,
" plinkInfo_DLinks: "
);
94
for
(
const
DL
& dl : acc_plink.getDataLinkSpan (*plinksinfo->container())) {
95
std::print (
ss
,
"{} "
, formDL (dl));
96
}
97
ATH_MSG_INFO
(
ss
.str() );
98
99
ATH_CHECK
(
dumpPLinks
(*plinksinfo) );
100
ATH_CHECK
(
dumpInfoDecor
(ctx, *plinksinfo) );
101
}
102
103
return
StatusCode::SUCCESS;
104
}
105
106
110
StatusCode
xAODTestReadPLinks::dumpPLinks
(
const
PLinks
& plinks)
const
111
{
112
std::ostringstream
ss
;
113
std::print (
ss
,
" link: {}"
, formEL (plinks.
plink
()));
114
std::print (
ss
,
" links:"
);
115
for
(
EL
el : plinks.
vlinks
()) {
116
std::print (
ss
,
" {}"
, formEL (el));
117
}
118
ATH_MSG_INFO
(
ss
.str() );
119
return
StatusCode::SUCCESS;
120
}
121
122
126
StatusCode
127
xAODTestReadPLinks::dumpDecor
(
const
EventContext& ctx,
128
const
PLinks
& plinks)
const
129
{
130
std::ostringstream
ss
;
131
if
(!
m_plinksDecorLinkKey
.empty()) {
132
SG::ReadDecorHandle<PLinksContainer, SG::PackedLink<CVec>
> decor (
m_plinksDecorLinkKey
, ctx);
133
std::print (
ss
,
" decorLink: {}"
, formEL (decor (plinks)));
134
}
135
136
if
(!
m_plinksDecorVLinksKey
.empty()) {
137
SG::ReadDecorHandle<PLinksContainer, std::vector<SG::PackedLink<CVec>
> > decor (
m_plinksDecorVLinksKey
, ctx);
138
std::print (
ss
,
" decorVLinks:"
);
139
for
(
ElementLink<CVec>
el : decor (plinks)) {
140
std::print (
ss
,
" {}"
, formEL (el));
141
}
142
}
143
ATH_MSG_INFO
(
ss
.str() );
144
return
StatusCode::SUCCESS;
145
}
146
147
151
StatusCode
152
xAODTestReadPLinks::dumpInfoDecor
(
const
EventContext& ctx,
153
const
PLinks
& plinks)
const
154
{
155
std::ostringstream
ss
;
156
if
(!
m_plinksInfoDecorLinkKey
.empty()) {
157
SG::ReadDecorHandle<PLinks, SG::PackedLink<CVec>
> decor (
m_plinksInfoDecorLinkKey
, ctx);
158
std::print (
ss
,
" decorLink: {}"
, formEL (decor (plinks)));
159
}
160
161
if
(!
m_plinksInfoDecorVLinksKey
.empty()) {
162
SG::ReadDecorHandle<PLinks, std::vector<SG::PackedLink<CVec>
> > decor (
m_plinksInfoDecorVLinksKey
, ctx);
163
std::print (
ss
,
" decorVLinks:"
);;
164
for
(
ElementLink<CVec>
el : decor (plinks)) {
165
std::print (
ss
,
" {}"
, formEL (el));
166
}
167
}
168
ATH_MSG_INFO
(
ss
.str() );
169
return
StatusCode::SUCCESS;
170
}
171
172
173
}
// namespace DMTest
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:45
PackedLink.h
ss
static Double_t ss
Definition
LArPhysWaveHECTool.cxx:37
ReadDecorHandle.h
Handle class for reading a decoration on an object.
ReadHandle.h
Handle class for reading from StoreGate.
DMTest::PLinks_v1::plink
ElementLink< CVec > plink() const
DMTest::PLinks_v1::vlinks
const_el_range vlinks() const
Get the vector of links, as a const range.
Definition
PLinks_v1.cxx:39
DMTest::xAODTestReadPLinks::EL
ElementLink< DMTest::CVec > EL
Definition
xAODTestReadPLinks.h:38
DMTest::xAODTestReadPLinks::m_plinksInfoDecorVLinksKey
SG::ReadDecorHandleKey< DMTest::PLinks > m_plinksInfoDecorVLinksKey
Definition
xAODTestReadPLinks.h:91
DMTest::xAODTestReadPLinks::m_plinksInfoKey
SG::ReadHandleKey< DMTest::PLinks > m_plinksInfoKey
Definition
xAODTestReadPLinks.h:79
DMTest::xAODTestReadPLinks::m_plinksDecorVLinksKey
SG::ReadDecorHandleKey< DMTest::PLinksContainer > m_plinksDecorVLinksKey
Definition
xAODTestReadPLinks.h:85
DMTest::xAODTestReadPLinks::dumpDecor
StatusCode dumpDecor(const EventContext &ctx, const PLinks &plinks) const
Dump decorations from a PLinks object.
Definition
xAODTestReadPLinks.cxx:127
DMTest::xAODTestReadPLinks::m_plinksContainerKey
SG::ReadHandleKey< DMTest::PLinksContainer > m_plinksContainerKey
Definition
xAODTestReadPLinks.h:76
DMTest::xAODTestReadPLinks::execute
virtual StatusCode execute(const EventContext &ctx) const override
Algorithm event processing.
Definition
xAODTestReadPLinks.cxx:67
DMTest::xAODTestReadPLinks::m_plinksInfoDecorLinkKey
SG::ReadDecorHandleKey< DMTest::PLinks > m_plinksInfoDecorLinkKey
Definition
xAODTestReadPLinks.h:88
DMTest::xAODTestReadPLinks::DL
DataLink< DMTest::CVec > DL
Definition
xAODTestReadPLinks.h:39
DMTest::xAODTestReadPLinks::m_plinksDecorLinkKey
SG::ReadDecorHandleKey< DMTest::PLinksContainer > m_plinksDecorLinkKey
Definition
xAODTestReadPLinks.h:82
DMTest::xAODTestReadPLinks::dumpPLinks
StatusCode dumpPLinks(const PLinks &plinks) const
Dump a PLinks object.
Definition
xAODTestReadPLinks.cxx:110
DMTest::xAODTestReadPLinks::initialize
virtual StatusCode initialize() override
Algorithm initialization; called at the beginning of the job.
Definition
xAODTestReadPLinks.cxx:52
DMTest::xAODTestReadPLinks::dumpInfoDecor
StatusCode dumpInfoDecor(const EventContext &ctx, const PLinks &plinks) const
Dump decorations from a standalone PLinks object.
Definition
xAODTestReadPLinks.cxx:152
ElementLink
ElementLink implementation for ROOT usage.
Definition
A/AthLinks/ElementLink.h:40
SG::ConstAccessor
Helper class to provide constant type-safe access to aux data.
Definition
ConstAccessor.h:55
SG::ReadDecorHandle
Handle class for reading a decoration on an object.
Definition
StoreGate/StoreGate/ReadDecorHandle.h:94
SG::ReadHandle
Definition
StoreGate/StoreGate/ReadHandle.h:66
DMTest
Definition
B.h:23
DMTest::PLinks
PLinks_v1 PLinks
Definition
PLinks.h:23
EL
This module defines the arguments passed from the BATCH driver to the BATCH worker.
Definition
AsgComponentFactories.h:16
SG::AllowEmpty
@ AllowEmpty
Definition
StoreGate/StoreGate/VarHandleKey.h:29
TestSUSYToolsAlg.dl
dl
Definition
TestSUSYToolsAlg.py:98
python.getProblemFolderFromLogs.el
dict el
Definition
getProblemFolderFromLogs.py:51
xAODTestReadPLinks.h
Generated on
for ATLAS Offline Software by
1.17.0