00001 #ifndef SiPixelObjects_LinearConversion_H 00002 #define SiPixelObjects_LinearConversion_H 00003 00004 namespace sipixelobjects { 00005 00006 class LinearConversion { 00007 00008 public: 00009 LinearConversion(int offset =0, int slope =1) : theOffset(offset), theSlope(slope) { } 00010 int convert( int item) const { return theOffset+theSlope*item; } 00011 int inverse( int item) const { return (item - theOffset)/theSlope; } 00012 int offset() const { return theOffset; } 00013 int slope() const { return theSlope; } 00014 00015 private: 00016 int theOffset, theSlope; 00017 }; 00018 00019 } 00020 #endif