ATLAS Offline Software
Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
Muon::TgcRODReadOut Class Reference

#include <TgcRODReadOut.h>

Collaboration diagram for Muon::TgcRODReadOut:

Public Member Functions

 TgcRODReadOut (const MuonTGC_CablingSvc &cabling)
 Constructor. More...
 
virtual ~TgcRODReadOut ()
 Destructor. More...
 
StatusCode byteStream2Rdo (const ByteStream &bs, TgcRdo &tgcRdo, uint32_t source_id) const
 Convert BS (ROB fragment) to RDO. More...
 
StatusCode check (const ByteStream &bs, TgcRdo &tgcRdo, uint32_t source_id) const
 Convert BS (ROB fragment) to RDO and compare decoded RDO container and another RDO container decoded by other converter. More...
 
StatusCode compare (TgcRdo *rdo, TgcRdo *newRdo) const
 Compare two RDO containers. More...
 
StatusCode decodeRodToRdo (TgcRdo &tgcRdo, const ByteStream &vData, uint16_t subDetectorId, uint16_t rodId, uint32_t l1Id, uint16_t bcId) const
 Decode BS to RDO container. More...
 

Static Public Member Functions

static bool isMatched (const TgcRawData *rdo1, const TgcRawData *rdo2)
 Compare two RDOs. More...
 

Protected Types

enum  {
  RawDataFragMask =0xFF000000, FragmentIdMask =0xFF000000, FragmentCountMask =0x00FFFFFF, HeaderMask =0xE0000000,
  HeaderEvent =0x00000000, HeaderError =0x20000000, HeaderSLB10 =0x40000000, HeaderSLB11 =0x60000000,
  HeaderSLBC =0x80000000, HeaderSLBP =0xA0000000, HeaderSLBN =0xC0000000, HeaderTrailer =0x70000000,
  ROD_START = 0xEE1234EE, ROD_HEADER_SIZE = 0x09, ROD_STATUS_SIZE = 0x05
}
 

Protected Member Functions

bool setSbLoc (uint16_t subDetectorId, uint16_t rodId, TgcSlbData *slb, int rxId) const
 Set sbLoc. More...
 

Private Types

enum  NROD_SIDE { NROD = 24+1, NSROD = 6+1, ASIDE = 0x67, CSIDE = 0x68 }
 The number of RODs (1-24 for 12-fold) More...
 
typedef OFFLINE_FRAGMENTS_NAMESPACE::PointerType ByteStream
 

Private Member Functions

TgcRODReadOutoperator= (const TgcRODReadOut &right)
 
 TgcRODReadOut (const TgcRODReadOut &)
 

Private Attributes

std::atomic< unsigned int > m_failedDecodeRodToRdo [NROD+1]
 The number of failures on decodeRodToRdo. More...
 
std::atomic< unsigned int > m_failedHeaderSizeRawData [NROD+1]
 The number of strange header and SizeRawData. More...
 
std::atomic< unsigned int > m_failedSetSbLoc [NROD+1]
 The number of failures on setSbLoc. More...
 
std::atomic< unsigned int > m_failedSetType [NROD+1]
 The number of failures on setType. More...
 
std::atomic< unsigned int > m_failedGetSLBIDfromRxID [NROD+1]
 The number of failures on getSLBIDfromRxID. More...
 
std::atomic< unsigned int > m_failedGetReadoutIDfromSLBID [NROD+1]
 The number of failures on getReadoutIDfromSLBID. More...
 
const MuonTGC_CablingSvcm_cabling
 TGC Cabling Svc. More...
 
TgcSlbDataHelperm_tgcSlbDataHelper
 TGC SLB data helper. More...
 

Detailed Description

TGC ROD decoder for conversion from ROB fragment to TgcRDO

Author
Susumu Oda Susum.nosp@m.u.Od.nosp@m.a@cer.nosp@m.n.ch
Hisaya Kurashige

This class was developed by Tadashi Maeno based on MdtRODReadOut written by S. Rosati. Hisaya Kurashige
removed TGC ROD Encoder and updated decodeRodToRdo on January 2008. Takashi Kubota migrated to MuonTGC_CnvTools.

Definition at line 35 of file TgcRODReadOut.h.

Member Typedef Documentation

◆ ByteStream

Definition at line 38 of file TgcRODReadOut.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
protected
Enumerator
RawDataFragMask 
FragmentIdMask 
FragmentCountMask 
HeaderMask 
HeaderEvent 
HeaderError 
HeaderSLB10 
HeaderSLB11 
HeaderSLBC 
HeaderSLBP 
HeaderSLBN 
HeaderTrailer 
ROD_START 
ROD_HEADER_SIZE 
ROD_STATUS_SIZE 

Definition at line 69 of file TgcRODReadOut.h.

69  {
70  RawDataFragMask =0xFF000000, // RawData Fragment HEADER Mask
71  FragmentIdMask =0xFF000000, // Fragmen ID Mask
72  FragmentCountMask =0x00FFFFFF, // Fragmen ID Mask
73  HeaderMask =0xE0000000, //
74  HeaderEvent =0x00000000, // Event Header
75  HeaderError =0x20000000, // Error Report
76  HeaderSLB10 =0x40000000, // SLB Header 10
77  HeaderSLB11 =0x60000000, // SLB Header 11
78  HeaderSLBC =0x80000000, // central bunch
79  HeaderSLBP =0xA0000000, // previous bunch
80  HeaderSLBN =0xC0000000, // next bunch
81  HeaderTrailer =0x70000000, // SLB Header 11
82 
83  ROD_START = 0xEE1234EE,
84  ROD_HEADER_SIZE = 0x09,
85  ROD_STATUS_SIZE = 0x05
86  };

◆ NROD_SIDE

The number of RODs (1-24 for 12-fold)

Enumerator
NROD 
NSROD 
ASIDE 
CSIDE 

Definition at line 95 of file TgcRODReadOut.h.

95  {
96  NROD = 24+1,
97  NSROD = 6+1,
98  ASIDE = 0x67, // 103
99  CSIDE = 0x68 // 104
100  };

Constructor & Destructor Documentation

◆ TgcRODReadOut() [1/2]

Muon::TgcRODReadOut::TgcRODReadOut ( const MuonTGC_CablingSvc cabling)

Constructor.

Definition at line 12 of file TgcRODReadOut.cxx.

14 {
15  m_tgcSlbDataHelper = new TgcSlbDataHelper;
16 
17  for(unsigned int rodId=0; rodId<NROD+1; rodId++) {
18  m_failedDecodeRodToRdo[rodId] = 0;
19  m_failedHeaderSizeRawData[rodId] = 0;
20  m_failedSetSbLoc[rodId] = 0;
21  m_failedSetType[rodId] = 0;
22  m_failedGetSLBIDfromRxID[rodId] = 0;
24  }
25 }

◆ ~TgcRODReadOut()

Muon::TgcRODReadOut::~TgcRODReadOut ( )
virtual

Destructor.

Definition at line 28 of file TgcRODReadOut.cxx.

29 {
30  MsgStream log(Athena::getMessageSvc(),"Muon::TgcRODReadOut");
31  for(unsigned int rodId=0; rodId<NROD+1; rodId++) {
32  if(m_failedDecodeRodToRdo[rodId]) {
33  log << MSG::WARNING << "rodId=" << rodId << " : decodeRodToRdo faied "
34  << m_failedDecodeRodToRdo[rodId] << " times" << endmsg;
35  }
36  if(m_failedDecodeRodToRdo[rodId]) {
37  log << MSG::WARNING << "rodId=" << rodId << " : decodeRodToRdo faied "
38  << m_failedDecodeRodToRdo[rodId] << " times" << endmsg;
39  }
40  if(m_failedHeaderSizeRawData[rodId]) {
41  log << MSG::WARNING << "rodId=" << rodId << " : Header or SizeRawData was strange "
42  << m_failedHeaderSizeRawData[rodId] << " times" << endmsg;
43  }
44  if(m_failedSetSbLoc[rodId]) {
45  log << MSG::WARNING << "rodId=" << rodId << " : setSbLoc failed "
46  << m_failedSetSbLoc[rodId] << " times" << endmsg;
47  }
48  if(m_failedSetType[rodId]) {
49  log << MSG::WARNING << "rodId=" << rodId << " : setType failed "
50  << m_failedSetType[rodId] << " times" << endmsg;
51  }
52  if(m_failedGetSLBIDfromRxID[rodId]) {
53  log << MSG::WARNING << "rodId=" << rodId << " : getSLBIDfromRxID failed "
54  << m_failedGetSLBIDfromRxID[rodId] << " times" << endmsg;
55  }
57  log << MSG::WARNING << "rodId=" << rodId << " : getReadoutIDfromSLBID failed "
58  << m_failedGetReadoutIDfromSLBID[rodId] << " times" << endmsg;
59  }
60  }
61  delete m_tgcSlbDataHelper; m_tgcSlbDataHelper=nullptr;
62 }

◆ TgcRODReadOut() [2/2]

Muon::TgcRODReadOut::TgcRODReadOut ( const TgcRODReadOut )
private

Member Function Documentation

◆ byteStream2Rdo()

StatusCode Muon::TgcRODReadOut::byteStream2Rdo ( const ByteStream bs,
TgcRdo tgcRdo,
uint32_t  source_id 
) const

Convert BS (ROB fragment) to RDO.

Definition at line 64 of file TgcRODReadOut.cxx.

67 {
68  MsgStream log(Athena::getMessageSvc(),"Muon::TgcRODReadOut");
69  bool t_debug = (log.level()<=MSG::DEBUG);
70 
71  // set ROD attribute
72  uint16_t subDetectorId = (source_id & 0x00FF0000) >> 16;
73  uint16_t rodId = (source_id & 0x000000FF); // ROD : 0x01-0x0C(12), SROD: 0x11(17)-0x13(19)
74 
75  uint32_t l1Id = tgcRdo.l1Id();
76  uint16_t bcId = tgcRdo.bcId();
77 
78  tgcRdo.setOnlineId(subDetectorId, rodId);
79 
80  // decode
81  if(!(decodeRodToRdo(tgcRdo, bs,subDetectorId, rodId,l1Id, bcId).isSuccess())){
82  unsigned int tmpRodId = rodId + (subDetectorId==CSIDE ? NROD/2 : 0);
83  if(tmpRodId>NROD) tmpRodId = NROD;
84 
85  if(t_debug || !m_failedDecodeRodToRdo[tmpRodId]) {
86  log << (!m_failedDecodeRodToRdo[tmpRodId] ? MSG::WARNING : MSG::DEBUG)
87  << " Can't convert TGC BS to RDO: "
88  << "subDetectorId = " << subDetectorId
89  << "rodId = " << rodId
90  << "l1Id = " << l1Id
91  << "bcId = " << bcId
92  << endmsg;
93  log << (!m_failedDecodeRodToRdo[tmpRodId] ? MSG::WARNING : MSG::DEBUG)
94  << "Corrupted data, Skip decoding of remaining hits of this event..."
95  << endmsg;
96  }
97  m_failedDecodeRodToRdo[tmpRodId]++;
98 
99  return StatusCode::SUCCESS;
100  }
101 
102  return StatusCode::SUCCESS;
103 }

◆ check()

StatusCode Muon::TgcRODReadOut::check ( const ByteStream bs,
TgcRdo tgcRdo,
uint32_t  source_id 
) const

Convert BS (ROB fragment) to RDO and compare decoded RDO container and another RDO container decoded by other converter.

Definition at line 105 of file TgcRODReadOut.cxx.

108 {
109  // create another TgcTdo
110  TgcRdo newRdo;
111 
112  MsgStream log(Athena::getMessageSvc(),"Muon::TgcRODReadOut");
113 
114  // set ROD attribute
115  uint16_t subDetectorId = (source_id & 0x00FF0000) >> 16;
116  uint16_t rodId = (source_id & 0x000000FF);
117 
118  uint32_t l1Id = tgcRdo.l1Id();
119  uint16_t bcId = tgcRdo.bcId();
120 
121  newRdo.setOnlineId(subDetectorId, rodId);
122 
123  // decode
124  if(!(decodeRodToRdo(newRdo, bs,subDetectorId, rodId,l1Id, bcId).isSuccess())){
125  log << MSG::WARNING << " Can't convert TGC BS to RDO: "
126  << "subDetectorId = " << subDetectorId
127  << "rodId = " << rodId
128  << "l1Id = " << l1Id
129  << "bcId = " << bcId
130  << endmsg;
131  log << MSG::WARNING << "Corrupted data, Skip decoding of remaining hits of this event..."
132  << endmsg;
133  return StatusCode::SUCCESS;
134  }
135 
136  // compare
137  if(!compare(&tgcRdo, &newRdo)){
138  log << MSG::WARNING << "Can't compare TgcRdos: Skip decoding of remaining hits of this event..."<<endmsg;
139  return StatusCode::SUCCESS;
140  }
141 
142  return StatusCode::SUCCESS;
143 }

◆ compare()

StatusCode Muon::TgcRODReadOut::compare ( TgcRdo rdo,
TgcRdo newRdo 
) const

Compare two RDO containers.

Definition at line 145 of file TgcRODReadOut.cxx.

146 {
147  #ifndef NDEBUG
148  MsgStream log(Athena::getMessageSvc(),"Muon::TgcRODReadOut");
149  log << MSG::DEBUG << "TgcRODReadOut::compare" << endmsg;
150  log << MSG::DEBUG
151  << " rdo->size()=" << rdo->size()
152  << " newRdo->size()=" << newRdo->size()
153  << endmsg;
154  #endif
155 
156  size_t n_data = newRdo->size();
157  size_t o_data = rdo->size();
158  std::vector<bool> check(o_data, false);
159 
160  #ifndef NDEBUG
161  log << MSG::DEBUG << "Unmatched in RawData format" << endmsg;
162  #endif
163 
164  for(size_t ib=0; ib<n_data; ib++){
165  TgcRawData* nraw = (*newRdo)[ib];
166  #ifndef NDEBUG
167  bool matched = false; // matched flag is only needed for DEBUG messages
168  #endif
169  for(size_t ic=0; ic<o_data; ic++){
170  TgcRawData* oraw = (*rdo)[ic];
171  if(isMatched(nraw, oraw)){
172  check[ic] = true;
173  #ifndef NDEBUG
174  matched = true;
175  #endif
176  break;
177  }
178  }
179  #ifndef NDEBUG
180  if(!matched) {
181  log << MSG::DEBUG << (*nraw) << endmsg;
182  }
183  #endif
184  }
185 
186  #ifndef NDEBUG
187  log << MSG::DEBUG << "Unmatched in Readout format" << endmsg;
188  #endif
189  for(size_t ic=0; ic<o_data; ic++){
190  if(check[ic]) continue;
191  TgcRawData* oraw = (*rdo)[ic];
192  #ifndef NDEBUG
193  bool matched = false; // matched flag is only needed for DEBUG messages
194  #endif
195  for(size_t ib=0; ib<n_data; ib++){
196  TgcRawData* nraw = (*newRdo)[ib];
197  if(isMatched(oraw, nraw)){
198  #ifndef NDEBUG
199  matched = true;
200  #endif
201  break;
202  }
203  }
204  #ifndef NDEBUG
205  if(!matched) {
206  log << MSG::DEBUG << (*oraw) << endmsg;
207  }
208  #endif
209  }
210 
211  return StatusCode::SUCCESS;
212 }

◆ decodeRodToRdo()

StatusCode Muon::TgcRODReadOut::decodeRodToRdo ( TgcRdo tgcRdo,
const ByteStream vData,
uint16_t  subDetectorId,
uint16_t  rodId,
uint32_t  l1Id,
uint16_t  bcId 
) const

Decode BS to RDO container.

Definition at line 269 of file TgcRODReadOut.cxx.

275 {
276 
278  // decode ROD data part
279 
280  // total data fragment size
281  //const uint32_t tot_vData = vData.size();
282 
283  //Data Word Count (added by okumura)
284  uint32_t sizeRawData=0;
285  uint32_t sizeReadOutFormatHit=0;
286  uint32_t sizeReadOutFormatTracklet=0;
287  //uint32_t sizeChamberFormatHit=0;
288  //uint32_t sizeChamberFormatTracklet=0;
289  uint32_t sizeHipTWord=0;
290  uint32_t sizeSectorLogicWord=0;
291 
292  // flag of correct header
293  bool isHeaderOK = true;
294  // index of vData;
295  unsigned int vDataIndex;
296  for(vDataIndex=0; isHeaderOK; vDataIndex++){
297  uint32_t rawdata_flag = (vData[vDataIndex] & RawDataFragMask) >>24;
298  uint32_t flagmentId = (vData[vDataIndex] & FragmentIdMask) >>24;
299 
300  // check HEADER for RawData section
301  if(rawdata_flag==0xFF) break;
302 
303  // Words Count
304  uint32_t counter=(vData[vDataIndex] & FragmentCountMask );
305 
306  switch(flagmentId) {
307  case 0x01: //Fragment ID ==1
308  sizeRawData = counter;
309  break;
310  case 0x02: //Fragmant ID ==2
311  sizeReadOutFormatHit = counter;
312  break;
313  case 0x03: //Fragmant ID ==3
314  sizeReadOutFormatTracklet = counter;
315  break;
316  //case 0x04: //Fragmant ID ==4
317  //sizeChamberFormatHit =counter;
318  //break;
319  //case 0x05: //Fragmant ID ==5
320  //sizeChamberFormatTracklet =counter;
321  //break;
322  case 0x08: //Fragmant ID ==8
323  sizeHipTWord =counter;
324  break;
325  case 0x09: //Fragmant ID ==9
326  sizeSectorLogicWord =counter;
327  break;
328  default:
329  isHeaderOK = false;
330  break;
331  }
332  }
333 
334  MsgStream log(Athena::getMessageSvc(),"Muon::TgcRODReadOut");
335  bool t_debug = (log.level()<=MSG::DEBUG);
336 
337  if(!isHeaderOK ||
338  sizeRawData==0 ||
339  sizeRawData>=0x10000
340  ) {
341  unsigned int tmpRodId = rodId + (subDetectorId==CSIDE ? NROD/2 : 0);
342  if(tmpRodId>NROD) tmpRodId = NROD;
343 
344  if((t_debug || !m_failedHeaderSizeRawData[tmpRodId])) {
345  log << (!m_failedHeaderSizeRawData[tmpRodId] ? MSG::WARNING : MSG::DEBUG)
346  << "Corrupted data, Skip decoding of this ROD data"
347  << " TgcRODReadout : ROD ID= " << rodId
348  << " RawData Size= " << sizeRawData
349  << endmsg;
350  log << (!m_failedHeaderSizeRawData[tmpRodId] ? MSG::WARNING : MSG::DEBUG)
351  << "ReadOut Hit Size= " << sizeReadOutFormatHit
352  << " ReadOut Tracklet= " << sizeReadOutFormatTracklet
353  << " ReadOut SL= " << sizeSectorLogicWord
354  << " vDataIndex = " << vDataIndex
355  << " HipT = " << sizeHipTWord
356  << endmsg;
357  }
358  m_failedHeaderSizeRawData[tmpRodId]++;
359 
360  return StatusCode::SUCCESS;
361  }
362 
363  if(t_debug) {
364  log << MSG::DEBUG
365  << "TgcRODReadout : ROD ID=" << rodId
366  << " RawData Size=" << sizeRawData
367  << " ReadOut Hit Size= " << sizeReadOutFormatHit
368  << " ReadOut Tracklet= " << sizeReadOutFormatTracklet
369  << " ReadOut SL= " << sizeSectorLogicWord
370  << endmsg;
371  }
372 
373  uint32_t firstRawDataIndex=vDataIndex;
374 
375  // RawData Collection.
376  std::vector<TgcRawData *> vCh;
377 
378  // decode RAW DATA Fragment process start
379  uint16_t fe_bcId=0;
380  uint32_t fe_l1Id=0;
381  uint16_t sswId= 999;
382  uint16_t slbId = 999;
383  uint16_t rxId = 999;
384  uint16_t mod = 999;
385  uint16_t b_error = 0;
386  uint16_t rec_type= 999;
387 
388  TgcSlbData* slb =nullptr;
389 
390 
391  for(; vDataIndex < firstRawDataIndex+sizeRawData; ++vDataIndex){
392  if(t_debug) {
393  log << MSG::DEBUG
394  << "Tgc BS Raw:" << vDataIndex
395  << ": " << std::hex << vData[vDataIndex]
396  << endmsg;
397  }
398 
399  // header check
400  unsigned int header = vData[vDataIndex] & HeaderMask;
401 
402  uint32_t rawdata_flag = (vData[vDataIndex] & RawDataFragMask) >> 24;
403  if((rawdata_flag == 0xff) || (rawdata_flag == 0xfc)){
404  continue;
405  }
406 
407  switch(header) {
408  case HeaderEvent: // Event header
409  // get Rec Type
410  rec_type = (vData[vDataIndex] & 0x18000000) >> 27;
411  if (rec_type >1) {
412  log << MSG::WARNING
413  << "Rec Type " << rec_type << " is not supproted "
414  << " Skip decoding of remaining hits of this event..."
415  << endmsg;
416  return StatusCode::SUCCESS;
417  }
418 
419  // get SSW ID
420  if (rec_type == 0) {
421  // format Oct. 09
422  sswId = (vData[vDataIndex] & 0x0F0000) >> 16;
423  } else if (rec_type ==1) {
424  // original SSW format
425  sswId = (vData[vDataIndex] & 0x07800000) >> 23;
426  }
427  break;
428 
429  case HeaderSLB10: // SLB header 10
430  // Create RDOs by using slb bit array
431  if(slb!=nullptr) {
432  m_tgcSlbDataHelper->convertToHits(subDetectorId, rodId, slb, vCh);
433  m_tgcSlbDataHelper->convertToCoincidences(subDetectorId, rodId, slb, vCh);
434  delete slb; slb = nullptr;
435  }
436  // get SLB ID, BCID, L1ID, ModuleType
437  fe_l1Id = (vData[vDataIndex] & 0x0000F000) >> 12;
438  fe_bcId = vData[vDataIndex] & 0x00000FFF;
439  slbId = (vData[vDataIndex] & 0x1F000000) >> 24;
440 
441  if (rec_type == 0) {
442  // format Oct. 09
443  mod = (vData[vDataIndex] & 0x00070000) >> 16;
444  rxId = (vData[vDataIndex] & 0x00F80000) >> 19;
445  } else if (rec_type ==1) {
446  // original SSW format
447  mod = (vData[vDataIndex] & 0x000E0000) >> 17;
448  }
449 
450  if(fe_l1Id != l1Id) {
451  if(t_debug) {
452  log << MSG::DEBUG
453  << "l1Id in SLB Header is different from l1Id in ROD "
454  << " for rodId:" << rodId
455  << " slbId:" << slbId
456  << " l1Id, bcId (SLB):" << fe_l1Id << ", " << fe_bcId
457  << " l1Id, bcId (ROD):" << l1Id << ", " << bcId
458  << endmsg;
459  }
460  }
461  b_error = 0;
462  break;
463 
464 
465  case HeaderSLB11: // SLB header 11 or Trailer
466  if(vData[vDataIndex] & 0x10000000){
467  //SLB Trailer
468  // decode Bit map
469  b_error = vData[vDataIndex] & 0x0FFF;
470 
471  } else {
472  //SLBHeader 11
473  // get RXID
474  rxId = (vData[vDataIndex] & 0x7C00000) >> 22;
475 
476  break;
477  }
478  /* FALLTHROUGH */
479 
480 
481  case HeaderSLBC: // SLB data
482  case HeaderSLBP:
483  case HeaderSLBN:
484  // create slb
485  if(!slb) {
486  // create TgcSlbData
487  slb = new TgcSlbData(bcId, l1Id, sswId, slbId);
488  // set sbLoc by using rxId
489  if(!setSbLoc(subDetectorId, rodId, slb, rxId) ){
490  unsigned int tmpRodId = rodId + (subDetectorId==CSIDE ? NROD/2 : 0);
491  if(tmpRodId>NROD) tmpRodId = NROD;
492 
493  if((t_debug || !m_failedSetSbLoc[tmpRodId])) {
494  log << (!m_failedSetSbLoc[tmpRodId] ? MSG::WARNING : MSG::DEBUG)
495  << " Fail to set sbLoc"
496  << " :rodId=" << rodId
497  << " :sswId=" << sswId
498  << " :slbAddress= " << slbId
499  << " : rxId= " << rxId
500  << endmsg;
501  log << (!m_failedSetSbLoc[tmpRodId] ? MSG::WARNING : MSG::DEBUG)
502  << "Corrupted data, Skip decoding of remaining hits of this event..."
503  << endmsg;
504  }
505  m_failedSetSbLoc[tmpRodId]++;
506  delete slb; slb = nullptr;
507  return StatusCode::SUCCESS;
508  }
509  if(!m_tgcSlbDataHelper->setType(subDetectorId, rodId, slb, mod)) {
510  unsigned int tmpRodId = rodId + (subDetectorId==CSIDE ? NROD/2 : 0);
511  if(tmpRodId>NROD) tmpRodId = NROD;
512 
513  if((t_debug || !m_failedSetType[tmpRodId])) {
514  log << (!m_failedSetType[tmpRodId] ? MSG::WARNING : MSG::DEBUG)
515  << " Fail to set Module Type"
516  << " :rodId=" << rodId
517  << " :sswId=" << sswId
518  << " :slbAddress= " << slbId
519  << endmsg;
520  log << (!m_failedSetType[tmpRodId] ? MSG::WARNING : MSG::DEBUG)
521  << "Corrupted data, Skip decoding of remaining hits of this event..."
522  << endmsg;
523  }
524  m_failedSetType[tmpRodId]++;
525  delete slb; slb = nullptr;
526  return StatusCode::SUCCESS;
527  }
528  if(b_error) {
529  slb->setError(b_error);
530  }
531  if(t_debug) {
532  log << MSG::DEBUG
533  << "TgcRODReadout : slb =" << slb
534  << " : rodId=" << rodId
535  << " : sswId=" << sswId
536  << " : slbAddress= " << slbId
537  << " : rxId= "<< rxId
538  << endmsg;
539  }
540  }
541 
542 
543  // decode Bit map
544  for(int iHL=0; iHL<32; iHL+=16) {// Higher and Lower word
545  uint32_t vd = vData[vDataIndex] << iHL;
546  // get BC tag
547  uint32_t bcTag;
548  if((vd & HeaderMask) == HeaderSLBC) {
550  } else if((vd & HeaderMask) == HeaderSLBP) {
552  } else if((vd& HeaderMask) == HeaderSLBN) {
554  } else if((vd& HeaderMask) == HeaderSLB11) {
555  // Trailer
556  slb->setError(vData[vDataIndex] & 0x0FFF);
557  continue;
558  } else {
559  continue;
560  }
561  // Cell Address and Bit map
562  unsigned long cellAddr = (vd & 0x1F000000) >> 24;
563  unsigned long cellBitMap = (vd & 0x00FF0000) >> 16;
564 
565  if(cellAddr < 25) {
566  // set Bit map
567  slb->setBitmap(bcTag, cellAddr, cellBitMap);
568  } else {
569  // PADWORD
570  }
571  }
572  break;
573 
574  case HeaderError: // Error Report
575  {
576  uint32_t error_context = (vData[vDataIndex] & 0x00FFFFFF);
577  uint16_t error_id = (vData[vDataIndex] & 0x01F000000)>>24;
578  if((t_debug && (error_context!=0))) {
579  log << MSG::DEBUG
580  << "TgcRODReadout : Error Report "
581  << " : error id =" << error_id
582  << " : context =" << error_context
583  << endmsg;
584  }
585  }
586  break;
587 
588  default:
589  break;
590  }
591  }
592  if(slb!=nullptr) {
593  m_tgcSlbDataHelper->convertToHits(subDetectorId, rodId, slb, vCh);
594  m_tgcSlbDataHelper->convertToCoincidences(subDetectorId, rodId, slb, vCh);
595  delete slb; slb = nullptr;
596  }
597 
598  if(t_debug) {
599  uint32_t firstROHitIndex=vDataIndex;
600  for(; vDataIndex < firstROHitIndex+sizeReadOutFormatHit; ++vDataIndex){
601  log << MSG::DEBUG
602  << "Tgc BS Readout HIT:" << vDataIndex
603  << ": " << std::hex << vData[vDataIndex] << endmsg;
604  }
605  uint32_t firstROTrackletIndex=vDataIndex;
606  for(; vDataIndex < firstROTrackletIndex+sizeReadOutFormatTracklet; ++vDataIndex){
607  log << MSG::DEBUG
608  << "Tgc BS Readout HIT:" << vDataIndex
609  << ": " << std::hex << vData[vDataIndex] << endmsg;
610  }
611  }
612 
613 
615  // append Hits to RDO
616 
617  // loop over all hits
618  std::vector<TgcRawData *>::iterator ith = vCh.begin();
619  std::vector<TgcRawData *>::iterator ith_e = vCh.end();
620 
621  size_t n_vCh=0;
622  for(; ith!=ith_e; ++ith){
623  // push back
624  tgcRdo.push_back(*ith);
625 
626  n_vCh +=1;
627 
628  }
629  if(t_debug) {
630  log << MSG::DEBUG
631  << n_vCh << "words of were recorded in TgcRdo container"
632  << endmsg;
633  }
634 
635  return StatusCode::SUCCESS;
636 
637 }

◆ isMatched()

bool Muon::TgcRODReadOut::isMatched ( const TgcRawData rdo1,
const TgcRawData rdo2 
)
static

Compare two RDOs.

Definition at line 214 of file TgcRODReadOut.cxx.

216 {
217  if(rdo1->subDetectorId() != rdo2->subDetectorId()) return false;
218  if(rdo1->rodId() != rdo2->rodId()) return false;
219  if(rdo1->sswId() != rdo2->sswId()) return false;
220  if(rdo1->slbId() != rdo2->slbId()) return false;
221  if(rdo1->bcTag() != rdo2->bcTag()) return false;
222  if(rdo1->type() != rdo2->type()) return false;
223 
224  switch(rdo1->type()){
226  if(rdo1->isAdjacent() != rdo2->isAdjacent()) return false;
227  return rdo1->bitpos() == rdo2->bitpos();
228  break;
229 
231  if(rdo1->segment() != rdo2->segment()) return false;
232  if(rdo1->subMatrix() != rdo2->subMatrix()) return false;
233  if(rdo1->segment() != rdo2->segment()) return false;
234  if(rdo1->position() != rdo2->position()) return false;
235  if(rdo1->delta() != rdo2->delta()) return false;
236  return true;
237  break;
238 
240  if(rdo1->isStrip() != rdo2->isStrip()) return false;
241  if(rdo1->isForward() != rdo2->isForward()) return false;
242  if(rdo1->sector() != rdo2->sector()) return false;
243  if(rdo1->chip() != rdo2->chip()) return false;
244  if(rdo1->index() != rdo2->index()) return false;
245  if(rdo1->isHipt() != rdo2->isHipt()) return false;
246  if(rdo1->hitId() != rdo2->hitId()) return false;
247  if(rdo1->hsub() != rdo2->hsub()) return false;
248  if(rdo1->delta() != rdo2->delta()) return false;
249  return true;
250  break;
251 
252  case TgcRawData::TYPE_SL:
253  if(rdo1->isForward() != rdo2->isForward()) return false;
254  if(rdo1->sector() != rdo2->sector()) return false;
255  if(rdo1->index() != rdo2->index()) return false;
256  if(rdo1->isMuplus() != rdo2->isMuplus()) return false;
257  if(rdo1->threshold() != rdo2->threshold()) return false;
258  if(rdo1->roi() != rdo2->roi()) return false;
259  return true;
260  break;
261 
262  default:
263  return true;
264  break;
265  }
266 }

◆ operator=()

TgcRODReadOut& Muon::TgcRODReadOut::operator= ( const TgcRODReadOut right)
private

◆ setSbLoc()

bool Muon::TgcRODReadOut::setSbLoc ( uint16_t  subDetectorId,
uint16_t  rodId,
TgcSlbData slb,
int  rxId 
) const
protected

Set sbLoc.

Definition at line 640 of file TgcRODReadOut.cxx.

644 {
645  MsgStream log(Athena::getMessageSvc(),"Muon::TgcRODReadOut");
646  bool t_debug = (log.level()<=MSG::DEBUG);
647 
648  // get sbLoc
649  int phi = 0;
650  bool isAside = false;
651  bool isEndcap = false;
652  int moduleType = 0;
653  int slbId = 0;
654  int dummy_subDetectorId = 0;
655  int dummy_rodId = 0;
656  int dummy_sswId = 0;
657  int sbLoc = 0;
658  int slbaddress_ret = 0;
659 
660  int sswId = slb->getSswId();
661 
662  if(!m_cabling.getSLBIDfromRxID(phi,
663  isAside,
664  isEndcap,
665  moduleType,
666  slbId,
667  subDetectorId,
668  rodId,
669  sswId,
670  rxId)) {
671  unsigned int tmpRodId = rodId + (subDetectorId==CSIDE ? NROD/2 : 0);
672  if(tmpRodId>NROD) tmpRodId = NROD;
673 
674  if(t_debug || !m_failedGetSLBIDfromRxID[tmpRodId]) {
675  log << (!m_failedGetSLBIDfromRxID[tmpRodId] ? MSG::WARNING : MSG::DEBUG)
676  << " Fail to getSLBIDfromRxID "
677  << " :rodId=" <<rodId
678  << " :sswId="<<sswId
679  << " :rxId= "<<rxId
680  << endmsg;
681  }
682  m_failedGetSLBIDfromRxID[tmpRodId]++;
683 
684  return false;
685  }
686 
688  isAside,
689  isEndcap,
690  moduleType,
691  slbId,
692  dummy_subDetectorId,
693  dummy_rodId,
694  dummy_sswId,
695  sbLoc)) {
696  unsigned int tmpRodId = rodId + (subDetectorId==CSIDE ? NROD/2 : 0);
697  if(tmpRodId>NROD) tmpRodId = NROD;
698 
699  if((t_debug || !m_failedGetReadoutIDfromSLBID[tmpRodId])) {
700  log << (!m_failedGetReadoutIDfromSLBID[tmpRodId] ? MSG::WARNING : MSG::DEBUG)
701  << " Fail to getReadoutIDfromSLBID "
702  << " :rodId=" <<rodId
703  << " :sswId="<<sswId
704  << " :rxId= "<<rxId
705  << endmsg;
706  }
707  m_failedGetReadoutIDfromSLBID[tmpRodId]++;
708 
709  return false;
710  }
711 
712  if(m_cabling.getSLBAddressfromReadoutID(slbaddress_ret,
713  subDetectorId,
714  rodId,
715  sswId,
716  sbLoc)) {
717  // check SLB Address
718  if(slbaddress_ret != slb->getSlbId() ) {
719  if(t_debug) {
720  log << MSG::DEBUG
721  << " wrong getSLBAddress :"
722  <<" :sswId = "<<sswId
723  <<" :rxId = " <<rxId << ":sbLoc = " << sbLoc
724  << endmsg;
725  log << MSG::DEBUG
726  <<" :slbAddress = " << slb->getSlbId()
727  <<" expected value = " << slbaddress_ret
728  << endmsg;
729  }
730  }
731  }
732 
733  // set sbLoc
734  slb->setSbLoc(sbLoc);
735 
736  return true;
737 }

Member Data Documentation

◆ m_cabling

const MuonTGC_CablingSvc& Muon::TgcRODReadOut::m_cabling
private

TGC Cabling Svc.

Definition at line 115 of file TgcRODReadOut.h.

◆ m_failedDecodeRodToRdo

std::atomic<unsigned int> Muon::TgcRODReadOut::m_failedDecodeRodToRdo[NROD+1]
mutableprivate

The number of failures on decodeRodToRdo.

Definition at line 102 of file TgcRODReadOut.h.

◆ m_failedGetReadoutIDfromSLBID

std::atomic<unsigned int> Muon::TgcRODReadOut::m_failedGetReadoutIDfromSLBID[NROD+1]
mutableprivate

The number of failures on getReadoutIDfromSLBID.

Definition at line 112 of file TgcRODReadOut.h.

◆ m_failedGetSLBIDfromRxID

std::atomic<unsigned int> Muon::TgcRODReadOut::m_failedGetSLBIDfromRxID[NROD+1]
mutableprivate

The number of failures on getSLBIDfromRxID.

Definition at line 110 of file TgcRODReadOut.h.

◆ m_failedHeaderSizeRawData

std::atomic<unsigned int> Muon::TgcRODReadOut::m_failedHeaderSizeRawData[NROD+1]
mutableprivate

The number of strange header and SizeRawData.

Definition at line 104 of file TgcRODReadOut.h.

◆ m_failedSetSbLoc

std::atomic<unsigned int> Muon::TgcRODReadOut::m_failedSetSbLoc[NROD+1]
mutableprivate

The number of failures on setSbLoc.

Definition at line 106 of file TgcRODReadOut.h.

◆ m_failedSetType

std::atomic<unsigned int> Muon::TgcRODReadOut::m_failedSetType[NROD+1]
mutableprivate

The number of failures on setType.

Definition at line 108 of file TgcRODReadOut.h.

◆ m_tgcSlbDataHelper

TgcSlbDataHelper* Muon::TgcRODReadOut::m_tgcSlbDataHelper
private

TGC SLB data helper.

Definition at line 118 of file TgcRODReadOut.h.


The documentation for this class was generated from the following files:
Muon::TgcRODReadOut::FragmentIdMask
@ FragmentIdMask
Definition: TgcRODReadOut.h:71
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
Muon::TgcRODReadOut::NROD
@ NROD
Definition: TgcRODReadOut.h:96
Muon::TgcRODReadOut::m_failedGetSLBIDfromRxID
std::atomic< unsigned int > m_failedGetSLBIDfromRxID[NROD+1]
The number of failures on getSLBIDfromRxID.
Definition: TgcRODReadOut.h:110
TgcRawData::bitpos
uint16_t bitpos() const
Definition: TgcRawData.h:293
Muon::TgcRODReadOut::isMatched
static bool isMatched(const TgcRawData *rdo1, const TgcRawData *rdo2)
Compare two RDOs.
Definition: TgcRODReadOut.cxx:214
Muon::TgcSlbData::BC_PREVIOUS
@ BC_PREVIOUS
Definition: TgcSlbData.h:27
header
Definition: hcg.cxx:526
Muon::TgcRODReadOut::HeaderTrailer
@ HeaderTrailer
Definition: TgcRODReadOut.h:81
TgcRawData::isMuplus
bool isMuplus() const
Definition: TgcRawData.h:361
TgcRawData::TYPE_HIT
@ TYPE_HIT
Definition: TgcRawData.h:43
Muon::TgcRODReadOut::HeaderSLBP
@ HeaderSLBP
Definition: TgcRODReadOut.h:79
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
TgcRawData::delta
int16_t delta() const
Definition: TgcRawData.h:317
TgcRawData::hsub
uint16_t hsub() const
Definition: TgcRawData.h:349
Muon::TgcRODReadOut::m_failedDecodeRodToRdo
std::atomic< unsigned int > m_failedDecodeRodToRdo[NROD+1]
The number of failures on decodeRodToRdo.
Definition: TgcRODReadOut.h:102
Muon::TgcRODReadOut::FragmentCountMask
@ FragmentCountMask
Definition: TgcRODReadOut.h:72
Muon::TgcRODReadOut::HeaderError
@ HeaderError
Definition: TgcRODReadOut.h:75
ReadCellNoiseFromCool.cabling
cabling
Definition: ReadCellNoiseFromCool.py:154
Muon::TgcSlbDataHelper::convertToCoincidences
void convertToCoincidences(uint16_t subDetectorId, uint16_t rodId, const TgcSlbData *slb, std::vector< TgcRawData * > &vChannel) const
Convert to coincidences.
Definition: TgcSlbDataHelper.cxx:98
Muon::TgcRODReadOut::HeaderSLB10
@ HeaderSLB10
Definition: TgcRODReadOut.h:76
PlotCalibFromCool.ib
ib
Definition: PlotCalibFromCool.py:419
TgcRawData::subDetectorId
uint16_t subDetectorId() const
Definition: TgcRawData.h:264
Muon::TgcRODReadOut::m_failedSetType
std::atomic< unsigned int > m_failedSetType[NROD+1]
The number of failures on setType.
Definition: TgcRODReadOut.h:108
Muon::TgcRODReadOut::CSIDE
@ CSIDE
Definition: TgcRODReadOut.h:99
TgcRawData::isHipt
bool isHipt() const
Definition: TgcRawData.h:341
Muon::TgcRODReadOut::ROD_STATUS_SIZE
@ ROD_STATUS_SIZE
Definition: TgcRODReadOut.h:85
TgcRdo::l1Id
uint16_t l1Id() const
Definition: TgcRdo.h:150
Athena::getMessageSvc
IMessageSvc * getMessageSvc(bool quiet=false)
Definition: getMessageSvc.cxx:20
TgcRawData::rodId
uint16_t rodId() const
Definition: TgcRawData.h:268
Muon::TgcRODReadOut::setSbLoc
bool setSbLoc(uint16_t subDetectorId, uint16_t rodId, TgcSlbData *slb, int rxId) const
Set sbLoc.
Definition: TgcRODReadOut.cxx:640
TgcRawData::subMatrix
uint16_t subMatrix() const
Definition: TgcRawData.h:329
xAOD::phi
setEt phi
Definition: TrigEMCluster_v1.cxx:29
TgcRawData::isForward
bool isForward() const
Definition: TgcRawData.h:289
maskDeadModules.mod
mod
Definition: maskDeadModules.py:36
xAOD::uint16_t
setWord1 uint16_t
Definition: eFexEMRoI_v1.cxx:88
Muon::TgcRODReadOut::m_failedHeaderSizeRawData
std::atomic< unsigned int > m_failedHeaderSizeRawData[NROD+1]
The number of strange header and SizeRawData.
Definition: TgcRODReadOut.h:104
Muon::TgcRODReadOut::HeaderSLB11
@ HeaderSLB11
Definition: TgcRODReadOut.h:77
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
MuonTGC_CablingSvc::getSLBIDfromRxID
bool getSLBIDfromRxID(int &phi, bool &isAside, bool &isEndcap, int &moduleType, int &id, const int subsectorID, const int rodID, const int sswID, const int rxId) const
Definition: MuonTGC_CablingSvc.cxx:1178
Muon::TgcRODReadOut::HeaderSLBN
@ HeaderSLBN
Definition: TgcRODReadOut.h:80
TgcRawData::TYPE_SL
@ TYPE_SL
Definition: TgcRawData.h:46
TgcRawData::sector
uint16_t sector() const
Definition: TgcRawData.h:333
Muon::TgcRODReadOut::HeaderEvent
@ HeaderEvent
Definition: TgcRODReadOut.h:74
TgcRawData::sswId
uint16_t sswId() const
Definition: TgcRawData.h:272
TgcRawData::isStrip
bool isStrip() const
Definition: TgcRawData.h:353
Muon::TgcRODReadOut::ROD_HEADER_SIZE
@ ROD_HEADER_SIZE
Definition: TgcRODReadOut.h:84
TgcRdo::bcId
uint16_t bcId() const
Definition: TgcRdo.h:146
TgcRawData::position
uint16_t position() const
Definition: TgcRawData.h:313
grepfile.ic
int ic
Definition: grepfile.py:33
TgcRawData::hitId
uint16_t hitId() const
Definition: TgcRawData.h:345
TgcRawData::threshold
uint16_t threshold() const
Definition: TgcRawData.h:365
bcId
uint16_t bcId(uint32_t data)
Definition: TgcByteStreamData.h:326
TgcRawData::segment
uint16_t segment() const
Definition: TgcRawData.h:325
TgcRawData::chip
uint16_t chip() const
Definition: TgcRawData.h:337
TgcRawData::roi
uint16_t roi() const
Definition: TgcRawData.h:377
TgcRawData::isAdjacent
bool isAdjacent() const
Definition: TgcRawData.h:305
DataVector::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
python.ElectronD3PDObject.matched
matched
Definition: ElectronD3PDObject.py:138
Muon::TgcSlbData::BC_NEXT
@ BC_NEXT
Definition: TgcSlbData.h:29
TgcRdo::setOnlineId
void setOnlineId(uint16_t subDetectorId, uint16_t rodId)
Definition: TgcRdo.cxx:35
Muon::TgcRODReadOut::ASIDE
@ ASIDE
Definition: TgcRODReadOut.h:98
Muon::TgcRODReadOut::decodeRodToRdo
StatusCode decodeRodToRdo(TgcRdo &tgcRdo, const ByteStream &vData, uint16_t subDetectorId, uint16_t rodId, uint32_t l1Id, uint16_t bcId) const
Decode BS to RDO container.
Definition: TgcRODReadOut.cxx:269
MuonTGC_CablingSvc::getSLBAddressfromReadoutID
bool getSLBAddressfromReadoutID(int &slbAddr, const int subsectorID, const int rodID, const int sswID, const int sbLoc) const
Definition: MuonTGC_CablingSvc.cxx:1116
Muon::TgcSlbDataHelper::convertToHits
void convertToHits(uint16_t subDetectorId, uint16_t rodId, const TgcSlbData *slb, std::vector< TgcRawData * > &vChannel) const
Convert to Hits.
Definition: TgcSlbDataHelper.cxx:30
TgcRawData::bcTag
uint16_t bcTag() const
Definition: TgcRawData.h:251
Muon::TgcRODReadOut::HeaderMask
@ HeaderMask
Definition: TgcRODReadOut.h:73
TgcRawData::slbId
uint16_t slbId() const
Definition: TgcRawData.h:276
Muon::TgcRODReadOut::m_failedSetSbLoc
std::atomic< unsigned int > m_failedSetSbLoc[NROD+1]
The number of failures on setSbLoc.
Definition: TgcRODReadOut.h:106
TgcRawData::index
uint16_t index() const
Definition: TgcRawData.h:309
Muon::TgcSlbData::BC_CENTRAL
@ BC_CENTRAL
Definition: TgcSlbData.h:28
TgcRawData::TYPE_HIPT
@ TYPE_HIPT
Definition: TgcRawData.h:45
TgcRawData
An unit object of TGC ROD output.
Definition: TgcRawData.h:23
DEBUG
#define DEBUG
Definition: page_access.h:11
bcTag
unsigned bcTag(unsigned bcBitMap)
Definition: TgcByteStreamData.h:359
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
Muon::TgcRODReadOut::m_tgcSlbDataHelper
TgcSlbDataHelper * m_tgcSlbDataHelper
TGC SLB data helper.
Definition: TgcRODReadOut.h:118
TgcRawData::type
DataType type() const
Definition: TgcRawData.h:280
Muon::TgcSlbDataHelper::setType
static bool setType(uint16_t subDetectorId, uint16_t rodId, TgcSlbData *slb, int moduleType)
Set SLB Type based on sswId and moduleType.
Definition: TgcSlbDataHelper.cxx:471
TgcRdo
Definition: TgcRdo.h:22
Muon::TgcRODReadOut::NSROD
@ NSROD
Definition: TgcRODReadOut.h:97
Muon::TgcRODReadOut::ROD_START
@ ROD_START
Definition: TgcRODReadOut.h:83
TgcRawData::TYPE_TRACKLET
@ TYPE_TRACKLET
Definition: TgcRawData.h:44
test_pyathena.counter
counter
Definition: test_pyathena.py:15
MuonTGC_CablingSvc::getReadoutIDfromSLBID
bool getReadoutIDfromSLBID(const int phi, const bool isAside, const bool isEndcap, const int moduleType, const int id, int &subsectorID, int &rodID, int &sswID, int &sbLoc) const
Definition: MuonTGC_CablingSvc.cxx:1224
Muon::TgcRODReadOut::HeaderSLBC
@ HeaderSLBC
Definition: TgcRODReadOut.h:78
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
Muon::TgcRODReadOut::check
StatusCode check(const ByteStream &bs, TgcRdo &tgcRdo, uint32_t source_id) const
Convert BS (ROB fragment) to RDO and compare decoded RDO container and another RDO container decoded ...
Definition: TgcRODReadOut.cxx:105
Muon::TgcRODReadOut::m_failedGetReadoutIDfromSLBID
std::atomic< unsigned int > m_failedGetReadoutIDfromSLBID[NROD+1]
The number of failures on getReadoutIDfromSLBID.
Definition: TgcRODReadOut.h:112
Muon::TgcRODReadOut::compare
StatusCode compare(TgcRdo *rdo, TgcRdo *newRdo) const
Compare two RDO containers.
Definition: TgcRODReadOut.cxx:145
Muon::TgcRODReadOut::m_cabling
const MuonTGC_CablingSvc & m_cabling
TGC Cabling Svc.
Definition: TgcRODReadOut.h:115
Muon::TgcRODReadOut::RawDataFragMask
@ RawDataFragMask
Definition: TgcRODReadOut.h:70