CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
RectangularPixelTopology.h
Go to the documentation of this file.
1 #ifndef Geometry_TrackerGeometryBuilder_RectangularPixelTopology_H
2 #define Geometry_TrackerGeometryBuilder_RectangularPixelTopology_H
3 
7 // Modified for the large pixels. Should work for barrel and forward.
8 // Danek Kotlinski & Michele Pioppi, 3/06.
9 // The bigger pixels are on the ROC boundries.
10 // For columns (Y direction, longer direction):
11 // the normal pixel are 150um long, big pixels are 300um long,
12 // the pixel index goes from 0 to 416 (or less for smaller modules)
13 // the big pixel are in 0, 52,104,156,208,260,312,363
14 // 51,103,155,207,259,311,363,415 .
15 // For rows (X direction, shorter direction):
16 // the normal pixel are 100um wide, big pixels are 200um wide,
17 // the pixel index goes from 0 to 159 (or less for smaller modules)
18 // the big pixel are in 79,80.
19 // The ROC has rows=80, cols=52.
20 // There are a lot of hardwired constants, sorry but this is a very
21 // specific class. For any other sensor design it has to be rewritten.
22 
23 // G. Giurgiu 11/27/06 ---------------------------------------------
24 // Check whether the pixel is at the edge of the module by adding the
25 // following functions (ixbin and iybin are the pixel row and column
26 // inside the module):
27 // bool isItEdgePixelInX (int ixbin)
28 // bool isItEdgePixelInY (int iybin)
29 // bool isItEdgePixel (int ixbin, int iybin)
30 // ------------------------------------------------------------------
31 // Add the individual measurement to local trasformations classes 01/07 d.k.
32 // ------------------------------------------------------------------
33 // Add big pixel flags for cluster range 15/3/07 V.Chiochia
34 
39 
40 namespace {
41  const float EPS = 0.001; // accuray in pixel units, so about 0.1 um
42  const float EPSCM = 0.00001; // accuray in cm, so about 0.1 um
43 }
44 
46 {
47 public:
48 
49  // Constructor, initilize
50  RectangularPixelTopology( int nrows, int ncols, float pitchx, float pitchy,
51  bool upgradeGeometry,
52  int ROWS_PER_ROC, // Num of Rows per ROC
53  int COLS_PER_ROC, // Num of Cols per ROC
54  int BIG_PIX_PER_ROC_X, // in x direction, rows. BIG_PIX_PER_ROC_X = 0 for SLHC
55  int BIG_PIX_PER_ROC_Y, // in y direction, cols. BIG_PIX_PER_ROC_Y = 0 for SLHC
56  int ROCS_X, int ROCS_Y )
57  : m_pitchx( pitchx ),
58  m_pitchy( pitchy ),
59  m_nrows( nrows ),
60  m_ncols( ncols ),
61  m_ROWS_PER_ROC( ROWS_PER_ROC ), // Num of Rows per ROC
62  m_COLS_PER_ROC( COLS_PER_ROC ), // Num of Cols per ROC
63  m_ROCS_X( ROCS_X ), // 2 for SLHC
64  m_ROCS_Y( ROCS_Y ), // 8 for SLHC
65  m_upgradeGeometry( upgradeGeometry )
66  {
67  // Calculate the edge of the active sensor with respect to the center,
68  // that is simply the half-size.
69  // Take into account large pixels
70  m_xoffset = -(m_nrows + BIG_PIX_PER_ROC_X*m_nrows/ROWS_PER_ROC)/2. *
71  m_pitchx;
72  m_yoffset = -(m_ncols + BIG_PIX_PER_ROC_Y*m_ncols/COLS_PER_ROC)/2. *
73  m_pitchy;
74 
75  LogDebug("RectangularPixelTopology") << "nrows " << m_nrows << ", ncols " << m_ncols << ", pitchx "
76  << m_pitchx << ", pitchy " << m_pitchy << ", xoffset "
77  << m_xoffset << ", yoffset " << m_yoffset << ", BIG_PIX_PER_ROC_X "
78  << BIG_PIX_PER_ROC_X << ", BIG_PIX_PER_ROC_Y " << BIG_PIX_PER_ROC_Y << ", ROWS_PER_ROC "
79  << ROWS_PER_ROC << ", COLS_PER_ROC " << COLS_PER_ROC << ", ROCS_X " << ROCS_X << ", ROCS_Y " << ROCS_Y
80  << "\nNROWS " << m_ROWS_PER_ROC * m_ROCS_X << ", NCOL " << m_COLS_PER_ROC * m_ROCS_Y;
81  }
82 
83  // Topology interface, go from Masurement to Local corrdinates
84  // pixel coordinates (mp) -> cm (LocalPoint)
85  virtual LocalPoint localPosition( const MeasurementPoint& mp ) const;
86 
87  // Transform LocalPoint to Measurement. Call pixel().
89  const {
90  std::pair<float,float> p = pixel( lp );
91  return MeasurementPoint( p.first, p.second );
92  }
93 
94  // PixelTopology interface.
95  // Transform LocalPoint in cm to measurement in pitch units.
96  virtual std::pair<float,float> pixel( const LocalPoint& p ) const;
97 
98  // Errors
99  // Error in local (cm) from the masurement errors
100  virtual LocalError localError( const MeasurementPoint&,
101  const MeasurementError& ) const;
102  // Errors in pitch units from localpoint error (in cm)
104  const LocalError& ) const;
105 
106  //-------------------------------------------------------------
107  // Transform LocalPoint to channel. Call pixel()
108  //
109  virtual int channel( const LocalPoint& lp ) const {
110  std::pair<float,float> p = pixel( lp );
111  return PixelChannelIdentifier::pixelToChannel( int( p.first ),
112  int( p.second ));
113  }
114 
115  //-------------------------------------------------------------
116  // Transform measurement to local coordinates individually in each dimension
117  //
118  virtual float localX( const float mpX ) const;
119  virtual float localY( const float mpY ) const;
120 
121  //-------------------------------------------------------------
122  // Return the BIG pixel information for a given pixel
123  //
124  virtual bool isItBigPixelInX( const int ixbin ) const {
125  return (( m_upgradeGeometry )?(false):(( ixbin == 79 ) | ( ixbin == 80 )));
126  }
127 
128  virtual bool isItBigPixelInY( const int iybin ) const {
129  if unlikely( m_upgradeGeometry ) return false;
130  else {
131  int iybin0 = iybin%52;
132  return(( iybin0 == 0 ) | ( iybin0 == 51 ));
133  // constexpr int bigYIndeces[]{0,51,52,103,104,155,156,207,208,259,260,311,312,363,364,415,416,511};
134  // return *std::lower_bound(std::begin(bigYIndeces),std::end(bigYIndeces),iybin) == iybin;
135  }
136  }
137 
138  //-------------------------------------------------------------
139  // Return BIG pixel flag in a given pixel range
140  //
141  bool containsBigPixelInX(int ixmin, int ixmax ) const {
142  return m_upgradeGeometry ? false :( (ixmin<=80) & (ixmax>=79) );
143  }
144  bool containsBigPixelInY(int iymin, int iymax ) const {
145  return m_upgradeGeometry ? false :
146  ( isItBigPixelInY( iymin ) || isItBigPixelInY( iymax ) || (iymin/52) != (iymax/52) )
147  ;
148  }
149 
150 
151  //-------------------------------------------------------------
152  // Check whether the pixel is at the edge of the module
153  //
154  bool isItEdgePixelInX (int ixbin) const {
155  return ( (ixbin == 0) | (ixbin == (m_nrows-1)) );
156  }
157  bool isItEdgePixelInY (int iybin) const {
158  return ( (iybin == 0) | (iybin == (m_ncols-1)) );
159  }
160  bool isItEdgePixel (int ixbin, int iybin) const {
161  return ( isItEdgePixelInX( ixbin ) | isItEdgePixelInY( iybin ) );
162  }
163 
164  //------------------------------------------------------------------
165  // Return pitch
166  virtual std::pair<float,float> pitch() const {
167  return std::pair<float,float>( float(m_pitchx), float(m_pitchy));
168  }
169  // Return number of rows
170  virtual int nrows() const {
171  return ( m_nrows );
172  }
173  // Return number of cols
174  virtual int ncolumns() const {
175  return ( m_ncols );
176  }
177  // mlw Return number of ROCS Y
178  virtual int rocsY() const {
179  return m_ROCS_Y;
180  }
181  // mlw Return number of ROCS X
182  virtual int rocsX() const {
183  return m_ROCS_X;
184  }
185  // mlw Return number of rows per roc
186  virtual int rowsperroc() const {
187  return m_ROWS_PER_ROC;
188  }
189  // mlw Return number of cols per roc
190  virtual int colsperroc() const {
191  return m_COLS_PER_ROC;
192  }
193 
194 private:
195 
196  float m_pitchx;
197  float m_pitchy;
198  float m_xoffset;
199  float m_yoffset;
200  int m_nrows;
201  int m_ncols;
204  int m_ROCS_X;
205  int m_ROCS_Y;
207 };
208 
209 #endif
210 
211 
#define LogDebug(id)
bool containsBigPixelInY(int iymin, int iymax) const
#define GCC11_FINAL
virtual float localY(const float mpY) const
bool isItEdgePixelInY(int iybin) const
virtual MeasurementError measurementError(const LocalPoint &, const LocalError &) const
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)
static const int COLS_PER_ROC
Definition: TrackUtils.cc:61
#define EPS
virtual bool isItBigPixelInY(const int iybin) const
virtual std::pair< float, float > pitch() const
bool isItEdgePixelInX(int ixbin) const
static const int BIG_PIX_PER_ROC_Y
Definition: TrackUtils.cc:60
virtual MeasurementPoint measurementPosition(const LocalPoint &lp) const
bool isItEdgePixel(int ixbin, int iybin) const
static const int ROWS_PER_ROC
Definition: TrackUtils.cc:62
#define unlikely(x)
static const int BIG_PIX_PER_ROC_X
Definition: TrackUtils.cc:63
Measurement2DPoint MeasurementPoint
Measurement points are two-dimensional by default.
bool containsBigPixelInX(int ixmin, int ixmax) const
virtual LocalError localError(const MeasurementPoint &, const MeasurementError &) const
virtual int channel(const LocalPoint &lp) const
virtual LocalPoint localPosition(const MeasurementPoint &mp) const
virtual float localX(const float mpX) const
virtual std::pair< float, float > pixel(const LocalPoint &p) const
virtual bool isItBigPixelInX(const int ixbin) const
static int pixelToChannel(int row, int col)