File indexing completed on 2023-01-21 00:19:32
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
0092 LocalError localError(const MeasurementPoint&, const MeasurementError&) const override;
0093
0094 MeasurementError measurementError(const LocalPoint&, const LocalError&) const override;
0095
0096
0097
0098 int channel(const LocalPoint& lp) const override {
0099 std::pair<float, float> p = pixel(lp);
0100 return MTDChannelIdentifier::pixelToChannel(int(p.first), int(p.second));
0101 }
0102
0103
0104
0105
0106 LocalPoint moduleToPixelLocalPoint(const LocalPoint& mlp) const {
0107 std::pair<float, float> p = pixel(mlp);
0108 return LocalPoint(mlp.x() - (m_xoffset + (int(p.first) + 0.5f) * m_pitchx),
0109 mlp.y() - (m_yoffset + (int(p.second) + 0.5f) * m_pitchy),
0110 mlp.z());
0111 }
0112 LocalPoint pixelToModuleLocalPoint(const LocalPoint& plp, int row, int col) const {
0113 return LocalPoint(
0114 plp.x() + (m_xoffset + (row + 0.5f) * m_pitchx), plp.y() + (m_yoffset + (col + 0.5f) * m_pitchy), plp.z());
0115 }
0116 LocalPoint pixelToModuleLocalPoint(const LocalPoint& plp, int channel) const {
0117 std::pair<int, int> p = MTDChannelIdentifier::channelToPixel(channel);
0118 return pixelToModuleLocalPoint(plp, p.first, p.second);
0119 }
0120
0121
0122
0123 bool isItBigPixelInX(const int ixbin) const override { return false; }
0124
0125 bool isItBigPixelInY(const int iybin) const override { return false; }
0126
0127
0128
0129 bool containsBigPixelInX(int ixmin, int ixmax) const override { return false; }
0130
0131 bool containsBigPixelInY(int iymin, int iymax) const override { return false; }
0132
0133
0134 bool isItEdgePixelInX(int ixbin) const override { return ((ixbin == 0) | (ixbin == (m_nrows - 1))); }
0135
0136 bool isItEdgePixelInY(int iybin) const override { return ((iybin == 0) | (iybin == (m_ncols - 1))); }
0137
0138 bool isItEdgePixel(int ixbin, int iybin) const override {
0139 return (isItEdgePixelInX(ixbin) || isItEdgePixelInY(iybin));
0140 }
0141
0142
0143
0144
0145 float localX(const float mpX) const override;
0146 float localY(const float mpY) const override;
0147
0148
0149
0150 std::pair<float, float> pitch() const override { return std::pair<float, float>(float(m_pitchx), float(m_pitchy)); }
0151
0152 int nrows() const override { return (m_nrows); }
0153
0154 int ncolumns() const override { return (m_ncols); }
0155
0156 int rocsY() const override { return m_ROCS_Y; }
0157
0158 int rocsX() const override { return m_ROCS_X; }
0159
0160 int rowsperroc() const override { return m_ROWS_PER_ROC; }
0161
0162 int colsperroc() const override { return m_COLS_PER_ROC; }
0163 float xoffset() const { return m_xoffset; }
0164 float yoffset() const { return m_yoffset; }
0165 float gapxInterpad() const { return m_GAPxInterpad; }
0166 float gapyInterpad() const { return m_GAPyInterpad; }
0167 float gapxBorder() const { return m_GAPxBorder; }
0168 float gapyBorder() const { return m_GAPyBorder; }
0169 float gapxInterpadFrac() const { return m_GAPxInterpadFrac; }
0170 float gapyInterpadFrac() const { return m_GAPyInterpadFrac; }
0171 float gapxBorderFrac() const { return m_GAPxBorderFrac; }
0172 float gapyBorderFrac() const { return m_GAPyBorderFrac; }
0173
0174 private:
0175 float m_pitchx;
0176 float m_pitchy;
0177 float m_xoffset;
0178 float m_yoffset;
0179 int m_nrows;
0180 int m_ncols;
0181 int m_ROWS_PER_ROC;
0182 int m_COLS_PER_ROC;
0183 int m_ROCS_X;
0184 int m_ROCS_Y;
0185 float m_GAPxInterpad;
0186 float m_GAPxBorder;
0187 float m_GAPyInterpad;
0188 float m_GAPyBorder;
0189 float m_GAPxInterpadFrac;
0190 float m_GAPxBorderFrac;
0191 float m_GAPyInterpadFrac;
0192 float m_GAPyBorderFrac;
0193 };
0194
0195 #endif