CMS 3D CMS Logo

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

#include <RectangularPixelTopology.h>

Inheritance diagram for RectangularPixelTopology:
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
 
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
 
 RectangularPixelTopology (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
 
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 RectangularPixelTopology.h.

Constructor & Destructor Documentation

RectangularPixelTopology::RectangularPixelTopology ( 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 RectangularPixelTopology.h.

References localPosition(), 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.

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  // Calculate the edge of the active sensor with respect to the center,
63  // that is simply the half-size.
64  // Take into account large pixels
65  m_xoffset = -(m_nrows + BIG_PIX_PER_ROC_X*m_nrows/ROWS_PER_ROC)/2. *
66  m_pitchx;
67  m_yoffset = -(m_ncols + BIG_PIX_PER_ROC_Y*m_ncols/COLS_PER_ROC)/2. *
68  m_pitchy;
69 
70  LogDebug("RectangularPixelTopology") << "nrows " << m_nrows << ", ncols " << m_ncols << ", pitchx "
71  << m_pitchx << ", pitchy " << m_pitchy << ", xoffset "
72  << m_xoffset << ", yoffset " << m_yoffset << ", BIG_PIX_PER_ROC_X "
73  << BIG_PIX_PER_ROC_X << ", BIG_PIX_PER_ROC_Y " << BIG_PIX_PER_ROC_Y << ", ROWS_PER_ROC "
74  << ROWS_PER_ROC << ", COLS_PER_ROC " << COLS_PER_ROC << ", ROCS_X " << ROCS_X << ", ROCS_Y " << ROCS_Y
75  << "\nNROWS " << m_ROWS_PER_ROC * m_ROCS_X << ", NCOL " << m_COLS_PER_ROC * m_ROCS_Y;
76  }
#define LogDebug(id)

Member Function Documentation

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

Implements Topology.

Definition at line 104 of file RectangularPixelTopology.h.

References localX(), localY(), pixel(), and PixelChannelIdentifier::pixelToChannel().

104  {
105  std::pair<float,float> p = pixel( lp );
106  return PixelChannelIdentifier::pixelToChannel( int( p.first ),
107  int( p.second ));
108  }
std::pair< float, float > pixel(const LocalPoint &p) const override
static int pixelToChannel(int row, int col)
int RectangularPixelTopology::colsperroc ( ) const
inlineoverridevirtual

Implements PixelTopology.

Definition at line 185 of file RectangularPixelTopology.h.

References m_COLS_PER_ROC.

185  {
186  return m_COLS_PER_ROC;
187  }
bool RectangularPixelTopology::containsBigPixelInX ( int  ixmin,
int  ixmax 
) const
inlineoverridevirtual

Implements PixelTopology.

Definition at line 136 of file RectangularPixelTopology.h.

References m_upgradeGeometry.

Referenced by PixelCPEGeneric::localError(), PixelCPEBase::setTheClu(), and PixelTemplateSmearerBase::smearHit().

136  {
137  return m_upgradeGeometry ? false :( (ixmin<=80) & (ixmax>=79) );
138  }
bool RectangularPixelTopology::containsBigPixelInY ( int  iymin,
int  iymax 
) const
inlineoverridevirtual

Implements PixelTopology.

Definition at line 139 of file RectangularPixelTopology.h.

References isItBigPixelInY(), and m_upgradeGeometry.

Referenced by PixelCPEGeneric::localError(), PixelCPEBase::setTheClu(), and PixelTemplateSmearerBase::smearHit().

139  {
140  return m_upgradeGeometry ? false :
141  ( isItBigPixelInY( iymin ) || isItBigPixelInY( iymax ) || (iymin/52) != (iymax/52) )
142  ;
143  }
bool isItBigPixelInY(const int iybin) const override
bool RectangularPixelTopology::isItBigPixelInX ( const int  ixbin) const
inlineoverridevirtual
bool RectangularPixelTopology::isItBigPixelInY ( const int  iybin) const
inlineoverridevirtual

Implements PixelTopology.

Definition at line 123 of file RectangularPixelTopology.h.

References m_upgradeGeometry, and UNLIKELY.

Referenced by containsBigPixelInY(), localError(), PixelCPEGeneric::localError(), PixelCPEClusterRepair::localPosition(), PixelCPETemplateReco::localPosition(), PixelCPEGeneric::localPosition(), and PixelTemplateSmearerBase::smearHit().

123  {
125  else {
126  int iybin0 = iybin%52;
127  return(( iybin0 == 0 ) | ( iybin0 == 51 ));
128  // constexpr int bigYIndeces[]{0,51,52,103,104,155,156,207,208,259,260,311,312,363,364,415,416,511};
129  // return *std::lower_bound(std::begin(bigYIndeces),std::end(bigYIndeces),iybin) == iybin;
130  }
131  }
return((rh^lh)&mask)
#define UNLIKELY(x)
bool RectangularPixelTopology::isItEdgePixel ( int  ixbin,
int  iybin 
) const
inlineoverridevirtual

Implements PixelTopology.

Definition at line 155 of file RectangularPixelTopology.h.

References isItEdgePixelInX(), and isItEdgePixelInY().

155  {
156  return ( isItEdgePixelInX( ixbin ) | isItEdgePixelInY( iybin ) );
157  }
bool isItEdgePixelInX(int ixbin) const override
bool isItEdgePixelInY(int iybin) const override
bool RectangularPixelTopology::isItEdgePixelInX ( int  ixbin) const
inlineoverridevirtual

Implements PixelTopology.

Definition at line 149 of file RectangularPixelTopology.h.

References m_nrows.

Referenced by isItEdgePixel(), PixelCPETemplateReco::localError(), PixelCPEGeneric::localError(), PixelCPEBase::setTheClu(), and PixelTemplateSmearerBase::smearHit().

149  {
150  return ( (ixbin == 0) | (ixbin == (m_nrows-1)) );
151  }
bool RectangularPixelTopology::isItEdgePixelInY ( int  iybin) const
inlineoverridevirtual

Implements PixelTopology.

Definition at line 152 of file RectangularPixelTopology.h.

References m_ncols.

Referenced by isItEdgePixel(), PixelCPETemplateReco::localError(), PixelCPEGeneric::localError(), PixelCPEBase::setTheClu(), and PixelTemplateSmearerBase::smearHit().

152  {
153  return ( (iybin == 0) | (iybin == (m_ncols-1)) );
154  }
LocalError RectangularPixelTopology::localError ( const MeasurementPoint mp,
const MeasurementError me 
) const
overridevirtual

Implements Topology.

Definition at line 314 of file RectangularPixelTopology.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().

316 {
317  float pitchy=m_pitchy;
318  int binoffy=int(mp.y());
319  if( isItBigPixelInY(binoffy) )pitchy = 2.*m_pitchy;
320 
321  float pitchx=m_pitchx;
322  int binoffx=int(mp.x());
323  if( isItBigPixelInX(binoffx) )pitchx = 2.*m_pitchx;
324 
325  return LocalError( me.uu()*float(pitchx*pitchx), 0,
326  me.vv()*float(pitchy*pitchy));
327 }
float vv() const
T y() const
Definition: PV2DBase.h:46
float uu() const
bool isItBigPixelInY(const int iybin) const override
bool isItBigPixelInX(const int ixbin) const override
T x() const
Definition: PV2DBase.h:45
LocalPoint RectangularPixelTopology::localPosition ( const MeasurementPoint mp) const
overridevirtual

Implements Topology.

Definition at line 171 of file RectangularPixelTopology.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 RectangularPixelTopology(), and PixelTemplateSmearerBase::smearHit().

172 {
173  float mpy = mp.y(); // measurements
174  float mpx = mp.x();
175 
176 #ifdef EDM_ML_DEBUG
177 #define EPS 0
178  // check limits
179  std::ostringstream debugstr;
180 
181  if( mpy < 0.)
182  {
183  debugstr << " wrong mp y, fix " << mpy << " " << 0 << "\n";
184  mpy = 0.;
185  }
186  if( mpy >= m_ncols)
187  {
188  debugstr << " wrong mp y, fix " << mpy << " " << m_ncols << "\n";
189  mpy = float(m_ncols) - EPS; // EPS is a small number
190  }
191  if( mpx < 0.)
192  {
193  debugstr << " wrong mp x, fix " << mpx << " " << 0 << "\n";
194  mpx = 0.;
195  }
196  if( mpx >= m_nrows )
197  {
198  debugstr << " wrong mp x, fix " << mpx << " " << m_nrows << "\n";
199  mpx = float(m_nrows) - EPS; // EPS is a small number
200  }
201  if(! debugstr.str().empty())
202  LogDebug("RectangularPixelTopology") << debugstr.str();
203 #endif // EDM_ML_DEBUG
204 
205  float lpY = localY( mpy );
206  float lpX = localX( mpx );
207 
208  // Return it as a LocalPoint
209  return LocalPoint( lpX, lpY );
210 }
#define LogDebug(id)
Point3DBase< Scalar, LocalTag > LocalPoint
Definition: Definitions.h:32
T y() const
Definition: PV2DBase.h:46
float localY(const float mpY) const override
#define EPS
float localX(const float mpX) const override
T x() const
Definition: PV2DBase.h:45
float RectangularPixelTopology::localX ( const float  mpX) const
overridevirtual

Implements PixelTopology.

Definition at line 217 of file RectangularPixelTopology.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 channel(), and localPosition().

218 {
219  int binoffx = int( mpx ); // truncate to int
220  float fractionX = mpx - float(binoffx); // find the fraction
221  float local_pitchx = m_pitchx; // defaultpitch
222 
224 #ifdef EDM_ML_DEBUG
225  if( binoffx > m_ROWS_PER_ROC * m_ROCS_X ) // too large
226  {
227  LogDebug("RectangularPixelTopology") << " very bad, binx " << binoffx << "\n"
228  << mpx << " " << binoffx << " "
229  << fractionX << " " << local_pitchx << " " << m_xoffset << "\n";
230  }
231 #endif
232  } else {
233  if (binoffx>80) { // ROC 1 - handles x on edge cluster
234  binoffx=binoffx+2;
235  } else if (binoffx==80) { // ROC 1
236  binoffx=binoffx+1;
237  local_pitchx *= 2;
238  } else if (binoffx==79) { // ROC 0
239  binoffx=binoffx+0;
240  local_pitchx *= 2;
241  }
242  // else if (binoffx>=0) { // ROC 0
243  // binoffx=binoffx+0;
244  // }
245 
246 #ifdef EDM_ML_DEBUG
247  if (binoffx<0) // too small
248  LogDebug("RectangularPixelTopology") << " very bad, binx " << binoffx << "\n"
249  << mpx << " " << binoffx << " "
250  << fractionX << " " << local_pitchx << " " << m_xoffset;
251 #endif
252  }
253 
254  // The final position in local coordinates
255  float lpX = float( binoffx * m_pitchx ) + fractionX * local_pitchx + m_xoffset;
256 
257 #ifdef EDM_ML_DEBUG
258 
259  if( lpX < m_xoffset || lpX > ( -m_xoffset ))
260  {
261  LogDebug("RectangularPixelTopology") << " bad lp x " << lpX << "\n"
262  << mpx << " " << binoffx << " "
263  << fractionX << " " << local_pitchx << " " << m_xoffset;
264  }
265 #endif // EDM_ML_DEBUG
266 
267  return lpX;
268 }
#define LogDebug(id)
#define UNLIKELY(x)
float RectangularPixelTopology::localY ( const float  mpY) const
overridevirtual

Implements PixelTopology.

Definition at line 273 of file RectangularPixelTopology.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 channel(), and localPosition().

274 {
275  int binoffy = int( mpy ); // truncate to int
276  float fractionY = mpy - float(binoffy); // find the fraction
277  float local_pitchy = m_pitchy; // defaultpitch
278 
280  #ifdef EDM_ML_DEBUG
281  if( binoffy > m_ROCS_Y * m_COLS_PER_ROC ) // too large
282  {
283  LogDebug( "RectangularPixelTopology" ) << " very bad, biny " << binoffy << "\n"
284  << mpy << " " << binoffy << " " << fractionY
285  << " " << local_pitchy << " " << m_yoffset;
286  }
287 #endif
288  } else { // 415 is last big pixel, 416 and above do not exists!
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);
293  }
294 
295  // The final position in local coordinates
296  float lpY = float(binoffy*m_pitchy) + fractionY*local_pitchy + m_yoffset;
297 
298 #ifdef EDM_ML_DEBUG
299 
300  if( lpY < m_yoffset || lpY > ( -m_yoffset ))
301  {
302  LogDebug( "RectangularPixelTopology" ) << " bad lp y " << lpY << "\n"
303  << mpy << " " << binoffy << " "
304  << fractionY << " " << local_pitchy << " " << m_yoffset;
305  }
306 #endif // EDM_ML_DEBUG
307 
308  return lpY;
309 }
#define LogDebug(id)
#define constexpr
#define end
Definition: vmac.h:39
#define begin
Definition: vmac.h:32
#define UNLIKELY(x)
MeasurementError RectangularPixelTopology::measurementError ( const LocalPoint lp,
const LocalError le 
) const
overridevirtual

Implements Topology.

Definition at line 332 of file RectangularPixelTopology.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().

334 {
335  float pitchy=m_pitchy;
336  float pitchx=m_pitchx;
337 
338  if LIKELY( !m_upgradeGeometry ) {
339  int iybin = int( (lp.y() - m_yoffset)/m_pitchy ); //get bin for equal picth
340  int iybin0 = iybin%54; //This is just to avoid many ifs by using the periodicy
341  //quasi bins 0,1,52,53 fall into larger pixels
342  if( (iybin0<=1) | (iybin0>=52) )
343  pitchy = 2.f * m_pitchy;
344 
345  int ixbin = int( (lp.x() - m_xoffset)/m_pitchx ); //get bin for equal pitch
346  //quasi bins 79,80,81,82 fall into the 2 larger pixels
347  if( (ixbin>=79) & (ixbin<=82) ) pitchx = 2.f * m_pitchx;
348  }
349 
350  return MeasurementError( le.xx()/float(pitchx*pitchx), 0,
351  le.yy()/float(pitchy*pitchy));
352 }
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 RectangularPixelTopology::measurementPosition ( const LocalPoint lp) const
inlineoverridevirtual

Implements Topology.

Definition at line 83 of file RectangularPixelTopology.h.

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

Referenced by PixelTemplateSmearerBase::smearHit().

84  {
85  std::pair<float,float> p = pixel( lp );
86  return MeasurementPoint( p.first, p.second );
87  }
std::pair< float, float > pixel(const LocalPoint &p) const override
Measurement2DPoint MeasurementPoint
Measurement points are two-dimensional by default.
int RectangularPixelTopology::ncolumns ( ) const
inlineoverridevirtual

Implements PixelTopology.

Definition at line 169 of file RectangularPixelTopology.h.

References m_ncols.

169  {
170  return ( m_ncols );
171  }
int RectangularPixelTopology::nrows ( ) const
inlineoverridevirtual

Implements PixelTopology.

Definition at line 165 of file RectangularPixelTopology.h.

References m_nrows.

165  {
166  return ( m_nrows );
167  }
std::pair<float,float> RectangularPixelTopology::pitch ( ) const
inlineoverridevirtual

Implements PixelTopology.

Definition at line 161 of file RectangularPixelTopology.h.

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

161  {
162  return std::pair<float,float>( float(m_pitchx), float(m_pitchy));
163  }
std::pair< float, float > RectangularPixelTopology::pixel ( const LocalPoint p) const
overridevirtual

Topology for rectangular pixel detector with BIG pixels.

Implements PixelTopology.

Definition at line 14 of file RectangularPixelTopology.cc.

References 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(), and measurementPosition().

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

Implements PixelTopology.

Definition at line 177 of file RectangularPixelTopology.h.

References m_ROCS_X.

177  {
178  return m_ROCS_X;
179  }
int RectangularPixelTopology::rocsY ( ) const
inlineoverridevirtual

Implements PixelTopology.

Definition at line 173 of file RectangularPixelTopology.h.

References m_ROCS_Y.

173  {
174  return m_ROCS_Y;
175  }
int RectangularPixelTopology::rowsperroc ( ) const
inlineoverridevirtual

Implements PixelTopology.

Definition at line 181 of file RectangularPixelTopology.h.

References m_ROWS_PER_ROC.

181  {
182  return m_ROWS_PER_ROC;
183  }
float RectangularPixelTopology::xoffset ( ) const
inline

Definition at line 188 of file RectangularPixelTopology.h.

References m_xoffset.

188  {
189  return m_xoffset;
190  }
float RectangularPixelTopology::yoffset ( ) const
inline

Definition at line 191 of file RectangularPixelTopology.h.

References m_yoffset.

191  {
192  return m_yoffset;
193  }

Member Data Documentation

int RectangularPixelTopology::m_COLS_PER_ROC
private

Definition at line 205 of file RectangularPixelTopology.h.

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

int RectangularPixelTopology::m_ncols
private
int RectangularPixelTopology::m_nrows
private
float RectangularPixelTopology::m_pitchx
private
float RectangularPixelTopology::m_pitchy
private
int RectangularPixelTopology::m_ROCS_X
private

Definition at line 206 of file RectangularPixelTopology.h.

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

int RectangularPixelTopology::m_ROCS_Y
private

Definition at line 207 of file RectangularPixelTopology.h.

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

int RectangularPixelTopology::m_ROWS_PER_ROC
private

Definition at line 204 of file RectangularPixelTopology.h.

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

bool RectangularPixelTopology::m_upgradeGeometry
private
float RectangularPixelTopology::m_xoffset
private
float RectangularPixelTopology::m_yoffset
private