File indexing completed on 2024-05-22 04:03:03
0001 #ifndef Geometry_MTDGeometryBuilder_RectangularMTDTopology_H
0002 #define Geometry_MTDGeometryBuilder_RectangularMTDTopology_H
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035 #include "Geometry/CommonTopologies/interface/PixelTopology.h"
0036 #include "DataFormats/ForwardDetId/interface/MTDChannelIdentifier.h"
0037 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0038
0039 class RectangularMTDTopology final : public PixelTopology {
0040 public:
0041
0042 RectangularMTDTopology(int nrows,
0043 int ncols,
0044 float pitchx,
0045 float pitchy,
0046 int ROWS_PER_ROC,
0047 int COLS_PER_ROC,
0048 int ROCS_X,
0049 int ROCS_Y,
0050 float GAPxInterpad,
0051 float GAPxBorder,
0052 float GAPyInterpad,
0053 float GAPyBorder)
0054 : m_pitchx(pitchx),
0055 m_pitchy(pitchy),
0056 m_nrows(nrows),
0057 m_ncols(ncols),
0058 m_ROWS_PER_ROC(ROWS_PER_ROC),
0059 m_COLS_PER_ROC(COLS_PER_ROC),
0060 m_ROCS_X(ROCS_X),
0061 m_ROCS_Y(ROCS_Y),
0062 m_GAPxInterpad(GAPxInterpad),
0063 m_GAPxBorder(GAPxBorder),
0064 m_GAPyInterpad(GAPyInterpad),
0065 m_GAPyBorder(GAPyBorder) {
0066 m_xoffset = -(m_nrows / 2.) * m_pitchx;
0067 m_yoffset = -(m_ncols / 2.) * m_pitchy;
0068 m_GAPxInterpadFrac = m_GAPxInterpad / m_pitchx;
0069 m_GAPxBorderFrac = m_GAPxBorder / m_pitchx;
0070 m_GAPyInterpadFrac = m_GAPyInterpad / m_pitchy;
0071 m_GAPyBorderFrac = m_GAPyBorder / m_pitchy;
0072 }
0073
0074
0075
0076 LocalPoint localPosition(const MeasurementPoint& mp) const override;
0077
0078
0079 MeasurementPoint measurementPosition(const LocalPoint& lp) const override {
0080 std::pair<float, float> p = pixel(lp);
0081 return MeasurementPoint(p.first, p.second);
0082 }
0083
0084
0085 std::pair<float, float> pixel(const LocalPoint& p) const override;
0086
0087
0088 bool isInPixel(const LocalPoint& p) const;
0089
0090
0091 std::pair<int, int> pixelIndex(const LocalPoint& p) const;
0092
0093
0094
0095 LocalError localError(const MeasurementPoint&, const MeasurementError&) const override;
0096
0097 MeasurementError measurementError(const LocalPoint&, const LocalError&) const override;
0098
0099
0100
0101 int channel(const LocalPoint& lp) const override {
0102 std::pair<float, float> p = pixel(lp);
0103 return MTDChannelIdentifier::pixelToChannel(int(p.first), int(p.second));
0104 }
0105
0106
0107
0108
0109 LocalPoint moduleToPixelLocalPoint(const LocalPoint& mlp) const {
0110 std::pair<float, float> p = pixel(mlp);
0111 return LocalPoint(mlp.x() - (m_xoffset + (int(p.first) + 0.5f) * m_pitchx),
0112 mlp.y() - (m_yoffset + (int(p.second) + 0.5f) * m_pitchy),
0113 mlp.z());
0114 }
0115 LocalPoint pixelToModuleLocalPoint(const LocalPoint& plp, int row, int col) const {
0116 return LocalPoint(
0117 plp.x() + (m_xoffset + (row + 0.5f) * m_pitchx), plp.y() + (m_yoffset + (col + 0.5f) * m_pitchy), plp.z());
0118 }
0119 LocalPoint pixelToModuleLocalPoint(const LocalPoint& plp, int channel) const {
0120 std::pair<int, int> p = MTDChannelIdentifier::channelToPixel(channel);
0121 return pixelToModuleLocalPoint(plp, p.first, p.second);
0122 }
0123
0124
0125
0126 bool isItBigPixelInX(const int ixbin) const override { return false; }
0127
0128 bool isItBigPixelInY(const int iybin) const override { return false; }
0129
0130 float pixelFractionInX(int ixbin) const override { return 1.0f; }
0131 float pixelFractionInY(int iybin) const override { return 1.0f; }
0132
0133
0134 bool containsBigPixelInX(int ixmin, int ixmax) const override { return false; }
0135
0136 bool containsBigPixelInY(int iymin, int iymax) const override { return false; }
0137
0138
0139 bool isItEdgePixelInX(int ixbin) const override { return ((ixbin == 0) | (ixbin == (m_nrows - 1))); }
0140
0141 bool isItEdgePixelInY(int iybin) const override { return ((iybin == 0) | (iybin == (m_ncols - 1))); }
0142
0143 bool isItEdgePixel(int ixbin, int iybin) const override {
0144 return (isItEdgePixelInX(ixbin) || isItEdgePixelInY(iybin));
0145 }
0146
0147
0148
0149
0150 float localX(const float mpX) const override;
0151 float localY(const float mpY) const override;
0152
0153
0154
0155 std::pair<float, float> pitch() const override { return std::pair<float, float>(float(m_pitchx), float(m_pitchy)); }
0156
0157 int nrows() const override { return (m_nrows); }
0158
0159 int ncolumns() const override { return (m_ncols); }
0160
0161 int rocsY() const override { return m_ROCS_Y; }
0162
0163 int rocsX() const override { return m_ROCS_X; }
0164
0165 int rowsperroc() const override { return m_ROWS_PER_ROC; }
0166
0167 int colsperroc() const override { return m_COLS_PER_ROC; }
0168 bool bigpixelsX() const override { return false; }
0169 bool bigpixelsY() const override { return false; }
0170 float xoffset() const { return m_xoffset; }
0171 float yoffset() const { return m_yoffset; }
0172 float gapxInterpad() const { return m_GAPxInterpad; }
0173 float gapyInterpad() const { return m_GAPyInterpad; }
0174 float gapxBorder() const { return m_GAPxBorder; }
0175 float gapyBorder() const { return m_GAPyBorder; }
0176 float gapxInterpadFrac() const { return m_GAPxInterpadFrac; }
0177 float gapyInterpadFrac() const { return m_GAPyInterpadFrac; }
0178 float gapxBorderFrac() const { return m_GAPxBorderFrac; }
0179 float gapyBorderFrac() const { return m_GAPyBorderFrac; }
0180
0181 private:
0182 float m_pitchx;
0183 float m_pitchy;
0184 float m_xoffset;
0185 float m_yoffset;
0186 int m_nrows;
0187 int m_ncols;
0188 int m_ROWS_PER_ROC;
0189 int m_COLS_PER_ROC;
0190 int m_ROCS_X;
0191 int m_ROCS_Y;
0192 float m_GAPxInterpad;
0193 float m_GAPxBorder;
0194 float m_GAPyInterpad;
0195 float m_GAPyBorder;
0196 float m_GAPxInterpadFrac;
0197 float m_GAPxBorderFrac;
0198 float m_GAPyInterpadFrac;
0199 float m_GAPyBorderFrac;
0200 };
0201
0202 #endif