1 #ifndef RecoLocalTracker_SiPixelRecHits_interface_pixelCPEforDevice_h 2 #define RecoLocalTracker_SiPixelRecHits_interface_pixelCPEforDevice_h 103 template <
typename TrackerTopology>
106 uint8_t
layer[pixelTopology::layerIndexSize<TrackerTopology>];
114 DetParams const& __restrict__ detParams,
float const x,
float const y,
float& cotalpha,
float& cotbeta) {
116 auto gvx =
x - detParams.x0;
117 auto gvy = y - detParams.y0;
118 auto gvz = -1.f / detParams.z0;
121 cotalpha = gvx * gvz;
128 uint16_t upper_edge_first_pix,
129 uint16_t lower_edge_last_pix,
146 auto w_inner = pitch *
float(lower_edge_last_pix - upper_edge_first_pix);
149 auto w_pred = theThickness * cot_angle
160 simple = (w_eff < 0.0f) | (w_eff > pitch);
165 float sum_of_edge = 2.0f;
170 w_eff = pitch * 0.5f * sum_of_edge;
174 float qdiff = q_l - q_f;
175 float qsum = q_l + q_f;
181 return 0.5f * (qdiff / qsum) * w_eff;
184 template <
typename TrackerTraits>
191 uint16_t llx =
cp.minRow[ic] + 1;
192 uint16_t lly =
cp.minCol[ic] + 1;
195 uint16_t urx =
cp.maxRow[ic];
196 uint16_t ury =
cp.maxCol[ic];
198 uint16_t llxl = llx, llyl = lly, urxl = urx, uryl = ury;
200 llxl = TrackerTraits::localX(llx);
201 llyl = TrackerTraits::localY(lly);
202 urxl = TrackerTraits::localX(urx);
203 uryl = TrackerTraits::localY(ury);
205 auto mx = llxl + urxl;
206 auto my = llyl + uryl;
213 if (TrackerTraits::isBigPixX(
cp.minRow[ic]))
215 if (TrackerTraits::isBigPixX(
cp.maxRow[ic]))
217 if (TrackerTraits::isBigPixY(
cp.minCol[ic]))
219 if (TrackerTraits::isBigPixY(
cp.maxCol[ic]))
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]);
231 if (
cp.minRow[ic] == 0 ||
cp.maxRow[ic] == uint32_t(detParams.nRows - 1))
232 cp.xsize[ic] = -
cp.xsize[ic];
234 if (
cp.minCol[ic] == 0 ||
cp.maxCol[ic] == uint32_t(detParams.nCols - 1))
235 cp.ysize[ic] = -
cp.ysize[ic];
241 float xPos = std::fmaf(0.5
f * ((
float)mx - (
float)detParams.nRows) - TrackerTraits::bigPixXCorrection,
244 float yPos = std::fmaf(0.5
f * ((
float)my - (
float)detParams.nCols) - TrackerTraits::bigPixYCorrection,
248 float cotalpha = 0, cotbeta = 0;
252 auto thickness = detParams.isBarrel ? comParams.theThicknessB : comParams.theThicknessE;
259 detParams.chargeWidthX,
263 TrackerTraits::isBigPixX(
cp.minRow[ic]),
264 TrackerTraits::isBigPixX(
cp.maxRow[ic]));
271 detParams.chargeWidthY,
275 TrackerTraits::isBigPixY(
cp.minCol[ic]),
276 TrackerTraits::isBigPixY(
cp.maxCol[ic]));
278 cp.xpos[ic] = xPos + xCorr;
279 cp.ypos[ic] = yPos + yCorr;
282 template <
typename TrackerTraits>
288 cp.xerr[ic] = 0.0050;
289 cp.yerr[ic] = 0.0085;
301 0.00375, 0.00230, 0.00250, 0.00250, 0.00230, 0.00230, 0.00210, 0.00210, 0.00240};
304 0.00375, 0.00230, 0.00250, 0.00250, 0.00230, 0.00230, 0.00210, 0.00210, 0.00240};
308 auto sx =
cp.maxRow[ic] -
cp.minRow[ic];
309 auto sy =
cp.maxCol[ic] -
cp.minCol[ic];
312 bool isEdgeX =
cp.xsize[ic] < 1;
313 bool isEdgeY =
cp.ysize[ic] < 1;
316 bool isBig1X = ((0 ==
sx) && TrackerTraits::isBigPixX(
cp.minRow[ic]));
317 bool isBig1Y = ((0 ==
sy) && TrackerTraits::isBigPixY(
cp.minCol[ic]));
319 if (!isEdgeX && !isBig1X) {
320 if (not detParams.isBarrel) {
322 }
else if (detParams.layer == 1) {
329 if (!isEdgeY && !isBig1Y) {
330 if (not detParams.isBarrel) {
332 }
else if (detParams.layer == 1) {
340 template <
typename TrackerTraits>
346 cp.xerr[ic] = 0.0050f;
347 cp.yerr[ic] = 0.0085f;
349 auto sx =
cp.maxRow[ic] -
cp.minRow[ic];
350 auto sy =
cp.maxCol[ic] -
cp.minCol[ic];
353 bool isEdgeX =
cp.xsize[ic] < 1;
354 bool isEdgeY =
cp.ysize[ic] < 1;
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]);
361 auto ch =
cp.charge[ic];
365 if (ch < detParams.minCh[
bin + 1])
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;
377 auto xoff = -
float(TrackerTraits::xOffset) * comParams.thePitchX;
382 int jx = std::clamp(bin_value, low_value, high_value);
384 auto toCM = [](uint8_t
x) {
return float(
x) * 1.e-4
f; };
387 cp.xerr[ic] = isOneX ? toCM(isBigX ? detParams.sx2 : detParams.sigmax1[jx])
388 : detParams.xfact[
bin] * toCM(detParams.sigmax[jx]);
391 auto ey =
cp.ysize[ic] > 8 ? detParams.sigmay[
std::min(
cp.ysize[ic] - 9, 15)] : detParams.sy1;
393 cp.yerr[ic] = isOneY ? toCM(isBigY ? detParams.sy2 : detParams.sy1) : detParams.yfact[
bin] * toCM(ey);
403 errorFromSize<pixelTopology::Phase2>(comParams, detParams,
cp, ic);
406 template <
typename TrackerTopology>
432 #endif // RecoLocalTracker_SiPixelRecHits_interface_pixelCPEforDevice_h
constexpr DetParams const &__restrict__ detParams(int i) const
int minCh[kGenErrorQBins]
DetParams & detParams(int i)
constexpr uint8_t layer(uint16_t id) const
constexpr uint32_t numberOfLayers
AverageGeometry & averageGeometry()
constexpr int32_t MaxHitsInIter
constexpr uint32_t maxHitsInIter()
uint8_t layer[pixelTopology::layerIndexSize< TrackerTopology >]
constexpr uint16_t numberOfModules
constexpr void errorFromSize(CommonParams const &__restrict__ comParams, DetParams const &__restrict__ detParams, ClusParams &cp, uint32_t ic)
constexpr int kNumErrorBins
uint8_t sigmax[kNumErrorBins]
constexpr float micronsToCm
AverageGeometry m_averageGeometry
constexpr void computeAnglesFromDet(DetParams const &__restrict__ detParams, float const x, float const y, float &cotalpha, float &cotbeta)
constexpr CommonParams const &__restrict__ commonParams() const
Abs< T >::type abs(const T &t)
uint8_t sigmax1[kNumErrorBins]
float yfact[kGenErrorQBins]
CommonParams & commonParams()
uint8_t sigmay[kNumErrorBins]
float xfact[kGenErrorQBins]
LayerGeometry m_layerGeometry
constexpr LayerGeometry const &__restrict__ layerGeometry() const
constexpr int kGenErrorQBins
CommonParams m_commonParams
DetParams m_detParams[TrackerTopology::numberOfModules]
uint8_t numberOfLaddersInBarrel
constexpr AverageGeometry const &__restrict__ averageGeometry() const
constexpr void position(CommonParams const &__restrict__ comParams, DetParams const &__restrict__ detParams, ClusParams &cp, uint32_t ic)
constexpr uint16_t maxModuleStride
LayerGeometry & layerGeometry()
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)
uint32_t layerStart[TrackerTopology::numberOfLayers+1]
constexpr void errorFromDB(CommonParams const &__restrict__ comParams, DetParams const &__restrict__ detParams, ClusParams &cp, uint32_t ic)
def cp(fromDir, toDir, listOfFiles, overwrite=False, smallList=False)