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];
238 float xoff = 0.5f *
float(detParams.nRows) * comParams.thePitchX;
239 float yoff = 0.5f *
float(detParams.nCols) * comParams.thePitchY;
242 xoff = xoff + TrackerTraits::bigPixXCorrection * comParams.thePitchX;
243 yoff = yoff + TrackerTraits::bigPixYCorrection * comParams.thePitchY;
246 auto xPos = detParams.shiftX + (comParams.thePitchX * 0.5f *
float(mx)) - xoff;
247 auto yPos = detParams.shiftY + (comParams.thePitchY * 0.5f *
float(my)) - yoff;
249 float cotalpha = 0, cotbeta = 0;
253 auto thickness = detParams.isBarrel ? comParams.theThicknessB : comParams.theThicknessE;
260 detParams.chargeWidthX,
264 TrackerTraits::isBigPixX(
cp.minRow[ic]),
265 TrackerTraits::isBigPixX(
cp.maxRow[ic]));
272 detParams.chargeWidthY,
276 TrackerTraits::isBigPixY(
cp.minCol[ic]),
277 TrackerTraits::isBigPixY(
cp.maxCol[ic]));
279 cp.xpos[ic] = xPos + xcorr;
280 cp.ypos[ic] = yPos + ycorr;
283 template <
typename TrackerTraits>
289 cp.xerr[ic] = 0.0050;
290 cp.yerr[ic] = 0.0085;
302 0.00375, 0.00230, 0.00250, 0.00250, 0.00230, 0.00230, 0.00210, 0.00210, 0.00240};
305 0.00375, 0.00230, 0.00250, 0.00250, 0.00230, 0.00230, 0.00210, 0.00210, 0.00240};
309 auto sx =
cp.maxRow[ic] -
cp.minRow[ic];
310 auto sy =
cp.maxCol[ic] -
cp.minCol[ic];
313 bool isEdgeX =
cp.xsize[ic] < 1;
314 bool isEdgeY =
cp.ysize[ic] < 1;
317 bool isBig1X = ((0 ==
sx) && TrackerTraits::isBigPixX(
cp.minRow[ic]));
318 bool isBig1Y = ((0 ==
sy) && TrackerTraits::isBigPixY(
cp.minCol[ic]));
320 if (!isEdgeX && !isBig1X) {
321 if (not detParams.isBarrel) {
323 }
else if (detParams.layer == 1) {
330 if (!isEdgeY && !isBig1Y) {
331 if (not detParams.isBarrel) {
333 }
else if (detParams.layer == 1) {
341 template <
typename TrackerTraits>
347 cp.xerr[ic] = 0.0050f;
348 cp.yerr[ic] = 0.0085f;
350 auto sx =
cp.maxRow[ic] -
cp.minRow[ic];
351 auto sy =
cp.maxCol[ic] -
cp.minCol[ic];
354 bool isEdgeX =
cp.xsize[ic] < 1;
355 bool isEdgeY =
cp.ysize[ic] < 1;
357 bool isOneX = (0 ==
sx);
358 bool isOneY = (0 ==
sy);
359 bool isBigX = TrackerTraits::isBigPixX(
cp.minRow[ic]);
360 bool isBigY = TrackerTraits::isBigPixY(
cp.minCol[ic]);
362 auto ch =
cp.charge[ic];
366 if (ch < detParams.minCh[
bin + 1])
373 cp.status[ic].isOneX = isOneX;
374 cp.status[ic].isBigX = (isOneX & isBigX) | isEdgeX;
375 cp.status[ic].isOneY = isOneY;
376 cp.status[ic].isBigY = (isOneY & isBigY) | isEdgeY;
378 auto xoff = -
float(TrackerTraits::xOffset) * comParams.thePitchX;
383 int jx = std::clamp(bin_value, low_value, high_value);
385 auto toCM = [](uint8_t
x) {
return float(
x) * 1.e-4
f; };
388 cp.xerr[ic] = isOneX ? toCM(isBigX ? detParams.sx2 : detParams.sigmax1[jx])
389 : detParams.xfact[
bin] * toCM(detParams.sigmax[jx]);
392 auto ey =
cp.ysize[ic] > 8 ? detParams.sigmay[
std::min(
cp.ysize[ic] - 9, 15)] : detParams.sy1;
394 cp.yerr[ic] = isOneY ? toCM(isBigY ? detParams.sy2 : detParams.sy1) : detParams.yfact[
bin] * toCM(ey);
404 errorFromSize<pixelTopology::Phase2>(comParams, detParams,
cp, ic);
407 template <
typename TrackerTopology>
433 #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)