Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:02:33

0001 #ifndef CondFormats_SiPixelObjects_LocalPixel_H
0002 #define CondFormats_SiPixelObjects_LocalPixel_H
0003 
0004 namespace sipixelobjects {
0005 
0006   /// identify pixel inside single ROC
0007   class LocalPixel {
0008   public:
0009     static const int numRowsInRoc = 80;
0010     static const int numColsInRoc = 52;
0011 
0012     /// row and collumn in ROC representation
0013     struct RocRowCol {
0014       int rocRow, rocCol;
0015       bool valid() const { return (0 <= rocRow) & (rocRow < numRowsInRoc) & (0 <= rocCol) & (rocCol < numColsInRoc); }
0016     };
0017 
0018     /// double collumn and pixel ID in double collumn representation
0019     struct DcolPxid {
0020       int dcol, pxid;
0021       bool valid() const { return ((0 <= dcol) & (dcol < 26) & (2 <= pxid) & (pxid < 162)); }
0022     };
0023 
0024     LocalPixel(const DcolPxid& pixel) {
0025       thePixel.rocRow = numRowsInRoc - pixel.pxid / 2;
0026       thePixel.rocCol = pixel.dcol * 2 + pixel.pxid % 2;
0027     }
0028 
0029     LocalPixel(const RocRowCol& pixel) : thePixel(pixel) {}
0030 
0031     int dcol() const { return thePixel.rocCol / 2; }
0032     int pxid() const { return 2 * (numRowsInRoc - thePixel.rocRow) + (thePixel.rocCol % 2); }
0033 
0034     int rocRow() const { return thePixel.rocRow; }
0035     int rocCol() const { return thePixel.rocCol; }
0036 
0037     bool valid() const { return thePixel.valid(); }
0038 
0039   private:
0040     RocRowCol thePixel;
0041   };
0042 }  // namespace sipixelobjects
0043 
0044 #endif