CMS 3D CMS Logo

RectangularMTDTopology.h
Go to the documentation of this file.
1 #ifndef Geometry_MTDGeometryBuilder_RectangularMTDTopology_H
2 #define Geometry_MTDGeometryBuilder_RectangularMTDTopology_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 class RectangularMTDTopology final : public PixelTopology {
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 ROCS_X,
49  int ROCS_Y,
50  float GAPxInterpad, // Value given in cm
51  float GAPxBorder, // Value given in cm
52  float GAPyInterpad, // Value given in cm
53  float GAPyBorder) // Value given in cm
54  : m_pitchx(pitchx),
55  m_pitchy(pitchy),
56  m_nrows(nrows),
57  m_ncols(ncols),
58  m_ROWS_PER_ROC(ROWS_PER_ROC), // Num of Rows per ROC
59  m_COLS_PER_ROC(COLS_PER_ROC), // Num of Cols per ROC
60  m_ROCS_X(ROCS_X), // 2 for SLHC
61  m_ROCS_Y(ROCS_Y), // 8 for SLHC
62  m_GAPxInterpad(GAPxInterpad),
63  m_GAPxBorder(GAPxBorder),
64  m_GAPyInterpad(GAPyInterpad),
65  m_GAPyBorder(GAPyBorder) {
66  m_xoffset = -(m_nrows / 2.) * m_pitchx;
67  m_yoffset = -(m_ncols / 2.) * m_pitchy;
72  }
73 
74  // Topology interface, go from Masurement to Local module corrdinates
75  // pixel coordinates (mp) -> cm (LocalPoint)
76  LocalPoint localPosition(const MeasurementPoint& mp) const override;
77 
78  // Transform LocalPoint to Measurement. Call pixel().
79  MeasurementPoint measurementPosition(const LocalPoint& lp) const override {
80  std::pair<float, float> p = pixel(lp);
81  return MeasurementPoint(p.first, p.second);
82  }
83 
84  // PixelTopology interface.
85  std::pair<float, float> pixel(const LocalPoint& p) const override;
86 
87  //check whether LocalPoint is inside the pixel active area
88  bool isInPixel(const LocalPoint& p) const;
89 
90  //provide pixel indices based on local module position (with protection for border positions)
91  std::pair<int, int> pixelIndex(const LocalPoint& p) const;
92 
93  // Errors
94  // Error in local (cm) from the masurement errors
95  LocalError localError(const MeasurementPoint&, const MeasurementError&) const override;
96  // Errors in pitch units from localpoint error (in cm)
97  MeasurementError measurementError(const LocalPoint&, const LocalError&) const override;
98 
99  //-------------------------------------------------------------
100  // Transform LocalPoint to channel. Call pixel()
101  int channel(const LocalPoint& lp) const override {
102  std::pair<float, float> p = pixel(lp);
103  return MTDChannelIdentifier::pixelToChannel(int(p.first), int(p.second));
104  }
105 
106  //----
107  // Transforms between module-local coordinates and pixel-local coordinates
108  // don't need a transform for errors, same units
110  std::pair<float, float> p = pixel(mlp);
111  return LocalPoint(mlp.x() - (m_xoffset + (int(p.first) + 0.5f) * m_pitchx),
112  mlp.y() - (m_yoffset + (int(p.second) + 0.5f) * m_pitchy),
113  mlp.z());
114  }
115  LocalPoint pixelToModuleLocalPoint(const LocalPoint& plp, int row, int col) const {
116  return LocalPoint(
117  plp.x() + (m_xoffset + (row + 0.5f) * m_pitchx), plp.y() + (m_yoffset + (col + 0.5f) * m_pitchy), plp.z());
118  }
120  std::pair<int, int> p = MTDChannelIdentifier::channelToPixel(channel);
121  return pixelToModuleLocalPoint(plp, p.first, p.second);
122  }
123 
124  //-------------------------------------------------------------
125  // Return the BIG pixel information for a given pixel
126  bool isItBigPixelInX(const int ixbin) const override { return false; }
127 
128  bool isItBigPixelInY(const int iybin) const override { return false; }
129 
130  float pixelFractionInX(int ixbin) const override { return 1.0f; }
131  float pixelFractionInY(int iybin) const override { return 1.0f; }
132  //-------------------------------------------------------------
133  // Return BIG pixel flag in a given pixel range
134  bool containsBigPixelInX(int ixmin, int ixmax) const override { return false; }
135 
136  bool containsBigPixelInY(int iymin, int iymax) const override { return false; }
137 
138  // Check whether the pixel is at the edge of the module
139  bool isItEdgePixelInX(int ixbin) const override { return ((ixbin == 0) | (ixbin == (m_nrows - 1))); }
140 
141  bool isItEdgePixelInY(int iybin) const override { return ((iybin == 0) | (iybin == (m_ncols - 1))); }
142 
143  bool isItEdgePixel(int ixbin, int iybin) const override {
144  return (isItEdgePixelInX(ixbin) || isItEdgePixelInY(iybin));
145  }
146 
147  //-------------------------------------------------------------
148  // Transform measurement to local coordinates individually in each dimension
149  //
150  float localX(const float mpX) const override;
151  float localY(const float mpY) const override;
152 
153  //------------------------------------------------------------------
154  // Return pitch
155  std::pair<float, float> pitch() const override { return std::pair<float, float>(float(m_pitchx), float(m_pitchy)); }
156  // Return number of rows
157  int nrows() const override { return (m_nrows); }
158  // Return number of cols
159  int ncolumns() const override { return (m_ncols); }
160  // mlw Return number of ROCS Y
161  int rocsY() const override { return m_ROCS_Y; }
162  // mlw Return number of ROCS X
163  int rocsX() const override { return m_ROCS_X; }
164  // mlw Return number of rows per roc
165  int rowsperroc() const override { return m_ROWS_PER_ROC; }
166  // mlw Return number of cols per roc
167  int colsperroc() const override { return m_COLS_PER_ROC; }
168  bool bigpixelsX() const override { return false; }
169  bool bigpixelsY() const override { return false; }
170  float xoffset() const { return m_xoffset; }
171  float yoffset() const { return m_yoffset; }
172  float gapxInterpad() const { return m_GAPxInterpad; } // Value returned in cm
173  float gapyInterpad() const { return m_GAPyInterpad; } // Value returned in cm
174  float gapxBorder() const { return m_GAPxBorder; } // Value returned in cm
175  float gapyBorder() const { return m_GAPyBorder; } // Value returned in cm
176  float gapxInterpadFrac() const { return m_GAPxInterpadFrac; }
177  float gapyInterpadFrac() const { return m_GAPyInterpadFrac; }
178  float gapxBorderFrac() const { return m_GAPxBorderFrac; }
179  float gapyBorderFrac() const { return m_GAPyBorderFrac; }
180 
181 private:
182  float m_pitchx;
183  float m_pitchy;
184  float m_xoffset;
185  float m_yoffset;
186  int m_nrows;
187  int m_ncols;
190  int m_ROCS_X;
191  int m_ROCS_Y;
200 };
201 
202 #endif
bool isItEdgePixel(int ixbin, int iybin) const override
LocalPoint pixelToModuleLocalPoint(const LocalPoint &plp, int channel) const
bool isInPixel(const LocalPoint &p) const
Point3DBase< Scalar, LocalTag > LocalPoint
Definition: Definitions.h:30
RectangularMTDTopology(int nrows, int ncols, float pitchx, float pitchy, int ROWS_PER_ROC, int COLS_PER_ROC, int ROCS_X, int ROCS_Y, float GAPxInterpad, float GAPxBorder, float GAPyInterpad, float GAPyBorder)
bool bigpixelsX() const override
LocalError localError(const MeasurementPoint &, const MeasurementError &) const override
int channel(const LocalPoint &lp) const override
T z() const
Definition: PV3DBase.h:61
static std::pair< int, int > channelToPixel(int ch)
bool bigpixelsY() const override
LocalPoint moduleToPixelLocalPoint(const LocalPoint &mlp) const
LocalPoint pixelToModuleLocalPoint(const LocalPoint &plp, int row, int col) const
bool isItBigPixelInY(const int iybin) const override
int colsperroc() const override
T x() const
Definition: PV3DBase.h:59
T y() const
Definition: PV3DBase.h:60
Measurement2DPoint MeasurementPoint
Measurement points are two-dimensional by default.
static int pixelToChannel(int row, int col)
bool isItEdgePixelInX(int ixbin) const override
std::pair< float, float > pixel(const LocalPoint &p) const override
float localX(const float mpX) const override
float pixelFractionInX(int ixbin) const override
int ncolumns() const override
MeasurementPoint measurementPosition(const LocalPoint &lp) const override
int rocsY() const override
int nrows() const override
float pixelFractionInY(int iybin) const override
float localY(const float mpY) const override
bool containsBigPixelInY(int iymin, int iymax) const override
int rocsX() const override
bool isItEdgePixelInY(int iybin) const override
int rowsperroc() const override
std::pair< float, float > pitch() const override
bool containsBigPixelInX(int ixmin, int ixmax) const override
col
Definition: cuy.py:1009
bool isItBigPixelInX(const int ixbin) const override
std::pair< int, int > pixelIndex(const LocalPoint &p) const
LocalPoint localPosition(const MeasurementPoint &mp) const override
MeasurementError measurementError(const LocalPoint &, const LocalError &) const override