CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
RectangularMTDTopology Class Referencefinal

#include <RectangularMTDTopology.h>

Inheritance diagram for RectangularMTDTopology:
PixelTopology Topology

Public Member Functions

int channel (const LocalPoint &lp) const override
 
int colsperroc () const override
 
bool containsBigPixelInX (int ixmin, int ixmax) const override
 
bool containsBigPixelInY (int iymin, int iymax) const override
 
bool isItBigPixelInX (const int ixbin) const override
 
bool isItBigPixelInY (const int iybin) const override
 
bool isItEdgePixel (int ixbin, int iybin) const override
 
bool isItEdgePixelInX (int ixbin) const override
 
bool isItEdgePixelInY (int iybin) const override
 
LocalError localError (const MeasurementPoint &, const MeasurementError &) const override
 
LocalPoint localPosition (const MeasurementPoint &mp) const override
 
float localX (const float mpX) const override
 
float localY (const float mpY) const override
 
MeasurementError measurementError (const LocalPoint &, const LocalError &) const override
 
MeasurementPoint measurementPosition (const LocalPoint &lp) const override
 
LocalPoint moduleToPixelLocalPoint (const LocalPoint &mlp) const
 
int ncolumns () const override
 
int nrows () const override
 
std::pair< float, float > pitch () const override
 
std::pair< float, float > pixel (const LocalPoint &p) const override
 
LocalPoint pixelToModuleLocalPoint (const LocalPoint &plp, int row, int col) const
 
LocalPoint pixelToModuleLocalPoint (const LocalPoint &plp, int channel) const
 
 RectangularMTDTopology (int nrows, int ncols, float pitchx, float pitchy, bool upgradeGeometry, int ROWS_PER_ROC, int COLS_PER_ROC, int BIG_PIX_PER_ROC_X, int BIG_PIX_PER_ROC_Y, int ROCS_X, int ROCS_Y)
 
int rocsX () const override
 
int rocsY () const override
 
int rowsperroc () 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 xoffset () const
 
float yoffset () const
 
- Public Member Functions inherited from PixelTopology
virtual float localX (const float mpX, const Topology::LocalTrackPred &) const
 
virtual float localY (const float mpY, const Topology::LocalTrackPred &) const
 
virtual std::pair< float, float > pixel (const LocalPoint &p, const Topology::LocalTrackAngles &) const
 conversion taking also the angle from the track state More...
 
 ~PixelTopology () override
 
- Public Member Functions inherited from Topology
virtual int channel (const LocalPoint &lp, const LocalTrackAngles &) const
 conversion taking also the angle from the track state More...
 
virtual LocalError localError (const MeasurementPoint &mp, const MeasurementError &me, const LocalTrackPred &) const
 conversion taking also the angle from the predicted track state More...
 
virtual LocalPoint localPosition (const MeasurementPoint &mp, const LocalTrackPred &) const
 conversion taking also the angle from the predicted track state More...
 
virtual MeasurementError measurementError (const LocalPoint &lp, const LocalError &le, const LocalTrackAngles &) const
 conversion taking also the angle from the track state More...
 
virtual MeasurementPoint measurementPosition (const LocalPoint &lp, const LocalTrackAngles &) const
 conversion taking also the angle from the track state More...
 
virtual ~Topology ()
 

Private Attributes

int m_COLS_PER_ROC
 
int m_ncols
 
int m_nrows
 
float m_pitchx
 
float m_pitchy
 
int m_ROCS_X
 
int m_ROCS_Y
 
int m_ROWS_PER_ROC
 
bool m_upgradeGeometry
 
float m_xoffset
 
float m_yoffset
 

Additional Inherited Members

- Public Types inherited from Topology
typedef Point2DBase< double, LocalTagLocal2DPoint
 
typedef Vector2D::MathVector MathVector2D
 
typedef Basic2DVector< double > Vector2D
 

Detailed Description

Topology for rectangular pixel detector with BIG pixels.

Definition at line 40 of file RectangularMTDTopology.h.

Constructor & Destructor Documentation

RectangularMTDTopology::RectangularMTDTopology ( int  nrows,
int  ncols,
float  pitchx,
float  pitchy,
bool  upgradeGeometry,
int  ROWS_PER_ROC,
int  COLS_PER_ROC,
int  BIG_PIX_PER_ROC_X,
int  BIG_PIX_PER_ROC_Y,
int  ROCS_X,
int  ROCS_Y 
)
inline

Definition at line 45 of file RectangularMTDTopology.h.

References localPosition(), and setOffset().

52  : m_pitchx( pitchx ),
53  m_pitchy( pitchy ),
54  m_nrows( nrows ),
55  m_ncols( ncols ),
56  m_ROWS_PER_ROC( ROWS_PER_ROC ), // Num of Rows per ROC
57  m_COLS_PER_ROC( COLS_PER_ROC ), // Num of Cols per ROC
58  m_ROCS_X( ROCS_X ), // 2 for SLHC
59  m_ROCS_Y( ROCS_Y ), // 8 for SLHC
60  m_upgradeGeometry( upgradeGeometry ) {
61 
62  setOffset(BIG_PIX_PER_ROC_X, BIG_PIX_PER_ROC_Y, ROWS_PER_ROC, COLS_PER_ROC);
63 
64  }
int nrows() 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)

Member Function Documentation

int RectangularMTDTopology::channel ( const LocalPoint lp) const
inlineoverridevirtual

Implements Topology.

Definition at line 98 of file RectangularMTDTopology.h.

References pixel(), and MTDChannelIdentifier::pixelToChannel().

98  {
99  std::pair<float,float> p = pixel( lp );
100  return MTDChannelIdentifier::pixelToChannel( int( p.first ),
101  int( p.second ));
102  }
static int pixelToChannel(int row, int col)
std::pair< float, float > pixel(const LocalPoint &p) const override
int RectangularMTDTopology::colsperroc ( ) const
inlineoverridevirtual

Implements PixelTopology.

Definition at line 198 of file RectangularMTDTopology.h.

References m_COLS_PER_ROC.

198  {
199  return m_COLS_PER_ROC;
200  }
bool RectangularMTDTopology::containsBigPixelInX ( int  ixmin,
int  ixmax 
) const
inlineoverridevirtual

Implements PixelTopology.

Definition at line 149 of file RectangularMTDTopology.h.

References m_upgradeGeometry.

149  {
150  return m_upgradeGeometry ? false :( (ixmin<=80) & (ixmax>=79) );
151  }
bool RectangularMTDTopology::containsBigPixelInY ( int  iymin,
int  iymax 
) const
inlineoverridevirtual

Implements PixelTopology.

Definition at line 152 of file RectangularMTDTopology.h.

References isItBigPixelInY(), and m_upgradeGeometry.

152  {
153  return m_upgradeGeometry ? false :
154  ( isItBigPixelInY( iymin ) || isItBigPixelInY( iymax ) || (iymin/52) != (iymax/52) )
155  ;
156  }
bool isItBigPixelInY(const int iybin) const override
bool RectangularMTDTopology::isItBigPixelInX ( const int  ixbin) const
inlineoverridevirtual

Implements PixelTopology.

Definition at line 132 of file RectangularMTDTopology.h.

References m_upgradeGeometry.

Referenced by localError().

132  {
133  return (( m_upgradeGeometry )?(false):(( ixbin == 79 ) | ( ixbin == 80 )));
134  }
bool RectangularMTDTopology::isItBigPixelInY ( const int  iybin) const
inlineoverridevirtual

Implements PixelTopology.

Definition at line 136 of file RectangularMTDTopology.h.

References m_upgradeGeometry, and UNLIKELY.

Referenced by containsBigPixelInY(), and localError().

136  {
138  else {
139  int iybin0 = iybin%52;
140  return(( iybin0 == 0 ) | ( iybin0 == 51 ));
141  // constexpr int bigYIndeces[]{0,51,52,103,104,155,156,207,208,259,260,311,312,363,364,415,416,511};
142  // return *std::lower_bound(std::begin(bigYIndeces),std::end(bigYIndeces),iybin) == iybin;
143  }
144  }
return((rh^lh)&mask)
#define UNLIKELY(x)
bool RectangularMTDTopology::isItEdgePixel ( int  ixbin,
int  iybin 
) const
inlineoverridevirtual

Implements PixelTopology.

Definition at line 168 of file RectangularMTDTopology.h.

References isItEdgePixelInX(), and isItEdgePixelInY().

168  {
169  return ( isItEdgePixelInX( ixbin ) | isItEdgePixelInY( iybin ) );
170  }
bool isItEdgePixelInX(int ixbin) const override
bool isItEdgePixelInY(int iybin) const override
bool RectangularMTDTopology::isItEdgePixelInX ( int  ixbin) const
inlineoverridevirtual

Implements PixelTopology.

Definition at line 162 of file RectangularMTDTopology.h.

References m_nrows.

Referenced by isItEdgePixel().

162  {
163  return ( (ixbin == 0) | (ixbin == (m_nrows-1)) );
164  }
bool RectangularMTDTopology::isItEdgePixelInY ( int  iybin) const
inlineoverridevirtual

Implements PixelTopology.

Definition at line 165 of file RectangularMTDTopology.h.

References m_ncols.

Referenced by isItEdgePixel().

165  {
166  return ( (iybin == 0) | (iybin == (m_ncols-1)) );
167  }
LocalError RectangularMTDTopology::localError ( const MeasurementPoint mp,
const MeasurementError me 
) const
overridevirtual

Implements Topology.

Definition at line 330 of file RectangularMTDTopology.cc.

References objects.autophobj::float, createfilelist::int, isItBigPixelInX(), isItBigPixelInY(), m_pitchx, m_pitchy, MeasurementError::uu(), MeasurementError::vv(), PV2DBase< T, PVType, FrameType >::x(), and PV2DBase< T, PVType, FrameType >::y().

Referenced by measurementPosition().

332 {
333  float pitchy=m_pitchy;
334  int binoffy=int(mp.y());
335  if( isItBigPixelInY(binoffy) )pitchy = 2.*m_pitchy;
336 
337  float pitchx=m_pitchx;
338  int binoffx=int(mp.x());
339  if( isItBigPixelInX(binoffx) )pitchx = 2.*m_pitchx;
340 
341  return LocalError( me.uu()*float(pitchx*pitchx), 0,
342  me.vv()*float(pitchy*pitchy));
343 }
float vv() const
T y() const
Definition: PV2DBase.h:46
bool isItBigPixelInX(const int ixbin) const override
bool isItBigPixelInY(const int iybin) const override
float uu() const
T x() const
Definition: PV2DBase.h:45
LocalPoint RectangularMTDTopology::localPosition ( const MeasurementPoint mp) const
overridevirtual

Implements Topology.

Definition at line 187 of file RectangularMTDTopology.cc.

References EPS, objects.autophobj::float, localX(), localY(), LogDebug, m_ncols, m_nrows, PV2DBase< T, PVType, FrameType >::x(), and PV2DBase< T, PVType, FrameType >::y().

Referenced by RectangularMTDTopology().

188 {
189  float mpy = mp.y(); // measurements
190  float mpx = mp.x();
191 
192 #ifdef EDM_ML_DEBUG
193 #define EPS 0
194  // check limits
195  std::ostringstream debugstr;
196 
197  if( mpy < 0.)
198  {
199  debugstr << " wrong mp y, fix " << mpy << " " << 0 << "\n";
200  mpy = 0.;
201  }
202  if( mpy >= m_ncols)
203  {
204  debugstr << " wrong mp y, fix " << mpy << " " << m_ncols << "\n";
205  mpy = float(m_ncols) - EPS; // EPS is a small number
206  }
207  if( mpx < 0.)
208  {
209  debugstr << " wrong mp x, fix " << mpx << " " << 0 << "\n";
210  mpx = 0.;
211  }
212  if( mpx >= m_nrows )
213  {
214  debugstr << " wrong mp x, fix " << mpx << " " << m_nrows << "\n";
215  mpx = float(m_nrows) - EPS; // EPS is a small number
216  }
217  if(! debugstr.str().empty())
218  LogDebug("RectangularMTDTopology") << debugstr.str();
219 #endif // EDM_ML_DEBUG
220 
221  float lpY = localY( mpy );
222  float lpX = localX( mpx );
223 
224  // Return it as a LocalPoint
225  return LocalPoint( lpX, lpY );
226 }
#define LogDebug(id)
Point3DBase< Scalar, LocalTag > LocalPoint
Definition: Definitions.h:32
T y() const
Definition: PV2DBase.h:46
float localX(const float mpX) const override
#define EPS
float localY(const float mpY) const override
T x() const
Definition: PV2DBase.h:45
float RectangularMTDTopology::localX ( const float  mpX) const
overridevirtual

Implements PixelTopology.

Definition at line 233 of file RectangularMTDTopology.cc.

References objects.autophobj::float, createfilelist::int, LogDebug, m_pitchx, m_ROCS_X, m_ROWS_PER_ROC, m_upgradeGeometry, m_xoffset, and UNLIKELY.

Referenced by localPosition(), and pixelToModuleLocalPoint().

234 {
235  int binoffx = int( mpx ); // truncate to int
236  float fractionX = mpx - float(binoffx); // find the fraction
237  float local_pitchx = m_pitchx; // defaultpitch
238 
240 #ifdef EDM_ML_DEBUG
241  if( binoffx > m_ROWS_PER_ROC * m_ROCS_X ) // too large
242  {
243  LogDebug("RectangularMTDTopology") << " very bad, binx " << binoffx << "\n"
244  << mpx << " " << binoffx << " "
245  << fractionX << " " << local_pitchx << " " << m_xoffset << "\n";
246  }
247 #endif
248  } else {
249  if (binoffx>80) { // ROC 1 - handles x on edge cluster
250  binoffx=binoffx+2;
251  } else if (binoffx==80) { // ROC 1
252  binoffx=binoffx+1;
253  local_pitchx *= 2;
254  } else if (binoffx==79) { // ROC 0
255  binoffx=binoffx+0;
256  local_pitchx *= 2;
257  }
258  // else if (binoffx>=0) { // ROC 0
259  // binoffx=binoffx+0;
260  // }
261 
262 #ifdef EDM_ML_DEBUG
263  if (binoffx<0) // too small
264  LogDebug("RectangularMTDTopology") << " very bad, binx " << binoffx << "\n"
265  << mpx << " " << binoffx << " "
266  << fractionX << " " << local_pitchx << " " << m_xoffset;
267 #endif
268  }
269 
270  // The final position in local coordinates
271  float lpX = float( binoffx * m_pitchx ) + fractionX * local_pitchx + m_xoffset;
272 
273 #ifdef EDM_ML_DEBUG
274 
275  if( lpX < m_xoffset || lpX > ( -m_xoffset ))
276  {
277  LogDebug("RectangularMTDTopology") << " bad lp x " << lpX << "\n"
278  << mpx << " " << binoffx << " "
279  << fractionX << " " << local_pitchx << " " << m_xoffset;
280  }
281 #endif // EDM_ML_DEBUG
282 
283  return lpX;
284 }
#define LogDebug(id)
#define UNLIKELY(x)
float RectangularMTDTopology::localY ( const float  mpY) const
overridevirtual

Implements PixelTopology.

Definition at line 289 of file RectangularMTDTopology.cc.

References begin, constexpr, end, objects.autophobj::float, createfilelist::int, LogDebug, m_COLS_PER_ROC, m_pitchy, m_ROCS_Y, m_upgradeGeometry, m_yoffset, and UNLIKELY.

Referenced by localPosition(), and pixelToModuleLocalPoint().

290 {
291  int binoffy = int( mpy ); // truncate to int
292  float fractionY = mpy - float(binoffy); // find the fraction
293  float local_pitchy = m_pitchy; // defaultpitch
294 
296  #ifdef EDM_ML_DEBUG
297  if( binoffy > m_ROCS_Y * m_COLS_PER_ROC ) // too large
298  {
299  LogDebug( "RectangularMTDTopology" ) << " very bad, biny " << binoffy << "\n"
300  << mpy << " " << binoffy << " " << fractionY
301  << " " << local_pitchy << " " << m_yoffset;
302  }
303 #endif
304  } else { // 415 is last big pixel, 416 and above do not exists!
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);
309  }
310 
311  // The final position in local coordinates
312  float lpY = float(binoffy*m_pitchy) + fractionY*local_pitchy + m_yoffset;
313 
314 #ifdef EDM_ML_DEBUG
315 
316  if( lpY < m_yoffset || lpY > ( -m_yoffset ))
317  {
318  LogDebug( "RectangularMTDTopology" ) << " bad lp y " << lpY << "\n"
319  << mpy << " " << binoffy << " "
320  << fractionY << " " << local_pitchy << " " << m_yoffset;
321  }
322 #endif // EDM_ML_DEBUG
323 
324  return lpY;
325 }
#define LogDebug(id)
#define constexpr
#define end
Definition: vmac.h:39
#define begin
Definition: vmac.h:32
#define UNLIKELY(x)
MeasurementError RectangularMTDTopology::measurementError ( const LocalPoint lp,
const LocalError le 
) const
overridevirtual

Implements Topology.

Definition at line 348 of file RectangularMTDTopology.cc.

References objects.autophobj::float, createfilelist::int, LIKELY, m_pitchx, m_pitchy, m_upgradeGeometry, m_xoffset, m_yoffset, PV3DBase< T, PVType, FrameType >::x(), LocalError::xx(), PV3DBase< T, PVType, FrameType >::y(), and LocalError::yy().

Referenced by measurementPosition().

350 {
351  float pitchy=m_pitchy;
352  float pitchx=m_pitchx;
353 
354  if LIKELY( !m_upgradeGeometry ) {
355  int iybin = int( (lp.y() - m_yoffset)/m_pitchy ); //get bin for equal picth
356  int iybin0 = iybin%54; //This is just to avoid many ifs by using the periodicy
357  //quasi bins 0,1,52,53 fall into larger pixels
358  if( (iybin0<=1) | (iybin0>=52) )
359  pitchy = 2.f * m_pitchy;
360 
361  int ixbin = int( (lp.x() - m_xoffset)/m_pitchx ); //get bin for equal pitch
362  //quasi bins 79,80,81,82 fall into the 2 larger pixels
363  if( (ixbin>=79) & (ixbin<=82) ) pitchx = 2.f * m_pitchx;
364  }
365 
366  return MeasurementError( le.xx()/float(pitchx*pitchx), 0,
367  le.yy()/float(pitchy*pitchy));
368 }
float xx() const
Definition: LocalError.h:24
T y() const
Definition: PV3DBase.h:63
float yy() const
Definition: LocalError.h:26
#define LIKELY(x)
T x() const
Definition: PV3DBase.h:62
MeasurementPoint RectangularMTDTopology::measurementPosition ( const LocalPoint lp) const
inlineoverridevirtual

Implements Topology.

Definition at line 77 of file RectangularMTDTopology.h.

References localError(), measurementError(), AlCaHLTBitMon_ParallelJobs::p, and pixel().

78  {
79  std::pair<float,float> p = pixel( lp );
80  return MeasurementPoint( p.first, p.second );
81  }
Measurement2DPoint MeasurementPoint
Measurement points are two-dimensional by default.
std::pair< float, float > pixel(const LocalPoint &p) const override
LocalPoint RectangularMTDTopology::moduleToPixelLocalPoint ( const LocalPoint mlp) const
inline

Definition at line 107 of file RectangularMTDTopology.h.

References createfilelist::int, m_pitchx, m_pitchy, m_xoffset, m_yoffset, pixel(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

107  {
108  std::pair<float,float> p = pixel( mlp );
109  return LocalPoint( mlp.x() - (m_xoffset + (int(p.first)+0.5f)*m_pitchx),
110  mlp.y() - (m_yoffset + (int(p.second)+0.5f)*m_pitchy),
111  mlp.z());
112  }
Point3DBase< Scalar, LocalTag > LocalPoint
Definition: Definitions.h:32
T y() const
Definition: PV3DBase.h:63
T z() const
Definition: PV3DBase.h:64
std::pair< float, float > pixel(const LocalPoint &p) const override
T x() const
Definition: PV3DBase.h:62
int RectangularMTDTopology::ncolumns ( ) const
inlineoverridevirtual

Implements PixelTopology.

Definition at line 182 of file RectangularMTDTopology.h.

References m_ncols.

182  {
183  return ( m_ncols );
184  }
int RectangularMTDTopology::nrows ( ) const
inlineoverridevirtual

Implements PixelTopology.

Definition at line 178 of file RectangularMTDTopology.h.

References m_nrows.

Referenced by BTLTileDeviceSim::getHitsResponse(), and BTLBarDeviceSim::getHitsResponse().

178  {
179  return ( m_nrows );
180  }
std::pair<float,float> RectangularMTDTopology::pitch ( ) const
inlineoverridevirtual

Implements PixelTopology.

Definition at line 174 of file RectangularMTDTopology.h.

References objects.autophobj::float, m_pitchx, and m_pitchy.

Referenced by BTLBarDeviceSim::getHitsResponse().

174  {
175  return std::pair<float,float>( float(m_pitchx), float(m_pitchy));
176  }
std::pair< float, float > RectangularMTDTopology::pixel ( const LocalPoint p) const
overridevirtual

Implements PixelTopology.

Definition at line 35 of file RectangularMTDTopology.cc.

References EPSCM, objects.autophobj::float, createfilelist::int, LogDebug, m_COLS_PER_ROC, m_pitchx, m_pitchy, m_upgradeGeometry, m_xoffset, m_yoffset, PV3DBase< T, PVType, FrameType >::x(), and PV3DBase< T, PVType, FrameType >::y().

Referenced by channel(), BTLTileDeviceSim::getHitsResponse(), BTLBarDeviceSim::getHitsResponse(), measurementPosition(), and moduleToPixelLocalPoint().

36 {
37  // check limits
38  float py = p.y();
39  float px = p.x();
40 
41  LogDebug("RectangularMTDTopology").log( [&](auto & debugstr) {
42 #define EPSCM 0
43 #define EPS 0
44  // This will catch points which are outside the active sensor area.
45  // In the digitizer during the early induce_signal phase non valid
46  // location are passed here. They are cleaned later.
47  debugstr << "py = " << py << ", m_yoffset = " << m_yoffset
48  << "px = " << px << ", m_xoffset = " << m_xoffset << "\n";
49 
50  if( py < m_yoffset ) // m_yoffset is negative
51  {
52  debugstr << " wrong lp y " << py << " " << m_yoffset << "\n";
53  py = m_yoffset + EPSCM; // make sure it is in, add an EPS in cm
54  }
55  if( py>-m_yoffset )
56  {
57  debugstr << " wrong lp y " << py << " " << -m_yoffset << "\n";
58  py = -m_yoffset - EPSCM;
59  }
60  if( px<m_xoffset ) // m_xoffset is negative
61  {
62  debugstr << " wrong lp x " << px << " " << m_xoffset << "\n";
63  px = m_xoffset + EPSCM;
64  }
65  if( px>-m_xoffset )
66  {
67  debugstr << " wrong lp x " << px << " " << -m_xoffset << "\n";
68  px = -m_xoffset - EPSCM;
69  }
70  });
71 
72  float newybin = ( py - m_yoffset ) / m_pitchy;
73  int iybin = int( newybin );
74  float fractionY = newybin - iybin;
75 
76  // Normalize it all to 1 ROC
77  int iybin0 = 0;
78  int numROC = 0;
79  float mpY = 0.;
80 
81  if( m_upgradeGeometry )
82  {
83  iybin0 = (iybin%m_COLS_PER_ROC); // 0-51
84  numROC = iybin/m_COLS_PER_ROC; // 0-7
85  mpY = float(numROC*m_COLS_PER_ROC + iybin0) + fractionY;
86 
87 #ifdef EDM_ML_DEBUG
88 
89  if( iybin0 > m_COLS_PER_ROC )
90  {
91  LogDebug("RectangularMTDTopology") << " very bad, newbiny " << iybin0 << "\n"
92  << py << " " << m_yoffset << " " << m_pitchy << " "
93  << newybin << " " << iybin << " " << fractionY << " " << iybin0 << " "
94  << numROC;
95  }
96 #endif // EDM_ML_DEBUG
97 
98  }
99  else
100  {
101  iybin0 = (iybin%54); // 0-53
102  numROC = iybin/54; // 0-7
103 
104  if (iybin0==53) { // inside big pixel
105  iybin0=51;
106  fractionY = (fractionY+1.)/2.;
107  } else if (iybin0==52) { // inside big pixel
108  iybin0=51;
109  fractionY = fractionY/2.;
110  } else if (iybin0>1) { // inside normal pixel
111  iybin0=iybin0-1;
112  } else if (iybin0==1) { // inside big pixel
113  iybin0=0;
114  fractionY = (fractionY+1.)/2.;
115  } else if (iybin0==0) { // inside big pixel
116  iybin0=0;
117  fractionY = fractionY/2.;
118  }
119 
120  mpY = float(numROC*52. + iybin0) + fractionY;
121  }
122 
123 #ifdef EDM_ML_DEBUG
124 
125  if( mpY < 0. || mpY >= 416. )
126  {
127  LogDebug("RectangularMTDTopology") << " bad pix y " << mpY << "\n"
128  << py << " " << m_yoffset << " " << m_pitchy << " "
129  << newybin << " " << iybin << " " << fractionY << " "
130  << iybin0 << " " << numROC;
131  }
132 #endif // EDM_ML_DEBUG
133 
134  // In X
135  float newxbin = ( px - m_xoffset ) / m_pitchx;
136  int ixbin = int( newxbin );
137  float fractionX = newxbin - ixbin;
138 
139 #ifdef EDM_ML_DEBUG
140 
141  if( ixbin > 161 || ixbin < 0 ) // ixbin < 0 outside range
142  {
143  LogDebug("RectangularMTDTopology") << " very bad, newbinx " << ixbin << "\n"
144  << px << " " << m_xoffset << " " << m_pitchx << " "
145  << newxbin << " " << ixbin << " " << fractionX;
146  }
147 #endif // EDM_ML_DEBUG
148 
149  if( ! m_upgradeGeometry )
150  {
151  if (ixbin>82) { // inside normal pixel, ROC 1
152  ixbin=ixbin-2;
153  } else if (ixbin==82) { // inside bin pixel
154  ixbin=80;
155  fractionX = (fractionX+1.)/2.;
156  } else if (ixbin==81) { // inside big pixel
157  ixbin=80;
158  fractionX = fractionX/2.;
159  } else if (ixbin==80) { // inside bin pixel, ROC 0
160  ixbin=79;
161  fractionX = (fractionX+1.)/2.;
162  } else if (ixbin==79) { // inside big pixel
163  ixbin=79;
164  fractionX = fractionX/2.;
165  }
166  }
167 
168  float mpX = float( ixbin ) + fractionX;
169 
170 #ifdef EDM_ML_DEBUG
171 
172  if( mpX < 0. || mpX >= 160. )
173  {
174  LogDebug("RectangularMTDTopology") << " bad pix x " << mpX << "\n"
175  << px << " " << m_xoffset << " " << m_pitchx << " "
176  << newxbin << " " << ixbin << " " << fractionX;
177  }
178 #endif // EDM_ML_DEBUG
179 
180  return std::pair<float, float>( mpX, mpY );
181 }
#define LogDebug(id)
T y() const
Definition: PV3DBase.h:63
#define EPSCM
T x() const
Definition: PV3DBase.h:62
LocalPoint RectangularMTDTopology::pixelToModuleLocalPoint ( const LocalPoint plp,
int  row,
int  col 
) const
inline
LocalPoint RectangularMTDTopology::pixelToModuleLocalPoint ( const LocalPoint plp,
int  channel 
) const
inline

Definition at line 118 of file RectangularMTDTopology.h.

References MTDChannelIdentifier::channelToPixel(), localX(), localY(), and pixelToModuleLocalPoint().

118  {
119  std::pair<int,int> p = MTDChannelIdentifier::channelToPixel(channel);
120  return pixelToModuleLocalPoint(plp,p.first,p.second);
121  }
static std::pair< int, int > channelToPixel(int ch)
int channel(const LocalPoint &lp) const override
LocalPoint pixelToModuleLocalPoint(const LocalPoint &plp, int row, int col) const
int RectangularMTDTopology::rocsX ( ) const
inlineoverridevirtual

Implements PixelTopology.

Definition at line 190 of file RectangularMTDTopology.h.

References m_ROCS_X.

190  {
191  return m_ROCS_X;
192  }
int RectangularMTDTopology::rocsY ( ) const
inlineoverridevirtual

Implements PixelTopology.

Definition at line 186 of file RectangularMTDTopology.h.

References m_ROCS_Y.

186  {
187  return m_ROCS_Y;
188  }
int RectangularMTDTopology::rowsperroc ( ) const
inlineoverridevirtual

Implements PixelTopology.

Definition at line 194 of file RectangularMTDTopology.h.

References m_ROWS_PER_ROC.

194  {
195  return m_ROWS_PER_ROC;
196  }
void RectangularMTDTopology::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 
)

Topology for rectangular pixel detector with BIG pixels.

Definition at line 15 of file RectangularMTDTopology.cc.

References LogDebug, m_COLS_PER_ROC, m_ncols, m_nrows, m_pitchx, m_pitchy, m_ROCS_X, m_ROCS_Y, m_ROWS_PER_ROC, m_xoffset, and m_yoffset.

Referenced by RectangularMTDTopology().

16  {
17 
18  m_xoffset = -(m_nrows + BIG_PIX_PER_ROC_X*m_nrows/ROWS_PER_ROC)/2. * m_pitchx;
19  m_yoffset = -(m_ncols + BIG_PIX_PER_ROC_Y*m_ncols/COLS_PER_ROC)/2. * m_pitchy;
20 
21  LogDebug("RectangularMTDTopology")
22  << "nrows " << m_nrows << ", ncols " << m_ncols << ", pitchx "
23  << m_pitchx << ", pitchy " << m_pitchy << ", xoffset "
24  << m_xoffset << ", yoffset " << m_yoffset << ", BIG_PIX_PER_ROC_X "
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
27  << "\nNROWS " << m_ROWS_PER_ROC * m_ROCS_X << ", NCOL " << m_COLS_PER_ROC * m_ROCS_Y;
28 
29 }
#define LogDebug(id)
float RectangularMTDTopology::xoffset ( ) const
inline

Definition at line 201 of file RectangularMTDTopology.h.

References m_xoffset.

201  {
202  return m_xoffset;
203  }
float RectangularMTDTopology::yoffset ( ) const
inline

Definition at line 204 of file RectangularMTDTopology.h.

References m_yoffset.

204  {
205  return m_yoffset;
206  }

Member Data Documentation

int RectangularMTDTopology::m_COLS_PER_ROC
private

Definition at line 218 of file RectangularMTDTopology.h.

Referenced by colsperroc(), localY(), pixel(), and setOffset().

int RectangularMTDTopology::m_ncols
private

Definition at line 216 of file RectangularMTDTopology.h.

Referenced by isItEdgePixelInY(), localPosition(), ncolumns(), and setOffset().

int RectangularMTDTopology::m_nrows
private

Definition at line 215 of file RectangularMTDTopology.h.

Referenced by isItEdgePixelInX(), localPosition(), nrows(), and setOffset().

float RectangularMTDTopology::m_pitchx
private
float RectangularMTDTopology::m_pitchy
private
int RectangularMTDTopology::m_ROCS_X
private

Definition at line 219 of file RectangularMTDTopology.h.

Referenced by localX(), rocsX(), and setOffset().

int RectangularMTDTopology::m_ROCS_Y
private

Definition at line 220 of file RectangularMTDTopology.h.

Referenced by localY(), rocsY(), and setOffset().

int RectangularMTDTopology::m_ROWS_PER_ROC
private

Definition at line 217 of file RectangularMTDTopology.h.

Referenced by localX(), rowsperroc(), and setOffset().

bool RectangularMTDTopology::m_upgradeGeometry
private
float RectangularMTDTopology::m_xoffset
private
float RectangularMTDTopology::m_yoffset
private