CMS 3D CMS Logo

Classes | Typedefs | Functions | Variables
pixelCPEforDevice Namespace Reference

Classes

struct  ClusParamsT
 
struct  CommonParams
 
struct  DetParams
 
struct  LayerGeometryT
 
struct  ParamsOnDeviceT
 

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)
 
template<typename TrackerTraits >
constexpr void errorFromDB (CommonParams const &__restrict__ comParams, DetParams const &__restrict__ detParams, ClusParams &cp, uint32_t ic)
 
template<>
constexpr void errorFromDB< pixelTopology::Phase2 > (CommonParams const &__restrict__ comParams, DetParams const &__restrict__ detParams, ClusParams &cp, uint32_t ic)
 
template<typename TrackerTraits >
constexpr void errorFromSize (CommonParams const &__restrict__ comParams, DetParams const &__restrict__ detParams, ClusParams &cp, uint32_t ic)
 
template<typename TrackerTraits >
constexpr void position (CommonParams const &__restrict__ comParams, DetParams const &__restrict__ detParams, ClusParams &cp, uint32_t ic)
 

Variables

constexpr int kGenErrorQBins = 5
 
constexpr int kNumErrorBins = 16
 
constexpr int32_t MaxHitsInIter = pixelClustering::maxHitsInIter()
 
constexpr float micronsToCm = 1.0e-4f
 

Typedef Documentation

◆ ClusParams

Definition at line 111 of file pixelCPEforDevice.h.

◆ Frame

using pixelCPEforDevice::Frame = typedef SOAFrame<float>

Definition at line 29 of file pixelCPEforDevice.h.

◆ Rotation

using pixelCPEforDevice::Rotation = typedef SOARotation<float>

Definition at line 30 of file pixelCPEforDevice.h.

◆ Status

Definition at line 28 of file pixelCPEforDevice.h.

Function Documentation

◆ computeAnglesFromDet()

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

Definition at line 113 of file pixelCPEforDevice.h.

References x.

Referenced by position().

114  {
115  // x,y local position on det
116  auto gvx = x - detParams.x0;
117  auto gvy = y - detParams.y0;
118  auto gvz = -1.f / detParams.z0;
119  // normalization not required as only ratio used...
120  // calculate angles
121  cotalpha = gvx * gvz;
122  cotbeta = gvy * gvz;
123  }
float x

◆ correction()

constexpr float pixelCPEforDevice::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 125 of file pixelCPEforDevice.h.

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

Referenced by position().

136  {
137  if (0 == sizeM1) // size 1
138  return 0;
139 
140  float w_eff = 0;
141  bool simple = true;
142  if (1 == sizeM1) { // size 2
143  //--- Width of the clusters minus the edge (first and last) pixels.
144  //--- In the note, they are denoted x_F and x_L (and y_F and y_L)
145  // assert(lower_edge_last_pix >= upper_edge_first_pix);
146  auto w_inner = pitch * float(lower_edge_last_pix - upper_edge_first_pix); // in cm
147 
148  //--- Predicted charge width from geometry
149  auto w_pred = theThickness * cot_angle // geometric correction (in cm)
150  - lorentz_shift; // (in cm) &&& check fpix!
151 
152  w_eff = std::abs(w_pred) - w_inner;
153 
154  //--- If the observed charge width is inconsistent with the expectations
155  //--- based on the track, do *not* use w_pred-w_inner. Instead, replace
156  //--- it with an *average* effective charge width, which is the average
157  //--- length of the edge pixels.
158 
159  // this can produce "large" regressions for very small numeric differences
160  simple = (w_eff < 0.0f) | (w_eff > pitch);
161  }
162 
163  if (simple) {
164  //--- Total length of the two edge pixels (first+last)
165  float sum_of_edge = 2.0f;
166  if (first_is_big)
167  sum_of_edge += 1.0f;
168  if (last_is_big)
169  sum_of_edge += 1.0f;
170  w_eff = pitch * 0.5f * sum_of_edge; // ave. length of edge pixels (first+last) (cm)
171  }
172 
173  //--- Finally, compute the position in this projection
174  float qdiff = q_l - q_f;
175  float qsum = q_l + q_f;
176 
177  //--- Temporary fix for clusters with both first and last pixel with charge = 0
178  if (qsum == 0)
179  qsum = 1.0f;
180 
181  return 0.5f * (qdiff / qsum) * w_eff;
182  }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22

◆ errorFromDB()

template<typename TrackerTraits >
constexpr void pixelCPEforDevice::errorFromDB ( CommonParams const &__restrict__  comParams,
DetParams const &__restrict__  detParams,
ClusParams cp,
uint32_t  ic 
)
inline

Definition at line 341 of file pixelCPEforDevice.h.

References newFWLiteAna::bin, f, nano_mu_digi_cff::float, kGenErrorQBins, kNumErrorBins, SiStripPI::min, fftjetcommon_cfi::sx, fftjetcommon_cfi::sy, and x.

344  {
345  // Edge cluster errors
346  cp.xerr[ic] = 0.0050f;
347  cp.yerr[ic] = 0.0085f;
348 
349  auto sx = cp.maxRow[ic] - cp.minRow[ic];
350  auto sy = cp.maxCol[ic] - cp.minCol[ic];
351 
352  // is edgy ? (size is set negative: see above)
353  bool isEdgeX = cp.xsize[ic] < 1;
354  bool isEdgeY = cp.ysize[ic] < 1;
355  // is one and big?
356  bool isOneX = (0 == sx);
357  bool isOneY = (0 == sy);
358  bool isBigX = TrackerTraits::isBigPixX(cp.minRow[ic]);
359  bool isBigY = TrackerTraits::isBigPixY(cp.minCol[ic]);
360 
361  auto ch = cp.charge[ic];
362  auto bin = 0;
363  for (; bin < kGenErrorQBins - 1; ++bin)
364  // find first bin which minimum charge exceeds cluster charge
365  if (ch < detParams.minCh[bin + 1])
366  break;
367 
368  // in detParams qBins are reversed bin0 -> smallest charge, bin4-> largest charge
369  // whereas in CondFormats/SiPixelTransient/src/SiPixelGenError.cc it is the opposite
370  // so we reverse the bin here -> kGenErrorQBins - 1 - bin
371  cp.status[ic].qBin = kGenErrorQBins - 1 - bin;
372  cp.status[ic].isOneX = isOneX;
373  cp.status[ic].isBigX = (isOneX & isBigX) | isEdgeX;
374  cp.status[ic].isOneY = isOneY;
375  cp.status[ic].isBigY = (isOneY & isBigY) | isEdgeY;
376 
377  auto xoff = -float(TrackerTraits::xOffset) * detParams.thePitchX;
378  int low_value = 0;
379  int high_value = kNumErrorBins - 1;
380  int bin_value = float(kNumErrorBins) * (cp.xpos[ic] + xoff) / (2 * xoff);
381  // return estimated bin value truncated to [0, 15]
382  int jx = std::clamp(bin_value, low_value, high_value);
383 
384  auto toCM = [](uint8_t x) { return float(x) * 1.e-4f; };
385 
386  if (not isEdgeX) {
387  cp.xerr[ic] = isOneX ? toCM(isBigX ? detParams.sx2 : detParams.sigmax1[jx])
388  : detParams.xfact[bin] * toCM(detParams.sigmax[jx]);
389  }
390 
391  auto ey = cp.ysize[ic] > 8 ? detParams.sigmay[std::min(cp.ysize[ic] - 9, 15)] : detParams.sy1;
392  if (not isEdgeY) {
393  cp.yerr[ic] = isOneY ? toCM(isBigY ? detParams.sy2 : detParams.sy1) : detParams.yfact[bin] * toCM(ey);
394  }
395  }
constexpr int kNumErrorBins
double f[11][100]
constexpr int kGenErrorQBins
float x

◆ errorFromDB< pixelTopology::Phase2 >()

template<>
constexpr void pixelCPEforDevice::errorFromDB< pixelTopology::Phase2 > ( CommonParams const &__restrict__  comParams,
DetParams const &__restrict__  detParams,
ClusParams cp,
uint32_t  ic 
)
inline

Definition at line 399 of file pixelCPEforDevice.h.

References CommonMethods::cp().

402  {
403  errorFromSize<pixelTopology::Phase2>(comParams, detParams, cp, ic);
404  }
def cp(fromDir, toDir, listOfFiles, overwrite=False, smallList=False)

◆ errorFromSize()

template<typename TrackerTraits >
constexpr void pixelCPEforDevice::errorFromSize ( CommonParams const &__restrict__  comParams,
DetParams const &__restrict__  detParams,
ClusParams cp,
uint32_t  ic 
)
inline

Definition at line 283 of file pixelCPEforDevice.h.

References ALPAKA_ACCELERATOR_NAMESPACE::brokenline::constexpr(), fftjetcommon_cfi::sx, fftjetcommon_cfi::sy, HLT_2024v14_cff::xerr_barrel_l1, HLT_2024v14_cff::xerr_barrel_l1_def, HLT_2024v14_cff::xerr_barrel_ln, HLT_2024v14_cff::xerr_barrel_ln_def, HLT_2024v14_cff::xerr_endcap, HLT_2024v14_cff::xerr_endcap_def, HLT_2024v14_cff::yerr_barrel_l1, HLT_2024v14_cff::yerr_barrel_l1_def, HLT_2024v14_cff::yerr_barrel_ln, HLT_2024v14_cff::yerr_barrel_ln_def, HLT_2024v14_cff::yerr_endcap, and HLT_2024v14_cff::yerr_endcap_def.

286  {
287  // Edge cluster errors
288  cp.xerr[ic] = 0.0050;
289  cp.yerr[ic] = 0.0085;
290 
291  // FIXME these are errors form Run1
298 
299  constexpr float xerr_barrel_l1[] = {0.00115, 0.00120, 0.00088}; //TODO MOVE THESE SOMEWHERE ELSE
300  constexpr float yerr_barrel_l1[] = {
301  0.00375, 0.00230, 0.00250, 0.00250, 0.00230, 0.00230, 0.00210, 0.00210, 0.00240};
302  constexpr float xerr_barrel_ln[] = {0.00115, 0.00120, 0.00088};
303  constexpr float yerr_barrel_ln[] = {
304  0.00375, 0.00230, 0.00250, 0.00250, 0.00230, 0.00230, 0.00210, 0.00210, 0.00240};
305  constexpr float xerr_endcap[] = {0.0020, 0.0020};
306  constexpr float yerr_endcap[] = {0.00210};
307 
308  auto sx = cp.maxRow[ic] - cp.minRow[ic];
309  auto sy = cp.maxCol[ic] - cp.minCol[ic];
310 
311  // is edgy ?
312  bool isEdgeX = cp.xsize[ic] < 1;
313  bool isEdgeY = cp.ysize[ic] < 1;
314 
315  // is one and big?
316  bool isBig1X = ((0 == sx) && TrackerTraits::isBigPixX(cp.minRow[ic]));
317  bool isBig1Y = ((0 == sy) && TrackerTraits::isBigPixY(cp.minCol[ic]));
318 
319  if (!isEdgeX && !isBig1X) {
320  if (not detParams.isBarrel) {
321  cp.xerr[ic] = sx < std::size(xerr_endcap) ? xerr_endcap[sx] : xerr_endcap_def;
322  } else if (detParams.layer == 1) {
323  cp.xerr[ic] = sx < std::size(xerr_barrel_l1) ? xerr_barrel_l1[sx] : xerr_barrel_l1_def;
324  } else {
325  cp.xerr[ic] = sx < std::size(xerr_barrel_ln) ? xerr_barrel_ln[sx] : xerr_barrel_ln_def;
326  }
327  }
328 
329  if (!isEdgeY && !isBig1Y) {
330  if (not detParams.isBarrel) {
331  cp.yerr[ic] = sy < std::size(yerr_endcap) ? yerr_endcap[sy] : yerr_endcap_def;
332  } else if (detParams.layer == 1) {
333  cp.yerr[ic] = sy < std::size(yerr_barrel_l1) ? yerr_barrel_l1[sy] : yerr_barrel_l1_def;
334  } else {
335  cp.yerr[ic] = sy < std::size(yerr_barrel_ln) ? yerr_barrel_ln[sy] : yerr_barrel_ln_def;
336  }
337  }
338  }

◆ position()

template<typename TrackerTraits >
constexpr void pixelCPEforDevice::position ( CommonParams const &__restrict__  comParams,
DetParams const &__restrict__  detParams,
ClusParams cp,
uint32_t  ic 
)
inline

Definition at line 185 of file pixelCPEforDevice.h.

References funct::abs(), cms::cuda::assert(), computeAnglesFromDet(), ALPAKA_ACCELERATOR_NAMESPACE::brokenline::constexpr(), correction(), f, nano_mu_digi_cff::float, createfilelist::int, reco_skim_cfg_mod::maxSize, SiStripPI::min, Calorimetry_cff::thickness, xsize, and ysize.

188  {
189  constexpr int maxSize = TrackerTraits::maxSizeCluster;
190  //--- Upper Right corner of Lower Left pixel -- in measurement frame
191  uint16_t llx = cp.minRow[ic] + 1;
192  uint16_t lly = cp.minCol[ic] + 1;
193 
194  //--- Lower Left corner of Upper Right pixel -- in measurement frame
195  uint16_t urx = cp.maxRow[ic];
196  uint16_t ury = cp.maxCol[ic];
197 
198  uint16_t llxl = llx, llyl = lly, urxl = urx, uryl = ury;
199 
200  llxl = TrackerTraits::localX(llx);
201  llyl = TrackerTraits::localY(lly);
202  urxl = TrackerTraits::localX(urx);
203  uryl = TrackerTraits::localY(ury);
204 
205  auto mx = llxl + urxl;
206  auto my = llyl + uryl;
207 
208  int xsize = int(urxl) + 2 - int(llxl);
209  int ysize = int(uryl) + 2 - int(llyl);
210  assert(xsize >= 0); // 0 if bixpix...
211  assert(ysize >= 0);
212 
213  if (TrackerTraits::isBigPixX(cp.minRow[ic]))
214  ++xsize;
215  if (TrackerTraits::isBigPixX(cp.maxRow[ic]))
216  ++xsize;
217  if (TrackerTraits::isBigPixY(cp.minCol[ic]))
218  ++ysize;
219  if (TrackerTraits::isBigPixY(cp.maxCol[ic]))
220  ++ysize;
221 
222  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]);
223  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]);
224 
225  xsize = 8 * xsize - unbalanceX;
226  ysize = 8 * ysize - unbalanceY;
227 
228  cp.xsize[ic] = std::min(xsize, maxSize);
229  cp.ysize[ic] = std::min(ysize, maxSize);
230 
231  if (cp.minRow[ic] == 0 || cp.maxRow[ic] == uint32_t(detParams.nRows - 1))
232  cp.xsize[ic] = -cp.xsize[ic];
233 
234  if (cp.minCol[ic] == 0 || cp.maxCol[ic] == uint32_t(detParams.nCols - 1))
235  cp.ysize[ic] = -cp.ysize[ic];
236 
237  // Compute the position relative to the center of the module, taking into account the corrections for
238  // the Phase 1 big pixels, the module pitch, and the Lorentz shift.
239  // Use an explicit FMA instruction instead of simply (position * pitch + shift) to make sure that
240  // different compiler optimizations do not produce different code on different architectures.
241  float xPos = std::fmaf(0.5f * ((float)mx - (float)detParams.nRows) - TrackerTraits::bigPixXCorrection,
242  detParams.thePitchX,
243  detParams.shiftX);
244  float yPos = std::fmaf(0.5f * ((float)my - (float)detParams.nCols) - TrackerTraits::bigPixYCorrection,
245  detParams.thePitchY,
246  detParams.shiftY);
247 
248  float cotalpha = 0, cotbeta = 0;
249 
250  computeAnglesFromDet(detParams, xPos, yPos, cotalpha, cotbeta);
251 
252  auto thickness = detParams.isBarrel ? comParams.theThicknessB : comParams.theThicknessE;
253 
254  auto xCorr = correction(cp.maxRow[ic] - cp.minRow[ic],
255  cp.q_f_X[ic],
256  cp.q_l_X[ic],
257  llxl,
258  urxl,
259  detParams.chargeWidthX, // lorentz shift in cm
260  thickness,
261  cotalpha,
262  detParams.thePitchX,
263  TrackerTraits::isBigPixX(cp.minRow[ic]),
264  TrackerTraits::isBigPixX(cp.maxRow[ic]));
265 
266  auto yCorr = correction(cp.maxCol[ic] - cp.minCol[ic],
267  cp.q_f_Y[ic],
268  cp.q_l_Y[ic],
269  llyl,
270  uryl,
271  detParams.chargeWidthY, // lorentz shift in cm
272  thickness,
273  cotbeta,
274  detParams.thePitchY,
275  TrackerTraits::isBigPixY(cp.minCol[ic]),
276  TrackerTraits::isBigPixY(cp.maxCol[ic]));
277 
278  cp.xpos[ic] = xPos + xCorr;
279  cp.ypos[ic] = yPos + yCorr;
280  }
const Int_t ysize
assert(be >=bs)
constexpr void computeAnglesFromDet(DetParams const &__restrict__ detParams, float const x, float const y, float &cotalpha, float &cotbeta)
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double f[11][100]
const Int_t xsize
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)

Variable Documentation

◆ kGenErrorQBins

constexpr int pixelCPEforDevice::kGenErrorQBins = 5

◆ kNumErrorBins

constexpr int pixelCPEforDevice::kNumErrorBins = 16

◆ MaxHitsInIter

constexpr int32_t pixelCPEforDevice::MaxHitsInIter = pixelClustering::maxHitsInIter()

◆ micronsToCm

constexpr float pixelCPEforDevice::micronsToCm = 1.0e-4f