CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions
RPixErrorChecker Class Reference

#include <RPixErrorChecker.h>

Public Types

typedef uint32_t Word32
 
typedef uint64_t Word64
 

Public Member Functions

bool checkCRC (bool &errorsInEvent, int fedId, const Word64 *trailer) const
 
bool checkHeader (bool &errorsInEvent, int fedId, const Word64 *header) const
 
bool checkROC (bool &errorsInEvent, int fedId, Word32 &errorWord) const
 
bool checkTrailer (bool &errorsInEvent, int fedId, int nWords, const Word64 *trailer) const
 
 RPixErrorChecker ()
 

Detailed Description

RPix == CTPPS Pixel detector (Roman Pot Pixels)

Definition at line 15 of file RPixErrorChecker.h.

Member Typedef Documentation

typedef uint32_t RPixErrorChecker::Word32

Definition at line 19 of file RPixErrorChecker.h.

typedef uint64_t RPixErrorChecker::Word64

Definition at line 20 of file RPixErrorChecker.h.

Constructor & Destructor Documentation

RPixErrorChecker::RPixErrorChecker ( )

Definition at line 35 of file RPixErrorChecker.cc.

35  {
36 
37 }

Member Function Documentation

bool RPixErrorChecker::checkCRC ( bool &  errorsInEvent,
int  fedId,
const Word64 trailer 
) const

Definition at line 39 of file RPixErrorChecker.cc.

Referenced by CTPPSPixelDataFormatter::interpretRawData().

40 {
41  int CRC_BIT = (*trailer >> CRC_shift) & CRC_mask;
42  if (CRC_BIT == 0) return true;
43  errorsInEvent = true;
44  LogError("CRCCheck")
45  <<"CRC check failed, errorType = 39";
46  return false;
47 }
bool RPixErrorChecker::checkHeader ( bool &  errorsInEvent,
int  fedId,
const Word64 header 
) const

Definition at line 49 of file RPixErrorChecker.cc.

References FEDHeader::check(), l1t::stage2::layer2::fedId, FEDHeader::moreHeaders(), and FEDHeader::sourceID().

Referenced by CTPPSPixelDataFormatter::interpretRawData().

50 {
51  FEDHeader fedHeader( reinterpret_cast<const unsigned char*>(header));
52  if ( !fedHeader.check() ) return false; // throw exception?
53  if ( fedHeader.sourceID() != fedId) {
54  LogError("CTPPSPixelDataFormatter::interpretRawData, fedHeader.sourceID() != fedId")
55  <<", sourceID = " <<fedHeader.sourceID()
56  <<", fedId = "<<fedId<<", errorType = 32";
57  errorsInEvent = true;
58 
59  }
60  return fedHeader.moreHeaders();
61 }
bool RPixErrorChecker::checkROC ( bool &  errorsInEvent,
int  fedId,
Word32 errorWord 
) const

Definition at line 81 of file RPixErrorChecker.cc.

References likely, and LogDebug.

Referenced by CTPPSPixelDataFormatter::interpretRawData().

82 {
83  int errorType = (errorWord >> ROC_shift) & ERROR_mask;
84  if likely(errorType<25) return true;
85 
86  switch (errorType) {
87  case(25) : {
88  LogDebug("")<<" invalid ROC=25 found (errorType=25)";
89  errorsInEvent = true;
90  break;
91  }
92  case(26) : {
93  //LogDebug("")<<" gap word found (errorType=26)";
94  return false;
95  }
96  case(27) : {
97  //LogDebug("")<<" dummy word found (errorType=27)";
98  return false;
99  }
100  case(28) : {
101  LogDebug("")<<" error fifo nearly full (errorType=28)";
102  errorsInEvent = true;
103  break;
104  }
105  case(29) : {
106  LogDebug("")<<" timeout on a channel (errorType=29)";
107  errorsInEvent = true;
108  if ((errorWord >> OMIT_ERR_shift) & OMIT_ERR_mask) {
109  LogDebug("")<<" ...first errorType=29 error, this gets masked out";
110  return false;
111  }
112  break;
113  }
114  case(30) : {
115  LogDebug("")<<" TBM error trailer (errorType=30)";
116  errorsInEvent = true;
117  break;
118  }
119  case(31) : {
120  LogDebug("")<<" event number error (errorType=31)";
121  errorsInEvent = true;
122  break;
123  }
124  default: return true;
125  };
126 
127  return false;
128 }
#define LogDebug(id)
#define likely(x)
return(e1-e2)*(e1-e2)+dp *dp
bool RPixErrorChecker::checkTrailer ( bool &  errorsInEvent,
int  fedId,
int  nWords,
const Word64 trailer 
) const

Definition at line 63 of file RPixErrorChecker.cc.

References FEDTrailer::check(), FEDTrailer::lenght(), and FEDTrailer::moreTrailers().

Referenced by CTPPSPixelDataFormatter::interpretRawData().

64 {
65  FEDTrailer fedTrailer(reinterpret_cast<const unsigned char*>(trailer));
66  if ( !fedTrailer.check()) {
67 
68  errorsInEvent = true;
69  LogError("FedTrailerCheck")
70  <<"fedTrailer.check failed, Fed: " << fedId << ", errorType = 33";
71  return false;
72  }
73  if ( fedTrailer.lenght()!= nWords) {
74  LogError("FedTrailerLenght")<< "fedTrailer.lenght()!= nWords !! Fed: " << fedId << ", errorType = 34";
75  errorsInEvent = true;
76 
77  }
78  return fedTrailer.moreTrailers();
79 }