CMS 3D CMS Logo

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

#include <RPixErrorChecker.h>

Public Types

typedef std::vector< CTPPSPixelDataErrorDetErrors
 
typedef std::map< uint32_t, DetErrorsErrors
 
typedef uint32_t Word32
 
typedef uint64_t Word64
 

Public Member Functions

bool checkCRC (bool &errorsInEvent, int fedId, const Word64 *trailer, Errors &errors) const
 
bool checkHeader (bool &errorsInEvent, int fedId, const Word64 *header, Errors &errors) const
 
bool checkROC (bool &errorsInEvent, int fedId, uint32_t iD, const Word32 &errorWord, Errors &errors) const
 
bool checkTrailer (bool &errorsInEvent, int fedId, unsigned int nWords, const Word64 *trailer, Errors &errors) const
 
void conversionError (int fedId, uint32_t iD, const State &state, const Word32 &errorWord, Errors &errors) const
 
 RPixErrorChecker ()
 
void setErrorStatus (bool errorStatus)
 

Static Public Attributes

static constexpr int ADC_bits = 8
 
static constexpr int ADC_shift = 0
 
static constexpr int CRC_bits = 1
 
static constexpr Word64 CRC_mask = ~(~RPixErrorChecker::Word64(0) << CRC_bits)
 
static constexpr int CRC_shift = 2
 
static constexpr int DCOL_bits = 5
 
static constexpr int DCOL_shift = PXID_shift + PXID_bits
 
static constexpr Word32 dummyDetId = 0xffffffff
 
static constexpr Word32 ERROR_mask = ~(~RPixErrorChecker::Word32(0) << ROC_bits)
 
static constexpr int OMIT_ERR_bits = 1
 
static constexpr Word32 OMIT_ERR_mask = ~(~RPixErrorChecker::Word32(0) << OMIT_ERR_bits)
 
static constexpr int OMIT_ERR_shift = 20
 
static constexpr int PXID_bits = 8
 
static constexpr int PXID_shift = ADC_shift + ADC_bits
 
static constexpr int ROC_bits = 5
 
static constexpr int ROC_shift = DCOL_shift + DCOL_bits
 

Private Attributes

bool includeErrors_
 

Detailed Description

RPix == CTPPS Pixel detector (Roman Pot Pixels)

Definition at line 17 of file RPixErrorChecker.h.

Member Typedef Documentation

Definition at line 24 of file RPixErrorChecker.h.

typedef std::map<uint32_t, DetErrors> RPixErrorChecker::Errors

Definition at line 25 of file RPixErrorChecker.h.

typedef uint32_t RPixErrorChecker::Word32

Definition at line 21 of file RPixErrorChecker.h.

typedef uint64_t RPixErrorChecker::Word64

Definition at line 22 of file RPixErrorChecker.h.

Constructor & Destructor Documentation

RPixErrorChecker::RPixErrorChecker ( )

Definition at line 12 of file RPixErrorChecker.cc.

13 {
14  includeErrors_ = false;
15 }

Member Function Documentation

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

Definition at line 22 of file RPixErrorChecker.cc.

References relativeConstraints::error, and LogDebug.

Referenced by CTPPSPixelDataFormatter::interpretRawData().

23 {
24  int CRC_BIT = (*trailer >> CRC_shift) & CRC_mask;
25  if (CRC_BIT == 0) return true;
26  errorsInEvent = true;
27  LogDebug("CRCCheck")
28  <<"CRC check failed, errorType = 39";
29  if (includeErrors_) {
30  int errorType = 39;
31  CTPPSPixelDataError error(*trailer, errorType, fedId);
32  errors[dummyDetId].push_back(error);
33  }
34  return false;
35 }
#define LogDebug(id)
static constexpr int CRC_shift
static constexpr Word32 dummyDetId
Definition: errors.py:1
static constexpr Word64 CRC_mask
Pixel error – collection of errors.
bool RPixErrorChecker::checkHeader ( bool &  errorsInEvent,
int  fedId,
const Word64 header,
Errors errors 
) const

Definition at line 37 of file RPixErrorChecker.cc.

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

Referenced by CTPPSPixelDataFormatter::interpretRawData().

38 {
39  FEDHeader fedHeader( reinterpret_cast<const unsigned char*>(header));
40  if ( !fedHeader.check() ) return false;
41  if ( fedHeader.sourceID() != fedId) {
42  LogDebug("CTPPSPixelDataFormatter::interpretRawData, fedHeader.sourceID() != fedId")
43  <<", sourceID = " <<fedHeader.sourceID()
44  <<", fedId = "<<fedId<<", errorType = 32";
45  errorsInEvent = true;
46  if (includeErrors_) {
47  int errorType = 32;
48  CTPPSPixelDataError error(*header, errorType, fedId);
49  errors[dummyDetId].push_back(error);
50  }
51  }
52  return fedHeader.moreHeaders();
53 }
#define LogDebug(id)
static constexpr Word32 dummyDetId
Definition: errors.py:1
Pixel error – collection of errors.
bool RPixErrorChecker::checkROC ( bool &  errorsInEvent,
int  fedId,
uint32_t  iD,
const Word32 errorWord,
Errors errors 
) const

check to see if overflow error for type 30, change type to 40 if so

store error

Definition at line 81 of file RPixErrorChecker.cc.

References relativeConstraints::error, 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  if(includeErrors_) {
129  if(errorType==30) {
130  uint32_t stateMach_bits = 4;
131  uint32_t stateMach_shift = 8;
132  uint32_t stateMach_mask = ~(~uint32_t(0) << stateMach_bits);
133  uint32_t stateMach = (errorWord >> stateMach_shift) & stateMach_mask;
134  if( stateMach==4 || stateMach==9 ) errorType = 40;
135  }
136 
138  CTPPSPixelDataError error(errorWord, errorType, fedId);
139 
140  errors[iD].push_back(error);
141 }
142 
143  return false;
144 }
#define LogDebug(id)
static constexpr int OMIT_ERR_shift
static constexpr Word32 OMIT_ERR_mask
return((rh^lh)&mask)
#define LIKELY(x)
static constexpr Word32 ERROR_mask
Definition: errors.py:1
static constexpr int ROC_shift
Pixel error – collection of errors.
bool RPixErrorChecker::checkTrailer ( bool &  errorsInEvent,
int  fedId,
unsigned int  nWords,
const Word64 trailer,
Errors errors 
) const

Definition at line 55 of file RPixErrorChecker.cc.

References FEDTrailer::check(), relativeConstraints::error, FEDTrailer::fragmentLength(), LogDebug, and FEDTrailer::moreTrailers().

Referenced by CTPPSPixelDataFormatter::interpretRawData().

56 {
57  FEDTrailer fedTrailer(reinterpret_cast<const unsigned char*>(trailer));
58  if ( !fedTrailer.check()) {
59  if(includeErrors_) {
60  int errorType = 33;
61  CTPPSPixelDataError error(*trailer, errorType, fedId);
62  errors[dummyDetId].push_back(error);
63  }
64  errorsInEvent = true;
65  LogDebug("FedTrailerCheck")
66  <<"fedTrailer.check failed, Fed: " << fedId << ", errorType = 33";
67  return false;
68  }
69  if ( fedTrailer.fragmentLength()!= nWords) {
70  LogDebug("FedTrailerLenght")<< "fedTrailer.fragmentLength()!= nWords !! Fed: " << fedId << ", errorType = 34";
71  errorsInEvent = true;
72  if(includeErrors_) {
73  int errorType = 34;
74  CTPPSPixelDataError error(*trailer, errorType, fedId);
75  errors[dummyDetId].push_back(error);
76  }
77  }
78  return fedTrailer.moreTrailers();
79 }
#define LogDebug(id)
static constexpr Word32 dummyDetId
Definition: errors.py:1
Pixel error – collection of errors.
void RPixErrorChecker::conversionError ( int  fedId,
uint32_t  iD,
const State state,
const Word32 errorWord,
Errors errors 
) const

Definition at line 146 of file RPixErrorChecker.cc.

References relativeConstraints::error, InvalidLinkId, InvalidPixelId, InvalidROCId, and LogDebug.

Referenced by CTPPSPixelDataFormatter::interpretRawData().

147 {
148  int errorType = 0;
149 
150  switch (state) {
151  case(InvalidLinkId) : {
152  LogDebug("ErrorChecker::conversionError") << " Fed: " << fedId << " invalid channel Id (errorType=35)";
153  errorType = 35;
154  break;
155  }
156  case(InvalidROCId) : {
157  LogDebug("ErrorChecker::conversionError")<< " Fed: " << fedId << " invalid ROC Id (errorType=36)";
158  errorType = 36;
159  break;
160  }
161  case(InvalidPixelId) : {
162  LogDebug("ErrorChecker::conversionError")<< " Fed: " << fedId << " invalid dcol/pixel value (errorType=37)";
163  errorType = 37;
164  break;
165  }
166 
167  default: LogDebug("ErrorChecker::conversionError")<<" cabling check returned unexpected result, status = "<< state;
168  };
169 
170  if(includeErrors_ && errorType>0){
171  CTPPSPixelDataError error(errorWord, errorType, fedId);
172  errors[iD].push_back(error);
173  }
174 }
#define LogDebug(id)
Definition: errors.py:1
Pixel error – collection of errors.
void RPixErrorChecker::setErrorStatus ( bool  errorStatus)

Definition at line 17 of file RPixErrorChecker.cc.

Referenced by CTPPSPixelDataFormatter::setErrorStatus().

18 {
19  includeErrors_ = errorStatus;
20 }

Member Data Documentation

constexpr int RPixErrorChecker::ADC_bits = 8
static

Definition at line 31 of file RPixErrorChecker.h.

constexpr int RPixErrorChecker::ADC_shift = 0
static

Definition at line 35 of file RPixErrorChecker.h.

constexpr int RPixErrorChecker::CRC_bits = 1
static

Definition at line 27 of file RPixErrorChecker.h.

constexpr Word64 RPixErrorChecker::CRC_mask = ~(~RPixErrorChecker::Word64(0) << CRC_bits)
static

Definition at line 43 of file RPixErrorChecker.h.

constexpr int RPixErrorChecker::CRC_shift = 2
static

Definition at line 34 of file RPixErrorChecker.h.

constexpr int RPixErrorChecker::DCOL_bits = 5
static

Definition at line 29 of file RPixErrorChecker.h.

constexpr int RPixErrorChecker::DCOL_shift = PXID_shift + PXID_bits
static

Definition at line 37 of file RPixErrorChecker.h.

RPixErrorChecker::Word32 RPixErrorChecker::dummyDetId = 0xffffffff
static
constexpr Word32 RPixErrorChecker::ERROR_mask = ~(~RPixErrorChecker::Word32(0) << ROC_bits)
static

Definition at line 44 of file RPixErrorChecker.h.

bool RPixErrorChecker::includeErrors_
private

Definition at line 66 of file RPixErrorChecker.h.

constexpr int RPixErrorChecker::OMIT_ERR_bits = 1
static

Definition at line 32 of file RPixErrorChecker.h.

constexpr Word32 RPixErrorChecker::OMIT_ERR_mask = ~(~RPixErrorChecker::Word32(0) << OMIT_ERR_bits)
static

Definition at line 45 of file RPixErrorChecker.h.

constexpr int RPixErrorChecker::OMIT_ERR_shift = 20
static

Definition at line 39 of file RPixErrorChecker.h.

constexpr int RPixErrorChecker::PXID_bits = 8
static

Definition at line 30 of file RPixErrorChecker.h.

constexpr int RPixErrorChecker::PXID_shift = ADC_shift + ADC_bits
static

Definition at line 36 of file RPixErrorChecker.h.

constexpr int RPixErrorChecker::ROC_bits = 5
static

Definition at line 28 of file RPixErrorChecker.h.

constexpr int RPixErrorChecker::ROC_shift = DCOL_shift + DCOL_bits
static

Definition at line 38 of file RPixErrorChecker.h.