ATLAS Offline Software
Loading...
Searching...
No Matches
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"
15#include <format>
16#include <print>
17#include <sstream>
18
19
20namespace {
21
22
26std::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
37std::string formDL (const DMTest::xAODTestReadPLinks::DL& dl)
38{
39 return std::format ("({})", dl.dataID());
40}
41
42
43} // anonymous namespace
44
45
46namespace DMTest {
47
48
62
63
67StatusCode xAODTestReadPLinks::execute (const EventContext& ctx) const
68{
69 static const SG::ConstAccessor< SG::PackedLink<CVec> > acc_plink ( "plink" );
70
71 if (!m_plinksContainerKey.empty()) {
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()) {
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
110StatusCode 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
126StatusCode
127xAODTestReadPLinks::dumpDecor (const EventContext& ctx,
128 const PLinks& plinks) const
129{
130 std::ostringstream ss;
131 if (!m_plinksDecorLinkKey.empty()) {
133 std::print (ss, " decorLink: {}", formEL (decor (plinks)));
134 }
135
136 if (!m_plinksDecorVLinksKey.empty()) {
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
151StatusCode
152xAODTestReadPLinks::dumpInfoDecor (const EventContext& ctx,
153 const PLinks& plinks) const
154{
155 std::ostringstream ss;
156 if (!m_plinksInfoDecorLinkKey.empty()) {
158 std::print (ss, " decorLink: {}", formEL (decor (plinks)));
159 }
160
161 if (!m_plinksInfoDecorVLinksKey.empty()) {
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
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_INFO(x,...)
static Double_t ss
Handle class for reading a decoration on an object.
Handle class for reading from StoreGate.
Helper class to provide constant type-safe access to aux data.
Handle class for reading a decoration on an object.
Definition B.h:23
PLinks_v1 PLinks
Definition PLinks.h:23
This module defines the arguments passed from the BATCH driver to the BATCH worker.