Back to home page

Project CMSSW displayed by LXR

 
 

    


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    * Topology for rectangular pixel detector with BIG pixels.
0006    */
0007 // Modified for the large pixels. Should work for barrel and forward.
0008 // Danek Kotlinski & Michele Pioppi, 3/06.
0009 // The bigger pixels are on the ROC boundries.
0010 // For columns (Y direction, longer direction):
0011 //  the normal pixel are 150um long, big pixels are 300um long,
0012 //  the pixel index goes from 0 to 416 (or less for smaller modules)
0013 //  the big pixel are in 0, 52,104,156,208,260,312,363
0014 //                      51,103,155,207,259,311,363,415 .
0015 // For rows (X direction, shorter direction):
0016 //  the normal pixel are 100um wide, big pixels are 200um wide,
0017 //  the pixel index goes from 0 to 159 (or less for smaller modules)
0018 //  the big pixel are in 79,80.
0019 // The ROC has rows=80, cols=52.
0020 // There are a lot of hardwired constants, sorry but this is a very
0021 // specific class. For any other sensor design it has to be rewritten.
0022 
0023 // G. Giurgiu 11/27/06 ---------------------------------------------
0024 // Check whether the pixel is at the edge of the module by adding the
0025 // following functions (ixbin and iybin are the pixel row and column
0026 // inside the module):
0027 // bool isItEdgePixelInX (int ixbin)
0028 // bool isItEdgePixelInY (int iybin)
0029 // bool isItEdgePixel (int ixbin, int iybin)
0030 // ------------------------------------------------------------------
0031 // Add the individual measurement to local trasformations classes 01/07 d.k.
0032 // ------------------------------------------------------------------
0033 // Add big pixel flags for cluster range 15/3/07 V.Chiochia
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   // Constructor, initilize
0042   RectangularPixelTopology(int nrows,
0043                            int ncols,
0044                            float pitchx,
0045                            float pitchy,
0046                            int ROWS_PER_ROC,       // Num of Rows per ROC
0047                            int COLS_PER_ROC,       // Num of Cols per ROC
0048                            int BIG_PIX_PER_ROC_X,  // in x direction, rows. BIG_PIX_PER_ROC_X = 0 for SLHC
0049                            int BIG_PIX_PER_ROC_Y,  // in y direction, cols. BIG_PIX_PER_ROC_Y = 0 for SLHC
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),  // Num of Rows per ROC
0057         m_COLS_PER_ROC(COLS_PER_ROC),  // Num of Cols per ROC
0058         m_ROCS_X(ROCS_X),              // 2 for SLHC
0059         m_ROCS_Y(ROCS_Y)               // 8 for SLHC
0060   {
0061     // Calculate the edge of the active sensor with respect to the center,
0062     // that is simply the half-size.
0063     // Take into account large pixels
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   // Topology interface, go from Masurement to Local corrdinates
0077   // pixel coordinates (mp) -> cm (LocalPoint)
0078   LocalPoint localPosition(const MeasurementPoint& mp) const override;
0079 
0080   // Transform LocalPoint to Measurement. Call pixel().
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   // PixelTopology interface.
0087   // Transform LocalPoint in cm to measurement in pitch units.
0088   std::pair<float, float> pixel(const LocalPoint& p) const override;
0089 
0090   // Errors
0091   // Error in local (cm) from the masurement errors
0092   LocalError localError(const MeasurementPoint&, const MeasurementError&) const override;
0093   // Errors in pitch units from localpoint error (in cm)
0094   MeasurementError measurementError(const LocalPoint&, const LocalError&) const override;
0095 
0096   //-------------------------------------------------------------
0097   // Transform LocalPoint to channel. Call pixel()
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   // Transform measurement to local coordinates individually in each dimension
0106   //
0107   float localX(const float mpX) const override;
0108   float localY(const float mpY) const override;
0109 
0110   //-------------------------------------------------------------
0111   // Return the BIG pixel information for a given pixel
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   // constexpr int bigYIndeces[]{0,51,52,103,104,155,156,207,208,259,260,311,312,363,364,415,416,511};
0137   // return *std::lower_bound(std::begin(bigYIndeces),std::end(bigYIndeces),iybin) == iybin;
0138 
0139   //-------------------------------------------------------------
0140   // Return BIG pixel flag in a given pixel range
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   // Check whether the pixel is at the edge of the module
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   // Return pitch
0161   std::pair<float, float> pitch() const override { return std::pair<float, float>(float(m_pitchx), float(m_pitchy)); }
0162   // Return number of rows
0163   int nrows() const override { return (m_nrows); }
0164   // Return number of cols
0165   int ncolumns() const override { return (m_ncols); }
0166   // mlw Return number of ROCS Y
0167   int rocsY() const override { return m_ROCS_Y; }
0168   // mlw Return number of ROCS X
0169   int rocsX() const override { return m_ROCS_X; }
0170   // mlw Return number of rows per roc
0171   int rowsperroc() const override { return m_ROWS_PER_ROC; }
0172   // mlw Return number of cols per roc
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