CMS 3D CMS Logo

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 
40 public:
41  // Constructor, initilize
43  int ncols,
44  float pitchx,
45  float pitchy,
46  int ROWS_PER_ROC, // Num of Rows per ROC
47  int COLS_PER_ROC, // Num of Cols per ROC
48  int BIG_PIX_PER_ROC_X, // in x direction, rows. BIG_PIX_PER_ROC_X = 0 for SLHC
49  int BIG_PIX_PER_ROC_Y, // in y direction, cols. BIG_PIX_PER_ROC_Y = 0 for SLHC
50  int ROCS_X,
51  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  {
61  // Calculate the edge of the active sensor with respect to the center,
62  // that is simply the half-size.
63  // Take into account large pixels
64  m_xoffset = -(m_nrows + BIG_PIX_PER_ROC_X * m_nrows / ROWS_PER_ROC) / 2. * m_pitchx;
65  m_yoffset = -(m_ncols + BIG_PIX_PER_ROC_Y * m_ncols / COLS_PER_ROC) / 2. * m_pitchy;
66 
67  LogDebug("RectangularPixelTopology") << "nrows " << m_nrows << ", ncols " << m_ncols << ", pitchx " << m_pitchx
68  << ", pitchy " << m_pitchy << ", xoffset " << m_xoffset << ", yoffset "
69  << m_yoffset << ", BIG_PIX_PER_ROC_X " << BIG_PIX_PER_ROC_X
70  << ", BIG_PIX_PER_ROC_Y " << BIG_PIX_PER_ROC_Y << ", ROWS_PER_ROC "
71  << ROWS_PER_ROC << ", COLS_PER_ROC " << COLS_PER_ROC << ", ROCS_X " << ROCS_X
72  << ", ROCS_Y " << ROCS_Y << "\nNROWS " << m_ROWS_PER_ROC * m_ROCS_X
73  << ", NCOL " << m_COLS_PER_ROC * m_ROCS_Y;
74  }
75 
76  // Topology interface, go from Masurement to Local corrdinates
77  // pixel coordinates (mp) -> cm (LocalPoint)
78  LocalPoint localPosition(const MeasurementPoint& mp) const override;
79 
80  // Transform LocalPoint to Measurement. Call pixel().
81  MeasurementPoint measurementPosition(const LocalPoint& lp) const override {
82  std::pair<float, float> p = pixel(lp);
83  return MeasurementPoint(p.first, p.second);
84  }
85 
86  // PixelTopology interface.
87  // Transform LocalPoint in cm to measurement in pitch units.
88  std::pair<float, float> pixel(const LocalPoint& p) const override;
89 
90  // Errors
91  // Error in local (cm) from the masurement errors
92  LocalError localError(const MeasurementPoint&, const MeasurementError&) const override;
93  // Errors in pitch units from localpoint error (in cm)
94  MeasurementError measurementError(const LocalPoint&, const LocalError&) const override;
95 
96  //-------------------------------------------------------------
97  // Transform LocalPoint to channel. Call pixel()
98  //
99  int channel(const LocalPoint& lp) const override {
100  std::pair<float, float> p = pixel(lp);
101  return PixelChannelIdentifier::pixelToChannel(int(p.first), int(p.second));
102  }
103 
104  //-------------------------------------------------------------
105  // Transform measurement to local coordinates individually in each dimension
106  //
107  float localX(const float mpX) const override;
108  float localY(const float mpY) const override;
109 
110  //-------------------------------------------------------------
111  // Return the BIG pixel information for a given pixel
112  //
113  bool isItBigPixelInX(const int ixbin) const override { return ((ixbin == 79) | (ixbin == 80)); }
114 
115  bool isItBigPixelInY(const int iybin) const override {
116  int iybin0 = iybin % 52;
117  return ((iybin0 == 0) | (iybin0 == 51));
118  }
119  float pixelFractionInX(const int ixbin) const override {
120  if ((ixbin == 79) | (ixbin == 80)) {
121  return 2.0f;
122  } else {
123  return 1.0f;
124  }
125  }
126 
127  float pixelFractionInY(const int iybin) const override {
128  int iybin0 = iybin % 52;
129 
130  if ((iybin0 == 0) | (iybin0 == 51)) {
131  return 2.0f;
132  } else {
133  return 1.0f;
134  }
135  }
136  // constexpr int bigYIndeces[]{0,51,52,103,104,155,156,207,208,259,260,311,312,363,364,415,416,511};
137  // return *std::lower_bound(std::begin(bigYIndeces),std::end(bigYIndeces),iybin) == iybin;
138 
139  //-------------------------------------------------------------
140  // Return BIG pixel flag in a given pixel range
141  //
142  bool containsBigPixelInX(int ixmin, int ixmax) const override { return ((ixmin <= 80) & (ixmax >= 79)); }
143  bool containsBigPixelInY(int iymin, int iymax) const override {
144  return (isItBigPixelInY(iymin) || isItBigPixelInY(iymax) || (iymin / 52) != (iymax / 52));
145  }
146 
147  bool bigpixelsX() const override { return false; }
148  bool bigpixelsY() const override { return false; }
149 
150  //-------------------------------------------------------------
151  // Check whether the pixel is at the edge of the module
152  //
153  bool isItEdgePixelInX(int ixbin) const override { return ((ixbin == 0) | (ixbin == (m_nrows - 1))); }
154  bool isItEdgePixelInY(int iybin) const override { return ((iybin == 0) | (iybin == (m_ncols - 1))); }
155  bool isItEdgePixel(int ixbin, int iybin) const override {
156  return (isItEdgePixelInX(ixbin) || isItEdgePixelInY(iybin));
157  }
158 
159  //------------------------------------------------------------------
160  // Return pitch
161  std::pair<float, float> pitch() const override { return std::pair<float, float>(float(m_pitchx), float(m_pitchy)); }
162  // Return number of rows
163  int nrows() const override { return (m_nrows); }
164  // Return number of cols
165  int ncolumns() const override { return (m_ncols); }
166  // mlw Return number of ROCS Y
167  int rocsY() const override { return m_ROCS_Y; }
168  // mlw Return number of ROCS X
169  int rocsX() const override { return m_ROCS_X; }
170  // mlw Return number of rows per roc
171  int rowsperroc() const override { return m_ROWS_PER_ROC; }
172  // mlw Return number of cols per roc
173  int colsperroc() const override { return m_COLS_PER_ROC; }
174  float xoffset() const { return m_xoffset; }
175  float yoffset() const { return m_yoffset; }
176 
177 private:
178  float m_pitchx;
179  float m_pitchy;
180  float m_xoffset;
181  float m_yoffset;
182  int m_nrows;
183  int m_ncols;
186  int m_ROCS_X;
187  int m_ROCS_Y;
188 };
189 
190 #endif
LocalPoint localPosition(const MeasurementPoint &mp) const override
std::pair< float, float > pitch() const override
std::pair< float, float > pixel(const LocalPoint &p) const override
float pixelFractionInY(const int iybin) const override
bool bigpixelsX() const override
bool containsBigPixelInY(int iymin, int iymax) const override
bool containsBigPixelInX(int ixmin, int ixmax) const override
bool bigpixelsY() const override
MeasurementError measurementError(const LocalPoint &, const LocalError &) const override
bool isItEdgePixel(int ixbin, int iybin) const override
Measurement2DPoint MeasurementPoint
Measurement points are two-dimensional by default.
bool isItBigPixelInX(const int ixbin) const override
float localY(const float mpY) const override
bool isItEdgePixelInY(int iybin) const override
bool isItEdgePixelInX(int ixbin) const override
float pixelFractionInX(const int ixbin) const override
int channel(const LocalPoint &lp) const override
static int pixelToChannel(int row, int col)
bool isItBigPixelInY(const int iybin) const override
RectangularPixelTopology(int nrows, int ncols, float pitchx, float pitchy, 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)
float localX(const float mpX) const override
LocalError localError(const MeasurementPoint &, const MeasurementError &) const override
#define LogDebug(id)
MeasurementPoint measurementPosition(const LocalPoint &lp) const override