1 #ifndef RecoLocalTracker_SiPixelRecHits_pixelCPEforGPU_h 2 #define RecoLocalTracker_SiPixelRecHits_pixelCPEforGPU_h 73 template <
typename TrackerTopology>
76 uint8_t
layer[pixelTopology::layerIndexSize<TrackerTopology>];
83 template <
typename TrackerTopology>
110 template <u
int32_t N>
140 DetParams const& __restrict__ detParams,
float const x,
float const y,
float& cotalpha,
float& cotbeta) {
142 auto gvx =
x - detParams.x0;
143 auto gvy = y - detParams.y0;
144 auto gvz = -1.f / detParams.z0;
147 cotalpha = gvx * gvz;
154 uint16_t upper_edge_first_pix,
155 uint16_t lower_edge_last_pix,
172 auto w_inner = pitch *
float(lower_edge_last_pix - upper_edge_first_pix);
175 auto w_pred = theThickness * cot_angle
186 simple = (w_eff < 0.0f) | (w_eff > pitch);
191 float sum_of_edge = 2.0f;
196 w_eff = pitch * 0.5f * sum_of_edge;
200 float qdiff = q_l - q_f;
201 float qsum = q_l + q_f;
207 return 0.5f * (qdiff / qsum) * w_eff;
210 template <
typename TrackerTraits>
215 constexpr
int maxSize = TrackerTraits::maxSizeCluster;
217 uint16_t llx =
cp.minRow[ic] + 1;
218 uint16_t lly =
cp.minCol[ic] + 1;
221 uint16_t urx =
cp.maxRow[ic];
222 uint16_t ury =
cp.maxCol[ic];
224 uint16_t llxl = llx, llyl = lly, urxl = urx, uryl = ury;
226 llxl = TrackerTraits::localX(llx);
227 llyl = TrackerTraits::localY(lly);
228 urxl = TrackerTraits::localX(urx);
229 uryl = TrackerTraits::localY(ury);
231 auto mx = llxl + urxl;
232 auto my = llyl + uryl;
239 if (TrackerTraits::isBigPixX(
cp.minRow[ic]))
241 if (TrackerTraits::isBigPixX(
cp.maxRow[ic]))
243 if (TrackerTraits::isBigPixY(
cp.minCol[ic]))
245 if (TrackerTraits::isBigPixY(
cp.maxCol[ic]))
248 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]);
249 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]);
257 if (
cp.minRow[ic] == 0 ||
cp.maxRow[ic] == uint32_t(detParams.nRows - 1))
258 cp.xsize[ic] = -
cp.xsize[ic];
260 if (
cp.minCol[ic] == 0 ||
cp.maxCol[ic] == uint32_t(detParams.nCols - 1))
261 cp.ysize[ic] = -
cp.ysize[ic];
264 float xoff = 0.5f *
float(detParams.nRows) * comParams.thePitchX;
265 float yoff = 0.5f *
float(detParams.nCols) * comParams.thePitchY;
268 xoff = xoff + TrackerTraits::bigPixXCorrection * comParams.thePitchX;
269 yoff = yoff + TrackerTraits::bigPixYCorrection * comParams.thePitchY;
272 auto xPos = detParams.shiftX + (comParams.thePitchX * 0.5f *
float(mx)) - xoff;
273 auto yPos = detParams.shiftY + (comParams.thePitchY * 0.5f *
float(my)) - yoff;
275 float cotalpha = 0, cotbeta = 0;
279 auto thickness = detParams.isBarrel ? comParams.theThicknessB : comParams.theThicknessE;
286 detParams.chargeWidthX,
290 TrackerTraits::isBigPixX(
cp.minRow[ic]),
291 TrackerTraits::isBigPixX(
cp.maxRow[ic]));
298 detParams.chargeWidthY,
302 TrackerTraits::isBigPixY(
cp.minCol[ic]),
303 TrackerTraits::isBigPixY(
cp.maxCol[ic]));
305 cp.xpos[ic] = xPos + xcorr;
306 cp.ypos[ic] = yPos + ycorr;
309 template <
typename TrackerTraits>
315 cp.xerr[ic] = 0.0050;
316 cp.yerr[ic] = 0.0085;
328 0.00375, 0.00230, 0.00250, 0.00250, 0.00230, 0.00230, 0.00210, 0.00210, 0.00240};
331 0.00375, 0.00230, 0.00250, 0.00250, 0.00230, 0.00230, 0.00210, 0.00210, 0.00240};
335 auto sx =
cp.maxRow[ic] -
cp.minRow[ic];
336 auto sy =
cp.maxCol[ic] -
cp.minCol[ic];
339 bool isEdgeX =
cp.xsize[ic] < 1;
340 bool isEdgeY =
cp.ysize[ic] < 1;
343 bool isBig1X = ((0 ==
sx) && TrackerTraits::isBigPixX(
cp.minRow[ic]));
344 bool isBig1Y = ((0 ==
sy) && TrackerTraits::isBigPixY(
cp.minCol[ic]));
346 if (!isEdgeX && !isBig1X) {
347 if (not detParams.isBarrel) {
349 }
else if (detParams.layer == 1) {
356 if (!isEdgeY && !isBig1Y) {
357 if (not detParams.isBarrel) {
359 }
else if (detParams.layer == 1) {
367 template <
typename TrackerTraits>
373 cp.xerr[ic] = 0.0050f;
374 cp.yerr[ic] = 0.0085f;
376 auto sx =
cp.maxRow[ic] -
cp.minRow[ic];
377 auto sy =
cp.maxCol[ic] -
cp.minCol[ic];
380 bool isEdgeX =
cp.xsize[ic] < 1;
381 bool isEdgeY =
cp.ysize[ic] < 1;
383 bool isOneX = (0 ==
sx);
384 bool isOneY = (0 ==
sy);
385 bool isBigX = TrackerTraits::isBigPixX(
cp.minRow[ic]);
386 bool isBigY = TrackerTraits::isBigPixY(
cp.minCol[ic]);
388 auto ch =
cp.charge[ic];
392 if (ch < detParams.minCh[
bin + 1])
399 cp.status[ic].isOneX = isOneX;
400 cp.status[ic].isBigX = (isOneX & isBigX) | isEdgeX;
401 cp.status[ic].isOneY = isOneY;
402 cp.status[ic].isBigY = (isOneY & isBigY) | isEdgeY;
404 auto xoff = -
float(TrackerTraits::xOffset) * comParams.thePitchX;
409 int jx = std::clamp(bin_value, low_value, high_value);
411 auto toCM = [](uint8_t
x) {
return float(
x) * 1.e-4
f; };
414 cp.xerr[ic] = isOneX ? toCM(isBigX ? detParams.sx2 : detParams.sigmax1[jx])
415 : detParams.xfact[
bin] * toCM(detParams.sigmax[jx]);
418 auto ey =
cp.ysize[ic] > 8 ? detParams.sigmay[
std::min(
cp.ysize[ic] - 9, 15)] : detParams.sy1;
420 cp.yerr[ic] = isOneY ? toCM(isBigY ? detParams.sy2 : detParams.sy1) : detParams.yfact[
bin] * toCM(ey);
426 constexpr
inline void errorFromDB<pixelTopology::Phase2>(
CommonParams const& __restrict__ comParams,
430 errorFromSize<pixelTopology::Phase2>(comParams, detParams,
cp, ic);
435 #endif // RecoLocalTracker_SiPixelRecHits_pixelCPEforGPU_h
uint8_t sigmax[CPEFastParametrisation::kNumErrorBins]
float xfact[CPEFastParametrisation::kGenErrorQBins]
uint8_t sigmax1[CPEFastParametrisation::kNumErrorBins]
constexpr uint32_t numberOfLayers
AverageGeometry const * m_averageGeometry
constexpr AverageGeometry const &__restrict__ averageGeometry() const
uint8_t numberOfLaddersInBarrel
constexpr LayerGeometry const &__restrict__ layerGeometry() const
DetParams const * m_detParams
constexpr int kGenErrorQBins
constexpr DetParams const &__restrict__ detParams(int i) const
constexpr void errorFromSize(CommonParams const &__restrict__ comParams, DetParams const &__restrict__ detParams, ClusParams &cp, uint32_t ic)
CommonParams const * m_commonParams
LayerGeometry const * m_layerGeometry
int minCh[CPEFastParametrisation::kGenErrorQBins]
constexpr uint32_t maxHitsInIter()
__device__ uint8_t layer(uint16_t id) const
Abs< T >::type abs(const T &t)
constexpr void position(CommonParams const &__restrict__ comParams, DetParams const &__restrict__ detParams, ClusParams &cp, uint32_t ic)
constexpr void computeAnglesFromDet(DetParams const &__restrict__ detParams, float const x, float const y, float &cotalpha, float &cotbeta)
constexpr CommonParams const &__restrict__ commonParams() const
constexpr void errorFromDB(CommonParams const &__restrict__ comParams, DetParams const &__restrict__ detParams, ClusParams &cp, uint32_t ic)
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]
uint8_t layer[pixelTopology::layerIndexSize< TrackerTopology >]
uint8_t sigmay[CPEFastParametrisation::kNumErrorBins]
constexpr int kNumErrorBins
constexpr int32_t MaxHitsInIter
uint32_t layerStart[TrackerTopology::numberOfLayers+1]
def cp(fromDir, toDir, listOfFiles, overwrite=False, smallList=False)