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

◆ DetErrors

Definition at line 22 of file RPixErrorChecker.h.

◆ Errors

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

Definition at line 23 of file RPixErrorChecker.h.

◆ Word32

typedef uint32_t RPixErrorChecker::Word32

Definition at line 19 of file RPixErrorChecker.h.

◆ Word64

typedef uint64_t RPixErrorChecker::Word64

Definition at line 20 of file RPixErrorChecker.h.

Constructor & Destructor Documentation

◆ RPixErrorChecker()

RPixErrorChecker::RPixErrorChecker ( )

Definition at line 12 of file RPixErrorChecker.cc.

12 { includeErrors_ = false; }

Member Function Documentation

◆ checkCRC()

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

Definition at line 16 of file RPixErrorChecker.cc.

16  {
17  int CRC_BIT = (*trailer >> CRC_shift) & CRC_mask;
18  if (CRC_BIT == 0)
19  return true;
20  errorsInEvent = true;
21  LogDebug("CRCCheck") << "CRC check failed, errorType = 39";
22  if (includeErrors_) {
23  int errorType = 39;
24  CTPPSPixelDataError error(*trailer, errorType, fedId);
25  errors[dummyDetId].push_back(error);
26  }
27  return false;
28 }

References relativeConstraints::error, l1tstage2_dqm_sourceclient-live_cfg::fedId, and LogDebug.

Referenced by CTPPSPixelDataFormatter::interpretRawData().

◆ checkHeader()

bool RPixErrorChecker::checkHeader ( bool &  errorsInEvent,
int  fedId,
const Word64 header,
Errors errors 
) const

Definition at line 30 of file RPixErrorChecker.cc.

30  {
31  FEDHeader fedHeader(reinterpret_cast<const unsigned char*>(header));
32  if (!fedHeader.check())
33  return false;
34  if (fedHeader.sourceID() != fedId) {
35  LogDebug("CTPPSPixelDataFormatter::interpretRawData, fedHeader.sourceID() != fedId")
36  << ", sourceID = " << fedHeader.sourceID() << ", fedId = " << fedId << ", errorType = 32";
37  errorsInEvent = true;
38  if (includeErrors_) {
39  int errorType = 32;
40  CTPPSPixelDataError error(*header, errorType, fedId);
41  errors[dummyDetId].push_back(error);
42  }
43  }
44  return fedHeader.moreHeaders();
45 }

References FEDHeader::check(), relativeConstraints::error, l1tstage2_dqm_sourceclient-live_cfg::fedId, RecoTauValidation_cfi::header, LogDebug, FEDHeader::moreHeaders(), and FEDHeader::sourceID().

Referenced by CTPPSPixelDataFormatter::interpretRawData().

◆ checkROC()

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 72 of file RPixErrorChecker.cc.

73  {
74  int errorType = (errorWord >> ROC_shift) & ERROR_mask;
75  if
76  LIKELY(errorType < 25) return true;
77 
78  switch (errorType) {
79  case (25): {
80  LogDebug("") << " invalid ROC=25 found (errorType=25)";
81  errorsInEvent = true;
82  break;
83  }
84  case (26): {
85  LogDebug("") << " gap word found (errorType=26)";
86  return false;
87  }
88  case (27): {
89  LogDebug("") << " dummy word found (errorType=27)";
90  return false;
91  }
92  case (28): {
93  LogDebug("") << " error fifo nearly full (errorType=28)";
94  errorsInEvent = true;
95  break;
96  }
97  case (29): {
98  LogDebug("") << " timeout on a channel (errorType=29)";
99  errorsInEvent = true;
100  if ((errorWord >> OMIT_ERR_shift) & OMIT_ERR_mask) {
101  LogDebug("") << " ...first errorType=29 error, this gets masked out";
102  return false;
103  }
104  break;
105  }
106  case (30): {
107  LogDebug("") << " TBM error trailer (errorType=30)";
108  errorsInEvent = true;
109  break;
110  }
111  case (31): {
112  LogDebug("") << " event number error (errorType=31)";
113  errorsInEvent = true;
114  break;
115  }
116  default:
117  return true;
118  };
119 
120  if (includeErrors_) {
122  if (errorType == 30) {
123  uint32_t stateMach_bits = 4;
124  uint32_t stateMach_shift = 8;
125  uint32_t stateMach_mask = ~(~uint32_t(0) << stateMach_bits);
126  uint32_t stateMach = (errorWord >> stateMach_shift) & stateMach_mask;
127  if (stateMach == 4 || stateMach == 9)
128  errorType = 40;
129  }
130 
132  CTPPSPixelDataError error(errorWord, errorType, fedId);
133 
134  errors[iD].push_back(error);
135  }
136 
137  return false;
138 }

References relativeConstraints::error, l1tstage2_dqm_sourceclient-live_cfg::fedId, LIKELY, and LogDebug.

Referenced by CTPPSPixelDataFormatter::interpretRawData().

◆ checkTrailer()

bool RPixErrorChecker::checkTrailer ( bool &  errorsInEvent,
int  fedId,
unsigned int  nWords,
const Word64 trailer,
Errors errors 
) const

Definition at line 47 of file RPixErrorChecker.cc.

48  {
49  FEDTrailer fedTrailer(reinterpret_cast<const unsigned char*>(trailer));
50  if (!fedTrailer.check()) {
51  if (includeErrors_) {
52  int errorType = 33;
53  CTPPSPixelDataError error(*trailer, errorType, fedId);
54  errors[dummyDetId].push_back(error);
55  }
56  errorsInEvent = true;
57  LogDebug("FedTrailerCheck") << "fedTrailer.check failed, Fed: " << fedId << ", errorType = 33";
58  return false;
59  }
60  if (fedTrailer.fragmentLength() != nWords) {
61  LogDebug("FedTrailerLenght") << "fedTrailer.fragmentLength()!= nWords !! Fed: " << fedId << ", errorType = 34";
62  errorsInEvent = true;
63  if (includeErrors_) {
64  int errorType = 34;
65  CTPPSPixelDataError error(*trailer, errorType, fedId);
66  errors[dummyDetId].push_back(error);
67  }
68  }
69  return fedTrailer.moreTrailers();
70 }

References FEDTrailer::check(), relativeConstraints::error, l1tstage2_dqm_sourceclient-live_cfg::fedId, FEDTrailer::fragmentLength(), LogDebug, and FEDTrailer::moreTrailers().

Referenced by CTPPSPixelDataFormatter::interpretRawData().

◆ conversionError()

void RPixErrorChecker::conversionError ( int  fedId,
uint32_t  iD,
const State state,
const Word32 errorWord,
Errors errors 
) const

Definition at line 140 of file RPixErrorChecker.cc.

141  {
142  int errorType = 0;
143 
144  switch (state) {
145  case (InvalidLinkId): {
146  LogDebug("ErrorChecker::conversionError") << " Fed: " << fedId << " invalid channel Id (errorType=35)";
147  errorType = 35;
148  break;
149  }
150  case (InvalidROCId): {
151  LogDebug("ErrorChecker::conversionError") << " Fed: " << fedId << " invalid ROC Id (errorType=36)";
152  errorType = 36;
153  break;
154  }
155  case (InvalidPixelId): {
156  LogDebug("ErrorChecker::conversionError") << " Fed: " << fedId << " invalid dcol/pixel value (errorType=37)";
157  errorType = 37;
158  break;
159  }
160 
161  default:
162  LogDebug("ErrorChecker::conversionError") << " cabling check returned unexpected result, status = " << state;
163  };
164 
165  if (includeErrors_ && errorType > 0) {
166  CTPPSPixelDataError error(errorWord, errorType, fedId);
167  errors[iD].push_back(error);
168  }
169 }

References relativeConstraints::error, l1tstage2_dqm_sourceclient-live_cfg::fedId, InvalidLinkId, InvalidPixelId, InvalidROCId, and LogDebug.

Referenced by CTPPSPixelDataFormatter::interpretRawData().

◆ setErrorStatus()

void RPixErrorChecker::setErrorStatus ( bool  errorStatus)

Definition at line 14 of file RPixErrorChecker.cc.

14 { includeErrors_ = errorStatus; }

Referenced by CTPPSPixelDataFormatter::setErrorStatus().

Member Data Documentation

◆ ADC_bits

constexpr int RPixErrorChecker::ADC_bits = 8
staticconstexpr

Definition at line 29 of file RPixErrorChecker.h.

◆ ADC_shift

constexpr int RPixErrorChecker::ADC_shift = 0
staticconstexpr

Definition at line 33 of file RPixErrorChecker.h.

◆ CRC_bits

constexpr int RPixErrorChecker::CRC_bits = 1
staticconstexpr

Definition at line 25 of file RPixErrorChecker.h.

◆ CRC_mask

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

Definition at line 41 of file RPixErrorChecker.h.

◆ CRC_shift

constexpr int RPixErrorChecker::CRC_shift = 2
staticconstexpr

Definition at line 32 of file RPixErrorChecker.h.

◆ DCOL_bits

constexpr int RPixErrorChecker::DCOL_bits = 5
staticconstexpr

Definition at line 27 of file RPixErrorChecker.h.

◆ DCOL_shift

constexpr int RPixErrorChecker::DCOL_shift = PXID_shift + PXID_bits
staticconstexpr

Definition at line 35 of file RPixErrorChecker.h.

◆ dummyDetId

constexpr RPixErrorChecker::Word32 RPixErrorChecker::dummyDetId = 0xffffffff
staticconstexpr

◆ ERROR_mask

constexpr Word32 RPixErrorChecker::ERROR_mask = ~(~RPixErrorChecker::Word32(0) << ROC_bits)
staticconstexpr

Definition at line 42 of file RPixErrorChecker.h.

◆ includeErrors_

bool RPixErrorChecker::includeErrors_
private

Definition at line 61 of file RPixErrorChecker.h.

◆ OMIT_ERR_bits

constexpr int RPixErrorChecker::OMIT_ERR_bits = 1
staticconstexpr

Definition at line 30 of file RPixErrorChecker.h.

◆ OMIT_ERR_mask

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

Definition at line 43 of file RPixErrorChecker.h.

◆ OMIT_ERR_shift

constexpr int RPixErrorChecker::OMIT_ERR_shift = 20
staticconstexpr

Definition at line 37 of file RPixErrorChecker.h.

◆ PXID_bits

constexpr int RPixErrorChecker::PXID_bits = 8
staticconstexpr

Definition at line 28 of file RPixErrorChecker.h.

◆ PXID_shift

constexpr int RPixErrorChecker::PXID_shift = ADC_shift + ADC_bits
staticconstexpr

Definition at line 34 of file RPixErrorChecker.h.

◆ ROC_bits

constexpr int RPixErrorChecker::ROC_bits = 5
staticconstexpr

Definition at line 26 of file RPixErrorChecker.h.

◆ ROC_shift

constexpr int RPixErrorChecker::ROC_shift = DCOL_shift + DCOL_bits
staticconstexpr

Definition at line 36 of file RPixErrorChecker.h.

RPixErrorChecker::dummyDetId
static constexpr Word32 dummyDetId
Definition: RPixErrorChecker.h:39
RPixErrorChecker::includeErrors_
bool includeErrors_
Definition: RPixErrorChecker.h:61
mathSSE::return
return((rh ^ lh) &mask)
relativeConstraints.error
error
Definition: relativeConstraints.py:53
RPixErrorChecker::ROC_shift
static constexpr int ROC_shift
Definition: RPixErrorChecker.h:36
Phase2TrackerMonitorDigi_cff.switch
switch
Definition: Phase2TrackerMonitorDigi_cff.py:13
errors
Definition: errors.py:1
InvalidPixelId
Definition: RPixErrorChecker.h:15
InvalidLinkId
Definition: RPixErrorChecker.h:15
RPixErrorChecker::CRC_shift
static constexpr int CRC_shift
Definition: RPixErrorChecker.h:32
RPixErrorChecker::ERROR_mask
static constexpr Word32 ERROR_mask
Definition: RPixErrorChecker.h:42
RPixErrorChecker::CRC_mask
static constexpr Word64 CRC_mask
Definition: RPixErrorChecker.h:41
funct::true
true
Definition: Factorize.h:173
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:223
FEDTrailer
Definition: FEDTrailer.h:14
InvalidROCId
Definition: RPixErrorChecker.h:15
RPixErrorChecker::OMIT_ERR_shift
static constexpr int OMIT_ERR_shift
Definition: RPixErrorChecker.h:37
l1tstage2_dqm_sourceclient-live_cfg.fedId
fedId
Definition: l1tstage2_dqm_sourceclient-live_cfg.py:88
RunInfoPI::state
state
Definition: RunInfoPayloadInspectoHelper.h:16
LIKELY
#define LIKELY(x)
Definition: Likely.h:20
RPixErrorChecker::OMIT_ERR_mask
static constexpr Word32 OMIT_ERR_mask
Definition: RPixErrorChecker.h:43
RecoTauValidation_cfi.header
header
Definition: RecoTauValidation_cfi.py:292
CTPPSPixelDataError
Pixel error – collection of errors.
Definition: CTPPSPixelDataError.h:17
FEDHeader
Definition: FEDHeader.h:14