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  bool upgradeGeometry,
47  int ROWS_PER_ROC, // Num of Rows per ROC
48  int COLS_PER_ROC, // Num of Cols per ROC
49  int BIG_PIX_PER_ROC_X, // in x direction, rows. BIG_PIX_PER_ROC_X = 0 for SLHC
50  int BIG_PIX_PER_ROC_Y, // in y direction, cols. BIG_PIX_PER_ROC_Y = 0 for SLHC
51  int ROCS_X,
52  int ROCS_Y)
53  : m_pitchx(pitchx),
54  m_pitchy(pitchy),
55  m_nrows(nrows),
56  m_ncols(ncols),
57  m_ROWS_PER_ROC(ROWS_PER_ROC), // Num of Rows per ROC
58  m_COLS_PER_ROC(COLS_PER_ROC), // Num of Cols per ROC
59  m_ROCS_X(ROCS_X), // 2 for SLHC
60  m_ROCS_Y(ROCS_Y), // 8 for SLHC
61  m_upgradeGeometry(upgradeGeometry) {
62  setOffset(BIG_PIX_PER_ROC_X, BIG_PIX_PER_ROC_Y, ROWS_PER_ROC, COLS_PER_ROC);
63  }
64 
65  // Edge of the active sensor with respect to the center
66  void setOffset(const int& BIG_PIX_PER_ROC_X,
67  const int& BIG_PIX_PER_ROC_Y,
68  const int& ROWS_PER_ROC,
69  const int& COLS_PER_ROC);
70 
71  // Topology interface, go from Masurement to Local module corrdinates
72  // pixel coordinates (mp) -> cm (LocalPoint)
73  LocalPoint localPosition(const MeasurementPoint& mp) const override;
74 
75  // Transform LocalPoint to Measurement. Call pixel().
76  MeasurementPoint measurementPosition(const LocalPoint& lp) const override {
77  std::pair<float, float> p = pixel(lp);
78  return MeasurementPoint(p.first, p.second);
79  }
80 
81  // PixelTopology interface.
82  // Transform LocalPoint in cm to measurement in pitch units.
83  std::pair<float, float> pixel(const LocalPoint& p) const override;
84 
85  // Errors
86  // Error in local (cm) from the masurement errors
87  LocalError localError(const MeasurementPoint&, const MeasurementError&) const override;
88  // Errors in pitch units from localpoint error (in cm)
89  MeasurementError measurementError(const LocalPoint&, const LocalError&) const override;
90 
91  //-------------------------------------------------------------
92  // Transform LocalPoint to channel. Call pixel()
93  //
94  int channel(const LocalPoint& lp) const override {
95  std::pair<float, float> p = pixel(lp);
96  return MTDChannelIdentifier::pixelToChannel(int(p.first), int(p.second));
97  }
98 
99  //----
100  // Transforms between module-local coordinates and pixel-local coordinates
101  // don't need a transform for errors, same units
103  std::pair<float, float> p = pixel(mlp);
104  return LocalPoint(mlp.x() - (m_xoffset + (int(p.first) + 0.5f) * m_pitchx),
105  mlp.y() - (m_yoffset + (int(p.second) + 0.5f) * m_pitchy),
106  mlp.z());
107  }
108  LocalPoint pixelToModuleLocalPoint(const LocalPoint& plp, int row, int col) const {
109  return LocalPoint(
110  plp.x() + (m_xoffset + (row + 0.5f) * m_pitchx), plp.y() + (m_yoffset + (col + 0.5f) * m_pitchy), plp.z());
111  }
113  std::pair<int, int> p = MTDChannelIdentifier::channelToPixel(channel);
114  return pixelToModuleLocalPoint(plp, p.first, p.second);
115  }
116 
117  //-------------------------------------------------------------
118  // Transform measurement to local coordinates individually in each dimension
119  //
120  float localX(const float mpX) const override;
121  float localY(const float mpY) const override;
122 
123  //-------------------------------------------------------------
124  // Return the BIG pixel information for a given pixel
125  //
126  bool isItBigPixelInX(const int ixbin) const override {
127  return ((m_upgradeGeometry) ? (false) : ((ixbin == 79) | (ixbin == 80)));
128  }
129 
130  bool isItBigPixelInY(const int iybin) const override {
131  if
132  UNLIKELY(m_upgradeGeometry) return false;
133  else {
134  int iybin0 = iybin % 52;
135  return ((iybin0 == 0) | (iybin0 == 51));
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 
141  //-------------------------------------------------------------
142  // Return BIG pixel flag in a given pixel range
143  //
144  bool containsBigPixelInX(int ixmin, int ixmax) const override {
145  return m_upgradeGeometry ? false : ((ixmin <= 80) & (ixmax >= 79));
146  }
147  bool containsBigPixelInY(int iymin, int iymax) const override {
148  return m_upgradeGeometry ? false
149  : (isItBigPixelInY(iymin) || isItBigPixelInY(iymax) || (iymin / 52) != (iymax / 52));
150  }
151 
152  //-------------------------------------------------------------
153  // Check whether the pixel is at the edge of the module
154  //
155  bool isItEdgePixelInX(int ixbin) const override { return ((ixbin == 0) | (ixbin == (m_nrows - 1))); }
156  bool isItEdgePixelInY(int iybin) const override { return ((iybin == 0) | (iybin == (m_ncols - 1))); }
157  bool isItEdgePixel(int ixbin, int iybin) const override {
158  return (isItEdgePixelInX(ixbin) | isItEdgePixelInY(iybin));
159  }
160 
161  //------------------------------------------------------------------
162  // Return pitch
163  std::pair<float, float> pitch() const override { return std::pair<float, float>(float(m_pitchx), float(m_pitchy)); }
164  // Return number of rows
165  int nrows() const override { return (m_nrows); }
166  // Return number of cols
167  int ncolumns() const override { return (m_ncols); }
168  // mlw Return number of ROCS Y
169  int rocsY() const override { return m_ROCS_Y; }
170  // mlw Return number of ROCS X
171  int rocsX() const override { return m_ROCS_X; }
172  // mlw Return number of rows per roc
173  int rowsperroc() const override { return m_ROWS_PER_ROC; }
174  // mlw Return number of cols per roc
175  int colsperroc() const override { return m_COLS_PER_ROC; }
176  float xoffset() const { return m_xoffset; }
177  float yoffset() const { return m_yoffset; }
178 
179 private:
180  float m_pitchx;
181  float m_pitchy;
182  float m_xoffset;
183  float m_yoffset;
184  int m_nrows;
185  int m_ncols;
188  int m_ROCS_X;
189  int m_ROCS_Y;
191 };
192 
193 #endif
Point2DBase
Definition: Point2DBase.h:9
hgcalPlots.ncols
ncols
Definition: hgcalPlots.py:105
RectangularMTDTopology::m_ROCS_Y
int m_ROCS_Y
Definition: RectangularMTDTopology.h:189
RectangularMTDTopology::m_pitchy
float m_pitchy
Definition: RectangularMTDTopology.h:181
RectangularMTDTopology::m_ncols
int m_ncols
Definition: RectangularMTDTopology.h:185
MessageLogger.h
funct::false
false
Definition: Factorize.h:29
PixelTopology.h
RectangularMTDTopology::ncolumns
int ncolumns() const override
Definition: RectangularMTDTopology.h:167
RectangularMTDTopology::isItBigPixelInX
bool isItBigPixelInX(const int ixbin) const override
Definition: RectangularMTDTopology.h:126
RectangularMTDTopology::pitch
std::pair< float, float > pitch() const override
Definition: RectangularMTDTopology.h:163
PV3DBase::x
T x() const
Definition: PV3DBase.h:59
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
cuy.col
col
Definition: cuy.py:1010
RectangularMTDTopology::pixel
std::pair< float, float > pixel(const LocalPoint &p) const override
Definition: RectangularMTDTopology.cc:33
RectangularMTDTopology::nrows
int nrows() const override
Definition: RectangularMTDTopology.h:165
RectangularMTDTopology::localY
float localY(const float mpY) const override
Definition: RectangularMTDTopology.cc:267
align::LocalPoint
Point3DBase< Scalar, LocalTag > LocalPoint
Definition: Definitions.h:30
RectangularMTDTopology::pixelToModuleLocalPoint
LocalPoint pixelToModuleLocalPoint(const LocalPoint &plp, int channel) const
Definition: RectangularMTDTopology.h:112
RectangularMTDTopology::localPosition
LocalPoint localPosition(const MeasurementPoint &mp) const override
Definition: RectangularMTDTopology.cc:172
PV3DBase::z
T z() const
Definition: PV3DBase.h:61
UNLIKELY
#define UNLIKELY(x)
Definition: Likely.h:21
RectangularMTDTopology::isItEdgePixelInY
bool isItEdgePixelInY(int iybin) const override
Definition: RectangularMTDTopology.h:156
MTDChannelIdentifier::pixelToChannel
static int pixelToChannel(int row, int col)
Definition: MTDChannelIdentifier.h:22
RectangularMTDTopology::m_xoffset
float m_xoffset
Definition: RectangularMTDTopology.h:182
MeasurementError
Definition: MeasurementError.h:8
RectangularMTDTopology::rocsX
int rocsX() const override
Definition: RectangularMTDTopology.h:171
Point3DBase< float, LocalTag >
PixelTopology
Definition: PixelTopology.h:10
RectangularMTDTopology::rowsperroc
int rowsperroc() const override
Definition: RectangularMTDTopology.h:173
RectangularMTDTopology::setOffset
void setOffset(const int &BIG_PIX_PER_ROC_X, const int &BIG_PIX_PER_ROC_Y, const int &ROWS_PER_ROC, const int &COLS_PER_ROC)
Definition: RectangularMTDTopology.cc:14
RectangularMTDTopology::m_upgradeGeometry
bool m_upgradeGeometry
Definition: RectangularMTDTopology.h:190
RectangularMTDTopology::yoffset
float yoffset() const
Definition: RectangularMTDTopology.h:177
RectangularMTDTopology::localError
LocalError localError(const MeasurementPoint &, const MeasurementError &) const override
Definition: RectangularMTDTopology.cc:308
RectangularMTDTopology::m_pitchx
float m_pitchx
Definition: RectangularMTDTopology.h:180
MeasurementPoint
Measurement2DPoint MeasurementPoint
Measurement points are two-dimensional by default.
Definition: MeasurementPoint.h:12
RectangularMTDTopology::containsBigPixelInX
bool containsBigPixelInX(int ixmin, int ixmax) const override
Definition: RectangularMTDTopology.h:144
LocalError
Definition: LocalError.h:12
RectangularMTDTopology::RectangularMTDTopology
RectangularMTDTopology(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)
Definition: RectangularMTDTopology.h:42
PV3DBase::y
T y() const
Definition: PV3DBase.h:60
createfilelist.int
int
Definition: createfilelist.py:10
RectangularMTDTopology::m_ROCS_X
int m_ROCS_X
Definition: RectangularMTDTopology.h:188
RectangularMTDTopology::colsperroc
int colsperroc() const override
Definition: RectangularMTDTopology.h:175
RectangularMTDTopology::isItEdgePixel
bool isItEdgePixel(int ixbin, int iybin) const override
Definition: RectangularMTDTopology.h:157
RectangularMTDTopology::isItBigPixelInY
bool isItBigPixelInY(const int iybin) const override
Definition: RectangularMTDTopology.h:130
RectangularMTDTopology::isItEdgePixelInX
bool isItEdgePixelInX(int ixbin) const override
Definition: RectangularMTDTopology.h:155
RectangularMTDTopology::measurementError
MeasurementError measurementError(const LocalPoint &, const LocalError &) const override
Definition: RectangularMTDTopology.cc:324
RectangularMTDTopology::localX
float localX(const float mpX) const override
Definition: RectangularMTDTopology.cc:212
RectangularMTDTopology
Definition: RectangularMTDTopology.h:39
RectangularMTDTopology::measurementPosition
MeasurementPoint measurementPosition(const LocalPoint &lp) const override
Definition: RectangularMTDTopology.h:76
RectangularMTDTopology::m_nrows
int m_nrows
Definition: RectangularMTDTopology.h:184
RectangularMTDTopology::m_yoffset
float m_yoffset
Definition: RectangularMTDTopology.h:183
RectangularMTDTopology::xoffset
float xoffset() const
Definition: RectangularMTDTopology.h:176
RectangularMTDTopology::moduleToPixelLocalPoint
LocalPoint moduleToPixelLocalPoint(const LocalPoint &mlp) const
Definition: RectangularMTDTopology.h:102
RectangularMTDTopology::m_ROWS_PER_ROC
int m_ROWS_PER_ROC
Definition: RectangularMTDTopology.h:186
RectangularMTDTopology::rocsY
int rocsY() const override
Definition: RectangularMTDTopology.h:169
RectangularMTDTopology::channel
int channel(const LocalPoint &lp) const override
Definition: RectangularMTDTopology.h:94
RectangularMTDTopology::containsBigPixelInY
bool containsBigPixelInY(int iymin, int iymax) const override
Definition: RectangularMTDTopology.h:147
MTDChannelIdentifier.h
MTDChannelIdentifier::channelToPixel
static std::pair< int, int > channelToPixel(int ch)
Definition: MTDChannelIdentifier.h:16
RectangularMTDTopology::pixelToModuleLocalPoint
LocalPoint pixelToModuleLocalPoint(const LocalPoint &plp, int row, int col) const
Definition: RectangularMTDTopology.h:108
RectangularMTDTopology::m_COLS_PER_ROC
int m_COLS_PER_ROC
Definition: RectangularMTDTopology.h:187