LCCD  1.5.0
CalibrationConstant.hh
1 #ifndef CalibrationConstant_h
2 #define CalibrationConstant_h 1
3 
4 #include "lcio.h"
5 #include "UTIL/LCFixedObject.h"
6 
7 #define NINT 1
8 #define NFLOAT 2
9 #define NDOUBLE 0
10 
11 #define ID_INDEX 0
12 #define OFFSET_INDEX 0
13 #define GAIN_INDEX 1
14 
15 using namespace lcio ;
16 
17 class CalibrationConstant ;
18 
26 class CalibrationConstant : public LCFixedObject<NINT,NFLOAT,NDOUBLE> {
27 
28 public:
29 
32  CalibrationConstant(int cellID, float offset, float gain) {
33 
34  obj()->setIntVal( ID_INDEX , cellID ) ;
35  obj()->setFloatVal( OFFSET_INDEX , offset ) ;
36  obj()->setFloatVal( GAIN_INDEX , gain ) ;
37  }
38 
41  CalibrationConstant(LCObject* obj) : LCFixedObject<NINT,NFLOAT,NDOUBLE>(obj) { }
42 
44  virtual ~CalibrationConstant() { /* no op*/ }
45 
46 
47  // the class interface:
48  int getCellID() { return obj()->getIntVal( ID_INDEX ) ; }
49  float getOffset() { return obj()->getFloatVal( OFFSET_INDEX ) ; }
50  float getGain() { return obj()->getFloatVal( GAIN_INDEX ) ; }
51 
52  void print( std::ostream& os ) ;
53 
54 
55  // -------- need to implement abstract methods from LCGenericObject
56 
57  const std::string getTypeName() const {
58  return"CalibrationConstant" ;
59  }
60 
61  const std::string getDataDescription() const {
62  return "i:cellID,f:offset,f:gain" ;
63  }
64 
65 }; // class
66 
67 
68 #endif
69 //=============================================================================
CalibrationConstant(int cellID, float offset, float gain)
Convenient c&#39;tor.
Definition: CalibrationConstant.hh:32
virtual ~CalibrationConstant()
Important for memory handling.
Definition: CalibrationConstant.hh:44
CalibrationConstant(LCObject *obj)
&#39;Copy constructor&#39; needed to interpret LCCollection read from file/database.
Definition: CalibrationConstant.hh:41
Example for a simple calibration class based on the LCFixedObject template.
Definition: CalibrationConstant.hh:26