CMS 3D CMS Logo

Classes | Functions
ALPAKA_ACCELERATOR_NAMESPACE::pixelDetails Namespace Reference

Classes

struct  FillHitsModuleStart
 
struct  RawToDigi_kernel
 
class  SiPixelRawToClusterKernel
 
class  WordFedAppender
 

Functions

template<bool debug = false>
ALPAKA_FN_ACC uint8_t checkROC (uint32_t errorWord, uint8_t fedId, uint32_t link, const SiPixelMappingSoAConstView &cablingMap)
 
template<bool debug = false>
ALPAKA_FN_ACC uint8_t conversionError (uint8_t fedId, uint8_t status)
 
ALPAKA_FN_ACC bool dcolIsValid (uint32_t dcol, uint32_t pxid)
 
ALPAKA_FN_ACC ::pixelDetails::Pixel frameConversion (bool bpix, int side, uint32_t layer, uint32_t rocIdInDetUnit, ::pixelDetails::Pixel local)
 
template<bool debug = false>
ALPAKA_FN_ACC uint32_t getErrRawID (uint8_t fedId, uint32_t errWord, uint32_t errorType, const SiPixelMappingSoAConstView &cablingMap)
 
ALPAKA_FN_ACC ::pixelDetails::DetIdGPU getRawId (const SiPixelMappingSoAConstView &cablingMap, uint8_t fed, uint32_t link, uint32_t roc)
 
ALPAKA_FN_ACC bool isBarrel (uint32_t rawId)
 
ALPAKA_FN_ACC bool rocRowColIsValid (uint32_t rocRow, uint32_t rocCol)
 

Function Documentation

◆ checkROC()

template<bool debug = false>
ALPAKA_FN_ACC uint8_t ALPAKA_ACCELERATOR_NAMESPACE::pixelDetails::checkROC ( uint32_t  errorWord,
uint8_t  fedId,
uint32_t  link,
const SiPixelMappingSoAConstView cablingMap 
)

Definition at line 176 of file SiPixelRawToClusterKernel.dev.cc.

References ALPAKA_ACCELERATOR_NAMESPACE::brokenline::constexpr(), debug, pixelDetails::ERROR_mask, l1tstage2_dqm_sourceclient-live_cfg::fedId, pixelgpudetails::MAX_LINK, pixelgpudetails::MAX_ROC, pixelDetails::MAX_ROC, sipixelconstants::OMIT_ERR_mask, sipixelconstants::OMIT_ERR_shift, and sipixelconstants::ROC_shift.

176  {
177  uint8_t errorType = (errorWord >> ::pixelDetails::ROC_shift) & ::pixelDetails::ERROR_mask;
178  if (errorType < 25)
179  return 0;
180  bool errorFound = false;
181 
182  switch (errorType) {
183  case 25: {
184  errorFound = true;
185  uint32_t index =
187  if (index > 1 && index <= cablingMap.size()) {
188  if (!(link == cablingMap.link()[index] && 1 == cablingMap.roc()[index]))
189  errorFound = false;
190  }
191  if constexpr (debug)
192  if (errorFound)
193  printf("Invalid ROC = 25 found (errorType = 25)\n");
194  break;
195  }
196  case 26: {
197  if constexpr (debug)
198  printf("Gap word found (errorType = 26)\n");
199  break;
200  }
201  case 27: {
202  if constexpr (debug)
203  printf("Dummy word found (errorType = 27)\n");
204  break;
205  }
206  case 28: {
207  if constexpr (debug)
208  printf("Error fifo nearly full (errorType = 28)\n");
209  errorFound = true;
210  break;
211  }
212  case 29: {
213  if constexpr (debug)
214  printf("Timeout on a channel (errorType = 29)\n");
216  if constexpr (debug)
217  printf("...2nd errorType=29 error, skip\n");
218  break;
219  }
220  errorFound = true;
221  break;
222  }
223  case 30: {
224  if constexpr (debug)
225  printf("TBM error trailer (errorType = 30)\n");
226  int stateMatch_bits = 4;
227  int stateMatch_shift = 8;
228  uint32_t stateMatch_mask = ~(~uint32_t(0) << stateMatch_bits);
229  int stateMatch = (errorWord >> stateMatch_shift) & stateMatch_mask;
230  if (stateMatch != 1 && stateMatch != 8) {
231  if constexpr (debug)
232  printf("FED error 30 with unexpected State Bits (errorType = 30)\n");
233  break;
234  }
235  if (stateMatch == 1)
236  errorType = 40; // 1=Overflow -> 40, 8=number of ROCs -> 30
237  errorFound = true;
238  break;
239  }
240  case 31: {
241  if constexpr (debug)
242  printf("Event number error (errorType = 31)\n");
243  errorFound = true;
244  break;
245  }
246  default:
247  errorFound = false;
248  };
249 
250  return errorFound ? errorType : 0;
251  }
constexpr uint32_t ERROR_mask
constexpr uint32_t ROC_shift
constexpr uint32_t OMIT_ERR_shift
constexpr unsigned int MAX_ROC
constexpr auto MAX_ROC
#define debug
Definition: HDRShower.cc:19
constexpr uint32_t OMIT_ERR_mask
constexpr unsigned int MAX_LINK

◆ conversionError()

template<bool debug = false>
ALPAKA_FN_ACC uint8_t ALPAKA_ACCELERATOR_NAMESPACE::pixelDetails::conversionError ( uint8_t  fedId,
uint8_t  status 
)

Definition at line 130 of file SiPixelRawToClusterKernel.dev.cc.

References ALPAKA_ACCELERATOR_NAMESPACE::brokenline::constexpr(), debug, l1tstage2_dqm_sourceclient-live_cfg::fedId, and mps_update::status.

130  {
131  uint8_t errorType = 0;
132 
133  switch (status) {
134  case 1: {
135  if constexpr (debug)
136  printf("Error in Fed: %i, invalid channel Id (errorType = 35\n)", fedId);
137  errorType = 35;
138  break;
139  }
140  case 2: {
141  if constexpr (debug)
142  printf("Error in Fed: %i, invalid ROC Id (errorType = 36)\n", fedId);
143  errorType = 36;
144  break;
145  }
146  case 3: {
147  if constexpr (debug)
148  printf("Error in Fed: %i, invalid dcol/pixel value (errorType = 37)\n", fedId);
149  errorType = 37;
150  break;
151  }
152  case 4: {
153  if constexpr (debug)
154  printf("Error in Fed: %i, dcol/pixel read out of order (errorType = 38)\n", fedId);
155  errorType = 38;
156  break;
157  }
158  default:
159  if constexpr (debug)
160  printf("Cabling check returned unexpected result, status = %i\n", status);
161  };
162 
163  return errorType;
164  }
#define debug
Definition: HDRShower.cc:19

◆ dcolIsValid()

ALPAKA_FN_ACC bool ALPAKA_ACCELERATOR_NAMESPACE::pixelDetails::dcolIsValid ( uint32_t  dcol,
uint32_t  pxid 
)

Definition at line 171 of file SiPixelRawToClusterKernel.dev.cc.

Referenced by ALPAKA_ACCELERATOR_NAMESPACE::pixelDetails::RawToDigi_kernel< debug >::operator()().

171 { return ((dcol < 26) & (2 <= pxid) & (pxid < 162)); }

◆ frameConversion()

ALPAKA_FN_ACC ::pixelDetails::Pixel ALPAKA_ACCELERATOR_NAMESPACE::pixelDetails::frameConversion ( bool  bpix,
int  side,
uint32_t  layer,
uint32_t  rocIdInDetUnit,
::pixelDetails::Pixel  local 
)

Definition at line 60 of file SiPixelRawToClusterKernel.dev.cc.

References DTRecHitClients_cfi::local, pixelDetails::numColsInRoc, pixelDetails::numRowsInRoc, and ALPAKA_ACCELERATOR_NAMESPACE::ecal::reconstruction::internal::barrel::side().

Referenced by ALPAKA_ACCELERATOR_NAMESPACE::pixelDetails::RawToDigi_kernel< debug >::operator()().

61  {
62  int slopeRow = 0, slopeCol = 0;
63  int rowOffset = 0, colOffset = 0;
64 
65  if (bpix) {
66  if (side == -1 && layer != 1) { // -Z side: 4 non-flipped modules oriented like 'dddd', except Layer 1
67  if (rocIdInDetUnit < 8) {
68  slopeRow = 1;
69  slopeCol = -1;
70  rowOffset = 0;
71  colOffset = (8 - rocIdInDetUnit) * ::pixelDetails::numColsInRoc - 1;
72  } else {
73  slopeRow = -1;
74  slopeCol = 1;
75  rowOffset = 2 * ::pixelDetails::numRowsInRoc - 1;
76  colOffset = (rocIdInDetUnit - 8) * ::pixelDetails::numColsInRoc;
77  } // if roc
78  } else { // +Z side: 4 non-flipped modules oriented like 'pppp', but all 8 in layer1
79  if (rocIdInDetUnit < 8) {
80  slopeRow = -1;
81  slopeCol = 1;
82  rowOffset = 2 * ::pixelDetails::numRowsInRoc - 1;
83  colOffset = rocIdInDetUnit * ::pixelDetails::numColsInRoc;
84  } else {
85  slopeRow = 1;
86  slopeCol = -1;
87  rowOffset = 0;
88  colOffset = (16 - rocIdInDetUnit) * ::pixelDetails::numColsInRoc - 1;
89  }
90  }
91 
92  } else { // fpix
93  if (side == -1) { // pannel 1
94  if (rocIdInDetUnit < 8) {
95  slopeRow = 1;
96  slopeCol = -1;
97  rowOffset = 0;
98  colOffset = (8 - rocIdInDetUnit) * ::pixelDetails::numColsInRoc - 1;
99  } else {
100  slopeRow = -1;
101  slopeCol = 1;
102  rowOffset = 2 * ::pixelDetails::numRowsInRoc - 1;
103  colOffset = (rocIdInDetUnit - 8) * ::pixelDetails::numColsInRoc;
104  }
105  } else { // pannel 2
106  if (rocIdInDetUnit < 8) {
107  slopeRow = 1;
108  slopeCol = -1;
109  rowOffset = 0;
110  colOffset = (8 - rocIdInDetUnit) * ::pixelDetails::numColsInRoc - 1;
111  } else {
112  slopeRow = -1;
113  slopeCol = 1;
114  rowOffset = 2 * ::pixelDetails::numRowsInRoc - 1;
115  colOffset = (rocIdInDetUnit - 8) * ::pixelDetails::numColsInRoc;
116  }
117 
118  } // side
119  }
120 
121  uint32_t gRow = rowOffset + slopeRow * local.row;
122  uint32_t gCol = colOffset + slopeCol * local.col;
123  // inside frameConversion row: gRow, column: gCol
124  ::pixelDetails::Pixel global = {gRow, gCol};
125  return global;
126  }
constexpr uint32_t numRowsInRoc
constexpr uint32_t numColsInRoc

◆ getErrRawID()

template<bool debug = false>
ALPAKA_FN_ACC uint32_t ALPAKA_ACCELERATOR_NAMESPACE::pixelDetails::getErrRawID ( uint8_t  fedId,
uint32_t  errWord,
uint32_t  errorType,
const SiPixelMappingSoAConstView cablingMap 
)

Definition at line 256 of file SiPixelRawToClusterKernel.dev.cc.

References l1tstage2_dqm_sourceclient-live_cfg::fedId, getRawId(), pixelClustering::invalidModuleId, pixelDetails::LINK_mask, sipixelconstants::LINK_shift, pixelDetails::DetIdGPU::rawId, PixelMapPlotter::roc, pixelDetails::ROC_mask, and sipixelconstants::ROC_shift.

256  {
257  uint32_t rID = 0xffffffff;
258 
259  switch (errorType) {
260  case 25:
261  case 29:
262  case 30:
263  case 31:
264  case 36:
265  case 40: {
266  uint32_t roc = 1;
267  uint32_t link = (errWord >> ::pixelDetails::LINK_shift) & ::pixelDetails::LINK_mask;
268  uint32_t rID_temp = getRawId(cablingMap, fedId, link, roc).rawId;
269  if (rID_temp != ::pixelClustering::invalidModuleId)
270  rID = rID_temp;
271  break;
272  }
273  case 37:
274  case 38: {
275  uint32_t roc = (errWord >> ::pixelDetails::ROC_shift) & ::pixelDetails::ROC_mask;
276  uint32_t link = (errWord >> ::pixelDetails::LINK_shift) & ::pixelDetails::LINK_mask;
277  uint32_t rID_temp = getRawId(cablingMap, fedId, link, roc).rawId;
278  if (rID_temp != ::pixelClustering::invalidModuleId)
279  rID = rID_temp;
280  break;
281  }
282  default:
283  break;
284  };
285 
286  return rID;
287  }
constexpr uint32_t ROC_shift
constexpr uint32_t ROC_mask
ALPAKA_FN_ACC ::pixelDetails::DetIdGPU getRawId(const SiPixelMappingSoAConstView &cablingMap, uint8_t fed, uint32_t link, uint32_t roc)
constexpr uint32_t LINK_shift
constexpr uint32_t LINK_mask
constexpr uint16_t invalidModuleId

◆ getRawId()

ALPAKA_FN_ACC ::pixelDetails::DetIdGPU ALPAKA_ACCELERATOR_NAMESPACE::pixelDetails::getRawId ( const SiPixelMappingSoAConstView cablingMap,
uint8_t  fed,
uint32_t  link,
uint32_t  roc 
)

Definition at line 47 of file SiPixelRawToClusterKernel.dev.cc.

References hcalRecHitTable_cff::detId, pixelgpudetails::MAX_LINK, pixelgpudetails::MAX_ROC, and PixelMapPlotter::roc.

Referenced by getErrRawID(), HcalAssistant::getRawId(), and ALPAKA_ACCELERATOR_NAMESPACE::pixelDetails::RawToDigi_kernel< debug >::operator()().

50  {
51  using namespace ::pixelDetails;
52  uint32_t index = fed * MAX_LINK * MAX_ROC + (link - 1) * MAX_ROC + roc;
53  DetIdGPU detId = {cablingMap.rawId()[index], cablingMap.rocInDet()[index], cablingMap.moduleId()[index]};
54  return detId;
55  }
constexpr unsigned int MAX_ROC
constexpr unsigned int MAX_LINK

◆ isBarrel()

ALPAKA_FN_ACC bool ALPAKA_ACCELERATOR_NAMESPACE::pixelDetails::isBarrel ( uint32_t  rawId)

◆ rocRowColIsValid()

ALPAKA_FN_ACC bool ALPAKA_ACCELERATOR_NAMESPACE::pixelDetails::rocRowColIsValid ( uint32_t  rocRow,
uint32_t  rocCol 
)

row and column in ROC representation

Definition at line 166 of file SiPixelRawToClusterKernel.dev.cc.

References pixelDetails::numColsInRoc, and pixelDetails::numRowsInRoc.

Referenced by ALPAKA_ACCELERATOR_NAMESPACE::pixelDetails::RawToDigi_kernel< debug >::operator()().

166  {
168  return ((rocRow < ::pixelDetails::numRowsInRoc) & (rocCol < ::pixelDetails::numColsInRoc));
169  }
constexpr uint32_t numRowsInRoc
constexpr uint32_t numColsInRoc