emcTracedFEM.h

Go to the documentation of this file.
00001 #ifndef  __EMCTRACEDFEM_H__
00002 #define  __EMCTRACEDFEM_H__
00003 
00004 #include <Rtypes.h>
00005 #include <vector>
00006 #include <cstdio>
00007 
00008 #ifndef __EMCCALFEM_H__
00009 #include "emcCalFEM.h"
00010 #endif
00011 
00012 class emcTracedValue;
00013 
00021 class emcTracedFEM : public emcCalFEM
00022 {
00023  public:
00024  
00026   explicit emcTracedFEM(int absPosition);
00027 
00029   emcTracedFEM(int absPosition, const PHTimeStamp& t1, const PHTimeStamp& t2);
00030 
00032   emcTracedFEM(const emcTracedFEM&);
00033 
00035   emcTracedFEM& operator=(const emcTracedFEM&);
00036 
00038   virtual emcTracedFEM* clone(void) const = 0 ; 
00039 
00041   virtual ~emcTracedFEM();
00042 
00045   virtual void AddNewItem(int channel, emcTracedValue* item);
00046 
00049   virtual float Compact(float epsilon) = 0;
00050 
00052   virtual float DefaultReturnValue(void) const { return 1.0; }
00053 
00055   void Delete(void);
00056 
00058   void FirstItem(int channel) const;
00059 
00063   virtual const char* GetCategory(void) const = 0;
00064 
00066   size_t GetNumberOfChannels(void) const { return fItems.size(); }
00067 
00071   size_t GetNumberOfItems(void) const { return fNItems; }
00072 
00074   size_t GetNumberOfItems(int ichannel) const; 
00075 
00076   using emcCalFEM::getValue;
00077   using emcCalFEM::getValueFast;
00078 
00079 #ifndef __CINT__
00080 
00081   virtual float getValueFast(int ichannel, time_t x) const;
00082 #endif
00083 
00084   virtual float getValueFast(int ichannel, int x) const { 
00085     return getValueFast(ichannel,static_cast<time_t>(x)); }
00086 
00088   virtual bool IsEqual(const emcCalFEM& obj) const;
00089 
00094   emcTracedValue* LastItem(int channel) const;
00095 
00098   emcTracedValue* NextItem(void) const;
00099 
00101   virtual std::ostream& Print(std::ostream& out=std::cout, int level=0) const;
00102 
00105   void RemoveLastItems(void);
00106 
00108   virtual void Reset(void);
00109 
00111   virtual void SetNumberOfChannels(int nchannels);
00112 
00114   virtual void writeDataToFile(FILE * fp) const;
00115 
00116 public:
00117 
00118 #ifndef __CINT__
00119 
00120   typedef std::vector<emcTracedValue*> emcItemVector;
00121 
00122 protected:
00124   void Copy(emcTracedFEM& o) const;
00125 
00126 
00128   emcTracedValue* getTV(int channel, time_t absoluteX, 
00129                         size_t& thecase) const;
00130 
00131 protected:
00133   std::vector<emcItemVector*> fItems; 
00134 
00135   size_t fNItems; 
00136 
00137 private:
00139   mutable size_t fCurrentItem; 
00140 
00141   mutable size_t fCurrentPosition; 
00142 #endif
00143 
00144 };
00145 
00146 #endif   //  __emcTracedFEM__ 
00147 
00148