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 
38 
39 
41 {
42 public:
43 
44  // Constructor, initilize
45  RectangularPixelTopology( int nrows, int ncols, float pitchx, float pitchy,
46  bool upgradeGeometry,
47  int ROWS_PER_ROC, // Num of Rows per ROC
48  int COLS_PER_ROC, // Num of Cols per ROC
49  int BIG_PIX_PER_ROC_X, // in x direction, rows. BIG_PIX_PER_ROC_X = 0 for SLHC
50  int BIG_PIX_PER_ROC_Y, // in y direction, cols. BIG_PIX_PER_ROC_Y = 0 for SLHC
51  int ROCS_X, int ROCS_Y )
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  }
77 
78  // Topology interface, go from Masurement to Local corrdinates
79  // pixel coordinates (mp) -> cm (LocalPoint)
80  virtual LocalPoint localPosition( const MeasurementPoint& mp ) const;
81 
82  // Transform LocalPoint to Measurement. Call pixel().
84  const {
85  std::pair<float,float> p = pixel( lp );
86  return MeasurementPoint( p.first, p.second );
87  }
88 
89  // PixelTopology interface.
90  // Transform LocalPoint in cm to measurement in pitch units.
91  virtual std::pair<float,float> pixel( const LocalPoint& p ) const;
92 
93  // Errors
94  // Error in local (cm) from the masurement errors
95  virtual LocalError localError( const MeasurementPoint&,
96  const MeasurementError& ) const;
97  // Errors in pitch units from localpoint error (in cm)
99  const LocalError& ) const;
100 
101  //-------------------------------------------------------------
102  // Transform LocalPoint to channel. Call pixel()
103  //
104  virtual int channel( const LocalPoint& lp ) const {
105  std::pair<float,float> p = pixel( lp );
106  return PixelChannelIdentifier::pixelToChannel( int( p.first ),
107  int( p.second ));
108  }
109 
110  //-------------------------------------------------------------
111  // Transform measurement to local coordinates individually in each dimension
112  //
113  virtual float localX( const float mpX ) const;
114  virtual float localY( const float mpY ) const;
115 
116  //-------------------------------------------------------------
117  // Return the BIG pixel information for a given pixel
118  //
119  virtual bool isItBigPixelInX( const int ixbin ) const {
120  return (( m_upgradeGeometry )?(false):(( ixbin == 79 ) | ( ixbin == 80 )));
121  }
122 
123  virtual bool isItBigPixelInY( const int iybin ) const {
124  if unlikely( m_upgradeGeometry ) return false;
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  }
132 
133  //-------------------------------------------------------------
134  // Return BIG pixel flag in a given pixel range
135  //
136  bool containsBigPixelInX(int ixmin, int ixmax ) const {
137  return m_upgradeGeometry ? false :( (ixmin<=80) & (ixmax>=79) );
138  }
139  bool containsBigPixelInY(int iymin, int iymax ) const {
140  return m_upgradeGeometry ? false :
141  ( isItBigPixelInY( iymin ) || isItBigPixelInY( iymax ) || (iymin/52) != (iymax/52) )
142  ;
143  }
144 
145 
146  //-------------------------------------------------------------
147  // Check whether the pixel is at the edge of the module
148  //
149  bool isItEdgePixelInX (int ixbin) const {
150  return ( (ixbin == 0) | (ixbin == (m_nrows-1)) );
151  }
152  bool isItEdgePixelInY (int iybin) const {
153  return ( (iybin == 0) | (iybin == (m_ncols-1)) );
154  }
155  bool isItEdgePixel (int ixbin, int iybin) const {
156  return ( isItEdgePixelInX( ixbin ) | isItEdgePixelInY( iybin ) );
157  }
158 
159  //------------------------------------------------------------------
160  // Return pitch
161  virtual std::pair<float,float> pitch() const {
162  return std::pair<float,float>( float(m_pitchx), float(m_pitchy));
163  }
164  // Return number of rows
165  virtual int nrows() const {
166  return ( m_nrows );
167  }
168  // Return number of cols
169  virtual int ncolumns() const {
170  return ( m_ncols );
171  }
172  // mlw Return number of ROCS Y
173  virtual int rocsY() const {
174  return m_ROCS_Y;
175  }
176  // mlw Return number of ROCS X
177  virtual int rocsX() const {
178  return m_ROCS_X;
179  }
180  // mlw Return number of rows per roc
181  virtual int rowsperroc() const {
182  return m_ROWS_PER_ROC;
183  }
184  // mlw Return number of cols per roc
185  virtual int colsperroc() const {
186  return m_COLS_PER_ROC;
187  }
188 
189 private:
190 
191  float m_pitchx;
192  float m_pitchy;
193  float m_xoffset;
194  float m_yoffset;
195  int m_nrows;
196  int m_ncols;
199  int m_ROCS_X;
200  int m_ROCS_Y;
202 };
203 
204 #endif
205 
206 
#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:65
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:64
virtual MeasurementPoint measurementPosition(const LocalPoint &lp) const
bool isItEdgePixel(int ixbin, int iybin) const
static const int ROWS_PER_ROC
Definition: TrackUtils.cc:66
#define unlikely(x)
static const int BIG_PIX_PER_ROC_X
Definition: TrackUtils.cc:67
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)