CMS 3D CMS Logo

RectangularPixelPhase2Topology.h
Go to the documentation of this file.
1 #ifndef Geometry_TrackerGeometryBuilder_RectangularPixelPhase2Topology_H
2 #define Geometry_TrackerGeometryBuilder_RectangularPixelPhase2Topology_H
3 
7 // Re-written for phase-2 pixels.
8 // E. Migliore INFN/Universita Torino 2023/11
9 // The bigger pixels are on the ROC boundries.
10 // G. Giurgiu 11/27/06 ---------------------------------------------
11 // Check whether the pixel is at the edge of the module by adding the
12 // following functions (ixbin and iybin are the pixel row and column
13 // inside the module):
14 // bool isItEdgePixelInX (int ixbin)
15 // bool isItEdgePixelInY (int iybin)
16 // bool isItEdgePixel (int ixbin, int iybin)
17 // ------------------------------------------------------------------
18 // Add the individual measurement to local trasformations classes 01/07 d.k.
19 // ------------------------------------------------------------------
20 // Add big pixel flags for cluster range 15/3/07 V.Chiochia
21 
25 
27 public:
28  // Constructor, initilize
30  int ncols,
31  float pitchx,
32  float pitchy,
33  int ROWS_PER_ROC, // Num of Rows per ROC
34  int COLS_PER_ROC, // Num of Cols per ROC
35  int BIG_PIX_PER_ROC_X, // in x direction, rows
36  int BIG_PIX_PER_ROC_Y, // in y direction, cols
37  float BIG_PIX_PITCH_X,
38  float BIG_PIX_PITCH_Y,
39  int ROCS_X,
40  int ROCS_Y)
41  : m_pitchx(pitchx),
42  m_pitchy(pitchy),
43  m_nrows(nrows),
44  m_ncols(ncols),
45  m_ROWS_PER_ROC(ROWS_PER_ROC), // Num of Rows per ROC
46  m_COLS_PER_ROC(COLS_PER_ROC), // Num of Cols per ROC
47  m_BIG_PIX_PER_ROC_X(BIG_PIX_PER_ROC_X), //
48  m_BIG_PIX_PER_ROC_Y(BIG_PIX_PER_ROC_Y), //
49  m_BIG_PIX_PITCH_X(BIG_PIX_PITCH_X),
50  m_BIG_PIX_PITCH_Y(BIG_PIX_PITCH_Y),
51  m_ROCS_X(ROCS_X), //
52  m_ROCS_Y(ROCS_Y) //
53  {
54  // Calculate the edge of the active sensor with respect to the center,
55  // that is simply the half-size.
56  // Take into account large pixels
57  m_xoffset = -(
60  m_BIG_PIX_PITCH_X); // assuming the big pixel pitch is well computed it gets always in the middle regardless the number of big pixel. Quad is 670*0.025 + 2*0.0875; double is 336* 0.025; 3D is 336*0.025; old geom is 672*faxe x pitch
62 
63  LogDebug("RectangularPixelPhase2Topology")
64  << "nrows " << m_nrows << ", ncols " << m_ncols << ", pitchx " << m_pitchx << ", pitchy " << m_pitchy
65  << ", xoffset " << m_xoffset << ", yoffset " << m_yoffset << ", BIG_PIX_PER_ROC_X " << BIG_PIX_PER_ROC_X
66  << ", BIG_PIX_PER_ROC_Y " << BIG_PIX_PER_ROC_Y << ", BIG_PIX_PITCH_X " << BIG_PIX_PITCH_X
67  << ", BIG_PIX_PITCH_Y " << BIG_PIX_PITCH_Y << ", ROWS_PER_ROC " << ROWS_PER_ROC << ", COLS_PER_ROC "
68  << COLS_PER_ROC << ", ROCS_X " << ROCS_X << ", ROCS_Y " << ROCS_Y << "\nNROWS " << m_ROWS_PER_ROC * m_ROCS_X
69  << ", NCOL " << m_COLS_PER_ROC * m_ROCS_Y;
70  }
71 
72  // Topology interface, go from Masurement to Local corrdinates
73  // pixel coordinates (mp) -> cm (LocalPoint)
74  LocalPoint localPosition(const MeasurementPoint& mp) const override;
75 
76  // Transform LocalPoint to Measurement. Call pixel().
77  MeasurementPoint measurementPosition(const LocalPoint& lp) const override {
78  std::pair<float, float> p = pixel(lp);
79  return MeasurementPoint(p.first, p.second);
80  }
81 
82  // PixelTopology interface.
83  // Transform LocalPoint in cm to measurement in pitch units.
84  std::pair<float, float> pixel(const LocalPoint& p) const override;
85 
86  // Errors
87  // Error in local (cm) from the masurement errors
88  LocalError localError(const MeasurementPoint&, const MeasurementError&) const override;
89  // Errors in pitch units from localpoint error (in cm)
90  MeasurementError measurementError(const LocalPoint&, const LocalError&) const override;
91 
92  //-------------------------------------------------------------
93  // Transform LocalPoint to channel. Call pixel()
94  //
95  int channel(const LocalPoint& lp) const override {
96  std::pair<float, float> p = pixel(lp);
97  return PixelChannelIdentifier::pixelToChannel(int(p.first), int(p.second));
98  }
99 
100  //-------------------------------------------------------------
101  // Transform measurement to local coordinates individually in each dimension
102  //
103  float localX(const float mpX) const override;
104  float localY(const float mpY) const override;
105 
106  //-------------------------------------------------------------
107  // Return the BIG pixel information for a given pixel (assuming they are always at the edge between two CROCs)
108  //
109  bool isItBigPixelInX(const int ixbin) const override {
110  bool no_big_pixel = (m_BIG_PIX_PER_ROC_X == 0);
111  if (!no_big_pixel)
112  no_big_pixel = std::abs((ixbin - m_nrows / 2) + 0.5) > m_BIG_PIX_PER_ROC_X;
113 
114  return !no_big_pixel;
115  }
116 
117  bool isItBigPixelInY(const int iybin) const override {
118  bool no_big_pixel = (m_BIG_PIX_PER_ROC_Y == 0);
119  if (!no_big_pixel)
120  no_big_pixel = std::abs((iybin - m_ncols / 2) + 0.5) > m_BIG_PIX_PER_ROC_Y;
121 
122  return !no_big_pixel;
123  }
124 
125  float pixelFractionInX(const int ixbin) const override {
126  bool no_big_pixel = (m_BIG_PIX_PER_ROC_X == 0);
127 
128  if (no_big_pixel) {
129  return 1.0f;
130  } else {
131  if (((m_nrows / 2 - m_BIG_PIX_PER_ROC_X) <= ixbin) &&
133  return float(m_BIG_PIX_PITCH_X / m_pitchx);
134  } else {
135  return 1.0f;
136  }
137  }
138  }
139 
140  float pixelFractionInY(const int iybin) const override {
141  bool no_big_pixel = (m_BIG_PIX_PER_ROC_Y == 0);
142  if (no_big_pixel) {
143  return 1.0f;
144  } else {
145  if (((m_ncols / 2 - m_BIG_PIX_PER_ROC_Y) <= iybin) &&
147  return float(m_BIG_PIX_PITCH_Y / m_pitchy);
148  } else {
149  return 1.0f;
150  }
151  }
152  }
153 
154  //-------------------------------------------------------------
155  // Return BIG pixel flag in a given pixel range (assuming they are always at the edge between two CROCs)
156  //
157  bool containsBigPixelInX(int ixmin, int ixmax) const override {
158  return containsBigPixel(ixmin, ixmax, m_nrows, m_BIG_PIX_PER_ROC_X);
159  }
160 
161  bool containsBigPixelInY(int iymin, int iymax) const override {
162  return containsBigPixel(iymin, iymax, m_ncols, m_BIG_PIX_PER_ROC_Y);
163  }
164 
165  bool bigpixelsX() const override { return false; }
166  bool bigpixelsY() const override { return false; }
167 
168  //-------------------------------------------------------------
169  // Check whether the pixel is at the edge of the module
170  //
171  bool isItEdgePixelInX(int ixbin) const override { return ((ixbin == 0) | (ixbin == (m_nrows - 1))); }
172  bool isItEdgePixelInY(int iybin) const override { return ((iybin == 0) | (iybin == (m_ncols - 1))); }
173  bool isItEdgePixel(int ixbin, int iybin) const override {
174  return (isItEdgePixelInX(ixbin) || isItEdgePixelInY(iybin));
175  }
176 
177  //------------------------------------------------------------------
178  // Return pitch
179  std::pair<float, float> pitch() const override { return std::pair<float, float>(float(m_pitchx), float(m_pitchy)); }
180  // Return number of rows
181  int nrows() const override { return (m_nrows); }
182  // Return number of cols
183  int ncolumns() const override { return (m_ncols); }
184  // mlw Return number of ROCS Y
185  int rocsY() const override { return m_ROCS_Y; }
186  // mlw Return number of ROCS X
187  int rocsX() const override { return m_ROCS_X; }
188  // mlw Return number of rows per roc
189  int rowsperroc() const override { return m_ROWS_PER_ROC; }
190  // mlw Return number of cols per roc
191  int colsperroc() const override { return m_COLS_PER_ROC; }
192  int bigpixperrocX() const { return m_BIG_PIX_PER_ROC_X; }
193  int bigpixperrocY() const { return m_BIG_PIX_PER_ROC_Y; }
194  float xoffset() const { return m_xoffset; }
195  float yoffset() const { return m_yoffset; }
196  float pitchbigpixelX() const { return m_BIG_PIX_PITCH_X; }
197  float pitchbigpixelY() const { return m_BIG_PIX_PITCH_Y; }
198 
199 private:
200  float m_pitchx;
201  float m_pitchy;
202  float m_xoffset;
203  float m_yoffset;
204  int m_nrows;
205  int m_ncols;
212  int m_ROCS_X;
213  int m_ROCS_Y;
214 
215  bool containsBigPixel(int iMin, int iMax, int nPxTot, int nPxBigPerROC) const {
216  // nPxTot/2 should lie in the upper half of the dimension
217  auto firstBigPixel = nPxTot / 2 - nPxBigPerROC;
218  auto lastBigPixel = nPxTot / 2 - 1 + nPxBigPerROC;
219 
220  // the interval contains no big pixel when either of the following is met:
221  // - there are no big pixels
222  // - the whole interval lies to the right of the big pixel chunk
223  // - the whole interval lies to the left of the big pixel chunk
224  bool noBigPixel = (nPxBigPerROC == 0) || (iMin > lastBigPixel) || (iMax < firstBigPixel);
225 
226  return !noBigPixel;
227  }
228 };
229 
230 #endif
float localX(const float mpX) const override
float pixelFractionInX(const int ixbin) const override
bool containsBigPixelInX(int ixmin, int ixmax) const override
bool isItBigPixelInY(const int iybin) const override
int channel(const LocalPoint &lp) const override
MeasurementPoint measurementPosition(const LocalPoint &lp) const override
MeasurementError measurementError(const LocalPoint &, const LocalError &) const override
RectangularPixelPhase2Topology(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, float BIG_PIX_PITCH_X, float BIG_PIX_PITCH_Y, int ROCS_X, int ROCS_Y)
bool containsBigPixelInY(int iymin, int iymax) const override
bool isItEdgePixelInX(int ixbin) const override
Measurement2DPoint MeasurementPoint
Measurement points are two-dimensional by default.
bool isItEdgePixel(int ixbin, int iybin) const override
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::pair< float, float > pixel(const LocalPoint &p) const override
bool isItEdgePixelInY(int iybin) const override
LocalPoint localPosition(const MeasurementPoint &mp) const override
bool isItBigPixelInX(const int ixbin) const override
bool containsBigPixel(int iMin, int iMax, int nPxTot, int nPxBigPerROC) const
float pixelFractionInY(const int iybin) const override
float localY(const float mpY) const override
static int pixelToChannel(int row, int col)
std::pair< float, float > pitch() const override
LocalError localError(const MeasurementPoint &, const MeasurementError &) const override
#define LogDebug(id)