ATLAS Offline Software
xAODTestReadCLinks.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3  */
12 #include "xAODTestReadCLinks.h"
13 #include "StoreGate/ReadHandle.h"
14 #include <sstream>
15 
16 
17 namespace {
18 
19 
21 
22 
26 std::string formEL (const EL& el)
27 {
28  std::ostringstream ss;
29  ss << "(" << el.dataID() << ":";
30  if (static_cast<int>(el.index()) == -1) {
31  ss << "inv";
32  }
33  else {
34  ss << el.index();
35  }
36  ss << ")";
37  return ss.str();
38 }
39 
40 
41 } // anonymous namespace
42 
43 
44 namespace DMTest {
45 
46 
51 {
52  ATH_CHECK( m_clinksKey.initialize (SG::AllowEmpty) );
55  return StatusCode::SUCCESS;
56 }
57 
58 
62 StatusCode xAODTestReadCLinks::execute (const EventContext& ctx) const
63 {
64  if (!m_clinksKey.empty()) {
65  SG::ReadHandle<CLinks> clinks (m_clinksKey, ctx);
66  ATH_MSG_INFO( m_clinksKey.key() );
67  ATH_CHECK( dumpCLinks (*clinks) );
68  }
69 
70  if (!m_clinksContainerKey.empty()) {
73  for (const CLinks* clinks : *clinkscont) {
74  ATH_CHECK( dumpCLinks (*clinks) );
75  }
76  }
77 
78  if (!m_clinksAODKey.empty()) {
81 
82  std::ostringstream ss1;
83  ss1 << " ";
84  for (const EL& el : clinksaod->vel()) {
85  ss1 << formEL (el) << " ";
86  }
87  ATH_MSG_INFO (ss1.str());
88 
89  std::ostringstream ss2;
90  ss2 << " ";
91  for (const EL el : clinksaod->elv()) {
92  ss2 << formEL (el) << " ";
93  }
94  ATH_MSG_INFO (ss2.str());
95  }
96 
97  return StatusCode::SUCCESS;
98 }
99 
100 
105 {
106  std::ostringstream ss;
107  ss << " link: " << formEL (clinks.link()) << " links: ";
108  for (const EL& el : clinks.links()) {
109  ss << formEL (el) << " ";
110  }
111  ATH_MSG_INFO( ss.str() );
112  return StatusCode::SUCCESS;
113 }
114 
115 
116 } // namespace DMTest
DMTest::EL
ElementLink< CVec > EL
Definition: xAODTestWriteCLinks.cxx:22
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::VarHandleKey::key
const std::string & key() const
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:141
SG::VarHandleKey::empty
bool empty() const
Test if the key is blank.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:150
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
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
ReadHandle.h
Handle class for reading from StoreGate.
SG::AllowEmpty
@ AllowEmpty
Definition: StoreGate/StoreGate/VarHandleKey.h:30
DMTest
Definition: B.h:23