7#include "GaudiKernel/MsgStream.h"
17 bool p_debug = (log.level() <= MSG::DEBUG);
20 log << MSG::DEBUG <<
"TgcByteStream::rdo2ByteStream" <<
endmsg;
23 ByteStream headerBS, statusBS, countersBS, dataBS, footerBS;
25 {0, 5}, {0, 8}, {0, 9}};
29 log << MSG::DEBUG <<
"Encoding " << rdo->
size() <<
" elements"
34 switch (raw->type()) {
40 roh.
channel = raw->channel() - 40;
41 roh.
sbId = raw->slbId();
57 roh.
sbType = raw->slbType();
72 if (raw->slbId() % 2 == 0) {
73 roh.
sbId = raw->slbId() / 2;
75 roh.
sbId = (raw->slbId() + 15) / 2;
79 roh.
adj = raw->isAdjacent();
80 roh.
ldbId = raw->sswId();
84 dataBS.push_back(
toBS32(roh));
92 rot.
phi = raw->position();
93 rot.
seg = raw->segment();
94 rot.
sbId = raw->slbId();
95 rot.
ldbId = raw->sswId();
99 dataBS.push_back(
toBS32(rot));
102 rot.
rphi = raw->position();
103 rot.
subm = raw->subMatrix();
104 rot.
seg = raw->segment();
105 rot.
delta = raw->delta();
106 rot.
sbId = raw->slbId();
107 rot.
ldbId = raw->sswId();
126 dataBS.push_back(
toBS32(rot));
132 if (raw->isStrip() == 1 && raw->sector() & 4) {
134 hpt.
inner = raw->inner();
138 hpt.
sector = raw->sector();
140 hpt.
strip = raw->isStrip();
142 dataBS.push_back(
toBS32(hpt));
145 hpt.
delta = raw->delta();
146 hpt.
sub = raw->hsub();
147 hpt.
hitId = raw->hitId();
148 hpt.
hipt = raw->isHipt();
149 hpt.
cand = raw->index();
150 hpt.
chip = raw->chip();
151 hpt.
sector = raw->sector();
152 hpt.
fwd = raw->isForward();
153 hpt.
strip = raw->isStrip();
155 dataBS.push_back(
toBS32(hpt));
165 sl.
veto = raw->isVeto();
167 sl.
sign = raw->isMuplus();
168 sl.
cand = raw->index();
169 sl.
sector = raw->sector();
170 sl.
fwd = raw->isForward();
173 dataBS.push_back(
toBS32(sl));
177 log << MSG::ERROR <<
"Invalid type " << raw->typeName()
183 statusBS.push_back(
toBS32(ls));
184 statusBS.push_back(rdo->
orbit());
186 for (
int iCnt = 0; iCnt < 7; iCnt++) {
187 if (counters[iCnt].
count > 0) {
188 countersBS.push_back(
toBS32(counters[iCnt]));
193 bs.insert(bs.end(), countersBS.begin(), countersBS.end());
194 bs.insert(bs.end(), dataBS.begin(), dataBS.end());
197 log << MSG::DEBUG <<
"TgcByteStream::rdo2ByteStream done" <<
endmsg;
202 uint32_t source_id, MsgStream& log) {
205 bool p_debug = (log.level() <= MSG::DEBUG);
213 <<
"Error: input TgcRdo id does not match bytestream id"
222 {0, 5}, {0, 8}, {0, 9}};
226 for (
int iCnt = 0; iCnt < 7; iCnt++) {
228 if (counter.id == counters[iCnt].
id) {
229 counters[iCnt].
count = counter.count;
234 for (
int iCnt = 0; iCnt < 7; iCnt++) {
235 if (counters[iCnt].
count == 0) {
238 switch (counters[iCnt].
id) {
242 log << MSG::DEBUG <<
"fragment" << counters[iCnt].
id <<
" "
245 for (
unsigned iFrag = 0; iFrag < counters[iCnt].
count;
248 log << MSG::DEBUG <<
"WORD" << iFrag <<
":" << MSG::hex
259 log << MSG::DEBUG <<
"fragment" << counters[iCnt].
id <<
" "
263 for (
unsigned iFrag = 0; iFrag < counters[iCnt].
count;
266 log << MSG::DEBUG <<
"WORD" << iFrag <<
":" << MSG::hex
274 <<
" rdo.rodId():" << rdo.
rodId()
275 <<
" roh.ldbId:" << roh.
ldbId
276 <<
" roh.sbId:" << roh.
sbId
277 <<
" rdo.l1Id():" << rdo.
l1Id()
281 uint16_t slbId = roh.
sbId;
296 slbId = roh.
sbId * 2;
298 slbId = (roh.
sbId - 8) * 2 + 1;
328 log << MSG::DEBUG <<
"fragment" << counters[iCnt].
id <<
" "
333 for (
unsigned iFrag = 0; iFrag < counters[iCnt].
count;
336 log << MSG::DEBUG <<
"WORD" << iFrag <<
":" << MSG::hex
381 log << MSG::DEBUG <<
"fragment" << counters[iCnt].
id <<
" "
386 for (
unsigned iFrag = 0; iFrag < counters[iCnt].
count;
389 log << MSG::DEBUG <<
"WORD" << iFrag <<
":" << MSG::hex
393 if (hptinner.
sector & 4) {
397 0, hptinner.
sector, 0, 0, 0, 0, 0, 0,
416 log << MSG::DEBUG <<
"fragment" << counters[iCnt].
id <<
" "
420 for (
unsigned iFrag = 0; iFrag < counters[iCnt].
count;
423 log << MSG::DEBUG <<
"WORD" << iFrag <<
":" << MSG::hex
440 <<
"Error: TgcByteStream::byteStream2Rdo Unsupported "
449 log << MSG::DEBUG <<
"Decoded " << MSG::dec << rdo.
size() <<
" elements"
451 log << MSG::DEBUG <<
"TgcByteStream::byteStream2Rdo done" <<
endmsg;
Athena::TPCnvVers::Old Athena::TPCnvVers::Current Athena::TPCnvVers::Old Athena::TPCnvVers::Current Athena::TPCnvVers::Old Athena::TPCnvVers::Current Athena::TPCnvVers::Current Athena::TPCnvVers::Current Athena::TPCnvVers::Current Athena::TPCnvVers::Current TgcRawData
unsigned bcBitmap(uint16_t bcTag)
void fromBS32(uint32_t data, T &s)
unsigned bcTag(unsigned bcBitMap)
value_type push_back(value_type pElem)
Add an element to the end of the collection.
size_type size() const noexcept
Returns the number of elements in the collection.
std::vector< uint32_t > ByteStream
static void byteStream2Rdo(const ByteStream &bs, TgcRdo &rdo, uint32_t source_id, MsgStream &log)
Convert ByteStream to RDO.
TgcByteStream()
Constructor.
~TgcByteStream()
Destructor.
static void rdo2ByteStream(const TgcRdo *rdo, ByteStream &bs, MsgStream &log)
Convert RDO to ByteStream.
An unit object of TGC ROD output.
void setOnlineId(uint16_t subDetectorId, uint16_t rodId)
uint16_t subDetectorId() const
static uint16_t calculateOnlineId(uint16_t subDetectorId, uint16_t rodId)
uint16_t identify() const
int count(std::string s, const std::string ®x)
count how many occurances of a regx are in a string
The struct for fragment count in ByteStream.
The struct for Inner trigger bits in ByteStream.
The struct for HiPt in ByteStream.
The struct for local status in ByteStream.
The struct for hit in ByteStream.
The struct for tracklet in ByteStream.
The struct for triplet strip in ByteStream.
The struct for SL in ByteStream.
The struct for source ID in ByteStream.