CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_2_SLHC4_patch1/src/Geometry/TrackerGeometryBuilder/interface/RectangularPixelTopology.h

Go to the documentation of this file.
00001 #ifndef Geometry_TrackerGeometryBuilder_RectangularPixelTopology_H
00002 #define Geometry_TrackerGeometryBuilder_RectangularPixelTopology_H
00003 
00007 // Modified for the large pixels. Should work for barrel and forward.
00008 // Danek Kotlinski & Michele Pioppi, 3/06.
00009 // The bigger pixels are on the ROC boundries.
00010 // For columns (Y direction, longer direction):
00011 //  the normal pixel are 150um long, big pixels are 300um long, 
00012 //  the pixel index goes from 0 to 416 (or less for smaller modules)
00013 //  the big pixel are in 0, 52,104,156,208,260,312,363
00014 //                      51,103,155,207,259,311,363,415 .
00015 // For rows (X direction, shorter direction):
00016 //  the normal pixel are 100um wide, big pixels are 200um wide, 
00017 //  the pixel index goes from 0 to 159 (or less for smaller modules)
00018 //  the big pixel are in 79,80.
00019 // The ROC has rows=80, cols=52.
00020 // There are a lot of hardwired constants, sorry but this is a very 
00021 // specific class. For any other sensor design it has to be rewritten.
00022 
00023 // G. Giurgiu 11/27/06 ---------------------------------------------
00024 // Check whether the pixel is at the edge of the module by adding the 
00025 // following functions (ixbin and iybin are the pixel row and column 
00026 // inside the module):
00027 // bool isItEdgePixelInX (int ixbin) 
00028 // bool isItEdgePixelInY (int iybin) 
00029 // bool isItEdgePixel (int ixbin, int iybin) 
00030 // ------------------------------------------------------------------
00031 // Add the individual measurement to local trasformations classes 01/07 d.k.
00032 // ------------------------------------------------------------------
00033 // Add big pixel flags for cluster range 15/3/07 V.Chiochia
00034 
00035 # include "Geometry/CommonTopologies/interface/PixelTopology.h"
00036 # include "DataFormats/SiPixelDetId/interface/PixelChannelIdentifier.h"
00037 # include "FWCore/ServiceRegistry/interface/Service.h"
00038 # include "FWCore/MessageLogger/interface/MessageLogger.h"
00039 
00040 namespace {
00041   const float EPS = 0.001;     // accuray in pixel units, so about 0.1 um
00042   const float EPSCM = 0.00001; // accuray in cm, so about 0.1 um
00043 }
00044 
00045 class RectangularPixelTopology GCC11_FINAL : public PixelTopology
00046 {
00047 public:
00048 
00049   // Constructor, initilize 
00050   RectangularPixelTopology( int nrows, int ncols, float pitchx, float pitchy,
00051                             bool upgradeGeometry,
00052                             int ROWS_PER_ROC, // Num of Rows per ROC
00053                             int COLS_PER_ROC, // Num of Cols per ROC
00054                             int BIG_PIX_PER_ROC_X, // in x direction, rows. BIG_PIX_PER_ROC_X = 0 for SLHC
00055                             int BIG_PIX_PER_ROC_Y, // in y direction, cols. BIG_PIX_PER_ROC_Y = 0 for SLHC
00056                             int ROCS_X, int ROCS_Y )
00057     : m_pitchx( pitchx ),
00058       m_pitchy( pitchy ),
00059       m_nrows( nrows ),
00060       m_ncols( ncols ),
00061       m_ROWS_PER_ROC( ROWS_PER_ROC ),     // Num of Rows per ROC 
00062       m_COLS_PER_ROC( COLS_PER_ROC ),     // Num of Cols per ROC
00063       m_ROCS_X( ROCS_X ), // 2 for SLHC
00064       m_ROCS_Y( ROCS_Y ),  // 8 for SLHC
00065       m_upgradeGeometry( upgradeGeometry )
00066     {
00067       // Calculate the edge of the active sensor with respect to the center,
00068       // that is simply the half-size.       
00069       // Take into account large pixels
00070       m_xoffset = -(m_nrows + BIG_PIX_PER_ROC_X*m_nrows/ROWS_PER_ROC)/2. * 
00071                   m_pitchx;
00072       m_yoffset = -(m_ncols + BIG_PIX_PER_ROC_Y*m_ncols/COLS_PER_ROC)/2. * 
00073                   m_pitchy;
00074 
00075       LogDebug("RectangularPixelTopology") << "nrows " << m_nrows << ", ncols " << m_ncols << ", pitchx "
00076                                            << m_pitchx << ", pitchy " << m_pitchy << ", xoffset "
00077                                            << m_xoffset << ", yoffset " << m_yoffset << ", BIG_PIX_PER_ROC_X "
00078                                            << BIG_PIX_PER_ROC_X << ", BIG_PIX_PER_ROC_Y " << BIG_PIX_PER_ROC_Y << ", ROWS_PER_ROC "
00079                                            << ROWS_PER_ROC << ", COLS_PER_ROC " << COLS_PER_ROC << ", ROCS_X " << ROCS_X << ", ROCS_Y " << ROCS_Y
00080                                            << "\nNROWS " << m_ROWS_PER_ROC * m_ROCS_X << ", NCOL " << m_COLS_PER_ROC * m_ROCS_Y;
00081     }
00082 
00083   // Topology interface, go from Masurement to Local corrdinates
00084   // pixel coordinates (mp) -> cm (LocalPoint)
00085   virtual LocalPoint localPosition( const MeasurementPoint& mp ) const;
00086 
00087   // Transform LocalPoint to Measurement. Call pixel().
00088   virtual MeasurementPoint measurementPosition( const LocalPoint& lp ) 
00089       const {
00090     std::pair<float,float> p = pixel( lp );
00091     return MeasurementPoint( p.first, p.second );
00092   }
00093 
00094   // PixelTopology interface. 
00095   // Transform LocalPoint in cm to measurement in pitch units.
00096   virtual std::pair<float,float> pixel( const LocalPoint& p ) const;
00097 
00098   // Errors
00099   // Error in local (cm) from the masurement errors
00100   virtual LocalError localError( const MeasurementPoint&,
00101                                  const MeasurementError& ) const;
00102   // Errors in pitch units from localpoint error (in cm)
00103   virtual MeasurementError measurementError( const LocalPoint&, 
00104                                              const LocalError& ) const;
00105   
00106   //-------------------------------------------------------------
00107   // Transform LocalPoint to channel. Call pixel()
00108   //
00109   virtual int channel( const LocalPoint& lp ) const {
00110     std::pair<float,float> p = pixel( lp );
00111     return PixelChannelIdentifier::pixelToChannel( int( p.first ), 
00112                                                    int( p.second ));
00113   }
00114 
00115   //-------------------------------------------------------------
00116   // Transform measurement to local coordinates individually in each dimension
00117   //
00118   virtual float localX( const float mpX ) const;
00119   virtual float localY( const float mpY ) const;
00120 
00121   //-------------------------------------------------------------
00122   // Return the BIG pixel information for a given pixel
00123   //
00124   virtual bool isItBigPixelInX( const int ixbin ) const {
00125     return (( m_upgradeGeometry )?(false):(( ixbin == 79 ) || ( ixbin == 80 )));
00126   } 
00127   virtual bool isItBigPixelInY( const int iybin ) const {
00128       if( m_upgradeGeometry ) return false;
00129       else
00130       {
00131         int iybin0 = iybin%52;
00132         return(( iybin0 == 0 ) || ( iybin0 == 51 ));
00133         // constexpr int bigYIndeces[]{0,51,52,103,104,155,156,207,208,259,260,311,312,363,364,415,416,511};
00134         // return *std::lower_bound(std::begin(bigYIndeces),std::end(bigYIndeces),iybin) == iybin;
00135      }
00136   }
00137   
00138   //-------------------------------------------------------------
00139   // Return BIG pixel flag in a given pixel range
00140   //
00141   bool containsBigPixelInX( const int& ixmin, const int& ixmax ) const;
00142   bool containsBigPixelInY( const int& iymin, const int& iymax ) const;
00143 
00144 
00145   //-------------------------------------------------------------
00146   // Check whether the pixel is at the edge of the module
00147   //
00148   bool isItEdgePixelInX (int ixbin) const {
00149     return ( (ixbin == 0) || (ixbin == (m_nrows-1)) );
00150   } 
00151   bool isItEdgePixelInY (int iybin) const {
00152     return ( (iybin == 0) || (iybin == (m_ncols-1)) );
00153   } 
00154   bool isItEdgePixel (int ixbin, int iybin) const {
00155     return ( isItEdgePixelInX( ixbin ) || isItEdgePixelInY( iybin ) );
00156   } 
00157 
00158   //------------------------------------------------------------------
00159   // Return pitch
00160   virtual std::pair<float,float> pitch() const {
00161     return std::pair<float,float>( float(m_pitchx), float(m_pitchy));
00162   }
00163   // Return number of rows
00164   virtual int nrows() const {
00165     return ( m_nrows );
00166   }
00167   // Return number of cols
00168   virtual int ncolumns() const {
00169     return ( m_ncols );
00170   }
00171   // mlw Return number of ROCS Y         
00172   virtual int rocsY() const {    
00173     return m_ROCS_Y;     
00174   }      
00175   // mlw Return number of ROCS X         
00176   virtual int rocsX() const {    
00177     return m_ROCS_X;     
00178   }      
00179   // mlw Return number of rows per roc   
00180   virtual int rowsperroc() const {       
00181     return m_ROWS_PER_ROC;       
00182   }      
00183   // mlw Return number of cols per roc   
00184   virtual int colsperroc() const {       
00185     return m_COLS_PER_ROC;       
00186   }
00187 
00188 private:
00189 
00190   float m_pitchx;
00191   float m_pitchy;
00192   float m_xoffset;
00193   float m_yoffset;
00194   int m_nrows;
00195   int m_ncols;
00196   int m_ROWS_PER_ROC;
00197   int m_COLS_PER_ROC;
00198   int m_ROCS_X;
00199   int m_ROCS_Y;
00200   bool m_upgradeGeometry;
00201 };
00202 
00203 #endif
00204 
00205