17 for(
unsigned int rodId=0; rodId<
NROD+1; rodId++) {
31 for(
unsigned int rodId=0; rodId<NROD+1; rodId++) {
32 if(m_failedDecodeRodToRdo[rodId]) {
33 log << MSG::WARNING <<
"rodId=" << rodId <<
" : decodeRodToRdo faied "
34 << m_failedDecodeRodToRdo[rodId] <<
" times" <<
endmsg;
36 if(m_failedDecodeRodToRdo[rodId]) {
37 log << MSG::WARNING <<
"rodId=" << rodId <<
" : decodeRodToRdo faied "
38 << m_failedDecodeRodToRdo[rodId] <<
" times" <<
endmsg;
40 if(m_failedHeaderSizeRawData[rodId]) {
41 log << MSG::WARNING <<
"rodId=" << rodId <<
" : Header or SizeRawData was strange "
42 << m_failedHeaderSizeRawData[rodId] <<
" times" <<
endmsg;
44 if(m_failedSetSbLoc[rodId]) {
45 log << MSG::WARNING <<
"rodId=" << rodId <<
" : setSbLoc failed "
46 << m_failedSetSbLoc[rodId] <<
" times" <<
endmsg;
48 if(m_failedSetType[rodId]) {
49 log << MSG::WARNING <<
"rodId=" << rodId <<
" : setType failed "
50 << m_failedSetType[rodId] <<
" times" <<
endmsg;
52 if(m_failedGetSLBIDfromRxID[rodId]) {
53 log << MSG::WARNING <<
"rodId=" << rodId <<
" : getSLBIDfromRxID failed "
54 << m_failedGetSLBIDfromRxID[rodId] <<
" times" <<
endmsg;
56 if(m_failedGetReadoutIDfromSLBID[rodId]) {
57 log << MSG::WARNING <<
"rodId=" << rodId <<
" : getReadoutIDfromSLBID failed "
58 << m_failedGetReadoutIDfromSLBID[rodId] <<
" times" <<
endmsg;
61 delete m_tgcSlbDataHelper; m_tgcSlbDataHelper=
nullptr;
72 uint16_t subDetectorId = (source_id & 0x00FF0000) >> 16;
73 uint16_t rodId = (source_id & 0x000000FF);
81 if(!(decodeRodToRdo(tgcRdo, bs,subDetectorId, rodId,l1Id,
bcId).isSuccess())){
82 unsigned int tmpRodId = rodId + (subDetectorId==
CSIDE ? NROD/2 : 0);
83 if(tmpRodId>NROD) tmpRodId = NROD;
85 if(t_debug || !m_failedDecodeRodToRdo[tmpRodId]) {
86 log << (!m_failedDecodeRodToRdo[tmpRodId] ? MSG::WARNING :
MSG::DEBUG)
87 <<
" Can't convert TGC BS to RDO: "
88 <<
"subDetectorId = " << subDetectorId
89 <<
"rodId = " << rodId
93 log << (!m_failedDecodeRodToRdo[tmpRodId] ? MSG::WARNING :
MSG::DEBUG)
94 <<
"Corrupted data, Skip decoding of remaining hits of this event..."
97 m_failedDecodeRodToRdo[tmpRodId]++;
99 return StatusCode::SUCCESS;
102 return StatusCode::SUCCESS;
115 uint16_t subDetectorId = (source_id & 0x00FF0000) >> 16;
116 uint16_t rodId = (source_id & 0x000000FF);
124 if(!(decodeRodToRdo(newRdo, bs,subDetectorId, rodId,l1Id,
bcId).isSuccess())){
125 log << MSG::WARNING <<
" Can't convert TGC BS to RDO: "
126 <<
"subDetectorId = " << subDetectorId
127 <<
"rodId = " << rodId
131 log << MSG::WARNING <<
"Corrupted data, Skip decoding of remaining hits of this event..."
133 return StatusCode::SUCCESS;
137 if(!
compare(&tgcRdo, &newRdo)){
138 log << MSG::WARNING <<
"Can't compare TgcRdos: Skip decoding of remaining hits of this event..."<<
endmsg;
139 return StatusCode::SUCCESS;
142 return StatusCode::SUCCESS;
151 <<
" rdo->size()=" << rdo->
size()
152 <<
" newRdo->size()=" << newRdo->
size()
156 size_t n_data = newRdo->
size();
157 size_t o_data = rdo->
size();
158 std::vector<bool>
check(o_data,
false);
164 for(
size_t ib=0;
ib<n_data;
ib++){
169 for(
size_t ic=0;
ic<o_data;
ic++){
189 for(
size_t ic=0;
ic<o_data;
ic++){
195 for(
size_t ib=0;
ib<n_data;
ib++){
211 return StatusCode::SUCCESS;
218 if(rdo1->
rodId() != rdo2->
rodId())
return false;
219 if(rdo1->
sswId() != rdo2->
sswId())
return false;
220 if(rdo1->
slbId() != rdo2->
slbId())
return false;
221 if(rdo1->
bcTag() != rdo2->
bcTag())
return false;
222 if(rdo1->
type() != rdo2->
type())
return false;
224 switch(rdo1->
type()){
235 if(rdo1->
delta() != rdo2->
delta())
return false;
243 if(rdo1->
chip() != rdo2->
chip())
return false;
244 if(rdo1->
index() != rdo2->
index())
return false;
246 if(rdo1->
hitId() != rdo2->
hitId())
return false;
247 if(rdo1->
hsub() != rdo2->
hsub())
return false;
248 if(rdo1->
delta() != rdo2->
delta())
return false;
255 if(rdo1->
index() != rdo2->
index())
return false;
258 if(rdo1->
roi() != rdo2->
roi())
return false;
286 uint32_t sizeReadOutFormatTracklet=0;
293 bool isHeaderOK =
true;
295 unsigned int vDataIndex;
296 for(vDataIndex=0; isHeaderOK; vDataIndex++){
297 uint32_t rawdata_flag = (vData[vDataIndex] & RawDataFragMask) >>24;
298 uint32_t flagmentId = (vData[vDataIndex] & FragmentIdMask) >>24;
301 if(rawdata_flag==0xFF)
break;
311 sizeReadOutFormatHit =
counter;
314 sizeReadOutFormatTracklet =
counter;
341 unsigned int tmpRodId = rodId + (subDetectorId==
CSIDE ? NROD/2 : 0);
342 if(tmpRodId>NROD) tmpRodId = NROD;
344 if((t_debug || !m_failedHeaderSizeRawData[tmpRodId])) {
345 log << (!m_failedHeaderSizeRawData[tmpRodId] ? MSG::WARNING :
MSG::DEBUG)
346 <<
"Corrupted data, Skip decoding of this ROD data"
347 <<
" TgcRODReadout : ROD ID= " << rodId
348 <<
" RawData Size= " << sizeRawData
350 log << (!m_failedHeaderSizeRawData[tmpRodId] ? MSG::WARNING :
MSG::DEBUG)
351 <<
"ReadOut Hit Size= " << sizeReadOutFormatHit
352 <<
" ReadOut Tracklet= " << sizeReadOutFormatTracklet
353 <<
" ReadOut SL= " << sizeSectorLogicWord
354 <<
" vDataIndex = " << vDataIndex
355 <<
" HipT = " << sizeHipTWord
358 m_failedHeaderSizeRawData[tmpRodId]++;
360 return StatusCode::SUCCESS;
365 <<
"TgcRODReadout : ROD ID=" << rodId
366 <<
" RawData Size=" << sizeRawData
367 <<
" ReadOut Hit Size= " << sizeReadOutFormatHit
368 <<
" ReadOut Tracklet= " << sizeReadOutFormatTracklet
369 <<
" ReadOut SL= " << sizeSectorLogicWord
373 uint32_t firstRawDataIndex=vDataIndex;
376 std::vector<TgcRawData *> vCh;
391 for(; vDataIndex < firstRawDataIndex+sizeRawData; ++vDataIndex){
394 <<
"Tgc BS Raw:" << vDataIndex
395 <<
": " << std::hex << vData[vDataIndex]
400 unsigned int header = vData[vDataIndex] & HeaderMask;
402 uint32_t rawdata_flag = (vData[vDataIndex] & RawDataFragMask) >> 24;
403 if((rawdata_flag == 0xff) || (rawdata_flag == 0xfc)){
410 rec_type = (vData[vDataIndex] & 0x18000000) >> 27;
413 <<
"Rec Type " << rec_type <<
" is not supproted "
414 <<
" Skip decoding of remaining hits of this event..."
416 return StatusCode::SUCCESS;
422 sswId = (vData[vDataIndex] & 0x0F0000) >> 16;
423 }
else if (rec_type ==1) {
425 sswId = (vData[vDataIndex] & 0x07800000) >> 23;
432 m_tgcSlbDataHelper->convertToHits(subDetectorId, rodId, slb, vCh);
433 m_tgcSlbDataHelper->convertToCoincidences(subDetectorId, rodId, slb, vCh);
434 delete slb; slb =
nullptr;
437 fe_l1Id = (vData[vDataIndex] & 0x0000F000) >> 12;
438 fe_bcId = vData[vDataIndex] & 0x00000FFF;
439 slbId = (vData[vDataIndex] & 0x1F000000) >> 24;
443 mod = (vData[vDataIndex] & 0x00070000) >> 16;
444 rxId = (vData[vDataIndex] & 0x00F80000) >> 19;
445 }
else if (rec_type ==1) {
447 mod = (vData[vDataIndex] & 0x000E0000) >> 17;
450 if(fe_l1Id != l1Id) {
453 <<
"l1Id in SLB Header is different from l1Id in ROD "
454 <<
" for rodId:" << rodId
455 <<
" slbId:" << slbId
456 <<
" l1Id, bcId (SLB):" << fe_l1Id <<
", " << fe_bcId
457 <<
" l1Id, bcId (ROD):" << l1Id <<
", " <<
bcId
466 if(vData[vDataIndex] & 0x10000000){
469 b_error = vData[vDataIndex] & 0x0FFF;
474 rxId = (vData[vDataIndex] & 0x7C00000) >> 22;
489 if(!setSbLoc(subDetectorId, rodId, slb, rxId) ){
490 unsigned int tmpRodId = rodId + (subDetectorId==
CSIDE ? NROD/2 : 0);
491 if(tmpRodId>NROD) tmpRodId = NROD;
493 if((t_debug || !m_failedSetSbLoc[tmpRodId])) {
494 log << (!m_failedSetSbLoc[tmpRodId] ? MSG::WARNING :
MSG::DEBUG)
495 <<
" Fail to set sbLoc"
496 <<
" :rodId=" << rodId
497 <<
" :sswId=" << sswId
498 <<
" :slbAddress= " << slbId
499 <<
" : rxId= " << rxId
501 log << (!m_failedSetSbLoc[tmpRodId] ? MSG::WARNING :
MSG::DEBUG)
502 <<
"Corrupted data, Skip decoding of remaining hits of this event..."
505 m_failedSetSbLoc[tmpRodId]++;
506 delete slb; slb =
nullptr;
507 return StatusCode::SUCCESS;
509 if(!m_tgcSlbDataHelper->setType(subDetectorId, rodId, slb,
mod)) {
510 unsigned int tmpRodId = rodId + (subDetectorId==
CSIDE ? NROD/2 : 0);
511 if(tmpRodId>NROD) tmpRodId = NROD;
513 if((t_debug || !m_failedSetType[tmpRodId])) {
514 log << (!m_failedSetType[tmpRodId] ? MSG::WARNING :
MSG::DEBUG)
515 <<
" Fail to set Module Type"
516 <<
" :rodId=" << rodId
517 <<
" :sswId=" << sswId
518 <<
" :slbAddress= " << slbId
520 log << (!m_failedSetType[tmpRodId] ? MSG::WARNING :
MSG::DEBUG)
521 <<
"Corrupted data, Skip decoding of remaining hits of this event..."
524 m_failedSetType[tmpRodId]++;
525 delete slb; slb =
nullptr;
526 return StatusCode::SUCCESS;
533 <<
"TgcRODReadout : slb =" << slb
534 <<
" : rodId=" << rodId
535 <<
" : sswId=" << sswId
536 <<
" : slbAddress= " << slbId
537 <<
" : rxId= "<< rxId
544 for(
int iHL=0; iHL<32; iHL+=16) {
545 uint32_t vd = vData[vDataIndex] << iHL;
548 if((vd & HeaderMask) == HeaderSLBC) {
550 }
else if((vd & HeaderMask) == HeaderSLBP) {
552 }
else if((vd& HeaderMask) == HeaderSLBN) {
554 }
else if((vd& HeaderMask) == HeaderSLB11) {
556 slb->
setError(vData[vDataIndex] & 0x0FFF);
562 unsigned long cellAddr = (vd & 0x1F000000) >> 24;
563 unsigned long cellBitMap = (vd & 0x00FF0000) >> 16;
576 uint32_t error_context = (vData[vDataIndex] & 0x00FFFFFF);
577 uint16_t error_id = (vData[vDataIndex] & 0x01F000000)>>24;
578 if((t_debug && (error_context!=0))) {
580 <<
"TgcRODReadout : Error Report "
581 <<
" : error id =" << error_id
582 <<
" : context =" << error_context
593 m_tgcSlbDataHelper->convertToHits(subDetectorId, rodId, slb, vCh);
594 m_tgcSlbDataHelper->convertToCoincidences(subDetectorId, rodId, slb, vCh);
595 delete slb; slb =
nullptr;
599 uint32_t firstROHitIndex=vDataIndex;
600 for(; vDataIndex < firstROHitIndex+sizeReadOutFormatHit; ++vDataIndex){
602 <<
"Tgc BS Readout HIT:" << vDataIndex
603 <<
": " << std::hex << vData[vDataIndex] <<
endmsg;
605 uint32_t firstROTrackletIndex=vDataIndex;
606 for(; vDataIndex < firstROTrackletIndex+sizeReadOutFormatTracklet; ++vDataIndex){
608 <<
"Tgc BS Readout HIT:" << vDataIndex
609 <<
": " << std::hex << vData[vDataIndex] <<
endmsg;
622 for(; ith!=ith_e; ++ith){
631 << n_vCh <<
"words of were recorded in TgcRdo container"
635 return StatusCode::SUCCESS;
650 bool isAside =
false;
651 bool isEndcap =
false;
654 int dummy_subDetectorId = 0;
658 int slbaddress_ret = 0;
662 if(!m_cabling.getSLBIDfromRxID(phi,
671 unsigned int tmpRodId = rodId + (subDetectorId==
CSIDE ? NROD/2 : 0);
672 if(tmpRodId>NROD) tmpRodId = NROD;
674 if(t_debug || !m_failedGetSLBIDfromRxID[tmpRodId]) {
675 log << (!m_failedGetSLBIDfromRxID[tmpRodId] ? MSG::WARNING :
MSG::DEBUG)
676 <<
" Fail to getSLBIDfromRxID "
677 <<
" :rodId=" <<rodId
682 m_failedGetSLBIDfromRxID[tmpRodId]++;
687 if(!m_cabling.getReadoutIDfromSLBID(phi,
696 unsigned int tmpRodId = rodId + (subDetectorId==
CSIDE ? NROD/2 : 0);
697 if(tmpRodId>NROD) tmpRodId = NROD;
699 if((t_debug || !m_failedGetReadoutIDfromSLBID[tmpRodId])) {
700 log << (!m_failedGetReadoutIDfromSLBID[tmpRodId] ? MSG::WARNING :
MSG::DEBUG)
701 <<
" Fail to getReadoutIDfromSLBID "
702 <<
" :rodId=" <<rodId
707 m_failedGetReadoutIDfromSLBID[tmpRodId]++;
712 if(m_cabling.getSLBAddressfromReadoutID(slbaddress_ret,
718 if(slbaddress_ret != slb->
getSlbId() ) {
721 <<
" wrong getSLBAddress :"
722 <<
" :sswId = "<<sswId
723 <<
" :rxId = " <<rxId <<
":sbLoc = " << sbLoc
726 <<
" :slbAddress = " << slb->
getSlbId()
727 <<
" expected value = " << slbaddress_ret