LCIO  02.17
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
CalibrationConstant.h
Go to the documentation of this file.
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 class CalibrationConstant ;
12 
20 class CalibrationConstant : public UTIL::LCFixedObject<NINT,NFLOAT,NDOUBLE> {
21 
22 public:
23 
26  CalibrationConstant(int cellID, float offset, float gain) {
27 
28  obj()->setIntVal( 0 , cellID ) ;
29  obj()->setFloatVal( 0 , offset ) ;
30  obj()->setFloatVal( 1 , gain ) ;
31  }
32 
35  CalibrationConstant(LCObject* o) : UTIL::LCFixedObject<NINT,NFLOAT,NDOUBLE>(o) { }
36 
38  virtual ~CalibrationConstant() { /* no op*/ }
39 
40 
41  // the class interface:
42  int getCellID() { return obj()->getIntVal(0) ; }
43  float getOffset() { return obj()->getFloatVal( 0 ) ; }
44  float getGain() { return obj()->getFloatVal( 1 ) ; }
45 
46  void print( std::ostream& os ) ;
47 
48 
49  // -------- need to implement abstract methods from LCGenericObject
50 
51  const std::string getTypeName() const {
52  return"CalibrationConstant" ;
53  }
54 
56  return "i:cellID,f:offset,f:gain" ;
57  }
58 
59 }; // class
60 
61 
62 #endif
63 //=============================================================================
virtual void setFloatVal(unsigned index, float value)
Sets the float value at the given index.
CalibrationConstant(int cellID, float offset, float gain)
Convenient c&#39;tor.
const std::string getDataDescription() const
The description string.
virtual int getIntVal(int index) const
Returns the integer value for the given index.
virtual float getFloatVal(int index) const
Returns the float value for the given index.
void print(std::ostream &os)
STL class.
virtual ~CalibrationConstant()
Important for memory handling.
virtual void setIntVal(unsigned index, int value)
Sets the integer value at the given index.
LCFixedObject()
Default c&#39;tor.
Definition: LCFixedObject.h:37
#define NFLOAT
CalibrationConstant(LCObject *o)
&#39;Copy constructor&#39; needed to interpret LCCollection read from file/database.
#define NDOUBLE
#define NINT
Example for a simple calibration class based on the LCFixedObject template.
const std::string getTypeName() const
The type name of the user class (typically the class name) This type name is stored as a collection p...
Template class for fixed size LCGenericObject subclasses.
Definition: LCFixedObject.h:25
IMPL::LCGenericObjectImpl * obj()
The LCGenericObjectImpl .
Definition: LCFixedObject.h:80
STL class.