16 const int& ROWS_PER_ROC,
const int& COLS_PER_ROC) {
25 << BIG_PIX_PER_ROC_X <<
", BIG_PIX_PER_ROC_Y " << BIG_PIX_PER_ROC_Y <<
", ROWS_PER_ROC " 26 << ROWS_PER_ROC <<
", COLS_PER_ROC " << COLS_PER_ROC <<
", ROCS_X " <<
m_ROCS_X <<
", ROCS_Y " <<
m_ROCS_Y 34 std::pair<float,float>
41 LogDebug(
"RectangularMTDTopology").log( [&](
auto & debugstr) {
47 debugstr <<
"py = " << py <<
", m_yoffset = " <<
m_yoffset 48 <<
"px = " << px <<
", m_xoffset = " <<
m_xoffset <<
"\n";
52 debugstr <<
" wrong lp y " << py <<
" " <<
m_yoffset <<
"\n";
53 py = m_yoffset +
EPSCM;
57 debugstr <<
" wrong lp y " << py <<
" " << -
m_yoffset <<
"\n";
58 py = -m_yoffset -
EPSCM;
62 debugstr <<
" wrong lp x " << px <<
" " << m_xoffset <<
"\n";
63 px = m_xoffset +
EPSCM;
67 debugstr <<
" wrong lp x " << px <<
" " << -m_xoffset <<
"\n";
68 px = -m_xoffset -
EPSCM;
73 int iybin =
int( newybin );
74 float fractionY = newybin - iybin;
91 LogDebug(
"RectangularMTDTopology") <<
" very bad, newbiny " << iybin0 <<
"\n" 93 << newybin <<
" " << iybin <<
" " << fractionY <<
" " << iybin0 <<
" " 96 #endif // EDM_ML_DEBUG 106 fractionY = (fractionY+1.)/2.;
107 }
else if (iybin0==52) {
109 fractionY = fractionY/2.;
110 }
else if (iybin0>1) {
112 }
else if (iybin0==1) {
114 fractionY = (fractionY+1.)/2.;
115 }
else if (iybin0==0) {
117 fractionY = fractionY/2.;
120 mpY =
float(numROC*52. + iybin0) + fractionY;
125 if( mpY < 0. || mpY >= 416. )
127 LogDebug(
"RectangularMTDTopology") <<
" bad pix y " << mpY <<
"\n" 129 << newybin <<
" " << iybin <<
" " << fractionY <<
" " 130 << iybin0 <<
" " << numROC;
132 #endif // EDM_ML_DEBUG 136 int ixbin =
int( newxbin );
137 float fractionX = newxbin - ixbin;
141 if( ixbin > 161 || ixbin < 0 )
143 LogDebug(
"RectangularMTDTopology") <<
" very bad, newbinx " << ixbin <<
"\n" 145 << newxbin <<
" " << ixbin <<
" " << fractionX;
147 #endif // EDM_ML_DEBUG 153 }
else if (ixbin==82) {
155 fractionX = (fractionX+1.)/2.;
156 }
else if (ixbin==81) {
158 fractionX = fractionX/2.;
159 }
else if (ixbin==80) {
161 fractionX = (fractionX+1.)/2.;
162 }
else if (ixbin==79) {
164 fractionX = fractionX/2.;
168 float mpX =
float( ixbin ) + fractionX;
172 if( mpX < 0. || mpX >= 160. )
174 LogDebug(
"RectangularMTDTopology") <<
" bad pix x " << mpX <<
"\n" 176 << newxbin <<
" " << ixbin <<
" " << fractionX;
178 #endif // EDM_ML_DEBUG 180 return std::pair<float, float>( mpX, mpY );
195 std::ostringstream debugstr;
199 debugstr <<
" wrong mp y, fix " << mpy <<
" " << 0 <<
"\n";
204 debugstr <<
" wrong mp y, fix " << mpy <<
" " <<
m_ncols <<
"\n";
209 debugstr <<
" wrong mp x, fix " << mpx <<
" " << 0 <<
"\n";
214 debugstr <<
" wrong mp x, fix " << mpx <<
" " <<
m_nrows <<
"\n";
217 if(! debugstr.str().empty())
218 LogDebug(
"RectangularMTDTopology") << debugstr.str();
219 #endif // EDM_ML_DEBUG 221 float lpY =
localY( mpy );
222 float lpX =
localX( mpx );
235 int binoffx =
int( mpx );
236 float fractionX = mpx -
float(binoffx);
243 LogDebug(
"RectangularMTDTopology") <<
" very bad, binx " << binoffx <<
"\n" 244 << mpx <<
" " << binoffx <<
" " 245 << fractionX <<
" " << local_pitchx <<
" " <<
m_xoffset <<
"\n";
251 }
else if (binoffx==80) {
254 }
else if (binoffx==79) {
264 LogDebug(
"RectangularMTDTopology") <<
" very bad, binx " << binoffx <<
"\n" 265 << mpx <<
" " << binoffx <<
" " 266 << fractionX <<
" " << local_pitchx <<
" " <<
m_xoffset;
275 if( lpX < m_xoffset || lpX > ( -m_xoffset ))
277 LogDebug(
"RectangularMTDTopology") <<
" bad lp x " << lpX <<
"\n" 278 << mpx <<
" " << binoffx <<
" " 279 << fractionX <<
" " << local_pitchx <<
" " <<
m_xoffset;
281 #endif // EDM_ML_DEBUG 291 int binoffy =
int( mpy );
292 float fractionY = mpy -
float(binoffy);
299 LogDebug(
"RectangularMTDTopology" ) <<
" very bad, biny " << binoffy <<
"\n" 300 << mpy <<
" " << binoffy <<
" " << fractionY
301 <<
" " << local_pitchy <<
" " <<
m_yoffset;
305 constexpr int bigYIndeces[]{0,51,52,103,104,155,156,207,208,259,260,311,312,363,364,415,416,511};
306 auto const j = std::lower_bound(
std::begin(bigYIndeces),
std::end(bigYIndeces),binoffy);
307 if (*j==binoffy) local_pitchy *= 2 ;
308 binoffy += (j-bigYIndeces);
316 if( lpY < m_yoffset || lpY > ( -m_yoffset ))
318 LogDebug(
"RectangularMTDTopology" ) <<
" bad lp y " << lpY <<
"\n" 319 << mpy <<
" " << binoffy <<
" " 320 << fractionY <<
" " << local_pitchy <<
" " <<
m_yoffset;
322 #endif // EDM_ML_DEBUG 334 int binoffy=
int(mp.
y());
338 int binoffx=
int(mp.
x());
356 int iybin0 = iybin%54;
358 if( (iybin0<=1) | (iybin0>=52) )
363 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
void setOffset(const int &BIG_PIX_PER_ROC_X, const int &BIG_PIX_PER_ROC_Y, const int &ROWS_PER_ROC, const int &COLS_PER_ROC)
float localY(const float mpY) const override
MeasurementError measurementError(const LocalPoint &, const LocalError &) const override