00001 #ifndef __EMCFEMTUPLE_H__ 00002 #define __EMCFEMTUPLE_H__ 00003 00004 #include <vector> 00005 #include <iosfwd> 00006 #ifndef __EMCMANAGEABLE_H__ 00007 #include "emcManageable.h" 00008 #endif 00009 #ifndef __EMCCALFEM_H__ 00010 #include "emcCalFEM.h" 00011 #endif 00012 #ifndef __PHTIMESTAMP_H__ 00013 #include "PHTimeStamp.h" 00014 #endif 00015 00027 class emcFEMtuple : public emcManageable 00028 { 00029 00030 public: 00031 00032 emcFEMtuple(); 00033 emcFEMtuple(const char* name, const char* title, const char* classname) 00034 : emcManageable(name, title, classname), fOwner(true) 00035 { 00036 } 00037 00038 virtual ~emcFEMtuple(); 00039 00040 public: 00041 00042 PHTimeStamp Get1() 00043 { 00044 return fLastStartTime; 00045 } 00046 PHTimeStamp Get2() 00047 { 00048 return fFirstEndTime; 00049 } 00050 00051 00057 virtual bool Add(emcFEMtuple& fem); 00058 00064 virtual emcCalFEM* AppendFEM(int absPosition, 00065 const PHTimeStamp& t1, 00066 const PHTimeStamp& t2); 00067 00069 virtual bool CheckIndex(int ifem) const 00070 { 00071 return (ifem >= 0 && ifem < static_cast<int>(fFEMs.size())); 00072 } 00073 00075 virtual emcCalFEM* GetFEM(int ifem); 00076 00078 virtual int GetNumberOfChannels(void) const; 00079 00081 virtual int GetNumberOfFEMs(void) const 00082 { 00083 return fFEMs.size(); 00084 } 00085 00086 virtual int GetXmin(int ifem = 0) const; 00087 virtual int GetXmax(int ifem = 0) const; 00088 00090 virtual int GetSize(void) const 00091 { 00092 return GetNumberOfFEMs(); 00093 } 00094 00096 virtual float getValue(int ichannel) const 00097 { 00098 return ( !fFEMs.empty() ) ? 00099 fFEMs[ichannel / 144]->getValue(ichannel % 144) : 0; 00100 } 00101 00103 virtual float getValue(int ichannel, int thetime) const 00104 { 00105 return (!fFEMs.empty()) ? 00106 fFEMs[ichannel / 144]->getValue(ichannel % 144, thetime) : 0; 00107 } 00108 00110 virtual float getValue(int ichannel, int amucell, const char* kind) const 00111 { 00112 return (!fFEMs.empty()) ? 00113 fFEMs[ichannel / 144]->getValue(ichannel % 144, amucell, kind) : 0; 00114 } 00115 00117 virtual float getValue(int ichannel, int amucell, const std::string& kind) const 00118 { 00119 return (!fFEMs.empty()) ? 00120 fFEMs[ichannel / 144]->getValue(ichannel % 144, amucell, kind) : 0; 00121 } 00122 00124 virtual float getValue(int ichannel, const char* kind, float& out) const 00125 { 00126 return (!fFEMs.empty()) ? 00127 fFEMs[ichannel / 144]->getValue(ichannel % 144, kind, out) : 0; 00128 } 00129 00131 virtual bool IsDraft(void) const; 00132 00134 virtual bool IsOwner(void) const 00135 { 00136 return fOwner; 00137 } 00138 00140 virtual bool IsValid(const PHTimeStamp& when) const; 00141 00143 virtual bool IsValid(const PHTimeStamp& when, int ifem) const; 00144 00146 virtual void Print(int level = 0); 00147 00149 virtual std::ostream& Print(std::ostream& out, int level); 00150 00159 virtual bool ReplaceFEM(int ifem, emcFEMtuple& fem); 00160 00162 virtual void Reset(void); 00163 00165 virtual void SetDraft(bool draft); 00166 00167 virtual bool SetXmin(int xmin, int ifem = 0); 00168 virtual bool SetXmax(int xmax, int ifem = 0); 00169 00171 void SetOwnership(bool owner = true) 00172 { 00173 fOwner = owner; 00174 } 00175 00177 virtual void updateValue(int ichannel, int amucell, float newValue, const char* kind) const 00178 { 00179 if (!fFEMs.empty()) 00180 { 00181 fFEMs[ichannel / 144]->updateValue(ichannel % 144, amucell, newValue, kind); 00182 } 00183 } 00184 00185 protected: 00186 00187 #ifndef __CINT__ 00188 00189 std::vector<emcCalFEM*> fFEMs; 00190 00191 #endif 00192 00193 bool fOwner; 00194 00195 PHTimeStamp fLastStartTime; 00196 PHTimeStamp fFirstEndTime; 00197 00198 }; 00199 00200 #endif // #ifndef __emcFEMtuple_h__