CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_4_5_patch3/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 <iostream>
00038 #include <iomanip>
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   const bool TP_DEBUG = false; // print flag
00044 }
00045 
00046 class RectangularPixelTopology : public PixelTopology {
00047  private:
00048   // This is temporary before we find a better way
00049   static const int ROWS_PER_ROC = 80;     // Num of cols per ROC
00050   static const int COLS_PER_ROC = 52;     // Num of Rows per ROC
00051   static const int BIG_PIX_PER_ROC_X = 1; // in x direction, rows
00052   static const int BIG_PIX_PER_ROC_Y = 2; // in y direction, cols
00053 
00054 public:
00055 
00056   // Constructor, initilize 
00057   RectangularPixelTopology( int nrows, int ncols, float pitchx, 
00058                             float pitchy) :
00059     m_nrows(nrows), m_ncols(ncols), 
00060     m_pitchx(pitchx), m_pitchy(pitchy) {
00061                                 
00062     //using std::cout;
00063     //using std::endl;
00064 
00065     // Calculate the edge of the active sensor with respect to the center,
00066     // that is simply the half-size.       
00067     // Take into account large pixels
00068     m_xoffset = -(m_nrows + BIG_PIX_PER_ROC_X*m_nrows/ROWS_PER_ROC)/2. * 
00069       m_pitchx;
00070     m_yoffset = -(m_ncols + BIG_PIX_PER_ROC_Y*m_ncols/COLS_PER_ROC)/2. * 
00071       m_pitchy;
00072 
00073     if(TP_DEBUG) std::cout<<" RectangularPixelTopology: "
00074                   <<m_nrows<<" "<<m_ncols<<" "
00075                   <<m_pitchx<<" "<<m_pitchy<<" "<<m_xoffset<<" "<<m_yoffset
00076                   <<BIG_PIX_PER_ROC_X<<" "<<BIG_PIX_PER_ROC_Y<<" "
00077                   <<ROWS_PER_ROC<<" "<<COLS_PER_ROC<<std::endl;
00078   }
00079 
00080   // Topology interface, go from Masurement to Local corrdinates
00081   // pixel coordinates (mp) -> cm (LocalPoint)
00082   virtual LocalPoint localPosition( const MeasurementPoint& mp) const;
00083 
00084   // Transform LocalPoint to Measurement. Call pixel().
00085   virtual MeasurementPoint measurementPosition( const LocalPoint& lp) 
00086       const {
00087     std::pair<float,float> p = pixel(lp);
00088     return MeasurementPoint( p.first, p.second);
00089   }
00090 
00091   // PixelTopology interface. 
00092   // Transform LocalPoint in cm to measurement in pitch units.
00093   virtual std::pair<float,float> pixel( const LocalPoint& p) const;
00094 
00095   // Errors
00096   // Error in local (cm) from the masurement errors
00097   virtual LocalError localError( const MeasurementPoint&,
00098                                  const MeasurementError& ) const;
00099   // Errors in pitch units from localpoint error (in cm)
00100   virtual MeasurementError measurementError( const LocalPoint&, 
00101                                              const LocalError& ) const;
00102   
00103   //
00104   // Transform LocalPoint to channel. Call pixel()
00105   virtual int channel( const LocalPoint& lp) const {
00106     std::pair<float,float> p = pixel(lp);
00107     return PixelChannelIdentifier::pixelToChannel( int(p.first), 
00108                                                    int(p.second));
00109   }
00110 
00111 
00112   // Transform measurement to local coordinates individually in each dimension
00113   virtual float localX(const float mpX) const;
00114   virtual float localY(const float mpY) const;
00115 
00116   //-------------------------------------------------------------
00117   // Return the BIG pixel information for a given pixel
00118   //
00119   virtual bool isItBigPixelInX(const int ixbin) const {
00120     return ( (ixbin == 79) || (ixbin == 80));
00121   } 
00122   virtual bool isItBigPixelInY(const int iybin) const {
00123     int iybin0 = iybin%52;
00124     return ( (iybin0 == 0) || (iybin0 == 51));
00125   } 
00126   //-------------------------------------------------------------
00127   // Return BIG pixel flag in a given pixel range
00128   //
00129   bool containsBigPixelInX(const int& ixmin, const int& ixmax) const;
00130   bool containsBigPixelInY(const int& iymin, const int& iymax) const;
00131 
00132 
00133   // Check whether the pixel is at the edge of the module
00134   bool isItEdgePixelInX (int ixbin) const {
00135     return ( (ixbin == 0) || (ixbin == (m_nrows-1)) );
00136   } 
00137   bool isItEdgePixelInY (int iybin) const {
00138     return ( (iybin == 0) || (iybin == (m_ncols-1)) );
00139   } 
00140   bool isItEdgePixel (int ixbin, int iybin) const {
00141     return ( isItEdgePixelInX( ixbin ) || isItEdgePixelInY( iybin ) );
00142   } 
00143 
00144   //------------------------------------------------------------------
00145   // Return pitch
00146   virtual std::pair<float,float> pitch() const {
00147     return std::pair<float,float>( float(m_pitchx), float(m_pitchy));
00148   }
00149   // Return number of rows
00150   virtual int nrows() const {
00151     return m_nrows;
00152   }
00153   // Return number of cols
00154   virtual int ncolumns() const {
00155     return m_ncols;
00156   }
00157   
00158 private:
00159   int m_nrows;
00160   int m_ncols;
00161   float m_pitchx;
00162   float m_pitchy;
00163   float m_xoffset;
00164   float m_yoffset;
00165 };
00166 
00167 #endif
00168 
00169