ATLAS Offline Software
xAODTestReadCLinks.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 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 DMTest {
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 
45 {
46  ATH_CHECK( m_clinksKey.initialize (SG::AllowEmpty) );
49  return StatusCode::SUCCESS;
50 }
51 
52 
56 StatusCode xAODTestReadCLinks::execute (const EventContext& ctx) const
57 {
58  if (!m_clinksKey.empty()) {
59  SG::ReadHandle<CLinks> clinks (m_clinksKey, ctx);
60  ATH_MSG_INFO( m_clinksKey.key() );
61  ATH_CHECK( dumpCLinks (*clinks) );
62  }
63 
64  if (!m_clinksContainerKey.empty()) {
67  for (const CLinks* clinks : *clinkscont) {
68  ATH_CHECK( dumpCLinks (*clinks) );
69  }
70  }
71 
72  if (!m_clinksAODKey.empty()) {
75 
76  std::ostringstream ss1;
77  ss1 << " ";
78  for (const EL& el : clinksaod->vel()) {
79  ss1 << formEL (el) << " ";
80  }
81  ATH_MSG_INFO (ss1.str());
82 
83  std::ostringstream ss2;
84  ss2 << " ";
85  for (const EL el : clinksaod->elv()) {
86  ss2 << formEL (el) << " ";
87  }
88  ATH_MSG_INFO (ss2.str());
89  }
90 
91  return StatusCode::SUCCESS;
92 }
93 
94 
99 {
100  std::ostringstream ss;
101  ss << " link: " << formEL (clinks.link()) << " links: ";
102  for (const EL& el : clinks.links()) {
103  ss << formEL (el) << " ";
104  }
105  ATH_MSG_INFO( ss.str() );
106  return StatusCode::SUCCESS;
107 }
108 
109 
110 } // namespace DMTest
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
DMTest::EL
ElementLink< CVec > EL
Definition: xAODTestReadCLinks.cxx:20
ReadHandle.h
Handle class for reading from StoreGate.
SG::AllowEmpty
@ AllowEmpty
Definition: StoreGate/StoreGate/VarHandleKey.h:30
DMTest::formEL
std::string formEL(const EL &el)
Format an ElementLink to a string.
Definition: xAODTestReadCLinks.cxx:26
DMTest
Definition: B.h:23