13 std::pair<float,float>
20 LogDebug(
"RectangularMTDTopology").log( [&](
auto & debugstr) {
26 debugstr <<
"py = " << py <<
", m_yoffset = " <<
m_yoffset 27 <<
"px = " << px <<
", m_xoffset = " <<
m_xoffset <<
"\n";
31 debugstr <<
" wrong lp y " << py <<
" " <<
m_yoffset <<
"\n";
32 py = m_yoffset +
EPSCM;
36 debugstr <<
" wrong lp y " << py <<
" " << -
m_yoffset <<
"\n";
37 py = -m_yoffset -
EPSCM;
41 debugstr <<
" wrong lp x " << px <<
" " << m_xoffset <<
"\n";
42 px = m_xoffset +
EPSCM;
46 debugstr <<
" wrong lp x " << px <<
" " << -m_xoffset <<
"\n";
47 px = -m_xoffset -
EPSCM;
52 int iybin =
int( newybin );
53 float fractionY = newybin - iybin;
70 LogDebug(
"RectangularMTDTopology") <<
" very bad, newbiny " << iybin0 <<
"\n" 72 << newybin <<
" " << iybin <<
" " << fractionY <<
" " << iybin0 <<
" " 75 #endif // EDM_ML_DEBUG 85 fractionY = (fractionY+1.)/2.;
86 }
else if (iybin0==52) {
88 fractionY = fractionY/2.;
89 }
else if (iybin0>1) {
91 }
else if (iybin0==1) {
93 fractionY = (fractionY+1.)/2.;
94 }
else if (iybin0==0) {
96 fractionY = fractionY/2.;
99 mpY =
float(numROC*52. + iybin0) + fractionY;
104 if( mpY < 0. || mpY >= 416. )
106 LogDebug(
"RectangularMTDTopology") <<
" bad pix y " << mpY <<
"\n" 108 << newybin <<
" " << iybin <<
" " << fractionY <<
" " 109 << iybin0 <<
" " << numROC;
111 #endif // EDM_ML_DEBUG 115 int ixbin =
int( newxbin );
116 float fractionX = newxbin - ixbin;
120 if( ixbin > 161 || ixbin < 0 )
122 LogDebug(
"RectangularMTDTopology") <<
" very bad, newbinx " << ixbin <<
"\n" 124 << newxbin <<
" " << ixbin <<
" " << fractionX;
126 #endif // EDM_ML_DEBUG 132 }
else if (ixbin==82) {
134 fractionX = (fractionX+1.)/2.;
135 }
else if (ixbin==81) {
137 fractionX = fractionX/2.;
138 }
else if (ixbin==80) {
140 fractionX = (fractionX+1.)/2.;
141 }
else if (ixbin==79) {
143 fractionX = fractionX/2.;
147 float mpX =
float( ixbin ) + fractionX;
151 if( mpX < 0. || mpX >= 160. )
153 LogDebug(
"RectangularMTDTopology") <<
" bad pix x " << mpX <<
"\n" 155 << newxbin <<
" " << ixbin <<
" " << fractionX;
157 #endif // EDM_ML_DEBUG 159 return std::pair<float, float>( mpX, mpY );
174 std::ostringstream debugstr;
178 debugstr <<
" wrong mp y, fix " << mpy <<
" " << 0 <<
"\n";
183 debugstr <<
" wrong mp y, fix " << mpy <<
" " <<
m_ncols <<
"\n";
188 debugstr <<
" wrong mp x, fix " << mpx <<
" " << 0 <<
"\n";
193 debugstr <<
" wrong mp x, fix " << mpx <<
" " <<
m_nrows <<
"\n";
196 if(! debugstr.str().empty())
197 LogDebug(
"RectangularMTDTopology") << debugstr.str();
198 #endif // EDM_ML_DEBUG 200 float lpY =
localY( mpy );
201 float lpX =
localX( mpx );
214 int binoffx =
int( mpx );
215 float fractionX = mpx -
float(binoffx);
222 LogDebug(
"RectangularMTDTopology") <<
" very bad, binx " << binoffx <<
"\n" 223 << mpx <<
" " << binoffx <<
" " 224 << fractionX <<
" " << local_pitchx <<
" " <<
m_xoffset <<
"\n";
230 }
else if (binoffx==80) {
233 }
else if (binoffx==79) {
243 LogDebug(
"RectangularMTDTopology") <<
" very bad, binx " << binoffx <<
"\n" 244 << mpx <<
" " << binoffx <<
" " 245 << fractionX <<
" " << local_pitchx <<
" " <<
m_xoffset;
254 if( lpX < m_xoffset || lpX > ( -m_xoffset ))
256 LogDebug(
"RectangularMTDTopology") <<
" bad lp x " << lpX <<
"\n" 257 << mpx <<
" " << binoffx <<
" " 258 << fractionX <<
" " << local_pitchx <<
" " <<
m_xoffset;
260 #endif // EDM_ML_DEBUG 270 int binoffy =
int( mpy );
271 float fractionY = mpy -
float(binoffy);
278 LogDebug(
"RectangularMTDTopology" ) <<
" very bad, biny " << binoffy <<
"\n" 279 << mpy <<
" " << binoffy <<
" " << fractionY
280 <<
" " << local_pitchy <<
" " <<
m_yoffset;
284 constexpr int bigYIndeces[]{0,51,52,103,104,155,156,207,208,259,260,311,312,363,364,415,416,511};
285 auto const j = std::lower_bound(
std::begin(bigYIndeces),
std::end(bigYIndeces),binoffy);
286 if (*j==binoffy) local_pitchy *= 2 ;
287 binoffy += (j-bigYIndeces);
295 if( lpY < m_yoffset || lpY > ( -m_yoffset ))
297 LogDebug(
"RectangularMTDTopology" ) <<
" bad lp y " << lpY <<
"\n" 298 << mpy <<
" " << binoffy <<
" " 299 << fractionY <<
" " << local_pitchy <<
" " <<
m_yoffset;
301 #endif // EDM_ML_DEBUG 313 int binoffy=
int(mp.
y());
317 int binoffx=
int(mp.
x());
335 int iybin0 = iybin%54;
337 if( (iybin0<=1) | (iybin0>=52) )
342 if( (ixbin>=79) & (ixbin<=82) ) pitchx = 2.f *
m_pitchx;
Point3DBase< Scalar, LocalTag > LocalPoint
bool isItBigPixelInX(const int ixbin) const override
float localX(const float mpX) const override
LocalError localError(const MeasurementPoint &, const MeasurementError &) const override
bool isItBigPixelInY(const int iybin) const override
LocalPoint localPosition(const MeasurementPoint &mp) const override
std::pair< float, float > pixel(const LocalPoint &p) const override
float localY(const float mpY) const override
MeasurementError measurementError(const LocalPoint &, const LocalError &) const override