ATLAS Offline Software
Loading...
Searching...
No Matches
TGC_RodDecoderReadout.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3*/
4
6// TGC_RodDecoderReadout.cxx, (c) ATLAS Detector software
8
10
11#include "Identifier/Identifier.h"
13#include "MuonRDO/TgcRdo.h"
15#include "TgcByteStreamData.h"
16#include "eformat/Issue.h"
17#include "eformat/SourceIdentifier.h"
18
19using eformat::helper::SourceIdentifier;
21
22//================ Constructor =================================================
23
24//================ Destructor =================================================
25
27
28//================ Initialisation =================
29
31
32 // Retrieve the TgcIdHelper
33 ATH_CHECK(detStore()->retrieve(m_tgcIdHelper, "TGCIDHELPER"));
34
35 ATH_MSG_INFO("initialize() successful in " << name());
36 return StatusCode::SUCCESS;
37}
38
39//================ Finalisation ===================
40
42
43 if (m_nCache > 0 || m_nNotCache > 0) {
44 const float cacheFraction =
45 ((float)m_nCache) / ((float)(m_nCache + m_nNotCache));
47 "Fraction of fills that use the cache = " << cacheFraction);
48 }
49
50 return StatusCode::SUCCESS;
51}
52
53//================ fillCollection ===============
54
56 const ROBFragment& robFrag, TgcRdoContainer& rdoIdc,
57 const EventContext& /*ctx*/) const {
58 try {
59 robFrag.check();
60 } catch (eformat::Issue& ex) { // error in fragment
61 ATH_MSG_WARNING(ex.what());
62 return StatusCode::SUCCESS;
63 }
64
65 // Get the identifier for this fragment
66 uint32_t source_id = robFrag.rod_source_id();
67 SourceIdentifier sid(source_id);
68
69 // do not convert if the TGC collection is already in the converter
70 uint16_t rdoId =
71 TgcRdo::calculateOnlineId(sid.subdetector_id(), sid.module_id());
72 TgcRdoIdHash rdoIdHash;
73 int idHash = rdoIdHash(rdoId);
74
75 // Get the IDC_WriteHandle for this hash (and check if it already exists)
76 std::unique_ptr<TgcRdo> rdo(nullptr);
78 if (lock.alreadyPresent()) {
80 " TGC RDO collection already exist with collection hash = "
81 << idHash << ", ID = " << sid.human()
82 << " - converting is skipped!");
83 ++m_nCache;
84 } else {
85 ATH_MSG_DEBUG(" Created new collection with ID = "
86 << sid.human() << ", hash = " << idHash);
88 // Create collection
89 rdo = std::make_unique<TgcRdo>(rdoId, idHash);
90 // Adjust bytestream data
92 robFrag.rod_data(bs);
93 // Get/fill the collection
94 getCollection(robFrag, rdo.get());
95 // Add bytestream information
96 if (sid.module_id() < 13) { // ROD
97 byteStream2Rdo(bs, rdo.get(), robFrag.rod_source_id());
98 } else if (sid.module_id() > 16) { // SROD
99 byteStreamSrod2Rdo(bs, rdo.get(), robFrag.rod_source_id(),
100 robFrag.rod_ndata());
101 } else {
102 ATH_MSG_DEBUG("Error: Invalid [S]ROD number");
103 return StatusCode::FAILURE;
104 }
105
106 // Add TgcRdo to the container
107 StatusCode status_lock = lock.addOrDelete(std::move(rdo));
108 if (status_lock != StatusCode::SUCCESS) {
110 " Failed to add TGC RDO collection to container with hash "
111 << idHash);
112 } else {
113 ATH_MSG_DEBUG(" Adding TgcRdo collection with hash "
114 << idHash << ", source id = " << sid.human()
115 << " to the TgcRdo Container");
116 }
117 }
118
119 return StatusCode::SUCCESS;
120}
121
122//================ getCollection ===============================================
124 TgcRdo* rdo) const {
125 // Retrieve information and set in rdo
126 uint32_t source_id = robFrag.rod_source_id();
127 SourceIdentifier sid(source_id);
128
129 uint16_t rdoId =
130 TgcRdo::calculateOnlineId(sid.subdetector_id(), sid.module_id());
131 TgcRdoIdHash rdoIdHash;
132 int idHash = rdoIdHash(rdoId);
133
134 rdo->setL1Id(robFrag.rod_lvl1_id());
135 rdo->setBcId(robFrag.rod_bc_id());
136 rdo->setTriggerType(robFrag.rod_lvl1_trigger_type());
137 rdo->setOnlineId(
138 sid.subdetector_id(),
139 sid.module_id()); // rodId = module_id (ROD: 1-12, SROD: 17-19)
140
141 uint32_t nstatus = robFrag.rod_nstatus(); // 5 : ROD , 3 : SROD
142 ATH_MSG_DEBUG(" Number of Status Words = " << nstatus);
143 const uint32_t* status;
144 robFrag.rod_status(status);
145 if (nstatus == 5 && sid.module_id() < 13) { // ROD
146 rdo->setErrors(status[0]);
147 rdo->setRodStatus(status[1]);
148 ;
149 rdo->setLocalStatus(status[3]);
150 rdo->setOrbit(status[4]);
151 } else if (nstatus == 3 && sid.module_id() > 16) { // SROD
152 rdo->setErrors(status[0]);
153 rdo->setRodStatus(status[1]);
154 rdo->setLocalStatus(status[2]);
155 }
156
157 if (m_showStatusWords) {
158 showStatusWords(source_id, rdoId, idHash, nstatus, status);
159 }
160}
161
162//================ byteStream2Rdo ===============
163
166 uint32_t source_id) const {
167 ATH_MSG_DEBUG("Muon::TGC_RodDecoderReadout::byteStream2Rdo");
168
169 // Check that we are filling the right collection
171 fromBS32(source_id, sid);
172
173 if (rdo->identify() != TgcRdo::calculateOnlineId(sid.side, sid.rodid)) {
174 ATH_MSG_DEBUG("Error: input TgcRdo id does not match bytestream id");
175 return;
176 }
177
178 // rdo.setOnlineId(sid.side, sid.rodid); // Standard data
179
180 TGC_BYTESTREAM_FRAGMENTCOUNT counters[7] = {{0, 1}, {0, 2}, {0, 3}, {0, 4},
181 {0, 5}, {0, 8}, {0, 9}};
183
184 int iBs = 0;
185 for (int iCnt = 0; iCnt < 7; iCnt++) {
186 fromBS32(bs[iBs], counter);
187 if (counter.id == counters[iCnt].id) {
188 counters[iCnt].count = counter.count;
189 iBs++;
190 }
191 }
192
193 // iBs--;
194 for (int iCnt = 0; iCnt < 7; iCnt++) {
195 if (counters[iCnt].count == 0) {
196 continue;
197 }
198 switch (counters[iCnt].id) {
199 case 1: // Raw data format (SSW format)
200 {
201 ATH_MSG_DEBUG("fragment" << counters[iCnt].id << " "
202 << counters[iCnt].count << "words");
203 for (unsigned iFrag = 0; iFrag < counters[iCnt].count;
204 iFrag++) {
205 ATH_MSG_DEBUG("WORD" << iFrag << ":" << MSG::hex
206 << bs[iBs]);
207 iBs++;
208 }
209 break;
210 }
211 case 2: // TgcRawData::TYPE_HIT
212 {
213 ATH_MSG_DEBUG("fragment" << counters[iCnt].id << " "
214 << counters[iCnt].count << "words");
216 for (unsigned iFrag = 0; iFrag < counters[iCnt].count;
217 iFrag++) {
218 ATH_MSG_DEBUG("WORD" << iFrag << ":" << MSG::hex
219 << bs[iBs]);
220 fromBS32(bs[iBs++], roh);
221
222 ATH_MSG_DEBUG(" rdo.subDetectorId():"
223 << rdo->subDetectorId() << " rdo.rodId():"
224 << rdo->rodId() << " roh.ldbId:" << roh.ldbId
225 << " roh.sbId:" << roh.sbId
226 << " rdo.l1Id():" << rdo->l1Id()
227 << " rdo.bcId():" << rdo->bcId());
228
229 uint16_t slbId = roh.sbId;
230 // SBLOCs for EIFI are different in online (ByteStream) and
231 // offline (RDO). bug #57051: Wrong numbering of SBLOC for
232 // Inner Stations (EI/FI) in 12-fold TGC cablings ByteStream
233 // : slbId = SBLOC + ip*2 (ip=0, 1, 2), SBLOC = 8 or 9 (EI),
234 // 0 or 1 (FI)
235 // slbId = 8, 10, 12, 9, 11, 13, 0, 2, 4,
236 // 1, 3, 5
237 // RDO : slbId = SBLOC + ip*4 (ip=0, 1, 2), SBLOC = 1
238 // or 3 (EI), 0 or 2 (FI)
239 // slbId = 1, 5, 9, 3, 7, 11, 0, 4, 8,
240 // 2, 6, 10
243 if (roh.sbId < 8) {
244 slbId = roh.sbId * 2;
245 } else {
246 slbId = (roh.sbId - 8) * 2 + 1;
247 }
248 }
249
250 TgcRawData* raw = new TgcRawData(
251 bcTag(roh.bcBitmap), rdo->subDetectorId(), rdo->rodId(),
252 roh.ldbId, slbId, rdo->l1Id(), rdo->bcId(),
253 // http://cern.ch/atlas-tgc/doc/ROBformat.pdf
254 // Table 7 : SB type, bits 15..13
255 // 0,1: doublet wire, strip
256 // 2,3: triplet wire, strip triplet;
257 // 4 : inner wire and strip
258 // TgcRawData::SlbType is defined in TgcRawData.h
259 // 0: SLB_TYPE_DOUBLET_WIRE,
260 // 1: SLB_TYPE_DOUBLET_STRIP,
261 // 2: SLB_TYPE_TRIPLET_WIRE,
262 // 3: SLB_TYPE_TRIPLET_STRIP,
263 // 4: SLB_TYPE_INNER_WIRE,
264 // 5: SLB_TYPE_INNER_STRIP,
265 // 6: SLB_TYPE_UNKNOWN
266 (TgcRawData::SlbType)roh.sbType, (bool)roh.adj,
267 roh.tracklet, roh.channel + 40);
268 rdo->push_back(raw);
269 }
270 break;
271 }
272 case 3: // TgcRawData::TYPE_TRACKLET
273 {
274 if (m_skipCoincidence) {
275 break;
276 }
277
278 ATH_MSG_DEBUG("fragment" << counters[iCnt].id << " "
279 << counters[iCnt].count << "words");
282 for (unsigned iFrag = 0; iFrag < counters[iCnt].count;
283 iFrag++) {
284 ATH_MSG_DEBUG("WORD" << iFrag << ":" << MSG::hex
285 << bs[iBs]);
286 fromBS32(bs[iBs], rostrip);
287
289 TgcRawData* raw = new TgcRawData(
290 bcTag(rostrip.bcBitmap), rdo->subDetectorId(),
291 rdo->rodId(), rostrip.ldbId, rostrip.sbId,
292 rdo->l1Id(), rdo->bcId(),
294 rostrip.subc, rostrip.phi);
295 rdo->push_back(raw);
296 } else {
297 fromBS32(bs[iBs], rotrk);
298
299 uint16_t slbId = rotrk.sbId;
300 // SBLOCs for EIFI are different in online (ByteStream)
301 // and offline (RDO). bug #57051: Wrong numbering of
302 // SBLOC for Inner Stations (EI/FI) in 12-fold TGC
303 // cablings ByteStream : slbId = SBLOC + ip*2 (ip=0, 1,
304 // 2), SBLOC = 8 or 9 (EI), 0 or 1 (FI)
305 // slbId = 8, 10, 12, 9, 11, 13, 0, 2,
306 // 4, 1, 3, 5
307 // RDO : slbId = SBLOC + ip*4 (ip=0, 1, 2), SBLOC
308 // = 1 or 3 (EI), 0 or 2 (FI)
309 // slbId = 1, 5, 9, 3, 7, 11, 0, 4,
310 // 8, 2, 6, 10
313 if (rotrk.sbId < 8) {
314 slbId = rotrk.sbId * 2;
315 } else {
316 slbId = (rotrk.sbId - 8) * 2 + 1;
317 }
318 }
319
320 TgcRawData* raw = new TgcRawData(
321 bcTag(rotrk.bcBitmap), rdo->subDetectorId(),
322 rdo->rodId(), rotrk.ldbId, slbId, rdo->l1Id(),
323 rdo->bcId(),
324 // http://cern.ch/atlas-tgc/doc/ROBformat.pdf
325 // Table 8 : Slave Board type, bits 30..28
326 // 0,1: doublet wire, strip
327 // 2,3: triplet wire, strip triplet;
328 // 4,5: inner wire, strip
329 // TgcRawData::SlbType is defined in TgcRawData.h
330 // 0: SLB_TYPE_DOUBLET_WIRE,
331 // 1: SLB_TYPE_DOUBLET_STRIP,
332 // 2: SLB_TYPE_TRIPLET_WIRE,
333 // 3: SLB_TYPE_TRIPLET_STRIP,
334 // 4: SLB_TYPE_INNER_WIRE,
335 // 5: SLB_TYPE_INNER_STRIP,
336 // 6: SLB_TYPE_UNKNOWN
337 (TgcRawData::SlbType)rotrk.slbType, rotrk.delta,
338 rotrk.seg, rotrk.subm, rotrk.rphi);
339 rdo->push_back(raw);
340 }
341 iBs++;
342 }
343 break;
344 }
345 case 8: // TgcRawData::TYPE_HIPT
346 {
347 if (m_skipCoincidence) {
348 break;
349 }
350
351 ATH_MSG_DEBUG("fragment" << counters[iCnt].id << " "
352 << counters[iCnt].count << "words");
355 for (unsigned iFrag = 0; iFrag < counters[iCnt].count;
356 iFrag++) {
357 ATH_MSG_DEBUG("WORD" << iFrag << ":" << MSG::hex
358 << bs[iBs]);
359 fromBS32(bs[iBs], hptinner);
360 if (hptinner.sector & 4) {
361 TgcRawData* raw = new TgcRawData(
362 bcTag(hptinner.bcBitmap), rdo->subDetectorId(),
363 rdo->rodId(), rdo->l1Id(), rdo->bcId(),
364 hptinner.strip, 0, hptinner.sector, 0, 0, 0, 0, 0,
365 0, hptinner.inner);
366 rdo->push_back(raw);
367 } else {
368 fromBS32(bs[iBs], hpt);
369 TgcRawData* raw = new TgcRawData(
370 bcTag(hpt.bcBitmap), rdo->subDetectorId(),
371 rdo->rodId(), rdo->l1Id(), rdo->bcId(), hpt.strip,
372 hpt.fwd, hpt.sector, hpt.chip, hpt.cand, hpt.hipt,
373 hpt.hitId, hpt.sub, hpt.delta, 0);
374 rdo->push_back(raw);
375 }
376 iBs++;
377 }
378 break;
379 }
380 case 9: // TgcRawData::TYPE_SL
381 {
382 if (m_skipCoincidence) {
383 break;
384 }
385
386 ATH_MSG_DEBUG("fragment" << counters[iCnt].id << " "
387 << counters[iCnt].count << "words");
389 for (unsigned iFrag = 0; iFrag < counters[iCnt].count;
390 iFrag++) {
391 ATH_MSG_DEBUG("WORD" << iFrag << ":" << MSG::hex
392 << bs[iBs]);
393 fromBS32(bs[iBs++], sl);
394
395 TgcRawData* raw = new TgcRawData(
396 bcTag(sl.bcBitmap), rdo->subDetectorId(), rdo->rodId(),
397 rdo->l1Id(), rdo->bcId(), sl.cand2plus,
398 static_cast<bool>(sl.fwd), sl.sector, sl.cand, sl.sign,
399 sl.threshold, sl.overlap, sl.veto, sl.roi);
400 rdo->push_back(raw);
401 }
402 break;
403 }
404 default:
406 "Error: Muon::TGC_RodDecoderReadout::byteStream2Rdo "
407 "Unsupported fragment type "
408 << counters[iCnt].id);
409 break;
410 }
411 }
412
413 ATH_MSG_DEBUG("Decoded " << MSG::dec << rdo->size() << " elements");
414 ATH_MSG_DEBUG("Muon::TGC_RodDecoderReadout::byteStream2Rdo done");
415}
416
419 uint32_t source_id, uint32_t ndata) const {
420 ATH_MSG_DEBUG("Muon::TGC_RodDecoderReadout::byteStreamSrod2Rdo");
421
422 // Check that we are filling the right collection
424 fromBS32(source_id, sid);
425 // uint16_t rod = sid.rodid & 0x0F; // 1-3
426
427 if (rdo->identify() !=
428 TgcRdo::calculateOnlineId(sid.side, sid.rodid)) // 24-29
429 {
430 ATH_MSG_DEBUG("Error: input TgcRdo id does not match bytestream id");
431 return;
432 }
433
435 for (uint32_t iBs = 0; iBs < ndata; iBs++) {
436 ATH_MSG_DEBUG("WORD" << iBs << ":" << MSG::hex << bs[iBs]);
437 fromBS32(bs[iBs], tmpfrag);
438 switch (tmpfrag.type) {
439 case 0: // RoI
440 {
442 fromBS32(bs[iBs], roi);
443 TgcRawData* raw = new TgcRawData(
444 roi.bcBitmap + 1, rdo->subDetectorId(), rdo->rodId(),
445 rdo->l1Id(), rdo->bcId(), static_cast<bool>(roi.fwd),
446 roi.sector, roi.innerflag, roi.coinflag,
447 static_cast<bool>(roi.charge), roi.pt, roi.roi);
448 rdo->push_back(raw);
449 break;
450 }
451 case 1: // HiPT
452 {
454 fromBS32(bs[iBs], hipt);
455 TgcRawData* raw = new TgcRawData(
456 hipt.bcBitmap + 1, rdo->subDetectorId(), rdo->rodId(),
457 rdo->l1Id(), rdo->bcId(), static_cast<bool>(hipt.strip),
458 static_cast<bool>(hipt.fwd), hipt.sector, hipt.chip,
459 hipt.cand, static_cast<bool>(hipt.hipt), hipt.hitId,
460 hipt.sub, hipt.delta, 0);
461 rdo->push_back(raw);
462 break;
463 }
464 case 2: // EIFI
465 {
467 fromBS32(bs[iBs], eifi);
468 for (int isector = 0; isector < 2;
469 isector++) { // duplicate for the neighboring trigger
470 // sector
471 TgcRawData* raw = new TgcRawData(
472 eifi.bcBitmap + 1, rdo->subDetectorId(), rdo->rodId(),
473 rdo->l1Id(), rdo->bcId(), static_cast<bool>(eifi.fwd),
474 eifi.sector + isector, eifi.ei, eifi.fi,
475 eifi.chamberid);
476 rdo->push_back(raw);
477 }
478 break;
479 }
480 case 3: // TMDB
481 {
483 fromBS32(bs[iBs], tmdb);
484 for (int isector = 0; isector < 2;
485 isector++) { // duplicate for the neighboring trigger
486 // sector
487 TgcRawData* raw = new TgcRawData(
488 tmdb.bcBitmap + 1, rdo->subDetectorId(), rdo->rodId(),
489 rdo->l1Id(), rdo->bcId(), false, tmdb.sector + isector,
490 tmdb.module, tmdb.bcid);
491 rdo->push_back(raw);
492 }
493 break;
494 }
495 case 4: // NSW 4-5
496 {
498 fromBS32(bs[iBs], nswpos);
499 iBs++;
501 fromBS32(bs[iBs], nswang);
502 if (nswang.type != 5) {
503 ATH_MSG_DEBUG("Error: non-consecutive NSW words ");
504 iBs--;
505 continue;
506 }
507 if ((nswpos.bcBitmap != nswang.bcBitmap) ||
508 (nswpos.cand != nswang.cand) ||
509 (nswpos.input != nswang.input)) {
510 ATH_MSG_DEBUG("Error: inconsistent NSW words");
511 iBs--;
512 continue;
513 }
514
515 uint16_t cand_input_bcid =
519
520 for (int isector = 0; isector < 2;
521 isector++) { // duplicate for the neighboring trigger
522 // sector
523 TgcRawData* raw = new TgcRawData(
524 nswpos.bcBitmap + 1, rdo->subDetectorId(), rdo->rodId(),
525 rdo->l1Id(), static_cast<uint16_t>(rdo->bcId()),
526 static_cast<bool>(nswpos.fwd),
527 static_cast<uint16_t>(nswpos.sector) + isector,
528 nswpos.eta, nswpos.phi,
529 cand_input_bcid, // was nswpos.cand,
530 nswang.angle, nswang.phires, nswang.lowres,
531 nswang.nswid);
532 rdo->push_back(raw);
533 }
534 break;
535 }
536 case 6: // RPC BIS78 6-7
537 {
539 fromBS32(bs[iBs], rpcpos);
540 iBs++;
542 fromBS32(bs[iBs], rpccoin);
543 if (rpccoin.type != 7) {
544 ATH_MSG_DEBUG("Error: non-consecutive RPCBIS78 words ");
545 iBs--;
546 continue;
547 }
548 if ((rpcpos.bcBitmap != rpccoin.bcBitmap) ||
549 (rpcpos.cand != rpccoin.cand)) {
550 ATH_MSG_DEBUG("Error: inconsistent RPCBIS78 words");
551 iBs--;
552 continue;
553 }
554
555 uint16_t flag_cand_bcid =
559
560 for (int isector = 0; isector < 2;
561 isector++) { // duplicate for the neighboring trigger
562 // sector
563 TgcRawData* raw = new TgcRawData(
564 rpcpos.bcBitmap + 1, rdo->subDetectorId(), rdo->rodId(),
565 rdo->l1Id(), static_cast<uint16_t>(rdo->bcId()),
566 static_cast<bool>(rpcpos.fwd),
567 static_cast<uint16_t>(rpcpos.sector) + isector,
568 rpcpos.eta, rpcpos.phi,
569 flag_cand_bcid, // was
570 // static_cast<uint16_t>(rpccoin.flag),
571 rpccoin.deta, rpccoin.dphi);
572 rdo->push_back(raw);
573 }
574 break;
575 }
576 } // switch
577 } // for iBs
578
579 ATH_MSG_DEBUG("Decoded " << MSG::dec << rdo->size() << " elements");
580 ATH_MSG_DEBUG("Muon::TGC_RodDecoderReadout::byteStreamSrod2Rdo done");
581}
582
584 const uint32_t source_id, const uint16_t rdoId, const int idHash,
585 const uint32_t nstatus, const uint32_t* status) const {
586 static const unsigned int maxNStatus = 5;
587 static const std::string statusDataWord[maxNStatus] = {
588 "First status word specific|generic:", // 0
589 "TGC ROD event status :", // 1
590 "ROD VME fileter bits | SSW timeout:", // 2
591 "Local status word | presence :", // 3
592 "orbit count :" // 4
593 };
594
595 static const unsigned int maxFirstStatus = 5;
596 static const std::string firstStatus[maxFirstStatus] = {
597 "incorrect BCID", // 0
598 "incorrect L1AID", // 1
599 "Timeout occurred in at least one of the FE links. Fragment is "
600 "incomplete.", // 2
601 "Data may be incorrect, see TGC ROD event status word", // 3
602 "An overflow in one of the ROD internal buffers has occurred. The "
603 "fragment is incomplete." // 4
604 };
605
606 static const unsigned int maxTgcRodEventStatus = 31;
607 static const std::string tgcRodEventStatus[maxTgcRodEventStatus] = {
608 "EC_RXsend : Error in request to send an event via RXlink", // 0
609 "EC_FELdown : A Front End link has gone down - abandoned", // 1
610 "EC_frame : Invalid FE link framing words", // 2
611 "EC_Glnk : Front End link G-link error", // 3
612 "EC_xor : Invalid XOR event checksum", // 4
613 "EC_ovfl : Input FE event is too long or FE FIFO overflow", // 5
614 "EC_timeout : Timeout expired for at least one FE link", // 6
615 "EC_xormezz : Bad XOR checksum from mezz board", // 7
616 "EC_wc0 : Event has WC=0 or WX>max WC", // 8
617 "EC_L1ID : L1ID mismatch (TTC EVID FIFO vs local).", // 9
618 "EC_nohdr : First word is not header", // 10
619 "EC_rectype : Unrecognized record type", // 11
620 "EC_null : Unexpected nulls in FE input", // 12
621 "EC_order : Word is out of order", // 13
622 "EC_LDB : Invalid or unexpected Star Switch ID", // 14
623 "EC_RXovfl : RXfifo has overflowed", // 15
624 "EC_SSWerr : SSW reports T1C, NRC, T2C, or GlinkNoLock error", // 16
625 "EC_sbid : SBid does not match SBinfo table", // 17
626 "EC_SBtype : SBtype does not match SBinfo table", // 18
627 "EC_duprx : RX ID is duplicated in the event", // 19
628 "EC_ec4 : Unexpected SB L1 Event ID(lo 4)", // 20
629 "EC_bc : Unexpected SB BCID", // 21
630 "EC_celladr : Invalid cell address", // 22
631 "EC_hitovfl : Too many hits in event", // 23
632 "EC_trgbit : Unexpected trigger bits", // 24
633 "EC_badEoE : Bad End-of-event marker received, not 0xFCA", // 25
634 "EC_endWCnot0 : WC not 0 after End-of-event marker", // 26
635 "EC_noEoE : No End-of-event marker received", // 27
636 "EC_SLGlink : Sector Logic reports G-Link error", // 28
637 "EC_SLbc : Sector Logic BCID[2:0] does not match its SB BCID", // 29
638 "EC_unxrxid : Data from disabled SSW RX ID" // 30
639 };
640
641 static const unsigned int maxSSWs = 12;
642
643 static const unsigned int maxPresence = 10;
644 static const std::string presence[maxPresence] = {
645 "", // 0
646 "raw data", // 1
647 "hits in readout fmt", // 2
648 "tracklets in readout fmt", // 3
649 "hits in chamber fmt", // 4
650 "tracklets in chamber fmt", // 5
651 "", // 6
652 "", // 7
653 "HipT output", // 8
654 "Sector Logic" // 9
655 };
656
657 static const unsigned int maxLocalStatus = 16;
658 static const std::string localStatus[maxLocalStatus] = {
659 "hit BCs are merged", // 0
660 "tracklet BCs are merged", // 1
661 "hits are sorted", // 2
662 "tracklets are sorted", // 3
663 "", // 4
664 "", // 5
665 "", // 6
666 "", // 7
667 "", // 8
668 "", // 9
669 "", // 10
670 "", // 11
671 "", // 12
672 "", // 13
673 "ROI in this fragment", // 14
674 "no L1AID, BCID check wrt ROD" // 15
675 };
676
677 ATH_MSG_INFO("***** TGC ROD STATUS WORDS for "
678 << "source_id=0x" << source_id << ", "
679 << "rdoId=0x" << rdoId << (rdoId < 16 ? " , " : ", ")
680 << "idHash=0x" << idHash << (idHash < 16 ? " , " : ", ")
681 << (idHash < 12 ? "A" : "C")
682 << (idHash % 12 + 1 < 10 ? "0" : "") << std::dec
683 << idHash % 12 + 1 << " ******");
685 "***** Based on http://cern.ch/atlas-tgc/doc/ROBformat.pdf "
686 "****************************");
687
688 for (uint32_t i = 0; i < nstatus && i < maxNStatus; i++) {
689 ATH_MSG_INFO(statusDataWord[i] << " status[" << i << "]=0x" << std::hex
690 << status[i]);
691
692 if (i == 0) {
693 // Table 2 ATLAS standard, first status word, all zero means no
694 // known errors
695 for (unsigned int j = 0; j < maxFirstStatus; j++) {
696 if ((status[i] >> j) & 0x1) {
697 ATH_MSG_INFO(std::dec << std::setw(3) << j << " : "
698 << firstStatus[j]);
699 }
700 }
701 } else if (i == 1) {
702 // Table 3 TGC ROD event status word
703 for (unsigned int j = 0; j < maxTgcRodEventStatus; j++) {
704 if ((status[i] >> j) & 0x1) {
705 ATH_MSG_INFO(std::dec << std::setw(3) << j << " : "
706 << tgcRodEventStatus[j]);
707 }
708 }
709 } else if (i == 2) {
710 // Table 4 Star switch time-out status and ROD VME filter bits
711 for (unsigned int j = 0; j < maxSSWs; j++) {
712 if ((status[i] >> j) & 0x1) {
713 ATH_MSG_INFO(std::dec << std::setw(3) << j << " : "
714 << "time-out for SSW" << j);
715 }
716 }
717 for (unsigned int j = 0 + 16; j <= maxSSWs + 16; j++) {
718 if ((status[i] >> j) & 0x1) {
719 ATH_MSG_INFO(std::dec << std::setw(3) << j << " : "
720 << "data from SSW" << j - 16
721 << " gave filter \"accept\"");
722 }
723 }
724 } else if (i == 3) {
725 // Table 6 Presence bits
726 for (unsigned int j = 0; j < maxPresence; j++) {
727 if (j == 0 || j == 6 || j == 7) {
728 continue;
729 }
730 if ((status[i] >> j) & 0x1) {
731 ATH_MSG_INFO(std::dec << std::setw(3) << j << " : "
732 << presence[j]);
733 }
734 }
735
736 // Table 5 Local status word
737 for (unsigned int j = 0 + 16; j < maxLocalStatus + 16; j++) {
738 if ((j >= 4 + 16 && j <= 13 + 16)) {
739 continue;
740 }
741 if ((status[i] >> j) & 0x1) {
742 ATH_MSG_INFO(std::dec << std::setw(3) << j << " : "
743 << localStatus[j - 16]);
744 }
745 }
746 }
747 }
748
750 "**********************************************************************"
751 "****************");
752}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
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
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.
StatusCode addOrDelete(std::unique_ptr< T > ptr)
IDC_WriteHandle getWriteHandle(IdentifierHash hash)
void byteStream2Rdo(OFFLINE_FRAGMENTS_NAMESPACE::PointerType bs, TgcRdo *rdo, uint32_t source_id) const
Convert data contents of ROBFragment to RDO.
virtual StatusCode fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment &robFrag, TgcRdoContainer &rdoIdc, const EventContext &ctx) const override
Convert ROBFragment to RDO.
virtual StatusCode initialize() override
Standard AlgTool method.
Gaudi::Property< bool > m_skipCoincidence
Flag for skipping coincidence objects (for TrigT1TGC running on data)
Gaudi::Property< bool > m_showStatusWords
Flag for showStatusWords.
void getCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment &robFrag, TgcRdo *rdo) const
Retrieve header of ROBFragment.
std::atomic< unsigned int > m_nCache
virtual StatusCode finalize() override
Standard AlgTool method.
std::atomic< unsigned int > m_nNotCache
const TgcIdHelper * m_tgcIdHelper
TGC ID helper.
void byteStreamSrod2Rdo(OFFLINE_FRAGMENTS_NAMESPACE::PointerType bs, TgcRdo *rdo, uint32_t source_id, uint32_t ndata) const
virtual ~TGC_RodDecoderReadout()
default destructor
void showStatusWords(const uint32_t source_id, const uint16_t rdoId, const int idHash, const uint32_t nstatus, const uint32_t *status) const
Show status words.
An unit object of TGC ROD output.
Definition TgcRawData.h:23
@ SLB_TYPE_INNER_WIRE
Definition TgcRawData.h:36
@ SLB_TYPE_TRIPLET_STRIP
Definition TgcRawData.h:35
@ SLB_TYPE_INNER_STRIP
Definition TgcRawData.h:37
static constexpr uint32_t RPC_CAND_BITSHIFT
Definition TgcRawData.h:224
static constexpr uint32_t NSW_CAND_BITSHIFT
Definition TgcRawData.h:215
static constexpr uint32_t RPC_BCID_BITSHIFT
Definition TgcRawData.h:226
static constexpr uint32_t NSW_INPUT_BITSHIFT
Definition TgcRawData.h:217
static constexpr uint32_t RPC_FLAG_BITSHIFT
Definition TgcRawData.h:222
static constexpr uint32_t NSW_BCID_BITSHIFT
Definition TgcRawData.h:219
void setLocalStatus(uint32_t data)
Definition TgcRdo.h:194
uint16_t rodId() const
Definition TgcRdo.h:138
void setTriggerType(uint16_t v)
Definition TgcRdo.h:127
uint16_t l1Id() const
Definition TgcRdo.h:150
void setRodStatus(uint32_t data)
Definition TgcRdo.h:178
void setL1Id(uint32_t v)
Definition TgcRdo.h:119
void setOnlineId(uint16_t subDetectorId, uint16_t rodId)
Definition TgcRdo.cxx:37
void setOrbit(uint32_t orbit)
Definition TgcRdo.h:210
void setErrors(uint16_t data)
Definition TgcRdo.h:162
uint16_t subDetectorId() const
Definition TgcRdo.h:134
static uint16_t calculateOnlineId(uint16_t subDetectorId, uint16_t rodId)
Definition TgcRdo.cxx:60
uint16_t identify() const
Definition TgcRdo.h:107
uint16_t bcId() const
Definition TgcRdo.h:146
void setBcId(uint16_t v)
Definition TgcRdo.h:123
bool hipt
Definition globals.cxx:29
int count(std::string s, const std::string &regx)
count how many occurances of a regx are in a string
Definition hcg.cxx:146
const DataType * PointerType
Definition RawEvent.h:25
eformat::ROBFragment< PointerType > ROBFragment
Definition RawEvent.h:27
The struct for fragment count in ByteStream.
The struct for Inner trigger bits in ByteStream.
The struct for HiPt 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.