emcCalibrationData.h

Go to the documentation of this file.
00001 #ifndef __EMCCALIBRATIONDATA_H__
00002 #define __EMCCALIBRATIONDATA_H__
00003 
00004 #ifndef __EMCMANAGEABLE_H__
00005 #include "emcManageable.h"
00006 #endif
00007 #ifndef __PHTIMESTAMP_H__
00008 #include "PHTimeStamp.h"
00009 #endif
00010 
00048 class emcCalibrationData : public emcManageable
00049   {
00050 
00051   public:
00052 
00053     // If you add a new enum there, put it AFTER those ones !
00054     enum EType { kUnknown = 0, 
00055                  kIniCal=1,         
00056  // 2,3,4 are not used on purpose (used to be there and were removed) 
00057                  kTofSectorOffset=5 
00058                };
00059 
00063     emcCalibrationData(EType type = kUnknown, size_t number = 0, size_t size = 0);
00064     virtual ~emcCalibrationData();
00065 
00066     // The category is used to build the database filename.
00067     const char* GetCategory(void) const;
00068 
00069     // End-of-validity time.
00070     const PHTimeStamp& GetEndValTime(void) const
00071       {
00072         return fEnd;
00073       }
00074 
00075     // Get the dimension of the internal arrays.
00076     size_t GetDimension(void) const
00077       {
00078         return fDimension;
00079       }
00080 
00081     // Get dim-th error for a given "channel".
00082     float GetError(size_t index, size_t dim = 0) const;
00083 
00084     // Get the characteristic number of this object.
00085     size_t GetNumber(void) const
00086       {
00087         return fNumber;
00088       }
00089 
00090     // Get the maximum allowed number of this object.
00091     size_t GetRange(void) const
00092       {
00093         return fRange;
00094       }
00095 
00096     // Get the size (i.e. the number of "channels").
00097     size_t GetSize(void) const
00098       {
00099         return fSize;
00100       }
00101 
00102     // Start-of-validity time.
00103     const PHTimeStamp& GetStartValTime(void) const
00104       {
00105         return fStart;
00106       }
00107 
00108     // Get the type of this object.
00109     EType GetType(void) const
00110       {
00111         return fType;
00112       }
00113 
00114     // Convert the type into a string. (static version)
00115     static const char* GetTypeName(EType type);
00116 
00117     // Convert the type into a string.
00118     const char* GetTypeName(void) const
00119       {
00120         return GetTypeName(fType);
00121       }
00122 
00123     // Get the dim-th value of a given "channel", indexed by index.
00124     float GetValue(size_t index, size_t dim = 0) const;
00125 
00126     // Tells if the object is valid at time 'when'
00127     virtual bool IsValid(const PHTimeStamp& when) const;
00128 
00129     // Prints header (level=0) or full object (level>0).
00130     void Print(int level = 0) const;
00131 
00132     // Resets completely the object (erases internal arrays).
00133     virtual void Reset(void);
00134 
00135     // Set value and error for a given dimension of a given channel.
00136     bool Set(size_t index, float value, float error, size_t dim = 0);
00137 
00144     void SetTypeAndSize(EType type, size_t size);
00145 
00146     // Set the characteristic number of this object.
00147     void SetNumber(size_t number)
00148     {
00149       fNumber = number;
00150     }
00151 
00152     // Set the validity period.
00153     void SetValidityPeriod(const PHTimeStamp& t1, const PHTimeStamp& t2)
00154     {
00155       fStart = t1;
00156       fEnd = t2;
00157     }
00158 
00159   public:
00160     static const float fgInvalidFloat;
00161 
00162   private:
00163     PHTimeStamp fStart;
00164     PHTimeStamp fEnd;
00165     EType fType;
00166     size_t fNumber;
00167     float** fValues;
00168     float** fErrors;
00169     size_t fSize;
00170     size_t fDimension;
00171     size_t fRange;
00172   };
00173 
00174 #endif