CMS 3D CMS Logo

Classes | Typedefs | Functions | Variables
pixelCPEforGPU Namespace Reference

Classes

struct  ClusParamsT
 
struct  CommonParams
 
struct  DetParams
 
struct  LayerGeometry
 
struct  ParamsOnGPU
 

Typedefs

using ClusParams = ClusParamsT< MaxHitsInIter >
 
using Frame = SOAFrame< float >
 
using Rotation = SOARotation< float >
 
using Status = SiPixelHitStatus
 

Functions

constexpr void computeAnglesFromDet (DetParams const &__restrict__ detParams, float const x, float const y, float &cotalpha, float &cotbeta)
 
constexpr float correction (int sizeM1, int q_f, int q_l, uint16_t upper_edge_first_pix, uint16_t lower_edge_last_pix, float lorentz_shift, float theThickness, float cot_angle, float pitch, bool first_is_big, bool last_is_big)
 
constexpr void errorFromDB (CommonParams const &__restrict__ comParams, DetParams const &__restrict__ detParams, ClusParams &cp, uint32_t ic)
 
constexpr void errorFromSize (CommonParams const &__restrict__ comParams, DetParams const &__restrict__ detParams, ClusParams &cp, uint32_t ic)
 
constexpr void position (CommonParams const &__restrict__ comParams, DetParams const &__restrict__ detParams, ClusParams &cp, uint32_t ic)
 

Variables

constexpr int32_t MaxHitsInIter = gpuClustering::maxHitsInIter()
 

Typedef Documentation

◆ ClusParams

Definition at line 132 of file pixelCPEforGPU.h.

◆ Frame

using pixelCPEforGPU::Frame = typedef SOAFrame<float>

Definition at line 27 of file pixelCPEforGPU.h.

◆ Rotation

using pixelCPEforGPU::Rotation = typedef SOARotation<float>

Definition at line 28 of file pixelCPEforGPU.h.

◆ Status

Definition at line 26 of file pixelCPEforGPU.h.

Function Documentation

◆ computeAnglesFromDet()

constexpr void pixelCPEforGPU::computeAnglesFromDet ( DetParams const &__restrict__  detParams,
float const  x,
float const  y,
float &  cotalpha,
float &  cotbeta 
)
inline

Definition at line 134 of file pixelCPEforGPU.h.

References x.

Referenced by position().

135  {
136  // x,y local position on det
137  auto gvx = x - detParams.x0;
138  auto gvy = y - detParams.y0;
139  auto gvz = -1.f / detParams.z0;
140  // normalization not required as only ratio used...
141  // calculate angles
142  cotalpha = gvx * gvz;
143  cotbeta = gvy * gvz;
144  }
float x

◆ correction()

constexpr float pixelCPEforGPU::correction ( int  sizeM1,
int  q_f,
int  q_l,
uint16_t  upper_edge_first_pix,
uint16_t  lower_edge_last_pix,
float  lorentz_shift,
float  theThickness,
float  cot_angle,
float  pitch,
bool  first_is_big,
bool  last_is_big 
)
inline
Parameters
q_fCharge in the first pixel.
q_lCharge in the last pixel.
upper_edge_first_pixAs the name says.
lower_edge_last_pixAs the name says.
lorentz_shiftL-shift at half thickness
cot_anglecot of alpha_ or beta_
pitchthePitchX or thePitchY
first_is_bigtrue if the first is big
last_is_bigtrue if the last is big

Definition at line 146 of file pixelCPEforGPU.h.

References funct::abs(), and dqmMemoryStats::float.

Referenced by position().

157  {
158  if (0 == sizeM1) // size 1
159  return 0;
160 
161  float w_eff = 0;
162  bool simple = true;
163  if (1 == sizeM1) { // size 2
164  //--- Width of the clusters minus the edge (first and last) pixels.
165  //--- In the note, they are denoted x_F and x_L (and y_F and y_L)
166  // assert(lower_edge_last_pix >= upper_edge_first_pix);
167  auto w_inner = pitch * float(lower_edge_last_pix - upper_edge_first_pix); // in cm
168 
169  //--- Predicted charge width from geometry
170  auto w_pred = theThickness * cot_angle // geometric correction (in cm)
171  - lorentz_shift; // (in cm) &&& check fpix!
172 
173  w_eff = std::abs(w_pred) - w_inner;
174 
175  //--- If the observed charge width is inconsistent with the expectations
176  //--- based on the track, do *not* use w_pred-w_inner. Instead, replace
177  //--- it with an *average* effective charge width, which is the average
178  //--- length of the edge pixels.
179 
180  // this can produce "large" regressions for very small numeric differences
181  simple = (w_eff < 0.0f) | (w_eff > pitch);
182  }
183 
184  if (simple) {
185  //--- Total length of the two edge pixels (first+last)
186  float sum_of_edge = 2.0f;
187  if (first_is_big)
188  sum_of_edge += 1.0f;
189  if (last_is_big)
190  sum_of_edge += 1.0f;
191  w_eff = pitch * 0.5f * sum_of_edge; // ave. length of edge pixels (first+last) (cm)
192  }
193 
194  //--- Finally, compute the position in this projection
195  float qdiff = q_l - q_f;
196  float qsum = q_l + q_f;
197 
198  //--- Temporary fix for clusters with both first and last pixel with charge = 0
199  if (qsum == 0)
200  qsum = 1.0f;
201 
202  return 0.5f * (qdiff / qsum) * w_eff;
203  }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22

◆ errorFromDB()

constexpr void pixelCPEforGPU::errorFromDB ( CommonParams const &__restrict__  comParams,
DetParams const &__restrict__  detParams,
ClusParams cp,
uint32_t  ic 
)
inline

Definition at line 388 of file pixelCPEforGPU.h.

References newFWLiteAna::bin, funct::false, dqmMemoryStats::float, phase1PixelTopology::isBigPixX(), phase1PixelTopology::isBigPixY(), phase1PixelTopology::isEdgeX(), phase1PixelTopology::isEdgeY(), CPEFastParametrisation::kGenErrorQBins, CPEFastParametrisation::kNumErrorBins, SiStripPI::min, fftjetcommon_cfi::sx, fftjetcommon_cfi::sy, x, and phase1PixelTopology::xOffset.

Referenced by gpuPixelRecHits::__attribute__(), and PixelCPEFast::localPosition().

391  {
392  // Edge cluster errors
393  cp.xerr[ic] = 0.0050f;
394  cp.yerr[ic] = 0.0085f;
395 
396  auto sx = cp.maxRow[ic] - cp.minRow[ic];
397  auto sy = cp.maxCol[ic] - cp.minCol[ic];
398 
399  // is edgy ? (size is set negative: see above)
400  bool isEdgeX = cp.xsize[ic] < 1;
401  bool isEdgeY = cp.ysize[ic] < 1;
402  // is one and big?
403  bool isOneX = (0 == sx);
404  bool isOneY = (0 == sy);
405  bool isBigX = comParams.isPhase2 ? false : phase1PixelTopology::isBigPixX(cp.minRow[ic]);
406  bool isBigY = comParams.isPhase2 ? false : phase1PixelTopology::isBigPixY(cp.minCol[ic]);
407 
408  auto ch = cp.charge[ic];
409  auto bin = 0;
411  // find first bin which minimum charge exceeds cluster charge
412  if (ch < detParams.minCh[bin + 1])
413  break;
414 
415  // in detParams qBins are reversed bin0 -> smallest charge, bin4-> largest charge
416  // whereas in CondFormats/SiPixelTransient/src/SiPixelGenError.cc it is the opposite
417  // so we reverse the bin here -> kGenErrorQBins - 1 - bin
418  cp.status[ic].qBin = CPEFastParametrisation::kGenErrorQBins - 1 - bin;
419  cp.status[ic].isOneX = isOneX;
420  cp.status[ic].isBigX = (isOneX & isBigX) | isEdgeX;
421  cp.status[ic].isOneY = isOneY;
422  cp.status[ic].isBigY = (isOneY & isBigY) | isEdgeY;
423 
424  auto xoff = -float(phase1PixelTopology::xOffset) * comParams.thePitchX;
425  int low_value = 0;
426  int high_value = CPEFastParametrisation::kNumErrorBins - 1;
427  int bin_value = float(CPEFastParametrisation::kNumErrorBins) * (cp.xpos[ic] + xoff) / (2 * xoff);
428  // return estimated bin value truncated to [0, 15]
429  int jx = std::clamp(bin_value, low_value, high_value);
430 
431  auto toCM = [](uint8_t x) { return float(x) * 1.e-4; };
432 
433  if (not isEdgeX) {
434  cp.xerr[ic] = isOneX ? toCM(isBigX ? detParams.sx2 : detParams.sigmax1[jx])
435  : detParams.xfact[bin] * toCM(detParams.sigmax[jx]);
436  }
437 
438  auto ey = cp.ysize[ic] > 8 ? detParams.sigmay[std::min(cp.ysize[ic] - 9, 15)] : detParams.sy1;
439  if (not isEdgeY) {
440  cp.yerr[ic] = isOneY ? toCM(isBigY ? detParams.sy2 : detParams.sy1) : detParams.yfact[bin] * toCM(ey);
441  }
442  }
constexpr int kGenErrorQBins
constexpr bool isEdgeY(uint16_t py)
constexpr bool isBigPixY(uint16_t py)
constexpr bool isEdgeX(uint16_t px)
constexpr bool isBigPixX(uint16_t px)
constexpr int16_t xOffset
float x
constexpr int kNumErrorBins

◆ errorFromSize()

constexpr void pixelCPEforGPU::errorFromSize ( CommonParams const &__restrict__  comParams,
DetParams const &__restrict__  detParams,
ClusParams cp,
uint32_t  ic 
)
inline

Definition at line 306 of file pixelCPEforGPU.h.

References funct::false, phase1PixelTopology::isBigPixX(), phase1PixelTopology::isBigPixY(), phase1PixelTopology::isEdgeX(), phase1PixelTopology::isEdgeY(), HLT_2022v12_cff::isPhase2, findQualityFiles::size, fftjetcommon_cfi::sx, fftjetcommon_cfi::sy, HLT_2022v12_cff::xerr_barrel_l1, HLT_2022v12_cff::xerr_barrel_l1_def, HLT_2022v12_cff::xerr_barrel_ln, HLT_2022v12_cff::xerr_barrel_ln_def, HLT_2022v12_cff::xerr_endcap, HLT_2022v12_cff::xerr_endcap_def, HLT_2022v12_cff::yerr_barrel_l1, HLT_2022v12_cff::yerr_barrel_l1_def, HLT_2022v12_cff::yerr_barrel_ln, HLT_2022v12_cff::yerr_barrel_ln_def, HLT_2022v12_cff::yerr_endcap, and HLT_2022v12_cff::yerr_endcap_def.

Referenced by gpuPixelRecHits::__attribute__().

309  {
310  // Edge cluster errors
311  cp.xerr[ic] = 0.0050;
312  cp.yerr[ic] = 0.0085;
313 
314  // FIXME these are errors form Run1
315 
316  bool isPhase2 = comParams.isPhase2;
317  // FIXME these are errors form Run1
318  float xerr_barrel_l1_def = isPhase2 ? 0.00035 : 0.00200; // 0.01030;
319  float yerr_barrel_l1_def = isPhase2 ? 0.00125 : 0.00210;
320  float xerr_barrel_ln_def = isPhase2 ? 0.00035 : 0.00200; // 0.01030;
321  float yerr_barrel_ln_def = isPhase2 ? 0.00125 : 0.00210;
322  float xerr_endcap_def = isPhase2 ? 0.00060 : 0.0020;
323  float yerr_endcap_def = isPhase2 ? 0.00180 : 0.00210;
324 
325  constexpr float xerr_barrel_l1[] = {0.00115, 0.00120, 0.00088};
326  constexpr float yerr_barrel_l1[] = {
327  0.00375, 0.00230, 0.00250, 0.00250, 0.00230, 0.00230, 0.00210, 0.00210, 0.00240};
328  constexpr float xerr_barrel_ln[] = {0.00115, 0.00120, 0.00088};
329  constexpr float yerr_barrel_ln[] = {
330  0.00375, 0.00230, 0.00250, 0.00250, 0.00230, 0.00230, 0.00210, 0.00210, 0.00240};
331  constexpr float xerr_endcap[] = {0.0020, 0.0020};
332  constexpr float yerr_endcap[] = {0.00210};
333 
334  auto sx = cp.maxRow[ic] - cp.minRow[ic];
335  auto sy = cp.maxCol[ic] - cp.minCol[ic];
336 
337  // is edgy ?
338  bool isEdgeX = cp.xsize[ic] < 1;
339  bool isEdgeY = cp.ysize[ic] < 1;
340 
341  // is one and big?
342  bool isBig1X = isPhase2 ? false : ((0 == sx) && phase1PixelTopology::isBigPixX(cp.minRow[ic]));
343  bool isBig1Y = isPhase2 ? false : ((0 == sy) && phase1PixelTopology::isBigPixY(cp.minCol[ic]));
344 
345  if (!isPhase2) {
346  if (!isEdgeX && !isBig1X) {
347  if (not detParams.isBarrel) {
349  } else if (detParams.layer == 1) {
351  } else {
353  }
354  }
355 
356  if (!isEdgeY && !isBig1Y) {
357  if (not detParams.isBarrel) {
359  } else if (detParams.layer == 1) {
361  } else {
363  }
364  }
365  } else {
366  if (!isEdgeX) {
367  if (not detParams.isBarrel) {
369  } else if (detParams.layer == 1) {
371  } else {
373  }
374  }
375 
376  if (!isEdgeY) {
377  if (not detParams.isBarrel) {
379  } else if (detParams.layer == 1) {
381  } else {
383  }
384  }
385  }
386  }
size
Write out results.
constexpr bool isEdgeY(uint16_t py)
constexpr bool isBigPixY(uint16_t py)
constexpr bool isEdgeX(uint16_t px)
constexpr bool isBigPixX(uint16_t px)

◆ position()

constexpr void pixelCPEforGPU::position ( CommonParams const &__restrict__  comParams,
DetParams const &__restrict__  detParams,
ClusParams cp,
uint32_t  ic 
)
inline

Definition at line 205 of file pixelCPEforGPU.h.

References funct::abs(), cms::cuda::assert(), computeAnglesFromDet(), correction(), dqmMemoryStats::float, createfilelist::int, phase1PixelTopology::isBigPixX(), phase1PixelTopology::isBigPixY(), phase1PixelTopology::lastColInModule, phase1PixelTopology::lastRowInModule, phase1PixelTopology::localX(), phase1PixelTopology::localY(), SiStripPI::min, Calorimetry_cff::thickness, xsize, and ysize.

Referenced by gpuPixelRecHits::__attribute__(), and PixelCPEFast::localPosition().

208  {
209  //--- Upper Right corner of Lower Left pixel -- in measurement frame
210  uint16_t llx = cp.minRow[ic] + 1;
211  uint16_t lly = cp.minCol[ic] + 1;
212 
213  //--- Lower Left corner of Upper Right pixel -- in measurement frame
214  uint16_t urx = cp.maxRow[ic];
215  uint16_t ury = cp.maxCol[ic];
216 
217  uint16_t llxl = llx, llyl = lly, urxl = urx, uryl = ury;
218  if (!comParams.isPhase2) //only in Phase1
219  {
220  llxl = phase1PixelTopology::localX(llx);
221  llyl = phase1PixelTopology::localY(lly);
222  urxl = phase1PixelTopology::localX(urx);
223  uryl = phase1PixelTopology::localY(ury);
224  }
225 
226  auto mx = llxl + urxl;
227  auto my = llyl + uryl;
228 
229  auto xsize = int(urxl) + 2 - int(llxl);
230  auto ysize = int(uryl) + 2 - int(llyl);
231  assert(xsize >= 0); // 0 if bixpix...
232  assert(ysize >= 0);
233 
234  if (!comParams.isPhase2) //Phase 1 big pixels
235  {
236  if (phase1PixelTopology::isBigPixX(cp.minRow[ic]))
237  ++xsize;
238  if (phase1PixelTopology::isBigPixX(cp.maxRow[ic]))
239  ++xsize;
240  if (phase1PixelTopology::isBigPixY(cp.minCol[ic]))
241  ++ysize;
242  if (phase1PixelTopology::isBigPixY(cp.maxCol[ic]))
243  ++ysize;
244  }
245 
246  int unbalanceX = 8.f * std::abs(float(cp.q_f_X[ic] - cp.q_l_X[ic])) / float(cp.q_f_X[ic] + cp.q_l_X[ic]);
247  int unbalanceY = 8.f * std::abs(float(cp.q_f_Y[ic] - cp.q_l_Y[ic])) / float(cp.q_f_Y[ic] + cp.q_l_Y[ic]);
248  xsize = 8 * xsize - unbalanceX;
249  ysize = 8 * ysize - unbalanceY;
250 
251  cp.xsize[ic] = std::min(xsize, comParams.isPhase2 ? 2047 : 1023);
252  cp.ysize[ic] = std::min(ysize, comParams.isPhase2 ? 2047 : 1023);
253 
254  if (cp.minRow[ic] == 0 || cp.maxRow[ic] == phase1PixelTopology::lastRowInModule)
255  cp.xsize[ic] = -cp.xsize[ic];
256  if (cp.minCol[ic] == 0 || cp.maxCol[ic] == phase1PixelTopology::lastColInModule)
257  cp.ysize[ic] = -cp.ysize[ic];
258 
259  // apply the lorentz offset correction
260  float xoff = 0.5f * float(detParams.nRows) * comParams.thePitchX;
261  float yoff = 0.5f * float(detParams.nCols) * comParams.thePitchY;
262 
263  if (!comParams.isPhase2) //correction for bigpixels for phase1
264  {
265  xoff = xoff + comParams.thePitchX;
266  yoff = yoff + 8.0f * comParams.thePitchY;
267  }
268  // apply the lorentz offset correction
269  auto xPos = detParams.shiftX + (comParams.thePitchX * 0.5f * float(mx)) - xoff;
270  auto yPos = detParams.shiftY + (comParams.thePitchY * 0.5f * float(my)) - yoff;
271 
272  float cotalpha = 0, cotbeta = 0;
273 
274  computeAnglesFromDet(detParams, xPos, yPos, cotalpha, cotbeta);
275 
276  auto thickness = detParams.isBarrel ? comParams.theThicknessB : comParams.theThicknessE;
277 
278  auto xcorr = correction(cp.maxRow[ic] - cp.minRow[ic],
279  cp.q_f_X[ic],
280  cp.q_l_X[ic],
281  llxl,
282  urxl,
283  detParams.chargeWidthX, // lorentz shift in cm
284  thickness,
285  cotalpha,
286  comParams.thePitchX,
287  comParams.isPhase2 ? false : phase1PixelTopology::isBigPixX(cp.minRow[ic]),
288  comParams.isPhase2 ? false : phase1PixelTopology::isBigPixX(cp.maxRow[ic]));
289 
290  auto ycorr = correction(cp.maxCol[ic] - cp.minCol[ic],
291  cp.q_f_Y[ic],
292  cp.q_l_Y[ic],
293  llyl,
294  uryl,
295  detParams.chargeWidthY, // lorentz shift in cm
296  thickness,
297  cotbeta,
298  comParams.thePitchY,
299  comParams.isPhase2 ? false : phase1PixelTopology::isBigPixY(cp.minCol[ic]),
300  comParams.isPhase2 ? false : phase1PixelTopology::isBigPixY(cp.maxCol[ic]));
301 
302  cp.xpos[ic] = xPos + xcorr;
303  cp.ypos[ic] = yPos + ycorr;
304  }
constexpr uint16_t lastRowInModule
constexpr uint16_t localY(uint16_t py)
const Int_t ysize
constexpr uint16_t lastColInModule
assert(be >=bs)
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
constexpr void computeAnglesFromDet(DetParams const &__restrict__ detParams, float const x, float const y, float &cotalpha, float &cotbeta)
constexpr bool isBigPixY(uint16_t py)
constexpr bool isBigPixX(uint16_t px)
constexpr uint16_t localX(uint16_t px)
constexpr float correction(int sizeM1, int q_f, int q_l, uint16_t upper_edge_first_pix, uint16_t lower_edge_last_pix, float lorentz_shift, float theThickness, float cot_angle, float pitch, bool first_is_big, bool last_is_big)
const Int_t xsize

Variable Documentation

◆ MaxHitsInIter

constexpr int32_t pixelCPEforGPU::MaxHitsInIter = gpuClustering::maxHitsInIter()

Definition at line 131 of file pixelCPEforGPU.h.

Referenced by gpuPixelRecHits::__attribute__().