File indexing completed on 2024-05-22 04:03:04
0001 #ifndef Geometry_TrackerGeometryBuilder_RectangularPixelTopology_H
0002 #define Geometry_TrackerGeometryBuilder_RectangularPixelTopology_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/SiPixelDetId/interface/PixelChannelIdentifier.h"
0037 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0038
0039 class RectangularPixelTopology final : public PixelTopology {
0040 public:
0041
0042 RectangularPixelTopology(int nrows,
0043 int ncols,
0044 float pitchx,
0045 float pitchy,
0046 int ROWS_PER_ROC,
0047 int COLS_PER_ROC,
0048 int BIG_PIX_PER_ROC_X,
0049 int BIG_PIX_PER_ROC_Y,
0050 int ROCS_X,
0051 int ROCS_Y)
0052 : m_pitchx(pitchx),
0053 m_pitchy(pitchy),
0054 m_nrows(nrows),
0055 m_ncols(ncols),
0056 m_ROWS_PER_ROC(ROWS_PER_ROC),
0057 m_COLS_PER_ROC(COLS_PER_ROC),
0058 m_ROCS_X(ROCS_X),
0059 m_ROCS_Y(ROCS_Y)
0060 {
0061
0062
0063
0064 m_xoffset = -(m_nrows + BIG_PIX_PER_ROC_X * m_nrows / ROWS_PER_ROC) / 2. * m_pitchx;
0065 m_yoffset = -(m_ncols + BIG_PIX_PER_ROC_Y * m_ncols / COLS_PER_ROC) / 2. * m_pitchy;
0066
0067 LogDebug("RectangularPixelTopology") << "nrows " << m_nrows << ", ncols " << m_ncols << ", pitchx " << m_pitchx
0068 << ", pitchy " << m_pitchy << ", xoffset " << m_xoffset << ", yoffset "
0069 << m_yoffset << ", BIG_PIX_PER_ROC_X " << BIG_PIX_PER_ROC_X
0070 << ", BIG_PIX_PER_ROC_Y " << BIG_PIX_PER_ROC_Y << ", ROWS_PER_ROC "
0071 << ROWS_PER_ROC << ", COLS_PER_ROC " << COLS_PER_ROC << ", ROCS_X " << ROCS_X
0072 << ", ROCS_Y " << ROCS_Y << "\nNROWS " << m_ROWS_PER_ROC * m_ROCS_X
0073 << ", NCOL " << m_COLS_PER_ROC * m_ROCS_Y;
0074 }
0075
0076
0077
0078 LocalPoint localPosition(const MeasurementPoint& mp) const override;
0079
0080
0081 MeasurementPoint measurementPosition(const LocalPoint& lp) const override {
0082 std::pair<float, float> p = pixel(lp);
0083 return MeasurementPoint(p.first, p.second);
0084 }
0085
0086
0087
0088 std::pair<float, float> pixel(const LocalPoint& p) const override;
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
0099 int channel(const LocalPoint& lp) const override {
0100 std::pair<float, float> p = pixel(lp);
0101 return PixelChannelIdentifier::pixelToChannel(int(p.first), int(p.second));
0102 }
0103
0104
0105
0106
0107 float localX(const float mpX) const override;
0108 float localY(const float mpY) const override;
0109
0110
0111
0112
0113 bool isItBigPixelInX(const int ixbin) const override { return ((ixbin == 79) | (ixbin == 80)); }
0114
0115 bool isItBigPixelInY(const int iybin) const override {
0116 int iybin0 = iybin % 52;
0117 return ((iybin0 == 0) | (iybin0 == 51));
0118 }
0119 float pixelFractionInX(const int ixbin) const override {
0120 if ((ixbin == 79) | (ixbin == 80)) {
0121 return 2.0f;
0122 } else {
0123 return 1.0f;
0124 }
0125 }
0126
0127 float pixelFractionInY(const int iybin) const override {
0128 int iybin0 = iybin % 52;
0129
0130 if ((iybin0 == 0) | (iybin0 == 51)) {
0131 return 2.0f;
0132 } else {
0133 return 1.0f;
0134 }
0135 }
0136
0137
0138
0139
0140
0141
0142 bool containsBigPixelInX(int ixmin, int ixmax) const override { return ((ixmin <= 80) & (ixmax >= 79)); }
0143 bool containsBigPixelInY(int iymin, int iymax) const override {
0144 return (isItBigPixelInY(iymin) || isItBigPixelInY(iymax) || (iymin / 52) != (iymax / 52));
0145 }
0146
0147 bool bigpixelsX() const override { return false; }
0148 bool bigpixelsY() const override { return false; }
0149
0150
0151
0152
0153 bool isItEdgePixelInX(int ixbin) const override { return ((ixbin == 0) | (ixbin == (m_nrows - 1))); }
0154 bool isItEdgePixelInY(int iybin) const override { return ((iybin == 0) | (iybin == (m_ncols - 1))); }
0155 bool isItEdgePixel(int ixbin, int iybin) const override {
0156 return (isItEdgePixelInX(ixbin) || isItEdgePixelInY(iybin));
0157 }
0158
0159
0160
0161 std::pair<float, float> pitch() const override { return std::pair<float, float>(float(m_pitchx), float(m_pitchy)); }
0162
0163 int nrows() const override { return (m_nrows); }
0164
0165 int ncolumns() const override { return (m_ncols); }
0166
0167 int rocsY() const override { return m_ROCS_Y; }
0168
0169 int rocsX() const override { return m_ROCS_X; }
0170
0171 int rowsperroc() const override { return m_ROWS_PER_ROC; }
0172
0173 int colsperroc() const override { return m_COLS_PER_ROC; }
0174 float xoffset() const { return m_xoffset; }
0175 float yoffset() const { return m_yoffset; }
0176
0177 private:
0178 float m_pitchx;
0179 float m_pitchy;
0180 float m_xoffset;
0181 float m_yoffset;
0182 int m_nrows;
0183 int m_ncols;
0184 int m_ROWS_PER_ROC;
0185 int m_COLS_PER_ROC;
0186 int m_ROCS_X;
0187 int m_ROCS_Y;
0188 };
0189
0190 #endif