ATLAS Offline Software
xAODTestReadPLinks.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3  */
11 #include "xAODTestReadPLinks.h"
12 #include "StoreGate/ReadHandle.h"
15 #include <sstream>
16 
17 
18 namespace {
19 
20 
24 std::string formEL (const DMTest::xAODTestReadPLinks::EL& el)
25 {
26  std::ostringstream ss;
27  ss << "(" << el.dataID() << ":";
28  if (static_cast<int>(el.index()) == -1) {
29  ss << "inv";
30  }
31  else {
32  ss << el.index();
33  }
34  ss << ")";
35  return ss.str();
36 }
37 
38 
42 std::string formDL (const DMTest::xAODTestReadPLinks::DL& dl)
43 {
44  std::ostringstream ss;
45  ss << "(" << dl.dataID() << ")";
46  return ss.str();
47 }
48 
49 
50 } // anonymous namespace
51 
52 
53 namespace DMTest {
54 
55 
60 {
67  return StatusCode::SUCCESS;
68 }
69 
70 
74 StatusCode xAODTestReadPLinks::execute (const EventContext& ctx) const
75 {
76  static const SG::ConstAccessor< SG::PackedLink<CVec> > acc_plink ( "plink" );
77 
78  if (!m_plinksContainerKey.empty()) {
81 
82  std::ostringstream ss;
83  ss << " plink_DLinks: ";
84  for (const DL& dl : acc_plink.getDataLinkSpan (*plinkscont)) {
85  ss << formDL (dl) << " ";
86  }
87  ATH_MSG_INFO( ss.str() );
88 
89  for (const PLinks* plinks : *plinkscont) {
90  ATH_CHECK( dumpPLinks (*plinks) );
91  ATH_CHECK( dumpDecor (ctx, *plinks) );
92  }
93  }
94 
95  if (!m_plinksInfoKey.empty()) {
96  SG::ReadHandle<PLinks> plinksinfo (m_plinksInfoKey, ctx);
98 
99  std::ostringstream ss;
100  ss << " plinkInfo_DLinks: ";
101  for (const DL& dl : acc_plink.getDataLinkSpan (*plinksinfo->container())) {
102  ss << formDL (dl) << " ";
103  }
104  ATH_MSG_INFO( ss.str() );
105 
106  ATH_CHECK( dumpPLinks (*plinksinfo) );
107  ATH_CHECK( dumpInfoDecor (ctx, *plinksinfo) );
108  }
109 
110  return StatusCode::SUCCESS;
111 }
112 
113 
118 {
119  std::ostringstream ss;
120  ss << " link: " << formEL (plinks.plink());
121  ss << " links:";
122  for (EL el : plinks.vlinks()) {
123  ss << " " << formEL (el);
124  }
125  ATH_MSG_INFO( ss.str() );
126  return StatusCode::SUCCESS;
127 }
128 
129 
134 xAODTestReadPLinks::dumpDecor (const EventContext& ctx,
135  const PLinks& plinks) const
136 {
137  std::ostringstream ss;
138  if (!m_plinksDecorLinkKey.empty()) {
140  ss << " decorLink: " << formEL (decor (plinks));
141  }
142 
143  if (!m_plinksDecorVLinksKey.empty()) {
145  ss << " decorVLinks:";
146  for (ElementLink<CVec> el : decor (plinks)) {
147  ss << " " << formEL (el);
148  }
149  }
150  ATH_MSG_INFO( ss.str() );
151  return StatusCode::SUCCESS;
152 }
153 
154 
159 xAODTestReadPLinks::dumpInfoDecor (const EventContext& ctx,
160  const PLinks& plinks) const
161 {
162  std::ostringstream ss;
163  if (!m_plinksInfoDecorLinkKey.empty()) {
165  ss << " decorLink: " << formEL (decor (plinks));
166  }
167 
168  if (!m_plinksInfoDecorVLinksKey.empty()) {
170  ss << " decorVLinks:";
171  for (ElementLink<CVec> el : decor (plinks)) {
172  ss << " " << formEL (el);
173  }
174  }
175  ATH_MSG_INFO( ss.str() );
176  return StatusCode::SUCCESS;
177 }
178 
179 
180 } // namespace DMTest
TestSUSYToolsAlg.dl
dl
Definition: TestSUSYToolsAlg.py:81
PowhegControl_ttHplus_NLO.ss
ss
Definition: PowhegControl_ttHplus_NLO.py:83
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
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
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
plotIsoValidation.el
el
Definition: plotIsoValidation.py:197
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
EL
This module defines the arguments passed from the BATCH driver to the BATCH worker.
Definition: AlgorithmWorkerData.h:24
ReadDecorHandle.h
Handle class for reading a decoration on an object.
ReadHandle.h
Handle class for reading from StoreGate.
SG::AllowEmpty
@ AllowEmpty
Definition: StoreGate/StoreGate/VarHandleKey.h:30
DMTest
Definition: B.h:23