26 debugstr <<
"py = " << py <<
", m_yoffset = " <<
m_yoffset <<
"px = " << px <<
", m_xoffset = " <<
m_xoffset <<
"\n";
30 debugstr <<
" wrong lp y " << py <<
" " <<
m_yoffset <<
"\n";
31 py = m_yoffset + EPSCM;
34 debugstr <<
" wrong lp y " << py <<
" " << -
m_yoffset <<
"\n";
35 py = -m_yoffset - EPSCM;
39 debugstr <<
" wrong lp x " << px <<
" " << m_xoffset <<
"\n";
40 px = m_xoffset + EPSCM;
42 if (px > -m_xoffset) {
43 debugstr <<
" wrong lp x " << px <<
" " << -m_xoffset <<
"\n";
44 px = -m_xoffset - EPSCM;
47 if (!debugstr.str().empty())
48 LogDebug(
"RectangularPixelTopology") << debugstr.str();
49 #endif // EDM_ML_DEBUG
52 int iybin = int(newybin);
53 float fractionY = newybin - iybin;
68 LogDebug(
"RectangularPixelTopology") <<
" very bad, newbiny " << iybin0 <<
"\n"
70 << iybin <<
" " << fractionY <<
" " << iybin0 <<
" " << numROC;
72 #endif // EDM_ML_DEBUG
75 iybin0 = (iybin % 54);
80 fractionY = (fractionY + 1.) / 2.;
81 }
else if (iybin0 == 52) {
83 fractionY = fractionY / 2.;
84 }
else if (iybin0 > 1) {
86 }
else if (iybin0 == 1) {
88 fractionY = (fractionY + 1.) / 2.;
89 }
else if (iybin0 == 0) {
91 fractionY = fractionY / 2.;
94 mpY = float(numROC * 52. + iybin0) + fractionY;
99 if (mpY < 0. || mpY >= 416.) {
100 LogDebug(
"RectangularPixelTopology") <<
" bad pix y " << mpY <<
"\n"
102 <<
" " << fractionY <<
" " << iybin0 <<
" " << numROC;
104 #endif // EDM_ML_DEBUG
108 int ixbin = int(newxbin);
109 float fractionX = newxbin - ixbin;
113 if (ixbin > 161 || ixbin < 0)
115 LogDebug(
"RectangularPixelTopology") <<
" very bad, newbinx " << ixbin <<
"\n"
116 << px <<
" " << m_xoffset <<
" " <<
m_pitchx <<
" " << newxbin <<
" " << ixbin
119 #endif // EDM_ML_DEBUG
124 }
else if (ixbin == 82) {
126 fractionX = (fractionX + 1.) / 2.;
127 }
else if (ixbin == 81) {
129 fractionX = fractionX / 2.;
130 }
else if (ixbin == 80) {
132 fractionX = (fractionX + 1.) / 2.;
133 }
else if (ixbin == 79) {
135 fractionX = fractionX / 2.;
139 float mpX = float(ixbin) + fractionX;
143 if (mpX < 0. || mpX >= 160.) {
144 LogDebug(
"RectangularPixelTopology") <<
" bad pix x " << mpX <<
"\n"
145 << px <<
" " << m_xoffset <<
" " <<
m_pitchx <<
" " << newxbin <<
" " << ixbin
148 #endif // EDM_ML_DEBUG
150 return std::pair<float, float>(mpX, mpY);
166 debugstr <<
" wrong mp y, fix " << mpy <<
" " << 0 <<
"\n";
170 debugstr <<
" wrong mp y, fix " << mpy <<
" " <<
m_ncols <<
"\n";
171 mpy = float(m_ncols) -
EPS;
174 debugstr <<
" wrong mp x, fix " << mpx <<
" " << 0 <<
"\n";
178 debugstr <<
" wrong mp x, fix " << mpx <<
" " <<
m_nrows <<
"\n";
179 mpx = float(m_nrows) -
EPS;
181 if (!debugstr.str().empty())
182 LogDebug(
"RectangularPixelTopology") << debugstr.str();
183 #endif // EDM_ML_DEBUG
197 int binoffx = int(mpx);
198 float fractionX = mpx - float(binoffx);
205 LogDebug(
"RectangularPixelTopology")
206 <<
" very bad, binx " << binoffx <<
"\n"
207 << mpx <<
" " << binoffx <<
" " << fractionX <<
" " << local_pitchx <<
" " <<
m_xoffset <<
"\n";
212 binoffx = binoffx + 2;
213 }
else if (binoffx == 80) {
214 binoffx = binoffx + 1;
216 }
else if (binoffx == 79) {
217 binoffx = binoffx + 0;
226 LogDebug(
"RectangularPixelTopology")
227 <<
" very bad, binx " << binoffx <<
"\n"
228 << mpx <<
" " << binoffx <<
" " << fractionX <<
" " << local_pitchx <<
" " <<
m_xoffset;
237 if (lpX < m_xoffset || lpX > (-m_xoffset)) {
238 LogDebug(
"RectangularPixelTopology") <<
" bad lp x " << lpX <<
"\n"
239 << mpx <<
" " << binoffx <<
" " << fractionX <<
" " << local_pitchx <<
" "
242 #endif // EDM_ML_DEBUG
250 int binoffy = int(mpy);
251 float fractionY = mpy - float(binoffy);
258 LogDebug(
"RectangularPixelTopology")
259 <<
" very bad, biny " << binoffy <<
"\n"
260 << mpy <<
" " << binoffy <<
" " << fractionY <<
" " << local_pitchy <<
" " <<
m_yoffset;
264 constexpr
int bigYIndeces[]{0, 51, 52, 103, 104, 155, 156, 207, 208, 259, 260, 311, 312, 363, 364, 415, 416, 511};
268 binoffy += (
j - bigYIndeces);
276 if (lpY < m_yoffset || lpY > (-m_yoffset)) {
277 LogDebug(
"RectangularPixelTopology") <<
" bad lp y " << lpY <<
"\n"
278 << mpy <<
" " << binoffy <<
" " << fractionY <<
" " << local_pitchy <<
" "
281 #endif // EDM_ML_DEBUG
290 int binoffy = int(mp.
y());
295 int binoffx = int(mp.
x());
299 return LocalError(me.
uu() * float(pitchx * pitchx), 0, me.
vv() * float(pitchy * pitchy));
310 int iybin0 = iybin % 54;
312 if ((iybin0 <= 1) | (iybin0 >= 52))
317 if ((ixbin >= 79) & (ixbin <= 82))
LocalPoint localPosition(const MeasurementPoint &mp) const override
Point3DBase< Scalar, LocalTag > LocalPoint
std::pair< float, float > pixel(const LocalPoint &p) const override
MeasurementError measurementError(const LocalPoint &, const LocalError &) const override
bool isItBigPixelInX(const int ixbin) const override
float localY(const float mpY) const override
__host__ __device__ constexpr RandomIt lower_bound(RandomIt first, RandomIt last, const T &value, Compare comp={})
bool isItBigPixelInY(const int iybin) const override
float localX(const float mpX) const override
LocalError localError(const MeasurementPoint &, const MeasurementError &) const override