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 if (rdo1.segment() != rdo2.segment()) {
227 return false;
228 }
229 if (rdo1.position() != rdo2.position()) {
230 return false;
231 }
232 if (rdo1.delta() != rdo2.delta()) {
233 return false;
234 }
235 return true;
236 break;
237
239 if (rdo1.isStrip() != rdo2.isStrip()) {
240 return false;
241 }
242 if (rdo1.isForward() != rdo2.isForward()) {
243 return false;
244 }
245 if (rdo1.sector() != rdo2.sector()) {
246 return false;
247 }
248 if (rdo1.chip() != rdo2.chip()) {
249 return false;
250 }
251 if (rdo1.index() != rdo2.index()) {
252 return false;
253 }
254 if (rdo1.isHipt() != rdo2.isHipt()) {
255 return false;
256 }
257 if (rdo1.hitId() != rdo2.hitId()) {
258 return false;
259 }
260 if (rdo1.hsub() != rdo2.hsub()) {
261 return false;
262 }
263 if (rdo1.delta() != rdo2.delta()) {
264 return false;
265 }
266 return true;
267 break;
268
270 if (rdo1.isForward() != rdo2.isForward()) {
271 return false;
272 }
273 if (rdo1.sector() != rdo2.sector()) {
274 return false;
275 }
276 if (rdo1.index() != rdo2.index()) {
277 return false;
278 }
279 if (rdo1.isMuplus() != rdo2.isMuplus()) {
280 return false;
281 }
282 if (rdo1.threshold() != rdo2.threshold()) {
283 return false;
284 }
285 if (rdo1.roi() != rdo2.roi()) {
286 return false;
287 }
288 return true;
289 break;
290
291 default:
292 return true;
293 break;
294 }
295}
296
297// decode ROD data to RDO
299 TgcRdo& tgcRdo, const ByteStream& vData, uint16_t subDetectorId,
300 uint16_t rodId, uint32_t l1Id, uint16_t bcId, const TgcCablingMap& cabling,
301 MsgStream& log
302
303) const {
304
306 // decode ROD data part
307
308 // total data fragment size
309
310 // Data Word Count (added by okumura)
311 uint32_t sizeRawData = 0;
312 uint32_t sizeReadOutFormatHit = 0;
313 uint32_t sizeReadOutFormatTracklet = 0;
314 uint32_t sizeHipTWord = 0;
315 uint32_t sizeSectorLogicWord = 0;
316
317 // flag of correct header
318 bool isHeaderOK = true;
319 // index of vData;
320 unsigned int vDataIndex = 0;
321 for (; isHeaderOK; ++vDataIndex) {
322 uint32_t rawdata_flag = (vData[vDataIndex] & RawDataFragMask) >> 24;
323 uint32_t flagmentId = (vData[vDataIndex] & FragmentIdMask) >> 24;
324
325 // check HEADER for RawData section
326 if (rawdata_flag == 0xFF) {
327 break;
328 }
329
330 // Words Count
331 uint32_t counter = (vData[vDataIndex] & FragmentCountMask);
332
333 switch (flagmentId) {
334 case 0x01: // Fragment ID ==1
335 sizeRawData = counter;
336 break;
337 case 0x02: // Fragmant ID ==2
338 sizeReadOutFormatHit = counter;
339 break;
340 case 0x03: // Fragmant ID ==3
341 sizeReadOutFormatTracklet = counter;
342 break;
343 // case 0x04: //Fragmant ID ==4
344 // sizeChamberFormatHit =counter;
345 // break;
346 // case 0x05: //Fragmant ID ==5
347 // sizeChamberFormatTracklet =counter;
348 // break;
349 case 0x08: // Fragmant ID ==8
350 sizeHipTWord = counter;
351 break;
352 case 0x09: // Fragmant ID ==9
353 sizeSectorLogicWord = counter;
354 break;
355 default:
356 isHeaderOK = false;
357 break;
358 }
359 }
360
361 bool t_debug = (log.level() <= MSG::DEBUG);
362
363 if (!isHeaderOK || sizeRawData == 0 || sizeRawData >= 0x10000) {
364 unsigned int tmpRodId = rodId + (subDetectorId == CSIDE ? NROD / 2 : 0);
365 if (tmpRodId > NROD) {
366 tmpRodId = NROD;
367 }
368
369 if ((t_debug || !m_failedHeaderSizeRawData[tmpRodId])) {
370 log << (!m_failedHeaderSizeRawData[tmpRodId] ? MSG::WARNING
371 : MSG::DEBUG)
372 << "Corrupted data, Skip decoding of this ROD data"
373 << " TgcRODReadout : ROD ID= " << rodId
374 << " RawData Size= " << sizeRawData << endmsg;
375 log << (!m_failedHeaderSizeRawData[tmpRodId] ? MSG::WARNING
376 : MSG::DEBUG)
377 << "ReadOut Hit Size= " << sizeReadOutFormatHit
378 << " ReadOut Tracklet= " << sizeReadOutFormatTracklet
379 << " ReadOut SL= " << sizeSectorLogicWord
380 << " vDataIndex = " << vDataIndex << " HipT = " << sizeHipTWord
381 << endmsg;
382 }
383 ++m_failedHeaderSizeRawData[tmpRodId];
384
385 return StatusCode::SUCCESS;
386 }
387
388 if (t_debug) {
389 log << MSG::DEBUG << "TgcRODReadout : ROD ID=" << rodId
390 << " RawData Size=" << sizeRawData
391 << " ReadOut Hit Size= " << sizeReadOutFormatHit
392 << " ReadOut Tracklet= " << sizeReadOutFormatTracklet
393 << " ReadOut SL= " << sizeSectorLogicWord << endmsg;
394 }
395
396 uint32_t firstRawDataIndex = vDataIndex;
397
398 // RawData Collection.
399 std::vector<TgcRawData*> vCh;
400
401 // decode RAW DATA Fragment process start
402 uint16_t fe_bcId = 0;
403 uint32_t fe_l1Id = 0;
404 uint16_t sswId = 999;
405 uint16_t slbId = 999;
406 uint16_t rxId = 999;
407 uint16_t mod = 999;
408 uint16_t b_error = 0;
409 uint16_t rec_type = 999;
410
411 std::unique_ptr<TgcSlbData> slb{};
412
413 for (; vDataIndex < firstRawDataIndex + sizeRawData; ++vDataIndex) {
414 if (t_debug) {
415 log << MSG::DEBUG << "Tgc BS Raw:" << vDataIndex << ": "
416 << std::hex << vData[vDataIndex] << endmsg;
417 }
418
419 // header check
420 unsigned int header = vData[vDataIndex] & HeaderMask;
421
422 uint32_t rawdata_flag = (vData[vDataIndex] & RawDataFragMask) >> 24;
423 if ((rawdata_flag == 0xff) || (rawdata_flag == 0xfc)) {
424 continue;
425 }
426
427 switch (header) {
428 case HeaderEvent: // Event header
429 // get Rec Type
430 rec_type = (vData[vDataIndex] & 0x18000000) >> 27;
431 if (rec_type > 1) {
432 log << MSG::WARNING << "Rec Type " << rec_type
433 << " is not supproted "
434 << " Skip decoding of remaining hits of this event..."
435 << endmsg;
436 return StatusCode::SUCCESS;
437 }
438
439 // get SSW ID
440 if (rec_type == 0) {
441 // format Oct. 09
442 sswId = (vData[vDataIndex] & 0x0F0000) >> 16;
443 } else if (rec_type == 1) {
444 // original SSW format
445 sswId = (vData[vDataIndex] & 0x07800000) >> 23;
446 }
447 break;
448
449 case HeaderSLB10: // SLB header 10
450 // Create RDOs by using slb bit array
451 if (slb != nullptr) {
452 m_tgcSlbDataHelper->convertToHits(subDetectorId, rodId,
453 slb.get(), vCh);
454 m_tgcSlbDataHelper->convertToCoincidences(
455 subDetectorId, rodId, slb.get(), vCh);
456 }
457 // get SLB ID, BCID, L1ID, ModuleType
458 fe_l1Id = (vData[vDataIndex] & 0x0000F000) >> 12;
459 fe_bcId = vData[vDataIndex] & 0x00000FFF;
460 slbId = (vData[vDataIndex] & 0x1F000000) >> 24;
461
462 if (rec_type == 0) {
463 // format Oct. 09
464 mod = (vData[vDataIndex] & 0x00070000) >> 16;
465 rxId = (vData[vDataIndex] & 0x00F80000) >> 19;
466 } else if (rec_type == 1) {
467 // original SSW format
468 mod = (vData[vDataIndex] & 0x000E0000) >> 17;
469 }
470
471 if (fe_l1Id != l1Id) {
472 if (t_debug) {
473 log << MSG::DEBUG
474 << "l1Id in SLB Header is different from l1Id in "
475 "ROD "
476 << " for rodId:" << rodId << " slbId:" << slbId
477 << " l1Id, bcId (SLB):" << fe_l1Id << ", "
478 << fe_bcId << " l1Id, bcId (ROD):" << l1Id << ", "
479 << bcId << endmsg;
480 }
481 }
482 b_error = 0;
483 break;
484
485 case HeaderSLB11: // SLB header 11 or Trailer
486 if (vData[vDataIndex] & 0x10000000) {
487 // SLB Trailer
488 // decode Bit map
489 b_error = vData[vDataIndex] & 0x0FFF;
490
491 } else {
492 // SLBHeader 11
493 // get RXID
494 rxId = (vData[vDataIndex] & 0x7C00000) >> 22;
495
496 break;
497 }
498 /* FALLTHROUGH */
499
500 case HeaderSLBC: // SLB data
501 case HeaderSLBP:
502 case HeaderSLBN:
503 // create slb
504 if (!slb) {
505 // create TgcSlbData
506 slb =
507 std::make_unique<TgcSlbData>(bcId, l1Id, sswId, slbId);
508 // set sbLoc by using rxId
509 if (!setSbLoc(subDetectorId, rodId, slb.get(), rxId,
510 cabling, log)) {
511 unsigned int tmpRodId =
512 rodId + (subDetectorId == CSIDE ? NROD / 2 : 0);
513 if (tmpRodId > NROD) {
514 tmpRodId = NROD;
515 }
516
517 if ((t_debug || !m_failedSetSbLoc[tmpRodId])) {
518 log << (!m_failedSetSbLoc[tmpRodId] ? MSG::WARNING
519 : MSG::DEBUG)
520 << " Fail to set sbLoc"
521 << " :rodId=" << rodId << " :sswId=" << sswId
522 << " :slbAddress= " << slbId
523 << " : rxId= " << rxId << endmsg;
524 log << (!m_failedSetSbLoc[tmpRodId] ? MSG::WARNING
525 : MSG::DEBUG)
526 << "Corrupted data, Skip decoding of remaining "
527 "hits of this event..."
528 << endmsg;
529 }
530 ++m_failedSetSbLoc[tmpRodId];
531 return StatusCode::SUCCESS;
532 }
533 if (!m_tgcSlbDataHelper->setType(subDetectorId, rodId,
534 slb.get(), mod)) {
535 unsigned int tmpRodId =
536 rodId + (subDetectorId == CSIDE ? NROD / 2 : 0);
537 if (tmpRodId > NROD) {
538 tmpRodId = NROD;
539 }
540
541 if ((t_debug || !m_failedSetType[tmpRodId])) {
542 log << (!m_failedSetType[tmpRodId] ? MSG::WARNING
543 : MSG::DEBUG)
544 << " Fail to set Module Type"
545 << " :rodId=" << rodId << " :sswId=" << sswId
546 << " :slbAddress= " << slbId << endmsg;
547 log << (!m_failedSetType[tmpRodId] ? MSG::WARNING
548 : MSG::DEBUG)
549 << "Corrupted data, Skip decoding of remaining "
550 "hits of this event..."
551 << endmsg;
552 }
553 ++m_failedSetType[tmpRodId];
554 return StatusCode::SUCCESS;
555 }
556 if (b_error) {
557 slb->setError(b_error);
558 }
559 if (t_debug) {
560 log << MSG::DEBUG << "TgcRODReadout : slb =" << slb
561 << " : rodId=" << rodId << " : sswId=" << sswId
562 << " : slbAddress= " << slbId << " : rxId= " << rxId
563 << endmsg;
564 }
565 }
566
567 // decode Bit map
568 for (int iHL = 0; iHL < 32;
569 iHL += 16) { // Higher and Lower word
570 uint32_t vd = vData[vDataIndex] << iHL;
571 // get BC tag
572 uint32_t bcTag;
573 if ((vd & HeaderMask) == HeaderSLBC) {
575 } else if ((vd & HeaderMask) == HeaderSLBP) {
577 } else if ((vd & HeaderMask) == HeaderSLBN) {
579 } else if ((vd & HeaderMask) == HeaderSLB11) {
580 // Trailer
581 slb->setError(vData[vDataIndex] & 0x0FFF);
582 continue;
583 } else {
584 continue;
585 }
586 // Cell Address and Bit map
587 unsigned long cellAddr = (vd & 0x1F000000) >> 24;
588 unsigned long cellBitMap = (vd & 0x00FF0000) >> 16;
589
590 if (cellAddr < 25) {
591 // set Bit map
592 slb->setBitmap(bcTag, cellAddr, cellBitMap);
593 } else {
594 // PADWORD
595 }
596 }
597 break;
598
599 case HeaderError: // Error Report
600 {
601 uint32_t error_context = (vData[vDataIndex] & 0x00FFFFFF);
602 uint16_t error_id = (vData[vDataIndex] & 0x01F000000) >> 24;
603 if ((t_debug && (error_context != 0))) {
604 log << MSG::DEBUG << "TgcRODReadout : Error Report "
605 << " : error id =" << error_id
606 << " : context =" << error_context << endmsg;
607 }
608 } break;
609
610 default:
611 break;
612 }
613 }
614 if (slb != nullptr) {
615 m_tgcSlbDataHelper->convertToHits(subDetectorId, rodId, slb.get(), vCh);
616 m_tgcSlbDataHelper->convertToCoincidences(subDetectorId, rodId,
617 slb.get(), vCh);
618 }
619
620 if (t_debug) {
621 uint32_t firstROHitIndex = vDataIndex;
622 for (; vDataIndex < firstROHitIndex + sizeReadOutFormatHit;
623 ++vDataIndex) {
624 log << MSG::DEBUG << "Tgc BS Readout HIT:" << vDataIndex << ": "
625 << std::hex << vData[vDataIndex] << endmsg;
626 }
627 uint32_t firstROTrackletIndex = vDataIndex;
628 for (; vDataIndex < firstROTrackletIndex + sizeReadOutFormatTracklet;
629 ++vDataIndex) {
630 log << MSG::DEBUG << "Tgc BS Readout HIT:" << vDataIndex << ": "
631 << std::hex << vData[vDataIndex] << endmsg;
632 }
633 }
634
636 // append Hits to RDO
637
638 // loop over all hits
639 std::vector<TgcRawData*>::iterator ith = vCh.begin();
640 std::vector<TgcRawData*>::iterator ith_e = vCh.end();
641
642 size_t n_vCh = 0;
643 for (; ith != ith_e; ++ith) {
644 // push back
645 tgcRdo.push_back(*ith);
646
647 n_vCh += 1;
648 }
649 if (t_debug) {
650 log << MSG::DEBUG << n_vCh
651 << "words of were recorded in TgcRdo container" << endmsg;
652 }
653 log<<std::dec; //restore ostream format
654 return StatusCode::SUCCESS;
655}
656
657// set sbLoc to slb
658bool Muon::TgcRODReadOut::setSbLoc(uint16_t subDetectorId, uint16_t rodId,
659 TgcSlbData* slb, int rxId,
660 const TgcCablingMap& cabling,
661 MsgStream& log) const {
662
663 bool t_debug = (log.level() <= MSG::DEBUG);
664
665 // get sbLoc
666 int phi = 0;
667 bool isAside = false;
668 bool isEndcap = false;
669 int moduleType = 0;
670 int slbId = 0;
671 int dummy_subDetectorId = 0;
672 int dummy_rodId = 0;
673 int dummy_sswId = 0;
674 int sbLoc = 0;
675 int slbaddress_ret = 0;
676
677 int sswId = slb->getSswId();
678
679 if (!cabling.getSLBIDfromRxID(phi, isAside, isEndcap, moduleType, slbId,
680 subDetectorId, rodId, sswId, rxId)) {
681 unsigned int tmpRodId = rodId + (subDetectorId == CSIDE ? NROD / 2 : 0);
682 if (tmpRodId > NROD) {
683 tmpRodId = NROD;
684 }
685
686 if (t_debug || !m_failedGetSLBIDfromRxID[tmpRodId]) {
687 log << (!m_failedGetSLBIDfromRxID[tmpRodId] ? MSG::WARNING
688 : MSG::DEBUG)
689 << " Fail to getSLBIDfromRxID "
690 << " :rodId=" << rodId << " :sswId=" << sswId
691 << " :rxId= " << rxId << endmsg;
692 }
693 m_failedGetSLBIDfromRxID[tmpRodId]++;
694
695 return false;
696 }
697
698 if (!cabling.getReadoutIDfromSLBID(phi, isAside, isEndcap, moduleType,
699 slbId, dummy_subDetectorId, dummy_rodId,
700 dummy_sswId, sbLoc)) {
701 unsigned int tmpRodId = rodId + (subDetectorId == CSIDE ? NROD / 2 : 0);
702 if (tmpRodId > NROD) {
703 tmpRodId = NROD;
704 }
705
706 if ((t_debug || !m_failedGetReadoutIDfromSLBID[tmpRodId])) {
707 log << (!m_failedGetReadoutIDfromSLBID[tmpRodId] ? MSG::WARNING
708 : MSG::DEBUG)
709 << " Fail to getReadoutIDfromSLBID "
710 << " :rodId=" << rodId << " :sswId=" << sswId
711 << " :rxId= " << rxId << endmsg;
712 }
713 m_failedGetReadoutIDfromSLBID[tmpRodId]++;
714
715 return false;
716 }
717
718 if (cabling.getSLBAddressfromReadoutID(slbaddress_ret, subDetectorId, rodId,
719 sswId, sbLoc)) {
720 // check SLB Address
721 if (slbaddress_ret != slb->getSlbId()) {
722 if (t_debug) {
723 log << MSG::DEBUG << " wrong getSLBAddress :"
724 << " :sswId = " << sswId << " :rxId = " << rxId
725 << ":sbLoc = " << sbLoc << endmsg;
726 log << MSG::DEBUG << " :slbAddress = " << slb->getSlbId()
727 << " expected value = " << slbaddress_ret << endmsg;
728 }
729 }
730 }
731
732 // set sbLoc
733 slb->setSbLoc(sbLoc);
734
735 return true;
736}
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)