ATLAS Offline Software
MuCTPIResult.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 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  SmartIF<IMessageSvc> msgSvc{Gaudi::svcLocator()->service("MessageSvc")};
143  if ( !msgSvc ) {
144  return;
145  }
146  MsgStream log( msgSvc, "MuCTPIResult" );
147  dumpData( log );
148 
149  return;
150  }
151 
159  void MuCTPIResult::dumpData( MsgStream& log ) const {
160 
161  log << MSG::DEBUG << "*BEGIN* MuCTPIResult" << endmsg;
162 
164  int counter = 0;
165  std::vector< MuCTPIRoI >::const_iterator it = m_MuCTPIResultRoIVec.begin();
166  for( ; it != m_MuCTPIResultRoIVec.end(); ++it, ++counter ) {
167 
168  std::string loc = "UNDEFINED";
169  if( it->getSectorLocation() == MuCTPI_RDO::ENDCAP )
170  loc = "ENDCAP";
171  else if( it->getSectorLocation() == MuCTPI_RDO::FORWARD )
172  loc = "FORWARD";
173  else if( it->getSectorLocation() == MuCTPI_RDO::BARREL )
174  loc = "BARREL";
175 
176  log << MSG::DEBUG << "RoI word[" << counter << "] : 0x"
177  << MSG::hex << it->roIWord() << MSG::dec << endmsg;
178  log << MSG::DEBUG << "Threshold : pt" << it->pt() << endmsg;
179  log << MSG::DEBUG << "Sector location : " << loc << endmsg;
180  log << MSG::DEBUG << "Sector ID : " << it->getSectorID() << endmsg;
181  log << MSG::DEBUG << "Sector addr : 0x" << MSG::hex
182  << it->getSectorID() << MSG::dec << endmsg;
183  log << MSG::DEBUG << "Sector overflow : " << it->getSectorOverflow() << endmsg;
184  log << MSG::DEBUG << "RoI overflow : " << it->getRoiOverflow() << endmsg;
185  log << MSG::DEBUG << "RoI number : " << it->getRoiNumber() << endmsg;
186  //log << MSG::DEBUG << "IsHighestPt : " << it->getCandidateIsHighestPt() << endmsg;
187  log << MSG::DEBUG << "Overlap : " << it->getOverlapBits() << endmsg;
188 
189  }
191  log << MSG::DEBUG << "*END* MuCTPIResult" << endmsg;
192 
193  return;
194  }
195 
196 } // 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:396
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
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:85
ROIB::Header
Header models the LVL1 ROD Header.
Definition: TrigT1Result/TrigT1Result/Header.h:37
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
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:311
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