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