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