LCIO  "2.7.4"
 All Classes Namespaces Functions Variables Typedefs Friends Pages
CalibrationConstant.h
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 using namespace lcio ;
12 
13 class CalibrationConstant ;
14 
22 class CalibrationConstant : public LCFixedObject<NINT,NFLOAT,NDOUBLE> {
23 
24 public:
25 
28  CalibrationConstant(int cellID, float offset, float gain) {
29 
30  obj()->setIntVal( 0 , cellID ) ;
31  obj()->setFloatVal( 0 , offset ) ;
32  obj()->setFloatVal( 1 , gain ) ;
33  }
34 
37  CalibrationConstant(LCObject* obj) : LCFixedObject<NINT,NFLOAT,NDOUBLE>(obj) { }
38 
40  virtual ~CalibrationConstant() { /* no op*/ }
41 
42 
43  // the class interface:
44  int getCellID() { return obj()->getIntVal(0) ; }
45  float getOffset() { return obj()->getFloatVal( 0 ) ; }
46  float getGain() { return obj()->getFloatVal( 1 ) ; }
47 
48  void print( std::ostream& os ) ;
49 
50 
51  // -------- need to implement abstract methods from LCGenericObject
52 
53  const std::string getTypeName() const {
54  return"CalibrationConstant" ;
55  }
56 
57  const std::string getDataDescription() const {
58  return "i:cellID,f:offset,f:gain" ;
59  }
60 
61 }; // class
62 
63 
64 #endif
65 //=============================================================================
The generic object that is held in an LCCollection.
Definition: LCObject.h:30
CalibrationConstant(int cellID, float offset, float gain)
Convenient c'tor.
Definition: CalibrationConstant.h:28
virtual ~CalibrationConstant()
Important for memory handling.
Definition: CalibrationConstant.h:40
CalibrationConstant(LCObject *obj)
'Copy constructor' needed to interpret LCCollection read from file/database.
Definition: CalibrationConstant.h:37
Example for a simple calibration class based on the LCFixedObject template.
Definition: CalibrationConstant.h:22