Back to home page

Project CMSSW displayed by LXR

 
 

    


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    * 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/ForwardDetId/interface/MTDChannelIdentifier.h"
0037 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0038 
0039 class RectangularMTDTopology final : public PixelTopology {
0040 public:
0041   // Constructor, initilize
0042   RectangularMTDTopology(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 ROCS_X,
0049                          int ROCS_Y,
0050                          float GAPxInterpad,  // Value given in cm
0051                          float GAPxBorder,    // Value given in cm
0052                          float GAPyInterpad,  // Value given in cm
0053                          float GAPyBorder)    // Value given in cm
0054       : m_pitchx(pitchx),
0055         m_pitchy(pitchy),
0056         m_nrows(nrows),
0057         m_ncols(ncols),
0058         m_ROWS_PER_ROC(ROWS_PER_ROC),  // Num of Rows per ROC
0059         m_COLS_PER_ROC(COLS_PER_ROC),  // Num of Cols per ROC
0060         m_ROCS_X(ROCS_X),              // 2 for SLHC
0061         m_ROCS_Y(ROCS_Y),              // 8 for SLHC
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   // Topology interface, go from Masurement to Local module corrdinates
0075   // pixel coordinates (mp) -> cm (LocalPoint)
0076   LocalPoint localPosition(const MeasurementPoint& mp) const override;
0077 
0078   // Transform LocalPoint to Measurement. Call pixel().
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   // PixelTopology interface.
0085   std::pair<float, float> pixel(const LocalPoint& p) const override;
0086 
0087   //check whether LocalPoint is inside the pixel active area
0088   bool isInPixel(const LocalPoint& p) const;
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   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   // Transforms between module-local coordinates and pixel-local coordinates
0105   // don't need a transform for errors, same units
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   // Return the BIG pixel information for a given pixel
0123   bool isItBigPixelInX(const int ixbin) const override { return false; }
0124 
0125   bool isItBigPixelInY(const int iybin) const override { return false; }
0126 
0127   //-------------------------------------------------------------
0128   // Return BIG pixel flag in a given pixel range
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   // Check whether the pixel is at the edge of the module
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   // Transform measurement to local coordinates individually in each dimension
0144   //
0145   float localX(const float mpX) const override;
0146   float localY(const float mpY) const override;
0147 
0148   //------------------------------------------------------------------
0149   // Return pitch
0150   std::pair<float, float> pitch() const override { return std::pair<float, float>(float(m_pitchx), float(m_pitchy)); }
0151   // Return number of rows
0152   int nrows() const override { return (m_nrows); }
0153   // Return number of cols
0154   int ncolumns() const override { return (m_ncols); }
0155   // mlw Return number of ROCS Y
0156   int rocsY() const override { return m_ROCS_Y; }
0157   // mlw Return number of ROCS X
0158   int rocsX() const override { return m_ROCS_X; }
0159   // mlw Return number of rows per roc
0160   int rowsperroc() const override { return m_ROWS_PER_ROC; }
0161   // mlw Return number of cols per roc
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; }  // Value returned in cm
0166   float gapyInterpad() const { return m_GAPyInterpad; }  // Value returned in cm
0167   float gapxBorder() const { return m_GAPxBorder; }      // Value returned in cm
0168   float gapyBorder() const { return m_GAPyBorder; }      // Value returned in cm
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