CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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

Definition at line 120 of file pixelCPEforGPU.h.

using pixelCPEforGPU::Frame = typedef SOAFrame<float>

Definition at line 27 of file pixelCPEforGPU.h.

using pixelCPEforGPU::Rotation = typedef SOARotation<float>

Definition at line 28 of file pixelCPEforGPU.h.

Definition at line 26 of file pixelCPEforGPU.h.

Function Documentation

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

Definition at line 122 of file pixelCPEforGPU.h.

Referenced by position().

123  {
124  // x,y local position on det
125  auto gvx = x - detParams.x0;
126  auto gvy = y - detParams.y0;
127  auto gvz = -1.f / detParams.z0;
128  // normalization not required as only ratio used...
129  // calculate angles
130  cotalpha = gvx * gvz;
131  cotbeta = gvy * gvz;
132  }
uint16_t const *__restrict__ x
Definition: gpuClustering.h:39
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 134 of file pixelCPEforGPU.h.

References funct::abs().

Referenced by FlavorJetCorrectionExample::analyze(), PartonJetCorrectionExample::analyze(), SiStripApvGainBuilderFromTag::analyze(), l1t::Stage2Layer2JetAlgorithmFirmwareImp1::calibrate(), TauJetCorrector::correction(), LXXXCorrector::correction(), reco::JetCorrectorImpl::correction(), PFRecoTauDiscriminationByHPSSelection::discriminate(), PFEnergyCalibration::EcorrBarrel(), RealisticHitToClusterAssociator::findAndMergeInvisibleClusters(), CSCChamberFitter::fit(), StubPtConsistency::getConsistency(), CastorPulseContainmentCorrection::getCorrection(), HcalPulseContainmentCorrection::getCorrection(), ZeeCalibration::getEtaCorrection(), HiEvtPlaneFlatten::getFlatPsi(), CalorimetryManager::HDShowerSimulation(), PixelTripletLargeTipGenerator::hitTriplets(), PixelTripletHLTGenerator::hitTriplets(), pat::muonRelMiniIsoPUCorrected(), position(), reco::CorrectedJetProducer< T >::produce(), cms::JetCorrectionProducer< T >::produce(), tmtt::KFbase::residual(), EnergyScaleCorrection_class::ScaleCorrection(), and CSCOverlapsAlignmentAlgorithm::terminate().

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

Definition at line 333 of file pixelCPEforGPU.h.

References newFWLiteAna::bin, pixelCPEforGPU::ClusParamsT< N >::charge, validate-o2o-wbm::f, phase1PixelTopology::isBigPixX(), phase1PixelTopology::isBigPixY(), SiPixelHitStatus::isBigX, SiPixelHitStatus::isBigY, phase1PixelTopology::isEdgeX(), phase1PixelTopology::isEdgeY(), SiPixelHitStatus::isOneX, SiPixelHitStatus::isOneY, CPEFastParametrisation::kGenErrorQBins, CPEFastParametrisation::kNumErrorBins, pixelCPEforGPU::ClusParamsT< N >::maxCol, pixelCPEforGPU::ClusParamsT< N >::maxRow, min(), pixelCPEforGPU::ClusParamsT< N >::minCol, pixelCPEforGPU::ClusParamsT< N >::minRow, SiPixelHitStatus::qBin, pixelCPEforGPU::ClusParamsT< N >::status, pixelCPEforGPU::ClusParamsT< N >::xerr, phase1PixelTopology::xOffset, pixelCPEforGPU::ClusParamsT< N >::xpos, pixelCPEforGPU::ClusParamsT< N >::xsize, pixelCPEforGPU::ClusParamsT< N >::yerr, and pixelCPEforGPU::ClusParamsT< N >::ysize.

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

336  {
337  // Edge cluster errors
338  cp.xerr[ic] = 0.0050f;
339  cp.yerr[ic] = 0.0085f;
340 
341  auto sx = cp.maxRow[ic] - cp.minRow[ic];
342  auto sy = cp.maxCol[ic] - cp.minCol[ic];
343 
344  // is edgy ? (size is set negative: see above)
345  bool isEdgeX = cp.xsize[ic] < 1;
346  bool isEdgeY = cp.ysize[ic] < 1;
347  // is one and big?
348  bool isOneX = (0 == sx);
349  bool isOneY = (0 == sy);
350  bool isBigX = phase1PixelTopology::isBigPixX(cp.minRow[ic]);
351  bool isBigY = phase1PixelTopology::isBigPixY(cp.minCol[ic]);
352 
353  auto ch = cp.charge[ic];
354  auto bin = 0;
356  // find first bin which minimum charge exceeds cluster charge
357  if (ch < detParams.minCh[bin + 1])
358  break;
359 
360  // in detParams qBins are reversed bin0 -> smallest charge, bin4-> largest charge
361  // whereas in CondFormats/SiPixelTransient/src/SiPixelGenError.cc it is the opposite
362  // so we reverse the bin here -> kGenErrorQBins - 1 - bin
363  cp.status[ic].qBin = CPEFastParametrisation::kGenErrorQBins - 1 - bin;
364  cp.status[ic].isOneX = isOneX;
365  cp.status[ic].isBigX = (isOneX & isBigX) | isEdgeX;
366  cp.status[ic].isOneY = isOneY;
367  cp.status[ic].isBigY = (isOneY & isBigY) | isEdgeY;
368 
369  auto xoff = -float(phase1PixelTopology::xOffset) * comParams.thePitchX;
370  int low_value = 0;
371  int high_value = CPEFastParametrisation::kNumErrorBins - 1;
372  int bin_value = float(CPEFastParametrisation::kNumErrorBins) * (cp.xpos[ic] + xoff) / (2.f * xoff);
373  // return estimated bin value truncated to [0, 15]
374  int jx = std::clamp(bin_value, low_value, high_value);
375 
376  auto toCM = [](uint8_t x) { return float(x) * 1.e-4f; };
377 
378  if (not isEdgeX) {
379  cp.xerr[ic] = isOneX ? toCM(isBigX ? detParams.sx2 : detParams.sigmax1[jx])
380  : detParams.xfact[bin] * toCM(detParams.sigmax[jx]);
381  }
382 
383  auto ey = cp.ysize[ic] > 8 ? detParams.sigmay[std::min(cp.ysize[ic] - 9, 15)] : detParams.sy1;
384  if (not isEdgeY) {
385  cp.yerr[ic] = isOneY ? toCM(isBigY ? detParams.sy2 : detParams.sy1) : detParams.yfact[bin] * toCM(ey);
386  }
387  }
constexpr int kGenErrorQBins
uint16_t const *__restrict__ x
Definition: gpuClustering.h:39
constexpr bool isEdgeY(uint16_t py)
T min(T a, T b)
Definition: MathUtil.h:58
constexpr bool isBigPixY(uint16_t py)
constexpr bool isEdgeX(uint16_t px)
constexpr bool isBigPixX(uint16_t px)
constexpr int16_t xOffset
constexpr int kNumErrorBins
constexpr void pixelCPEforGPU::errorFromSize ( CommonParams const &__restrict__  comParams,
DetParams const &__restrict__  detParams,
ClusParams &  cp,
uint32_t  ic 
)
inline

Definition at line 278 of file pixelCPEforGPU.h.

References phase1PixelTopology::isBigPixX(), phase1PixelTopology::isBigPixY(), phase1PixelTopology::isEdgeX(), phase1PixelTopology::isEdgeY(), pixelCPEforGPU::ClusParamsT< N >::maxCol, pixelCPEforGPU::ClusParamsT< N >::maxRow, pixelCPEforGPU::ClusParamsT< N >::minCol, pixelCPEforGPU::ClusParamsT< N >::minRow, findQualityFiles::size, pixelCPEforGPU::ClusParamsT< N >::xerr, HLT_FULL_cff::xerr_barrel_l1, HLT_FULL_cff::xerr_barrel_l1_def, HLT_FULL_cff::xerr_barrel_ln, HLT_FULL_cff::xerr_barrel_ln_def, HLT_FULL_cff::xerr_endcap, HLT_FULL_cff::xerr_endcap_def, pixelCPEforGPU::ClusParamsT< N >::xsize, pixelCPEforGPU::ClusParamsT< N >::yerr, HLT_FULL_cff::yerr_barrel_l1, HLT_FULL_cff::yerr_barrel_l1_def, HLT_FULL_cff::yerr_barrel_ln, HLT_FULL_cff::yerr_barrel_ln_def, HLT_FULL_cff::yerr_endcap, HLT_FULL_cff::yerr_endcap_def, and pixelCPEforGPU::ClusParamsT< N >::ysize.

281  {
282  // Edge cluster errors
283  cp.xerr[ic] = 0.0050;
284  cp.yerr[ic] = 0.0085;
285 
286  // FIXME these are errors form Run1
287  constexpr float xerr_barrel_l1[] = {0.00115, 0.00120, 0.00088};
288  constexpr float xerr_barrel_l1_def = 0.00200; // 0.01030;
289  constexpr float yerr_barrel_l1[] = {
290  0.00375, 0.00230, 0.00250, 0.00250, 0.00230, 0.00230, 0.00210, 0.00210, 0.00240};
291  constexpr float yerr_barrel_l1_def = 0.00210;
292  constexpr float xerr_barrel_ln[] = {0.00115, 0.00120, 0.00088};
293  constexpr float xerr_barrel_ln_def = 0.00200; // 0.01030;
294  constexpr float yerr_barrel_ln[] = {
295  0.00375, 0.00230, 0.00250, 0.00250, 0.00230, 0.00230, 0.00210, 0.00210, 0.00240};
296  constexpr float yerr_barrel_ln_def = 0.00210;
297  constexpr float xerr_endcap[] = {0.0020, 0.0020};
298  constexpr float xerr_endcap_def = 0.0020;
299  constexpr float yerr_endcap[] = {0.00210};
300  constexpr float yerr_endcap_def = 0.00210;
301 
302  auto sx = cp.maxRow[ic] - cp.minRow[ic];
303  auto sy = cp.maxCol[ic] - cp.minCol[ic];
304 
305  // is edgy ?
306  bool isEdgeX = cp.xsize[ic] < 1;
307  bool isEdgeY = cp.ysize[ic] < 1;
308  // is one and big?
309  bool isBig1X = (0 == sx) && phase1PixelTopology::isBigPixX(cp.minRow[ic]);
310  bool isBig1Y = (0 == sy) && phase1PixelTopology::isBigPixY(cp.minCol[ic]);
311 
312  if (!isEdgeX && !isBig1X) {
313  if (not detParams.isBarrel) {
314  cp.xerr[ic] = sx < std::size(xerr_endcap) ? xerr_endcap[sx] : xerr_endcap_def;
315  } else if (detParams.layer == 1) {
316  cp.xerr[ic] = sx < std::size(xerr_barrel_l1) ? xerr_barrel_l1[sx] : xerr_barrel_l1_def;
317  } else {
318  cp.xerr[ic] = sx < std::size(xerr_barrel_ln) ? xerr_barrel_ln[sx] : xerr_barrel_ln_def;
319  }
320  }
321 
322  if (!isEdgeY && !isBig1Y) {
323  if (not detParams.isBarrel) {
324  cp.yerr[ic] = sy < std::size(yerr_endcap) ? yerr_endcap[sy] : yerr_endcap_def;
325  } else if (detParams.layer == 1) {
326  cp.yerr[ic] = sy < std::size(yerr_barrel_l1) ? yerr_barrel_l1[sy] : yerr_barrel_l1_def;
327  } else {
328  cp.yerr[ic] = sy < std::size(yerr_barrel_ln) ? yerr_barrel_ln[sy] : yerr_barrel_ln_def;
329  }
330  }
331  }
tuple xerr_barrel_ln_def
tuple xerr_barrel_l1_def
tuple yerr_barrel_ln
tuple yerr_barrel_ln_def
tuple xerr_endcap_def
tuple yerr_barrel_l1
constexpr bool isEdgeY(uint16_t py)
tuple xerr_barrel_l1
tuple yerr_endcap_def
constexpr bool isBigPixY(uint16_t py)
constexpr bool isEdgeX(uint16_t px)
constexpr bool isBigPixX(uint16_t px)
tuple xerr_barrel_ln
tuple size
Write out results.
tuple yerr_barrel_l1_def
constexpr void pixelCPEforGPU::position ( CommonParams const &__restrict__  comParams,
DetParams const &__restrict__  detParams,
ClusParams &  cp,
uint32_t  ic 
)
inline

Definition at line 193 of file pixelCPEforGPU.h.

References funct::abs(), cms::cuda::assert(), computeAnglesFromDet(), correction(), phase1PixelTopology::isBigPixX(), phase1PixelTopology::isBigPixY(), phase1PixelTopology::lastColInModule, phase1PixelTopology::lastRowInModule, phase1PixelTopology::localX(), phase1PixelTopology::localY(), pixelCPEforGPU::ClusParamsT< N >::maxCol, pixelCPEforGPU::ClusParamsT< N >::maxRow, min(), pixelCPEforGPU::ClusParamsT< N >::minCol, pixelCPEforGPU::ClusParamsT< N >::minRow, pixelCPEforGPU::ClusParamsT< N >::q_f_X, pixelCPEforGPU::ClusParamsT< N >::q_f_Y, pixelCPEforGPU::ClusParamsT< N >::q_l_X, pixelCPEforGPU::ClusParamsT< N >::q_l_Y, TrackerMaterial_cfi::thickness, phase1PixelTopology::xOffset, pixelCPEforGPU::ClusParamsT< N >::xpos, xsize, pixelCPEforGPU::ClusParamsT< N >::xsize, phase1PixelTopology::yOffset, pixelCPEforGPU::ClusParamsT< N >::ypos, ysize, and pixelCPEforGPU::ClusParamsT< N >::ysize.

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

196  {
197  //--- Upper Right corner of Lower Left pixel -- in measurement frame
198  uint16_t llx = cp.minRow[ic] + 1;
199  uint16_t lly = cp.minCol[ic] + 1;
200 
201  //--- Lower Left corner of Upper Right pixel -- in measurement frame
202  uint16_t urx = cp.maxRow[ic];
203  uint16_t ury = cp.maxCol[ic];
204 
205  auto llxl = phase1PixelTopology::localX(llx);
206  auto llyl = phase1PixelTopology::localY(lly);
207  auto urxl = phase1PixelTopology::localX(urx);
208  auto uryl = phase1PixelTopology::localY(ury);
209 
210  auto mx = llxl + urxl;
211  auto my = llyl + uryl;
212 
213  auto xsize = int(urxl) + 2 - int(llxl);
214  auto ysize = int(uryl) + 2 - int(llyl);
215  assert(xsize >= 0); // 0 if bixpix...
216  assert(ysize >= 0);
217 
218  if (phase1PixelTopology::isBigPixX(cp.minRow[ic]))
219  ++xsize;
220  if (phase1PixelTopology::isBigPixX(cp.maxRow[ic]))
221  ++xsize;
222  if (phase1PixelTopology::isBigPixY(cp.minCol[ic]))
223  ++ysize;
224  if (phase1PixelTopology::isBigPixY(cp.maxCol[ic]))
225  ++ysize;
226 
227  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]);
228  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]);
229  xsize = 8 * xsize - unbalanceX;
230  ysize = 8 * ysize - unbalanceY;
231 
232  cp.xsize[ic] = std::min(xsize, 1023);
233  cp.ysize[ic] = std::min(ysize, 1023);
234 
235  if (cp.minRow[ic] == 0 || cp.maxRow[ic] == phase1PixelTopology::lastRowInModule)
236  cp.xsize[ic] = -cp.xsize[ic];
237  if (cp.minCol[ic] == 0 || cp.maxCol[ic] == phase1PixelTopology::lastColInModule)
238  cp.ysize[ic] = -cp.ysize[ic];
239 
240  // apply the lorentz offset correction
241  auto xPos = detParams.shiftX + comParams.thePitchX * (0.5f * float(mx) + float(phase1PixelTopology::xOffset));
242  auto yPos = detParams.shiftY + comParams.thePitchY * (0.5f * float(my) + float(phase1PixelTopology::yOffset));
243 
244  float cotalpha = 0, cotbeta = 0;
245 
246  computeAnglesFromDet(detParams, xPos, yPos, cotalpha, cotbeta);
247 
248  auto thickness = detParams.isBarrel ? comParams.theThicknessB : comParams.theThicknessE;
249 
250  auto xcorr = correction(cp.maxRow[ic] - cp.minRow[ic],
251  cp.q_f_X[ic],
252  cp.q_l_X[ic],
253  llxl,
254  urxl,
255  detParams.chargeWidthX, // lorentz shift in cm
256  thickness,
257  cotalpha,
258  comParams.thePitchX,
260  phase1PixelTopology::isBigPixX(cp.maxRow[ic]));
261 
262  auto ycorr = correction(cp.maxCol[ic] - cp.minCol[ic],
263  cp.q_f_Y[ic],
264  cp.q_l_Y[ic],
265  llyl,
266  uryl,
267  detParams.chargeWidthY, // lorentz shift in cm
268  thickness,
269  cotbeta,
270  comParams.thePitchY,
272  phase1PixelTopology::isBigPixY(cp.maxCol[ic]));
273 
274  cp.xpos[ic] = xPos + xcorr;
275  cp.ypos[ic] = yPos + ycorr;
276  }
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)
T min(T a, T b)
Definition: MathUtil.h:58
constexpr bool isBigPixY(uint16_t py)
constexpr bool isBigPixX(uint16_t px)
constexpr int16_t xOffset
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
constexpr int16_t yOffset

Variable Documentation

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

Definition at line 119 of file pixelCPEforGPU.h.

Referenced by gpuPixelRecHits::__attribute__().