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  // 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  int channel(const LocalPoint& lp) const override {
99  std::pair<float, float> p = pixel(lp);
100  return MTDChannelIdentifier::pixelToChannel(int(p.first), int(p.second));
101  }
102 
103  //----
104  // Transforms between module-local coordinates and pixel-local coordinates
105  // don't need a transform for errors, same units
107  std::pair<float, float> p = pixel(mlp);
108  return LocalPoint(mlp.x() - (m_xoffset + (int(p.first) + 0.5f) * m_pitchx),
109  mlp.y() - (m_yoffset + (int(p.second) + 0.5f) * m_pitchy),
110  mlp.z());
111  }
112  LocalPoint pixelToModuleLocalPoint(const LocalPoint& plp, int row, int col) const {
113  return LocalPoint(
114  plp.x() + (m_xoffset + (row + 0.5f) * m_pitchx), plp.y() + (m_yoffset + (col + 0.5f) * m_pitchy), plp.z());
115  }
117  std::pair<int, int> p = MTDChannelIdentifier::channelToPixel(channel);
118  return pixelToModuleLocalPoint(plp, p.first, p.second);
119  }
120 
121  //-------------------------------------------------------------
122  // Return the BIG pixel information for a given pixel
123  bool isItBigPixelInX(const int ixbin) const override { return false; }
124 
125  bool isItBigPixelInY(const int iybin) const override { return false; }
126 
127  //-------------------------------------------------------------
128  // Return BIG pixel flag in a given pixel range
129  bool containsBigPixelInX(int ixmin, int ixmax) const override { return false; }
130 
131  bool containsBigPixelInY(int iymin, int iymax) const override { return false; }
132 
133  // Check whether the pixel is at the edge of the module
134  bool isItEdgePixelInX(int ixbin) const override { return ((ixbin == 0) | (ixbin == (m_nrows - 1))); }
135 
136  bool isItEdgePixelInY(int iybin) const override { return ((iybin == 0) | (iybin == (m_ncols - 1))); }
137 
138  bool isItEdgePixel(int ixbin, int iybin) const override {
139  return (isItEdgePixelInX(ixbin) | isItEdgePixelInY(iybin));
140  }
141 
142  //-------------------------------------------------------------
143  // Transform measurement to local coordinates individually in each dimension
144  //
145  float localX(const float mpX) const override;
146  float localY(const float mpY) const override;
147 
148  //------------------------------------------------------------------
149  // Return pitch
150  std::pair<float, float> pitch() const override { return std::pair<float, float>(float(m_pitchx), float(m_pitchy)); }
151  // Return number of rows
152  int nrows() const override { return (m_nrows); }
153  // Return number of cols
154  int ncolumns() const override { return (m_ncols); }
155  // mlw Return number of ROCS Y
156  int rocsY() const override { return m_ROCS_Y; }
157  // mlw Return number of ROCS X
158  int rocsX() const override { return m_ROCS_X; }
159  // mlw Return number of rows per roc
160  int rowsperroc() const override { return m_ROWS_PER_ROC; }
161  // mlw Return number of cols per roc
162  int colsperroc() const override { return m_COLS_PER_ROC; }
163  float xoffset() const { return m_xoffset; }
164  float yoffset() const { return m_yoffset; }
165  float gapxInterpad() const { return m_GAPxInterpad; } // Value returned in cm
166  float gapyInterpad() const { return m_GAPyInterpad; } // Value returned in cm
167  float gapxBorder() const { return m_GAPxBorder; } // Value returned in cm
168  float gapyBorder() const { return m_GAPyBorder; } // Value returned in cm
169  float gapxInterpadFrac() const { return m_GAPxInterpadFrac; }
170  float gapyInterpadFrac() const { return m_GAPyInterpadFrac; }
171  float gapxBorderFrac() const { return m_GAPxBorderFrac; }
172  float gapyBorderFrac() const { return m_GAPyBorderFrac; }
173  bool isBricked() const override { return false; }
174 
175 private:
176  float m_pitchx;
177  float m_pitchy;
178  float m_xoffset;
179  float m_yoffset;
180  int m_nrows;
181  int m_ncols;
184  int m_ROCS_X;
185  int m_ROCS_Y;
194 };
195 
196 #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
bool isBricked() const override
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)
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)
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
int ncolumns() const override
MeasurementPoint measurementPosition(const LocalPoint &lp) const override
int rocsY() const override
int nrows() 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
LocalPoint localPosition(const MeasurementPoint &mp) const override
MeasurementError measurementError(const LocalPoint &, const LocalError &) const override