13 std::pair<float,float>
27 std::ostringstream debugstr;
28 debugstr <<
"py = " << py <<
", m_yoffset = " <<
m_yoffset 29 <<
"px = " << px <<
", m_xoffset = " <<
m_xoffset <<
"\n";
33 debugstr <<
" wrong lp y " << py <<
" " <<
m_yoffset <<
"\n";
34 py = m_yoffset +
EPSCM;
38 debugstr <<
" wrong lp y " << py <<
" " << -
m_yoffset <<
"\n";
39 py = -m_yoffset -
EPSCM;
43 debugstr <<
" wrong lp x " << px <<
" " << m_xoffset <<
"\n";
44 px = m_xoffset +
EPSCM;
48 debugstr <<
" wrong lp x " << px <<
" " << -m_xoffset <<
"\n";
49 px = -m_xoffset -
EPSCM;
52 if( !debugstr.str().empty())
53 LogDebug(
"RectangularPixelTopology" ) << debugstr.str();
54 #endif // EDM_ML_DEBUG 57 int iybin =
int( newybin );
58 float fractionY = newybin - iybin;
75 LogDebug(
"RectangularPixelTopology") <<
" very bad, newbiny " << iybin0 <<
"\n" 77 << newybin <<
" " << iybin <<
" " << fractionY <<
" " << iybin0 <<
" " 80 #endif // EDM_ML_DEBUG 90 fractionY = (fractionY+1.)/2.;
91 }
else if (iybin0==52) {
93 fractionY = fractionY/2.;
94 }
else if (iybin0>1) {
96 }
else if (iybin0==1) {
98 fractionY = (fractionY+1.)/2.;
99 }
else if (iybin0==0) {
101 fractionY = fractionY/2.;
104 mpY =
float(numROC*52. + iybin0) + fractionY;
109 if( mpY < 0. || mpY >= 416. )
111 LogDebug(
"RectangularPixelTopology") <<
" bad pix y " << mpY <<
"\n" 113 << newybin <<
" " << iybin <<
" " << fractionY <<
" " 114 << iybin0 <<
" " << numROC;
116 #endif // EDM_ML_DEBUG 120 int ixbin =
int( newxbin );
121 float fractionX = newxbin - ixbin;
125 if( ixbin > 161 || ixbin < 0 )
127 LogDebug(
"RectangularPixelTopology") <<
" very bad, newbinx " << ixbin <<
"\n" 128 << px <<
" " << m_xoffset <<
" " <<
m_pitchx <<
" " 129 << newxbin <<
" " << ixbin <<
" " << fractionX;
131 #endif // EDM_ML_DEBUG 137 }
else if (ixbin==82) {
139 fractionX = (fractionX+1.)/2.;
140 }
else if (ixbin==81) {
142 fractionX = fractionX/2.;
143 }
else if (ixbin==80) {
145 fractionX = (fractionX+1.)/2.;
146 }
else if (ixbin==79) {
148 fractionX = fractionX/2.;
152 float mpX =
float( ixbin ) + fractionX;
156 if( mpX < 0. || mpX >= 160. )
158 LogDebug(
"RectangularPixelTopology") <<
" bad pix x " << mpX <<
"\n" 159 << px <<
" " << m_xoffset <<
" " <<
m_pitchx <<
" " 160 << newxbin <<
" " << ixbin <<
" " << fractionX;
162 #endif // EDM_ML_DEBUG 164 return std::pair<float, float>( mpX, mpY );
179 std::ostringstream debugstr;
183 debugstr <<
" wrong mp y, fix " << mpy <<
" " << 0 <<
"\n";
188 debugstr <<
" wrong mp y, fix " << mpy <<
" " <<
m_ncols <<
"\n";
193 debugstr <<
" wrong mp x, fix " << mpx <<
" " << 0 <<
"\n";
198 debugstr <<
" wrong mp x, fix " << mpx <<
" " <<
m_nrows <<
"\n";
201 if(! debugstr.str().empty())
202 LogDebug(
"RectangularPixelTopology") << debugstr.str();
203 #endif // EDM_ML_DEBUG 205 float lpY =
localY( mpy );
206 float lpX =
localX( mpx );
219 int binoffx =
int( mpx );
220 float fractionX = mpx -
float(binoffx);
227 LogDebug(
"RectangularPixelTopology") <<
" very bad, binx " << binoffx <<
"\n" 228 << mpx <<
" " << binoffx <<
" " 229 << fractionX <<
" " << local_pitchx <<
" " <<
m_xoffset <<
"\n";
235 }
else if (binoffx==80) {
238 }
else if (binoffx==79) {
248 LogDebug(
"RectangularPixelTopology") <<
" very bad, binx " << binoffx <<
"\n" 249 << mpx <<
" " << binoffx <<
" " 250 << fractionX <<
" " << local_pitchx <<
" " <<
m_xoffset;
259 if( lpX < m_xoffset || lpX > ( -m_xoffset ))
261 LogDebug(
"RectangularPixelTopology") <<
" bad lp x " << lpX <<
"\n" 262 << mpx <<
" " << binoffx <<
" " 263 << fractionX <<
" " << local_pitchx <<
" " <<
m_xoffset;
265 #endif // EDM_ML_DEBUG 275 int binoffy =
int( mpy );
276 float fractionY = mpy -
float(binoffy);
283 LogDebug(
"RectangularPixelTopology" ) <<
" very bad, biny " << binoffy <<
"\n" 284 << mpy <<
" " << binoffy <<
" " << fractionY
285 <<
" " << local_pitchy <<
" " <<
m_yoffset;
289 constexpr int bigYIndeces[]{0,51,52,103,104,155,156,207,208,259,260,311,312,363,364,415,416,511};
290 auto const j = std::lower_bound(
std::begin(bigYIndeces),
std::end(bigYIndeces),binoffy);
291 if (*j==binoffy) local_pitchy *= 2 ;
292 binoffy += (j-bigYIndeces);
300 if( lpY < m_yoffset || lpY > ( -m_yoffset ))
302 LogDebug(
"RectangularPixelTopology" ) <<
" bad lp y " << lpY <<
"\n" 303 << mpy <<
" " << binoffy <<
" " 304 << fractionY <<
" " << local_pitchy <<
" " <<
m_yoffset;
306 #endif // EDM_ML_DEBUG 318 int binoffy=
int(mp.
y());
322 int binoffx=
int(mp.
x());
340 int iybin0 = iybin%54;
342 if( (iybin0<=1) | (iybin0>=52) )
347 if( (ixbin>=79) & (ixbin<=82) ) pitchx = 2.f *
m_pitchx;
LocalError localError(const MeasurementPoint &, const MeasurementError &) const override
Point3DBase< Scalar, LocalTag > LocalPoint
float localY(const float mpY) const override
std::pair< float, float > pixel(const LocalPoint &p) const override
bool isItBigPixelInY(const int iybin) const override
float localX(const float mpX) const override
bool isItBigPixelInX(const int ixbin) const override
MeasurementError measurementError(const LocalPoint &, const LocalError &) const override
LocalPoint localPosition(const MeasurementPoint &mp) const override