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 
45 class RectangularPixelTopology GCC11_FINAL : public PixelTopology
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  virtual bool isItBigPixelInY( const int iybin ) const {
128  if( m_upgradeGeometry ) return false;
129  else
130  {
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( const int& ixmin, const int& ixmax ) const;
142  bool containsBigPixelInY( const int& iymin, const int& iymax ) const;
143 
144 
145  //-------------------------------------------------------------
146  // Check whether the pixel is at the edge of the module
147  //
148  bool isItEdgePixelInX (int ixbin) const {
149  return ( (ixbin == 0) || (ixbin == (m_nrows-1)) );
150  }
151  bool isItEdgePixelInY (int iybin) const {
152  return ( (iybin == 0) || (iybin == (m_ncols-1)) );
153  }
154  bool isItEdgePixel (int ixbin, int iybin) const {
155  return ( isItEdgePixelInX( ixbin ) || isItEdgePixelInY( iybin ) );
156  }
157 
158  //------------------------------------------------------------------
159  // Return pitch
160  virtual std::pair<float,float> pitch() const {
161  return std::pair<float,float>( float(m_pitchx), float(m_pitchy));
162  }
163  // Return number of rows
164  virtual int nrows() const {
165  return ( m_nrows );
166  }
167  // Return number of cols
168  virtual int ncolumns() const {
169  return ( m_ncols );
170  }
171  // mlw Return number of ROCS Y
172  virtual int rocsY() const {
173  return m_ROCS_Y;
174  }
175  // mlw Return number of ROCS X
176  virtual int rocsX() const {
177  return m_ROCS_X;
178  }
179  // mlw Return number of rows per roc
180  virtual int rowsperroc() const {
181  return m_ROWS_PER_ROC;
182  }
183  // mlw Return number of cols per roc
184  virtual int colsperroc() const {
185  return m_COLS_PER_ROC;
186  }
187 
188 private:
189 
190  float m_pitchx;
191  float m_pitchy;
192  float m_xoffset;
193  float m_yoffset;
194  int m_nrows;
195  int m_ncols;
198  int m_ROCS_X;
199  int m_ROCS_Y;
201 };
202 
203 #endif
204 
205 
#define LogDebug(id)
virtual int channel(const LocalPoint &lp) const
virtual bool containsBigPixelInX(const int &ixmin, const int &ixmax) const =0
virtual LocalPoint localPosition(const MeasurementPoint &) const =0
bool isItEdgePixelInY(int iybin) const
static const int COLS_PER_ROC
Definition: TrackUtils.cc:62
#define EPS
virtual int colsperroc() const
static const int BIG_PIX_PER_ROC_Y
Definition: TrackUtils.cc:61
bool isItEdgePixel(int ixbin, int iybin) 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)
virtual int rocsX() const
virtual std::pair< float, float > pitch() const
static const int ROWS_PER_ROC
Definition: TrackUtils.cc:63
virtual MeasurementPoint measurementPosition(const LocalPoint &lp) const
virtual int nrows() const
static const int BIG_PIX_PER_ROC_X
Definition: TrackUtils.cc:64
Measurement2DPoint MeasurementPoint
Measurement points are two-dimensional by default.
virtual bool isItEdgePixelInX(int ixbin) const =0
virtual MeasurementError measurementError(const LocalPoint &, const LocalError &) const =0
virtual bool isItBigPixelInX(const int ixbin) const
virtual std::pair< float, float > pixel(const LocalPoint &p) const =0
virtual int rowsperroc() const
virtual int ncolumns() const
bool isItEdgePixelInX(int ixbin) const
virtual bool containsBigPixelInY(const int &iymin, const int &iymax) const =0
virtual float localX(const float mpX) const =0
virtual LocalError localError(const MeasurementPoint &, const MeasurementError &) const =0
virtual bool isItEdgePixelInY(int iybin) const =0
virtual bool isItBigPixelInY(const int iybin) const
static int pixelToChannel(int row, int col)
virtual float localY(const float mpY) const =0
Unlimited (trivial) bounds.
virtual int rocsY() const