CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_10_patch2/src/CondFormats/SiPixelObjects/interface/LocalPixel.h

Go to the documentation of this file.
00001 #ifndef CondFormats_SiPixelObjects_LocalPixel_H
00002 #define CondFormats_SiPixelObjects_LocalPixel_H
00003 
00004 namespace sipixelobjects {
00005 
00007   class LocalPixel { 
00008 
00009     public:
00010 
00011       static const int numRowsInRoc = 80;
00012       static const int numColsInRoc = 52;
00013 
00015       struct RocRowCol { 
00016         int rocRow, rocCol; 
00017         bool valid() const { return    0 <= rocRow && rocRow < numRowsInRoc  
00018                                     && 0 <= rocCol && rocCol < numColsInRoc; }
00019       };
00020 
00022       struct DcolPxid { 
00023         int dcol, pxid; 
00024         bool valid() const { return (0 <= dcol && dcol < 26 &&  2 <= pxid && pxid < 162 ); }
00025       }; 
00026 
00027       LocalPixel( const DcolPxid & pixel) {
00028         thePixel.rocCol = pixel.dcol*2 + pixel.pxid%2;
00029         thePixel.rocRow = numRowsInRoc - pixel.pxid/2;
00030       }
00031 
00032       LocalPixel( const RocRowCol & pixel) : thePixel(pixel) {} 
00033 
00034       int  dcol() const { return thePixel.rocCol/2; }
00035       int  pxid() const { return 2*(numRowsInRoc-thePixel.rocRow)+ (thePixel.rocCol%2); }
00036 
00037       int  rocRow() const { return thePixel.rocRow; }
00038       int  rocCol() const { return thePixel.rocCol; }
00039 
00040       bool valid() const { return thePixel.valid(); }
00041     private:
00042       RocRowCol thePixel;
00043   };
00044 }
00045 
00046 #endif