Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-02-24 03:08: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   //provide pixel indices based on local module position (with protection for border positions)
0091   std::pair<int, int> pixelIndex(const LocalPoint& p) const;
0092 
0093   // Errors
0094   // Error in local (cm) from the masurement errors
0095   LocalError localError(const MeasurementPoint&, const MeasurementError&) const override;
0096   // Errors in pitch units from localpoint error (in cm)
0097   MeasurementError measurementError(const LocalPoint&, const LocalError&) const override;
0098 
0099   //-------------------------------------------------------------
0100   // Transform LocalPoint to channel. Call pixel()
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   // Transforms between module-local coordinates and pixel-local coordinates
0108   // don't need a transform for errors, same units
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   // Return the BIG pixel information for a given pixel
0126   bool isItBigPixelInX(const int ixbin) const override { return false; }
0127 
0128   bool isItBigPixelInY(const int iybin) const override { return false; }
0129 
0130   //-------------------------------------------------------------
0131   // Return BIG pixel flag in a given pixel range
0132   bool containsBigPixelInX(int ixmin, int ixmax) const override { return false; }
0133 
0134   bool containsBigPixelInY(int iymin, int iymax) const override { return false; }
0135 
0136   // Check whether the pixel is at the edge of the module
0137   bool isItEdgePixelInX(int ixbin) const override { return ((ixbin == 0) | (ixbin == (m_nrows - 1))); }
0138 
0139   bool isItEdgePixelInY(int iybin) const override { return ((iybin == 0) | (iybin == (m_ncols - 1))); }
0140 
0141   bool isItEdgePixel(int ixbin, int iybin) const override {
0142     return (isItEdgePixelInX(ixbin) || isItEdgePixelInY(iybin));
0143   }
0144 
0145   //-------------------------------------------------------------
0146   // Transform measurement to local coordinates individually in each dimension
0147   //
0148   float localX(const float mpX) const override;
0149   float localY(const float mpY) const override;
0150 
0151   //------------------------------------------------------------------
0152   // Return pitch
0153   std::pair<float, float> pitch() const override { return std::pair<float, float>(float(m_pitchx), float(m_pitchy)); }
0154   // Return number of rows
0155   int nrows() const override { return (m_nrows); }
0156   // Return number of cols
0157   int ncolumns() const override { return (m_ncols); }
0158   // mlw Return number of ROCS Y
0159   int rocsY() const override { return m_ROCS_Y; }
0160   // mlw Return number of ROCS X
0161   int rocsX() const override { return m_ROCS_X; }
0162   // mlw Return number of rows per roc
0163   int rowsperroc() const override { return m_ROWS_PER_ROC; }
0164   // mlw Return number of cols per roc
0165   int colsperroc() const override { return m_COLS_PER_ROC; }
0166   float xoffset() const { return m_xoffset; }
0167   float yoffset() const { return m_yoffset; }
0168   float gapxInterpad() const { return m_GAPxInterpad; }  // Value returned in cm
0169   float gapyInterpad() const { return m_GAPyInterpad; }  // Value returned in cm
0170   float gapxBorder() const { return m_GAPxBorder; }      // Value returned in cm
0171   float gapyBorder() const { return m_GAPyBorder; }      // Value returned in cm
0172   float gapxInterpadFrac() const { return m_GAPxInterpadFrac; }
0173   float gapyInterpadFrac() const { return m_GAPyInterpadFrac; }
0174   float gapxBorderFrac() const { return m_GAPxBorderFrac; }
0175   float gapyBorderFrac() const { return m_GAPyBorderFrac; }
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   float m_GAPxInterpad;
0189   float m_GAPxBorder;
0190   float m_GAPyInterpad;
0191   float m_GAPyBorder;
0192   float m_GAPxInterpadFrac;
0193   float m_GAPxBorderFrac;
0194   float m_GAPyInterpadFrac;
0195   float m_GAPyBorderFrac;
0196 };
0197 
0198 #endif