1 #ifndef RecoLocalTracker_SiPixelRecHits_pixelCPEforGPU_h 2 #define RecoLocalTracker_SiPixelRecHits_pixelCPEforGPU_h 105 template <u
int32_t N>
135 DetParams const& __restrict__ detParams,
float const x,
float const y,
float& cotalpha,
float& cotbeta) {
137 auto gvx =
x - detParams.x0;
138 auto gvy = y - detParams.y0;
139 auto gvz = -1.f / detParams.z0;
142 cotalpha = gvx * gvz;
149 uint16_t upper_edge_first_pix,
150 uint16_t lower_edge_last_pix,
167 auto w_inner = pitch *
float(lower_edge_last_pix - upper_edge_first_pix);
170 auto w_pred = theThickness * cot_angle
181 simple = (w_eff < 0.0f) | (w_eff > pitch);
186 float sum_of_edge = 2.0f;
191 w_eff = pitch * 0.5f * sum_of_edge;
195 float qdiff = q_l - q_f;
196 float qsum = q_l + q_f;
202 return 0.5f * (qdiff / qsum) * w_eff;
210 uint16_t llx =
cp.minRow[ic] + 1;
211 uint16_t lly =
cp.minCol[ic] + 1;
214 uint16_t urx =
cp.maxRow[ic];
215 uint16_t ury =
cp.maxCol[ic];
217 uint16_t llxl = llx, llyl = lly, urxl = urx, uryl = ury;
218 if (!comParams.isPhase2)
226 auto mx = llxl + urxl;
227 auto my = llyl + uryl;
234 if (!comParams.isPhase2)
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]);
255 cp.xsize[ic] = -
cp.xsize[ic];
257 cp.ysize[ic] = -
cp.ysize[ic];
260 float xoff = 0.5f *
float(detParams.nRows) * comParams.thePitchX;
261 float yoff = 0.5f *
float(detParams.nCols) * comParams.thePitchY;
263 if (!comParams.isPhase2)
265 xoff = xoff + comParams.thePitchX;
266 yoff = yoff + 8.0f * comParams.thePitchY;
269 auto xPos = detParams.shiftX + (comParams.thePitchX * 0.5f *
float(mx)) - xoff;
270 auto yPos = detParams.shiftY + (comParams.thePitchY * 0.5f *
float(my)) - yoff;
272 float cotalpha = 0, cotbeta = 0;
276 auto thickness = detParams.isBarrel ? comParams.theThicknessB : comParams.theThicknessE;
283 detParams.chargeWidthX,
295 detParams.chargeWidthY,
302 cp.xpos[ic] = xPos + xcorr;
303 cp.ypos[ic] = yPos + ycorr;
311 cp.xerr[ic] = 0.0050;
312 cp.yerr[ic] = 0.0085;
327 0.00375, 0.00230, 0.00250, 0.00250, 0.00230, 0.00230, 0.00210, 0.00210, 0.00240};
330 0.00375, 0.00230, 0.00250, 0.00250, 0.00230, 0.00230, 0.00210, 0.00210, 0.00240};
334 auto sx =
cp.maxRow[ic] -
cp.minRow[ic];
335 auto sy =
cp.maxCol[ic] -
cp.minCol[ic];
347 if (not detParams.isBarrel) {
349 }
else if (detParams.layer == 1) {
357 if (not detParams.isBarrel) {
359 }
else if (detParams.layer == 1) {
367 if (not detParams.isBarrel) {
369 }
else if (detParams.layer == 1) {
377 if (not detParams.isBarrel) {
379 }
else if (detParams.layer == 1) {
393 cp.xerr[ic] = 0.0050f;
394 cp.yerr[ic] = 0.0085f;
396 auto sx =
cp.maxRow[ic] -
cp.minRow[ic];
397 auto sy =
cp.maxCol[ic] -
cp.minCol[ic];
403 bool isOneX = (0 ==
sx);
404 bool isOneY = (0 ==
sy);
408 auto ch =
cp.charge[ic];
412 if (ch < detParams.minCh[
bin + 1])
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;
429 int jx = std::clamp(bin_value, low_value, high_value);
431 auto toCM = [](uint8_t
x) {
return float(
x) * 1.e-4; };
434 cp.xerr[ic] = isOneX ? toCM(isBigX ? detParams.sx2 : detParams.sigmax1[jx])
435 : detParams.xfact[
bin] * toCM(detParams.sigmax[jx]);
438 auto ey =
cp.ysize[ic] > 8 ? detParams.sigmay[
std::min(
cp.ysize[ic] - 9, 15)] : detParams.sy1;
440 cp.yerr[ic] = isOneY ? toCM(isBigY ? detParams.sy2 : detParams.sy1) : detParams.yfact[
bin] * toCM(ey);
446 #endif // RecoLocalTracker_SiPixelRecHits_pixelCPEforGPU_h
constexpr uint16_t lastRowInModule
uint8_t sigmax[CPEFastParametrisation::kNumErrorBins]
float xfact[CPEFastParametrisation::kGenErrorQBins]
uint8_t sigmax1[CPEFastParametrisation::kNumErrorBins]
DetParams const * m_detParams
uint8_t numberOfLaddersInBarrel
constexpr uint16_t localY(uint16_t py)
constexpr void position(CommonParams const &__restrict__ comParams, DetParams const &__restrict__ detParams, ClusParams &cp, uint32_t ic)
constexpr int kGenErrorQBins
constexpr uint16_t lastColInModule
constexpr DetParams const &__restrict__ detParams(int i) const
LayerGeometry const * m_layerGeometry
constexpr AverageGeometry const &__restrict__ averageGeometry() const
AverageGeometry const * m_averageGeometry
int minCh[CPEFastParametrisation::kGenErrorQBins]
constexpr uint32_t maxHitsInIter()
uint32_t layerStart[phase2PixelTopology::numberOfLayers+1]
Abs< T >::type abs(const T &t)
constexpr bool isEdgeY(uint16_t py)
constexpr void computeAnglesFromDet(DetParams const &__restrict__ detParams, float const x, float const y, float &cotalpha, float &cotbeta)
constexpr bool isBigPixY(uint16_t py)
constexpr LayerGeometry const &__restrict__ layerGeometry() const
constexpr bool isEdgeX(uint16_t px)
constexpr CommonParams const &__restrict__ commonParams() const
constexpr bool isBigPixX(uint16_t px)
constexpr int16_t xOffset
CommonParams const * m_commonParams
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)
float yfact[CPEFastParametrisation::kGenErrorQBins]
__device__ uint8_t layer(uint16_t id) const
constexpr uint8_t numberOfLayers
constexpr uint16_t layerIndexSize
constexpr void errorFromSize(CommonParams const &__restrict__ comParams, DetParams const &__restrict__ detParams, ClusParams &cp, uint32_t ic)
constexpr void errorFromDB(CommonParams const &__restrict__ comParams, DetParams const &__restrict__ detParams, ClusParams &cp, uint32_t ic)
uint8_t layer[phase2PixelTopology::layerIndexSize]
uint8_t sigmay[CPEFastParametrisation::kNumErrorBins]
constexpr int kNumErrorBins
constexpr int32_t MaxHitsInIter