10#include "GaudiKernel/MsgStream.h"
20 bool p_debug = (log.level() <= MSG::DEBUG);
23 log << MSG::DEBUG <<
"TgcByteStream::rdo2ByteStream" <<
endmsg;
26 ByteStream headerBS, statusBS, countersBS, dataBS, footerBS;
28 {0, 1}, {0, 2}, {0, 3}, {0, 4}, {0, 5}, {0, 8}, {0, 9}
33 log << MSG::DEBUG <<
"Encoding " << rdo->
size() <<
" elements" <<
endmsg;
45 roh.
channel = raw->channel()-40;
46 roh.
sbId = raw->slbId();
61 roh.
sbType = raw->slbType();
71 if(raw->slbId()%2==0) roh.
sbId = raw->slbId() /2;
72 else roh.
sbId = (raw->slbId()+15)/2;
75 roh.
adj = raw->isAdjacent();
76 roh.
ldbId = raw->sswId();
80 dataBS.push_back(
toBS32(roh));
89 rot.
phi = raw->position();
90 rot.
seg = raw->segment();
91 rot.
sbId = raw->slbId();
92 rot.
ldbId = raw->sswId();
96 dataBS.push_back(
toBS32(rot));
101 rot.
rphi = raw->position();
102 rot.
subm = raw->subMatrix();
103 rot.
seg = raw->segment();
104 rot.
delta = raw->delta();
105 rot.
sbId = raw->slbId();
106 rot.
ldbId = raw->sswId();
124 dataBS.push_back(
toBS32(rot));
130 if(raw->isStrip() == 1 && raw->sector() & 4 ){
132 hpt.
inner = raw->inner();
136 hpt.
sector = raw->sector();
138 hpt.
strip = raw->isStrip();
140 dataBS.push_back(
toBS32(hpt));
143 hpt.
delta = raw->delta();
144 hpt.
sub = raw->hsub();
145 hpt.
hitId = raw->hitId();
146 hpt.
hipt = raw->isHipt();
147 hpt.
cand = raw->index();
148 hpt.
chip = raw->chip();
149 hpt.
sector = raw->sector();
150 hpt.
fwd = raw->isForward();
151 hpt.
strip = raw->isStrip();
153 dataBS.push_back(
toBS32(hpt));
163 sl.
veto = raw->isVeto();
165 sl.
sign = raw->isMuplus();
166 sl.
cand = raw->index();
167 sl.
sector = raw->sector();
168 sl.
fwd = raw->isForward();
171 dataBS.push_back(
toBS32(sl));
175 log << MSG::ERROR <<
"Invalid type " << raw->typeName() <<
endmsg;
180 statusBS.push_back(
toBS32(ls));
181 statusBS.push_back(rdo->
orbit());
183 for(
int iCnt = 0; iCnt < 7; iCnt++)
185 if(counters[iCnt].
count > 0)
187 countersBS.push_back(
toBS32(counters[iCnt]));
192 bs.insert(bs.end(), countersBS.begin(), countersBS.end());
193 bs.insert(bs.end(), dataBS.begin(), dataBS.end());
196 log << MSG::DEBUG <<
"TgcByteStream::rdo2ByteStream done" <<
endmsg;
205 bool p_debug = (log.level() <= MSG::DEBUG);
213 log << MSG::DEBUG <<
"Error: input TgcRdo id does not match bytestream id" <<
endmsg;
221 {0, 1}, {0, 2}, {0, 3}, {0, 4}, {0, 5}, {0, 8}, {0, 9}
227 for(
int iCnt = 0; iCnt < 7; iCnt++)
230 if(counter.id == counters[iCnt].
id)
232 counters[iCnt].
count = counter.count;
237 for(
int iCnt = 0; iCnt < 7; iCnt++)
239 if(counters[iCnt].
count == 0)
continue;
240 switch(counters[iCnt].
id)
246 <<
"fragment" << counters[iCnt].
id <<
" "
249 for(
unsigned iFrag = 0; iFrag < counters[iCnt].
count; iFrag++)
253 <<
"WORD" << iFrag <<
":" << MSG::hex << bs[iBs] <<
endmsg;
263 log << MSG::DEBUG <<
"fragment"
264 << counters[iCnt].
id <<
" " << counters[iCnt].
count
268 for(
unsigned iFrag = 0; iFrag < counters[iCnt].
count; iFrag++)
271 log << MSG::DEBUG <<
"WORD" << iFrag <<
":" << MSG::hex << bs[iBs] <<
endmsg;
279 <<
" rdo.rodId():" <<rdo.
rodId()
280 <<
" roh.ldbId:" <<roh.
ldbId
281 <<
" roh.sbId:" <<roh.
sbId
282 <<
" rdo.l1Id():"<<rdo.
l1Id()
286 uint16_t slbId = roh.
sbId;
296 else slbId = (roh.
sbId-8)*2+1;
331 log << MSG::DEBUG <<
"fragment"
332 << counters[iCnt].
id <<
" " << counters[iCnt].
count
337 for(
unsigned iFrag = 0; iFrag < counters[iCnt].
count; iFrag++)
340 log<< MSG::DEBUG <<
"WORD"
341 << iFrag <<
":" << MSG::hex << bs[iBs] <<
endmsg;
399 log << MSG::DEBUG <<
"fragment"
400 << counters[iCnt].
id <<
" " << counters[iCnt].
count
405 for(
unsigned iFrag = 0; iFrag < counters[iCnt].
count; iFrag++)
408 log << MSG::DEBUG <<
"WORD"
409 << iFrag <<
":" << MSG::hex << bs[iBs] <<
endmsg;
455 log << MSG::DEBUG <<
"fragment"
456 << counters[iCnt].
id <<
" " << counters[iCnt].
count
460 for(
unsigned iFrag = 0; iFrag < counters[iCnt].
count; iFrag++)
463 log << MSG::DEBUG <<
"WORD"
464 << iFrag <<
":" << MSG::hex << bs[iBs] <<
endmsg;
474 static_cast<bool>(sl.
fwd),
489 <<
"Error: TgcByteStream::byteStream2Rdo Unsupported fragment type "
497 log << MSG::DEBUG <<
"Decoded " << MSG::dec << rdo.
size()
499 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.