Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-05-22 04:03:03

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   float pixelFractionInX(int ixbin) const override { return 1.0f; }
0131   float pixelFractionInY(int iybin) const override { return 1.0f; }
0132   //-------------------------------------------------------------
0133   // Return BIG pixel flag in a given pixel range
0134   bool containsBigPixelInX(int ixmin, int ixmax) const override { return false; }
0135 
0136   bool containsBigPixelInY(int iymin, int iymax) const override { return false; }
0137 
0138   // Check whether the pixel is at the edge of the module
0139   bool isItEdgePixelInX(int ixbin) const override { return ((ixbin == 0) | (ixbin == (m_nrows - 1))); }
0140 
0141   bool isItEdgePixelInY(int iybin) const override { return ((iybin == 0) | (iybin == (m_ncols - 1))); }
0142 
0143   bool isItEdgePixel(int ixbin, int iybin) const override {
0144     return (isItEdgePixelInX(ixbin) || isItEdgePixelInY(iybin));
0145   }
0146 
0147   //-------------------------------------------------------------
0148   // Transform measurement to local coordinates individually in each dimension
0149   //
0150   float localX(const float mpX) const override;
0151   float localY(const float mpY) const override;
0152 
0153   //------------------------------------------------------------------
0154   // Return pitch
0155   std::pair<float, float> pitch() const override { return std::pair<float, float>(float(m_pitchx), float(m_pitchy)); }
0156   // Return number of rows
0157   int nrows() const override { return (m_nrows); }
0158   // Return number of cols
0159   int ncolumns() const override { return (m_ncols); }
0160   // mlw Return number of ROCS Y
0161   int rocsY() const override { return m_ROCS_Y; }
0162   // mlw Return number of ROCS X
0163   int rocsX() const override { return m_ROCS_X; }
0164   // mlw Return number of rows per roc
0165   int rowsperroc() const override { return m_ROWS_PER_ROC; }
0166   // mlw Return number of cols per roc
0167   int colsperroc() const override { return m_COLS_PER_ROC; }
0168   bool bigpixelsX() const override { return false; }
0169   bool bigpixelsY() const override { return false; }
0170   float xoffset() const { return m_xoffset; }
0171   float yoffset() const { return m_yoffset; }
0172   float gapxInterpad() const { return m_GAPxInterpad; }  // Value returned in cm
0173   float gapyInterpad() const { return m_GAPyInterpad; }  // Value returned in cm
0174   float gapxBorder() const { return m_GAPxBorder; }      // Value returned in cm
0175   float gapyBorder() const { return m_GAPyBorder; }      // Value returned in cm
0176   float gapxInterpadFrac() const { return m_GAPxInterpadFrac; }
0177   float gapyInterpadFrac() const { return m_GAPyInterpadFrac; }
0178   float gapxBorderFrac() const { return m_GAPxBorderFrac; }
0179   float gapyBorderFrac() const { return m_GAPyBorderFrac; }
0180 
0181 private:
0182   float m_pitchx;
0183   float m_pitchy;
0184   float m_xoffset;
0185   float m_yoffset;
0186   int m_nrows;
0187   int m_ncols;
0188   int m_ROWS_PER_ROC;
0189   int m_COLS_PER_ROC;
0190   int m_ROCS_X;
0191   int m_ROCS_Y;
0192   float m_GAPxInterpad;
0193   float m_GAPxBorder;
0194   float m_GAPyInterpad;
0195   float m_GAPyBorder;
0196   float m_GAPxInterpadFrac;
0197   float m_GAPxBorderFrac;
0198   float m_GAPyInterpadFrac;
0199   float m_GAPyBorderFrac;
0200 };
0201 
0202 #endif