ATLAS Offline Software
MuCTPIResult.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 
6 // STL include(s):
7 #include <string>
8 
9 // Gaudi/Athena include(s):
10 #include "GaudiKernel/Bootstrap.h"
11 #include "GaudiKernel/ISvcLocator.h"
12 #include "GaudiKernel/IMessageSvc.h"
13 #include "GaudiKernel/MsgStream.h"
14 
15 // Local include(s):
19 
20 using namespace std;
21 
22 namespace ROIB {
23 
31  MuCTPIResult::MuCTPIResult( Header&& head, Trailer&& trail, vector< MuCTPIRoI >&& roIVector )
32  : m_MuCTPIResultHeader( std::move(head) ), m_MuCTPIResultTrailer( std::move(trail) ),
33  m_MuCTPIResultRoIVec( std::move(roIVector) ) {
34 
35  }
36 
41  : m_MuCTPIResultHeader(), m_MuCTPIResultTrailer(),
42  m_MuCTPIResultRoIVec() {
43 
44  }
45 
51  const Header& MuCTPIResult::header() const {
52  return m_MuCTPIResultHeader;
53  }
54 
60  const Trailer& MuCTPIResult::trailer() const {
61  return m_MuCTPIResultTrailer;
62  }
63 
69  const vector< MuCTPIRoI >& MuCTPIResult::roIVec() const {
70  return m_MuCTPIResultRoIVec;
71  }
72 
73  const std::string MuCTPIResult::dump() const
74  {
75  std::ostringstream s;
76 
77  s << " [" << this->header().dump() << "] ";
78  s << " [";
79  for (std::vector<MuCTPIRoI>::size_type i(0); i < roIVec().size(); ++i) {
80  s << LVL1CTP::convertToHex(roIVec()[i].roIWord());
81  }
82  s << "] ";
83  s << " [" << this->trailer().dump() << "] ";
84 
85  return s.str();
86  }
87 
88  const std::string MuCTPIResult::print(const bool longFormat) const
89  {
90  std::ostringstream s;
91 
92  s << "header [" << this->header().print(longFormat) << "] ";
93  if (longFormat) s << std::endl;
94 
95  for(std::vector< MuCTPIRoI >::size_type i(0); i < roIVec().size(); ++i ) {
96 
97  std::string loc = "UNDEFINED";
98  if( roIVec()[i].getSectorLocation() == MuCTPI_RDO::ENDCAP )
99  loc = "ENDCAP";
100  else if( roIVec()[i].getSectorLocation() == MuCTPI_RDO::FORWARD )
101  loc = "FORWARD";
102  else if( roIVec()[i].getSectorLocation() == MuCTPI_RDO::BARREL )
103  loc = "BARREL";
104 
105  if (i == 0 || longFormat) s << "data";
106  if (longFormat) s << "[" << std::setw(2) << i << "]";
107 
108  s << " [";
109  if (longFormat) s << LVL1CTP::convertToHex(roIVec()[i].roIWord());
110  if (longFormat) s << std::setw(12) << "\n Threshold: ";
111  s << " " << roIVec()[i].pt();
112  if (longFormat) s << std::setw(12) << "\n Sector location: ";
113  s << " " << loc;
114  if (longFormat) s << std::setw(12) << "\n Sector ID:";
115  s << " " << roIVec()[i].getSectorID();
116  if (longFormat) s << std::setw(12) << "\n Sector addr:";
117  s << " " << LVL1CTP::convertToHex(roIVec()[i].getSectorID());
118  if (longFormat) s << std::setw(12) << "\n Sector overflow:";
119  s << " " << roIVec()[i].getSectorOverflow();
120  if (longFormat) s << std::setw(12) << "\n RoI overflow:";
121  s << " " << roIVec()[i].getRoiOverflow();
122  if (longFormat) s << std::setw(12) << "\n RoI number:";
123  s << " " << roIVec()[i].getRoiNumber();
124  //if (longFormat) s << std::setw(12) << "\n IsHighestPt:";
125  //s << " " << roIVec()[i].getCandidateIsHighestPt();
126  if (longFormat) s << std::setw(12) << "\n Overlap:";
127  s << " " << roIVec()[i].getOverlapBits();
128  s << "] ";
129  }
130  s << "trailer [" << this->trailer().print(longFormat) << "] ";
131 
132  return s.str();
133  }
134 
135 
140  void MuCTPIResult::dumpData() const {
141 
142  IMessageSvc* msgSvc;
143  ISvcLocator* svcLoc = Gaudi::svcLocator( );
144  StatusCode sc = svcLoc->service( "MessageSvc", msgSvc );
145  if( sc.isFailure() ) {
146  return;
147  }
148  MsgStream log( msgSvc, "MuCTPIResult" );
149  dumpData( log );
150 
151  return;
152  }
153 
161  void MuCTPIResult::dumpData( MsgStream& log ) const {
162 
163  log << MSG::DEBUG << "*BEGIN* MuCTPIResult" << endmsg;
164 
166  int counter = 0;
167  std::vector< MuCTPIRoI >::const_iterator it = m_MuCTPIResultRoIVec.begin();
168  for( ; it != m_MuCTPIResultRoIVec.end(); ++it, ++counter ) {
169 
170  std::string loc = "UNDEFINED";
171  if( it->getSectorLocation() == MuCTPI_RDO::ENDCAP )
172  loc = "ENDCAP";
173  else if( it->getSectorLocation() == MuCTPI_RDO::FORWARD )
174  loc = "FORWARD";
175  else if( it->getSectorLocation() == MuCTPI_RDO::BARREL )
176  loc = "BARREL";
177 
178  log << MSG::DEBUG << "RoI word[" << counter << "] : 0x"
179  << MSG::hex << it->roIWord() << MSG::dec << endmsg;
180  log << MSG::DEBUG << "Threshold : pt" << it->pt() << endmsg;
181  log << MSG::DEBUG << "Sector location : " << loc << endmsg;
182  log << MSG::DEBUG << "Sector ID : " << it->getSectorID() << endmsg;
183  log << MSG::DEBUG << "Sector addr : 0x" << MSG::hex
184  << it->getSectorID() << MSG::dec << endmsg;
185  log << MSG::DEBUG << "Sector overflow : " << it->getSectorOverflow() << endmsg;
186  log << MSG::DEBUG << "RoI overflow : " << it->getRoiOverflow() << endmsg;
187  log << MSG::DEBUG << "RoI number : " << it->getRoiNumber() << endmsg;
188  //log << MSG::DEBUG << "IsHighestPt : " << it->getCandidateIsHighestPt() << endmsg;
189  log << MSG::DEBUG << "Overlap : " << it->getOverlapBits() << endmsg;
190 
191  }
193  log << MSG::DEBUG << "*END* MuCTPIResult" << endmsg;
194 
195  return;
196  }
197 
198 } // namespace ROIB
ROIB::Trailer::dumpData
void dumpData() const
print object content to default message stream
Definition: Trailer.cxx:76
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
ROIB::MuCTPIResult::dumpData
void dumpData() const
Function dumping the stored information to the message stream.
Definition: MuCTPIResult.cxx:140
ROIB::Header::print
const std::string print(const bool longFormat=false) const
print object content in a human readable format to string
Definition: TrigT1Result/src/Header.cxx:80
ROIB::MuCTPIResult::m_MuCTPIResultRoIVec
std::vector< MuCTPIRoI > m_MuCTPIResultRoIVec
Variable storing the MuCTPI RoIs collected by the RoIB.
Definition: MuCTPIResult.h:81
ROIB::MuCTPIResult::m_MuCTPIResultTrailer
Trailer m_MuCTPIResultTrailer
Variable storing the trailer for the MuCTPI block.
Definition: MuCTPIResult.h:79
ROIB::MuCTPIResult::print
const std::string print(const bool longFormat=false) const
print object content in a human readable format to string
Definition: MuCTPIResult.cxx:88
skel.it
it
Definition: skel.GENtoEVGEN.py:423
MuCTPI_RDO::BARREL
@ BARREL
Definition: MuCTPI_RDO.h:45
MuCTPI_RDO::FORWARD
@ FORWARD
Definition: MuCTPI_RDO.h:45
ROIB::MuCTPIResult::m_MuCTPIResultHeader
Header m_MuCTPIResultHeader
Variable storing the header for the MuCTPI block.
Definition: MuCTPIResult.h:77
ROIB::MuCTPIResult::header
const Header & header() const
Member function returning the header.
Definition: MuCTPIResult.cxx:51
ROIB
Namespace of the LVL1 RoIB simulation.
Definition: ILvl1ResultAccessTool.h:19
LVL1CTP::convertToHex
const std::string convertToHex(const uint32_t word)
helper function to dump a number in hex format
Definition: TrigT1CTPDefs.h:41
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
MuCTPI_RDO::ENDCAP
@ ENDCAP
Definition: MuCTPI_RDO.h:45
StdJOSetup.msgSvc
msgSvc
Provide convenience handles for various services.
Definition: StdJOSetup.py:36
ROIB::MuCTPIResult::trailer
const Trailer & trailer() const
Member function returning the trailer.
Definition: MuCTPIResult.cxx:60
ROIB::Trailer::print
const std::string print(const bool longFormat=false) const
print object content in a human readable format to string
Definition: Trailer.cxx:56
lumiFormat.i
int i
Definition: lumiFormat.py:92
ROIB::Header
Header models the LVL1 ROD Header.
Definition: TrigT1Result/TrigT1Result/Header.h:37
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ROIB::Header::dump
const std::string dump() const
dump raw object content to string
Definition: TrigT1Result/src/Header.cxx:69
ROIB::Trailer::dump
const std::string dump() const
dump raw object content to string
Definition: Trailer.cxx:45
ROIB::MuCTPIResult::dump
const std::string dump() const
dump raw object content to string
Definition: MuCTPIResult.cxx:73
head
std::string head(std::string s, const std::string &pattern)
head of a string
Definition: computils.cxx:310
ROIB::Trailer
ROIB::Trailer models the LVL1 ROD Trailer.
Definition: Trailer.h:37
MuCTPI_RDO.h
ROIB::Header::dumpData
void dumpData() const
print object content to default message stream
Definition: TrigT1Result/src/Header.cxx:103
DEBUG
#define DEBUG
Definition: page_access.h:11
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
ROIB::MuCTPIResult::roIVec
const std::vector< MuCTPIRoI > & roIVec() const
Member function returning the RoI vector.
Definition: MuCTPIResult.cxx:69
MuCTPIResult.h
test_pyathena.counter
counter
Definition: test_pyathena.py:15
ROIB::MuCTPIResult::MuCTPIResult
MuCTPIResult()
Default constructor.
Definition: MuCTPIResult.cxx:40
TrigT1CTPDefs.h