1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
#ifndef SiPixelObjects_LinearConversion_H
#define SiPixelObjects_LinearConversion_H
namespace sipixelobjects {
class LinearConversion {
public:
LinearConversion(int offset = 0, int slope = 1) : theOffset(offset), theSlope(slope) {}
int convert(int item) const { return theOffset + theSlope * item; }
int inverse(int item) const { return (item - theOffset) / theSlope; }
int offset() const { return theOffset; }
int slope() const { return theSlope; }
private:
int theOffset, theSlope;
};
} // namespace sipixelobjects
#endif
|