ATLAS Offline Software
Loading...
Searching...
No Matches
TgcRODReadOut.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#include "TgcRODReadOut.h"
6#include "TgcSlbData.h"
7#include "TgcSlbDataHelper.h"
8
10
11// constructor
13 : m_cabling(cabling)
14{
16
17 for(unsigned int rodId=0; rodId<NROD+1; rodId++) {
18 m_failedDecodeRodToRdo[rodId] = 0;
20 m_failedSetSbLoc[rodId] = 0;
21 m_failedSetType[rodId] = 0;
22 m_failedGetSLBIDfromRxID[rodId] = 0;
24 }
25}
26
27// destructor
29{
30 MsgStream log(Athena::getMessageSvc(),"Muon::TgcRODReadOut");
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;
35 }
36 if(m_failedDecodeRodToRdo[rodId]) {
37 log << MSG::WARNING << "rodId=" << rodId << " : decodeRodToRdo faied "
38 << m_failedDecodeRodToRdo[rodId] << " times" << endmsg;
39 }
40 if(m_failedHeaderSizeRawData[rodId]) {
41 log << MSG::WARNING << "rodId=" << rodId << " : Header or SizeRawData was strange "
42 << m_failedHeaderSizeRawData[rodId] << " times" << endmsg;
43 }
44 if(m_failedSetSbLoc[rodId]) {
45 log << MSG::WARNING << "rodId=" << rodId << " : setSbLoc failed "
46 << m_failedSetSbLoc[rodId] << " times" << endmsg;
47 }
48 if(m_failedSetType[rodId]) {
49 log << MSG::WARNING << "rodId=" << rodId << " : setType failed "
50 << m_failedSetType[rodId] << " times" << endmsg;
51 }
52 if(m_failedGetSLBIDfromRxID[rodId]) {
53 log << MSG::WARNING << "rodId=" << rodId << " : getSLBIDfromRxID failed "
54 << m_failedGetSLBIDfromRxID[rodId] << " times" << endmsg;
55 }
57 log << MSG::WARNING << "rodId=" << rodId << " : getReadoutIDfromSLBID failed "
58 << m_failedGetReadoutIDfromSLBID[rodId] << " times" << endmsg;
59 }
60 }
62}
63
65 TgcRdo& tgcRdo,
66 uint32_t source_id) const
67{
68 MsgStream log(Athena::getMessageSvc(),"Muon::TgcRODReadOut");
69 bool t_debug = (log.level()<=MSG::DEBUG);
70
71 // set ROD attribute
72 uint16_t subDetectorId = (source_id & 0x00FF0000) >> 16;
73 uint16_t rodId = (source_id & 0x000000FF); // ROD : 0x01-0x0C(12), SROD: 0x11(17)-0x13(19)
74
75 uint32_t l1Id = tgcRdo.l1Id();
76 uint16_t bcId = tgcRdo.bcId();
77
78 tgcRdo.setOnlineId(subDetectorId, rodId);
79
80 // decode
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;
84
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
90 << "l1Id = " << l1Id
91 << "bcId = " << bcId
92 << endmsg;
93 log << (!m_failedDecodeRodToRdo[tmpRodId] ? MSG::WARNING : MSG::DEBUG)
94 << "Corrupted data, Skip decoding of remaining hits of this event..."
95 << endmsg;
96 }
97 m_failedDecodeRodToRdo[tmpRodId]++;
98
99 return StatusCode::SUCCESS;
100 }
101
102 return StatusCode::SUCCESS;
103}
104
106 TgcRdo& tgcRdo,
107 uint32_t source_id) const
108{
109 // create another TgcTdo
110 TgcRdo newRdo;
111
112 MsgStream log(Athena::getMessageSvc(),"Muon::TgcRODReadOut");
113
114 // set ROD attribute
115 uint16_t subDetectorId = (source_id & 0x00FF0000) >> 16;
116 uint16_t rodId = (source_id & 0x000000FF);
117
118 uint32_t l1Id = tgcRdo.l1Id();
119 uint16_t bcId = tgcRdo.bcId();
120
121 newRdo.setOnlineId(subDetectorId, rodId);
122
123 // decode
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
128 << "l1Id = " << l1Id
129 << "bcId = " << bcId
130 << endmsg;
131 log << MSG::WARNING << "Corrupted data, Skip decoding of remaining hits of this event..."
132 << endmsg;
133 return StatusCode::SUCCESS;
134 }
135
136 // compare
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;
140 }
141
142 return StatusCode::SUCCESS;
143}
144
145StatusCode Muon::TgcRODReadOut::compare(TgcRdo* rdo, TgcRdo* newRdo) const
146{
147 #ifndef NDEBUG
148 MsgStream log(Athena::getMessageSvc(),"Muon::TgcRODReadOut");
149 log << MSG::DEBUG << "TgcRODReadOut::compare" << endmsg;
150 log << MSG::DEBUG
151 << " rdo->size()=" << rdo->size()
152 << " newRdo->size()=" << newRdo->size()
153 << endmsg;
154 #endif
155
156 size_t n_data = newRdo->size();
157 size_t o_data = rdo->size();
158 std::vector<bool> check(o_data, false);
159
160 #ifndef NDEBUG
161 log << MSG::DEBUG << "Unmatched in RawData format" << endmsg;
162 #endif
163
164 for(size_t ib=0; ib<n_data; ib++){
165 TgcRawData* nraw = (*newRdo)[ib];
166 #ifndef NDEBUG
167 bool matched = false; // matched flag is only needed for DEBUG messages
168 #endif
169 for(size_t ic=0; ic<o_data; ic++){
170 TgcRawData* oraw = (*rdo)[ic];
171 if(isMatched(nraw, oraw)){
172 check[ic] = true;
173 #ifndef NDEBUG
174 matched = true;
175 #endif
176 break;
177 }
178 }
179 #ifndef NDEBUG
180 if(!matched) {
181 log << MSG::DEBUG << (*nraw) << endmsg;
182 }
183 #endif
184 }
185
186 #ifndef NDEBUG
187 log << MSG::DEBUG << "Unmatched in Readout format" << endmsg;
188 #endif
189 for(size_t ic=0; ic<o_data; ic++){
190 if(check[ic]) continue;
191 TgcRawData* oraw = (*rdo)[ic];
192 #ifndef NDEBUG
193 bool matched = false; // matched flag is only needed for DEBUG messages
194 #endif
195 for(size_t ib=0; ib<n_data; ib++){
196 TgcRawData* nraw = (*newRdo)[ib];
197 if(isMatched(oraw, nraw)){
198 #ifndef NDEBUG
199 matched = true;
200 #endif
201 break;
202 }
203 }
204 #ifndef NDEBUG
205 if(!matched) {
206 log << MSG::DEBUG << (*oraw) << endmsg;
207 }
208 #endif
209 }
210
211 return StatusCode::SUCCESS;
212}
213
215 const TgcRawData* rdo2)
216{
217 if(rdo1->subDetectorId() != rdo2->subDetectorId()) return false;
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;
223
224 switch(rdo1->type()){
226 if(rdo1->isAdjacent() != rdo2->isAdjacent()) return false;
227 return rdo1->bitpos() == rdo2->bitpos();
228 break;
229
231 if(rdo1->segment() != rdo2->segment()) return false;
232 if(rdo1->subMatrix() != rdo2->subMatrix()) return false;
233 if(rdo1->segment() != rdo2->segment()) return false;
234 if(rdo1->position() != rdo2->position()) return false;
235 if(rdo1->delta() != rdo2->delta()) return false;
236 return true;
237 break;
238
240 if(rdo1->isStrip() != rdo2->isStrip()) return false;
241 if(rdo1->isForward() != rdo2->isForward()) return false;
242 if(rdo1->sector() != rdo2->sector()) return false;
243 if(rdo1->chip() != rdo2->chip()) return false;
244 if(rdo1->index() != rdo2->index()) return false;
245 if(rdo1->isHipt() != rdo2->isHipt()) 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;
249 return true;
250 break;
251
253 if(rdo1->isForward() != rdo2->isForward()) return false;
254 if(rdo1->sector() != rdo2->sector()) return false;
255 if(rdo1->index() != rdo2->index()) return false;
256 if(rdo1->isMuplus() != rdo2->isMuplus()) return false;
257 if(rdo1->threshold() != rdo2->threshold()) return false;
258 if(rdo1->roi() != rdo2->roi()) return false;
259 return true;
260 break;
261
262 default:
263 return true;
264 break;
265 }
266}
267
268// decode ROD data to RDO
270 const ByteStream& vData,
271 uint16_t subDetectorId,
272 uint16_t rodId,
273 uint32_t l1Id,
274 uint16_t bcId) const
275{
276
278 // decode ROD data part
279
280 // total data fragment size
281 //const uint32_t tot_vData = vData.size();
282
283 //Data Word Count (added by okumura)
284 uint32_t sizeRawData=0;
285 uint32_t sizeReadOutFormatHit=0;
286 uint32_t sizeReadOutFormatTracklet=0;
287 //uint32_t sizeChamberFormatHit=0;
288 //uint32_t sizeChamberFormatTracklet=0;
289 uint32_t sizeHipTWord=0;
290 uint32_t sizeSectorLogicWord=0;
291
292 // flag of correct header
293 bool isHeaderOK = true;
294 // index of vData;
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;
299
300 // check HEADER for RawData section
301 if(rawdata_flag==0xFF) break;
302
303 // Words Count
304 uint32_t counter=(vData[vDataIndex] & FragmentCountMask );
305
306 switch(flagmentId) {
307 case 0x01: //Fragment ID ==1
308 sizeRawData = counter;
309 break;
310 case 0x02: //Fragmant ID ==2
311 sizeReadOutFormatHit = counter;
312 break;
313 case 0x03: //Fragmant ID ==3
314 sizeReadOutFormatTracklet = counter;
315 break;
316 //case 0x04: //Fragmant ID ==4
317 //sizeChamberFormatHit =counter;
318 //break;
319 //case 0x05: //Fragmant ID ==5
320 //sizeChamberFormatTracklet =counter;
321 //break;
322 case 0x08: //Fragmant ID ==8
323 sizeHipTWord =counter;
324 break;
325 case 0x09: //Fragmant ID ==9
326 sizeSectorLogicWord =counter;
327 break;
328 default:
329 isHeaderOK = false;
330 break;
331 }
332 }
333
334 MsgStream log(Athena::getMessageSvc(),"Muon::TgcRODReadOut");
335 bool t_debug = (log.level()<=MSG::DEBUG);
336
337 if(!isHeaderOK ||
338 sizeRawData==0 ||
339 sizeRawData>=0x10000
340 ) {
341 unsigned int tmpRodId = rodId + (subDetectorId==CSIDE ? NROD/2 : 0);
342 if(tmpRodId>NROD) tmpRodId = NROD;
343
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
349 << endmsg;
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
356 << endmsg;
357 }
358 m_failedHeaderSizeRawData[tmpRodId]++;
359
360 return StatusCode::SUCCESS;
361 }
362
363 if(t_debug) {
364 log << MSG::DEBUG
365 << "TgcRODReadout : ROD ID=" << rodId
366 << " RawData Size=" << sizeRawData
367 << " ReadOut Hit Size= " << sizeReadOutFormatHit
368 << " ReadOut Tracklet= " << sizeReadOutFormatTracklet
369 << " ReadOut SL= " << sizeSectorLogicWord
370 << endmsg;
371 }
372
373 uint32_t firstRawDataIndex=vDataIndex;
374
375 // RawData Collection.
376 std::vector<TgcRawData *> vCh;
377
378 // decode RAW DATA Fragment process start
379 uint16_t fe_bcId=0;
380 uint32_t fe_l1Id=0;
381 uint16_t sswId= 999;
382 uint16_t slbId = 999;
383 uint16_t rxId = 999;
384 uint16_t mod = 999;
385 uint16_t b_error = 0;
386 uint16_t rec_type= 999;
387
388 TgcSlbData* slb =nullptr;
389
390
391 for(; vDataIndex < firstRawDataIndex+sizeRawData; ++vDataIndex){
392 if(t_debug) {
393 log << MSG::DEBUG
394 << "Tgc BS Raw:" << vDataIndex
395 << ": " << std::hex << vData[vDataIndex]
396 << endmsg;
397 }
398
399 // header check
400 unsigned int header = vData[vDataIndex] & HeaderMask;
401
402 uint32_t rawdata_flag = (vData[vDataIndex] & RawDataFragMask) >> 24;
403 if((rawdata_flag == 0xff) || (rawdata_flag == 0xfc)){
404 continue;
405 }
406
407 switch(header) {
408 case HeaderEvent: // Event header
409 // get Rec Type
410 rec_type = (vData[vDataIndex] & 0x18000000) >> 27;
411 if (rec_type >1) {
412 log << MSG::WARNING
413 << "Rec Type " << rec_type << " is not supproted "
414 << " Skip decoding of remaining hits of this event..."
415 << endmsg;
416 return StatusCode::SUCCESS;
417 }
418
419 // get SSW ID
420 if (rec_type == 0) {
421 // format Oct. 09
422 sswId = (vData[vDataIndex] & 0x0F0000) >> 16;
423 } else if (rec_type ==1) {
424 // original SSW format
425 sswId = (vData[vDataIndex] & 0x07800000) >> 23;
426 }
427 break;
428
429 case HeaderSLB10: // SLB header 10
430 // Create RDOs by using slb bit array
431 if(slb!=nullptr) {
432 m_tgcSlbDataHelper->convertToHits(subDetectorId, rodId, slb, vCh);
433 m_tgcSlbDataHelper->convertToCoincidences(subDetectorId, rodId, slb, vCh);
434 delete slb; slb = nullptr;
435 }
436 // get SLB ID, BCID, L1ID, ModuleType
437 fe_l1Id = (vData[vDataIndex] & 0x0000F000) >> 12;
438 fe_bcId = vData[vDataIndex] & 0x00000FFF;
439 slbId = (vData[vDataIndex] & 0x1F000000) >> 24;
440
441 if (rec_type == 0) {
442 // format Oct. 09
443 mod = (vData[vDataIndex] & 0x00070000) >> 16;
444 rxId = (vData[vDataIndex] & 0x00F80000) >> 19;
445 } else if (rec_type ==1) {
446 // original SSW format
447 mod = (vData[vDataIndex] & 0x000E0000) >> 17;
448 }
449
450 if(fe_l1Id != l1Id) {
451 if(t_debug) {
452 log << MSG::DEBUG
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
458 << endmsg;
459 }
460 }
461 b_error = 0;
462 break;
463
464
465 case HeaderSLB11: // SLB header 11 or Trailer
466 if(vData[vDataIndex] & 0x10000000){
467 //SLB Trailer
468 // decode Bit map
469 b_error = vData[vDataIndex] & 0x0FFF;
470
471 } else {
472 //SLBHeader 11
473 // get RXID
474 rxId = (vData[vDataIndex] & 0x7C00000) >> 22;
475
476 break;
477 }
478 /* FALLTHROUGH */
479
480
481 case HeaderSLBC: // SLB data
482 case HeaderSLBP:
483 case HeaderSLBN:
484 // create slb
485 if(!slb) {
486 // create TgcSlbData
487 slb = new TgcSlbData(bcId, l1Id, sswId, slbId);
488 // set sbLoc by using rxId
489 if(!setSbLoc(subDetectorId, rodId, slb, rxId) ){
490 unsigned int tmpRodId = rodId + (subDetectorId==CSIDE ? NROD/2 : 0);
491 if(tmpRodId>NROD) tmpRodId = NROD;
492
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
500 << endmsg;
501 log << (!m_failedSetSbLoc[tmpRodId] ? MSG::WARNING : MSG::DEBUG)
502 << "Corrupted data, Skip decoding of remaining hits of this event..."
503 << endmsg;
504 }
505 m_failedSetSbLoc[tmpRodId]++;
506 delete slb; slb = nullptr;
507 return StatusCode::SUCCESS;
508 }
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;
512
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
519 << endmsg;
520 log << (!m_failedSetType[tmpRodId] ? MSG::WARNING : MSG::DEBUG)
521 << "Corrupted data, Skip decoding of remaining hits of this event..."
522 << endmsg;
523 }
524 m_failedSetType[tmpRodId]++;
525 delete slb; slb = nullptr;
526 return StatusCode::SUCCESS;
527 }
528 if(b_error) {
529 slb->setError(b_error);
530 }
531 if(t_debug) {
532 log << MSG::DEBUG
533 << "TgcRODReadout : slb =" << slb
534 << " : rodId=" << rodId
535 << " : sswId=" << sswId
536 << " : slbAddress= " << slbId
537 << " : rxId= "<< rxId
538 << endmsg;
539 }
540 }
541
542
543 // decode Bit map
544 for(int iHL=0; iHL<32; iHL+=16) {// Higher and Lower word
545 uint32_t vd = vData[vDataIndex] << iHL;
546 // get BC tag
547 uint32_t bcTag;
548 if((vd & HeaderMask) == HeaderSLBC) {
550 } else if((vd & HeaderMask) == HeaderSLBP) {
552 } else if((vd& HeaderMask) == HeaderSLBN) {
554 } else if((vd& HeaderMask) == HeaderSLB11) {
555 // Trailer
556 slb->setError(vData[vDataIndex] & 0x0FFF);
557 continue;
558 } else {
559 continue;
560 }
561 // Cell Address and Bit map
562 unsigned long cellAddr = (vd & 0x1F000000) >> 24;
563 unsigned long cellBitMap = (vd & 0x00FF0000) >> 16;
564
565 if(cellAddr < 25) {
566 // set Bit map
567 slb->setBitmap(bcTag, cellAddr, cellBitMap);
568 } else {
569 // PADWORD
570 }
571 }
572 break;
573
574 case HeaderError: // Error Report
575 {
576 uint32_t error_context = (vData[vDataIndex] & 0x00FFFFFF);
577 uint16_t error_id = (vData[vDataIndex] & 0x01F000000)>>24;
578 if((t_debug && (error_context!=0))) {
579 log << MSG::DEBUG
580 << "TgcRODReadout : Error Report "
581 << " : error id =" << error_id
582 << " : context =" << error_context
583 << endmsg;
584 }
585 }
586 break;
587
588 default:
589 break;
590 }
591 }
592 if(slb!=nullptr) {
593 m_tgcSlbDataHelper->convertToHits(subDetectorId, rodId, slb, vCh);
594 m_tgcSlbDataHelper->convertToCoincidences(subDetectorId, rodId, slb, vCh);
595 delete slb; slb = nullptr;
596 }
597
598 if(t_debug) {
599 uint32_t firstROHitIndex=vDataIndex;
600 for(; vDataIndex < firstROHitIndex+sizeReadOutFormatHit; ++vDataIndex){
601 log << MSG::DEBUG
602 << "Tgc BS Readout HIT:" << vDataIndex
603 << ": " << std::hex << vData[vDataIndex] << endmsg;
604 }
605 uint32_t firstROTrackletIndex=vDataIndex;
606 for(; vDataIndex < firstROTrackletIndex+sizeReadOutFormatTracklet; ++vDataIndex){
607 log << MSG::DEBUG
608 << "Tgc BS Readout HIT:" << vDataIndex
609 << ": " << std::hex << vData[vDataIndex] << endmsg;
610 }
611 }
612
613
615 // append Hits to RDO
616
617 // loop over all hits
618 std::vector<TgcRawData *>::iterator ith = vCh.begin();
619 std::vector<TgcRawData *>::iterator ith_e = vCh.end();
620
621 size_t n_vCh=0;
622 for(; ith!=ith_e; ++ith){
623 // push back
624 tgcRdo.push_back(*ith);
625
626 n_vCh +=1;
627
628 }
629 if(t_debug) {
630 log << MSG::DEBUG
631 << n_vCh << "words of were recorded in TgcRdo container"
632 << endmsg;
633 }
634
635 return StatusCode::SUCCESS;
636
637}
638
639// set sbLoc to slb
640bool Muon::TgcRODReadOut::setSbLoc(uint16_t subDetectorId,
641 uint16_t rodId,
642 TgcSlbData * slb,
643 int rxId) const
644{
645 MsgStream log(Athena::getMessageSvc(),"Muon::TgcRODReadOut");
646 bool t_debug = (log.level()<=MSG::DEBUG);
647
648 // get sbLoc
649 int phi = 0;
650 bool isAside = false;
651 bool isEndcap = false;
652 int moduleType = 0;
653 int slbId = 0;
654 int dummy_subDetectorId = 0;
655 int dummy_rodId = 0;
656 int dummy_sswId = 0;
657 int sbLoc = 0;
658 int slbaddress_ret = 0;
659
660 int sswId = slb->getSswId();
661
662 if(!m_cabling.getSLBIDfromRxID(phi,
663 isAside,
664 isEndcap,
665 moduleType,
666 slbId,
667 subDetectorId,
668 rodId,
669 sswId,
670 rxId)) {
671 unsigned int tmpRodId = rodId + (subDetectorId==CSIDE ? NROD/2 : 0);
672 if(tmpRodId>NROD) tmpRodId = NROD;
673
674 if(t_debug || !m_failedGetSLBIDfromRxID[tmpRodId]) {
675 log << (!m_failedGetSLBIDfromRxID[tmpRodId] ? MSG::WARNING : MSG::DEBUG)
676 << " Fail to getSLBIDfromRxID "
677 << " :rodId=" <<rodId
678 << " :sswId="<<sswId
679 << " :rxId= "<<rxId
680 << endmsg;
681 }
682 m_failedGetSLBIDfromRxID[tmpRodId]++;
683
684 return false;
685 }
686
687 if(!m_cabling.getReadoutIDfromSLBID(phi,
688 isAside,
689 isEndcap,
690 moduleType,
691 slbId,
692 dummy_subDetectorId,
693 dummy_rodId,
694 dummy_sswId,
695 sbLoc)) {
696 unsigned int tmpRodId = rodId + (subDetectorId==CSIDE ? NROD/2 : 0);
697 if(tmpRodId>NROD) tmpRodId = NROD;
698
699 if((t_debug || !m_failedGetReadoutIDfromSLBID[tmpRodId])) {
700 log << (!m_failedGetReadoutIDfromSLBID[tmpRodId] ? MSG::WARNING : MSG::DEBUG)
701 << " Fail to getReadoutIDfromSLBID "
702 << " :rodId=" <<rodId
703 << " :sswId="<<sswId
704 << " :rxId= "<<rxId
705 << endmsg;
706 }
708
709 return false;
710 }
711
712 if(m_cabling.getSLBAddressfromReadoutID(slbaddress_ret,
713 subDetectorId,
714 rodId,
715 sswId,
716 sbLoc)) {
717 // check SLB Address
718 if(slbaddress_ret != slb->getSlbId() ) {
719 if(t_debug) {
720 log << MSG::DEBUG
721 << " wrong getSLBAddress :"
722 <<" :sswId = "<<sswId
723 <<" :rxId = " <<rxId << ":sbLoc = " << sbLoc
724 << endmsg;
725 log << MSG::DEBUG
726 <<" :slbAddress = " << slb->getSlbId()
727 <<" expected value = " << slbaddress_ret
728 << endmsg;
729 }
730 }
731 }
732
733 // set sbLoc
734 slb->setSbLoc(sbLoc);
735
736 return true;
737}
Scalar phi() const
phi method
#define endmsg
uint16_t bcId(uint32_t data)
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.
StatusCode decodeRodToRdo(TgcRdo &tgcRdo, const ByteStream &vData, uint16_t subDetectorId, uint16_t rodId, uint32_t l1Id, uint16_t bcId) const
Decode BS to RDO container.
std::atomic< unsigned int > m_failedSetType[NROD+1]
The number of failures on setType.
virtual ~TgcRODReadOut()
Destructor.
const MuonTGC_CablingSvc & m_cabling
TGC Cabling Svc.
TgcSlbDataHelper * m_tgcSlbDataHelper
TGC SLB data helper.
std::atomic< unsigned int > m_failedDecodeRodToRdo[NROD+1]
The number of failures on decodeRodToRdo.
OFFLINE_FRAGMENTS_NAMESPACE::PointerType ByteStream
StatusCode check(const ByteStream &bs, TgcRdo &tgcRdo, uint32_t source_id) const
Convert BS (ROB fragment) to RDO and compare decoded RDO container and another RDO container decoded ...
bool setSbLoc(uint16_t subDetectorId, uint16_t rodId, TgcSlbData *slb, int rxId) const
Set sbLoc.
StatusCode byteStream2Rdo(const ByteStream &bs, TgcRdo &tgcRdo, uint32_t source_id) const
Convert BS (ROB fragment) to RDO.
std::atomic< unsigned int > m_failedGetSLBIDfromRxID[NROD+1]
The number of failures on getSLBIDfromRxID.
TgcRODReadOut(const MuonTGC_CablingSvc &cabling)
Constructor.
std::atomic< unsigned int > m_failedSetSbLoc[NROD+1]
The number of failures on setSbLoc.
StatusCode compare(TgcRdo *rdo, TgcRdo *newRdo) const
Compare two RDO containers.
std::atomic< unsigned int > m_failedGetReadoutIDfromSLBID[NROD+1]
The number of failures on getReadoutIDfromSLBID.
std::atomic< unsigned int > m_failedHeaderSizeRawData[NROD+1]
The number of strange header and SizeRawData.
static bool isMatched(const TgcRawData *rdo1, const TgcRawData *rdo2)
Compare two RDOs.
This is the SLB data helper class which stores bit map, reconstructs to hits and coincidences,...
This is the SLB data class which represents an SLB block.
Definition TgcSlbData.h:22
uint16_t getSswId() const
Get sswId.
void setBitmap(const uint16_t bcTag, const uint32_t cellAddr, const uint32_t cellData)
Store bitmap.
void setError(uint16_t error)
Set Error.
void setSbLoc(uint16_t sbLoc)
Set sbLoc.
uint16_t getSlbId() const
Get slbId.
An unit object of TGC ROD output.
Definition TgcRawData.h:23
uint16_t hsub() const
Definition TgcRawData.h:349
uint16_t sswId() const
Definition TgcRawData.h:272
bool isStrip() const
Definition TgcRawData.h:353
uint16_t chip() const
Definition TgcRawData.h:337
uint16_t index() const
Definition TgcRawData.h:309
int16_t delta() const
Definition TgcRawData.h:317
uint16_t position() const
Definition TgcRawData.h:313
uint16_t subMatrix() const
Definition TgcRawData.h:329
bool isAdjacent() const
Definition TgcRawData.h:305
bool isMuplus() const
Definition TgcRawData.h:361
DataType type() const
Definition TgcRawData.h:280
uint16_t bitpos() const
Definition TgcRawData.h:293
uint16_t segment() const
Definition TgcRawData.h:325
uint16_t bcTag() const
Definition TgcRawData.h:251
uint16_t subDetectorId() const
Definition TgcRawData.h:264
uint16_t slbId() const
Definition TgcRawData.h:276
uint16_t rodId() const
Definition TgcRawData.h:268
uint16_t sector() const
Definition TgcRawData.h:333
bool isHipt() const
Definition TgcRawData.h:341
uint16_t roi() const
Definition TgcRawData.h:377
uint16_t hitId() const
Definition TgcRawData.h:345
bool isForward() const
Definition TgcRawData.h:289
uint16_t threshold() const
Definition TgcRawData.h:365
uint16_t l1Id() const
Definition TgcRdo.h:150
void setOnlineId(uint16_t subDetectorId, uint16_t rodId)
Definition TgcRdo.cxx:37
uint16_t bcId() const
Definition TgcRdo.h:146
singleton-like access to IMessageSvc via open function and helper
IMessageSvc * getMessageSvc(bool quiet=false)