ATLAS Offline Software
Loading...
Searching...
No Matches
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
20using namespace std;
21
22namespace 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
45
53 }
54
62 }
63
69 const vector< MuCTPIRoI >& MuCTPIResult::roIVec() const {
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
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
163 m_MuCTPIResultHeader.dumpData( log );
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 }
190 m_MuCTPIResultTrailer.dumpData( log );
191 log << MSG::DEBUG << "*END* MuCTPIResult" << endmsg;
192
193 return;
194 }
195
196} // namespace ROIB
#define endmsg
Header models the LVL1 ROD Header.
const std::string print(const bool longFormat=false) const
print object content in a human readable format to string
const std::string dump() const
dump raw object content to string
void dumpData() const
Function dumping the stored information to the message stream.
MuCTPIResult()
Default constructor.
std::vector< MuCTPIRoI > m_MuCTPIResultRoIVec
Variable storing the MuCTPI RoIs collected by the RoIB.
const Header & header() const
Member function returning the header.
const std::string dump() const
dump raw object content to string
const std::string print(const bool longFormat=false) const
print object content in a human readable format to string
Header m_MuCTPIResultHeader
Variable storing the header for the MuCTPI block.
const Trailer & trailer() const
Member function returning the trailer.
const std::vector< MuCTPIRoI > & roIVec() const
Member function returning the RoI vector.
Trailer m_MuCTPIResultTrailer
Variable storing the trailer for the MuCTPI block.
ROIB::Trailer models the LVL1 ROD Trailer.
Definition Trailer.h:37
const std::string dump() const
dump raw object content to string
Definition Trailer.cxx:45
const std::string print(const bool longFormat=false) const
print object content in a human readable format to string
Definition Trailer.cxx:56
std::string head(std::string s, const std::string &pattern)
head of a string
const std::string convertToHex(const uint32_t word)
helper function to dump a number in hex format
Namespace of the LVL1 RoIB simulation.
STL namespace.