Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef SiPixelObjects_LinearConversion_H
0002 #define SiPixelObjects_LinearConversion_H
0003 
0004 namespace sipixelobjects {
0005 
0006   class LinearConversion {
0007   public:
0008     LinearConversion(int offset = 0, int slope = 1) : theOffset(offset), theSlope(slope) {}
0009     int convert(int item) const { return theOffset + theSlope * item; }
0010     int inverse(int item) const { return (item - theOffset) / theSlope; }
0011     int offset() const { return theOffset; }
0012     int slope() const { return theSlope; }
0013 
0014   private:
0015     int theOffset, theSlope;
0016   };
0017 
0018 }  // namespace sipixelobjects
0019 #endif