00001 // Convert Data Format from Online data to TofData 00002 // 00003 #ifndef TOFDATA_H 00004 #define TOFDATA_H 00005 #include "Identifier/Identifier.h" 00006 #include <vector> 00007 #include <map> 00008 00009 class TofValue{ 00010 public: 00011 TofValue(); 00012 virtual ~TofValue(); 00013 00014 // Assignment constructor. 00015 TofValue& operator=(const TofValue& source); 00016 00017 int channel() const { return m_channel; } 00018 int times() const { return m_times; } 00019 int number() const { return m_number; } 00020 int clock() const { return m_clock; } 00021 double value() const { return m_value; } 00022 bool used() const { return m_used; } 00023 00024 void timespp(); 00025 void timesmm(); 00026 void setNumber( int number ) { m_number = number; } 00027 // virtual void setValue( int value ) = 0; 00028 void setUsed( bool used ) { m_used = used; } 00029 00030 protected: 00031 int m_clock; 00032 int m_channel; 00033 double m_value; 00034 00035 private: 00036 int m_times; 00037 int m_number; 00038 bool m_used; 00039 00040 }; 00041 00042 00043 class Adc : public TofValue { 00044 public: 00045 Adc(); 00046 00047 void setCorr() { m_corr = true; } 00048 void setElec() { m_elec = true; } 00049 00050 void setValue( Identifier identify, int value ); 00051 00052 double qtc() const { return m_qtc; } 00053 00054 private: 00055 double m_qtc; 00056 bool m_corr, m_elec, m_mrpc; 00057 }; 00058 00059 00060 class Tdc : public TofValue { 00061 public: 00062 void setValue( int value ); 00063 private: 00064 }; 00065 00066 00067 class PmtData{ 00068 public: 00069 PmtData(); 00070 ~PmtData(); 00071 00072 // Assignment constructor. 00073 PmtData& operator=(const PmtData& source); 00074 00075 unsigned int iden() const { return m_iden_value; } 00076 unsigned int times() const { return m_times; } 00077 int adcChannel(); 00078 double qtc(); 00079 double adc(); 00080 int qclock(); 00081 int tdcChannel(); 00082 double tdc(); 00083 int tclock(); 00084 unsigned int quality() const { return m_quality; } 00085 00086 void timespp(); 00087 void timesmm(); 00088 int qtimes(); 00089 void qtimespp(); 00090 void qtimesmm(); 00091 int ttimes(); 00092 void ttimespp(); 00093 void ttimesmm(); 00094 00095 int qnumber(); 00096 int tnumber(); 00097 00098 bool qused(); 00099 bool tused(); 00100 bool used(); 00101 00102 void setIdentify( unsigned int iden ) { m_iden_value = iden; } 00103 void setAdc( Adc* adc ); 00104 void setTdc( Tdc* tdc ); 00105 void setUsed(); 00106 00107 void clear(); 00108 00109 private: 00110 unsigned int m_iden_value; 00111 unsigned int m_times; 00112 unsigned int m_quality; // 0x 0 0 1 (Q) 1 (T) 00113 Adc* m_adc; 00114 Tdc* m_tdc; 00115 00116 }; 00117 00118 00119 class TofData{ 00120 public: 00121 TofData(); 00122 ~TofData(); 00123 00124 // Assignment constructor. 00125 TofData& operator=(const TofData& source); 00126 00127 unsigned int identify() const { return m_identify; } 00128 bool is_mrpc() const { return m_mrpc; } 00129 bool barrel() const { return m_barrel; } 00130 int tofId() const { return m_tofId; } 00131 int layer() const { return m_layer; } 00132 int strip() const { return m_strip; } 00133 int tofTrackId() const { return m_tofTrackId; } 00134 00135 unsigned int times() const { return m_times; } 00136 00137 void data( double& adcEast, double& tdcEast, double& adcWest, double& tdcWest ); 00138 void data( double& adc, double& tdc ); 00139 00140 PmtData* forward() const { return m_forward; } 00141 PmtData* backward() const { return m_backward; } 00142 00143 double adc1(); 00144 double tdc1(); 00145 double adc2(); 00146 double tdc2(); 00147 double adc(); 00148 double tdc(); 00149 00150 double qtc1(); 00151 double qtc2(); 00152 double qtc(); 00153 00154 int adcChannelEast(); 00155 int tdcChannelEast(); 00156 int adcChannelWest(); 00157 int tdcChannelWest(); 00158 int adcChannel(); 00159 int tdcChannel(); 00160 00161 int qclock1(); 00162 int tclock1(); 00163 int qclock2(); 00164 int tclock2(); 00165 int qclock(); 00166 int tclock(); 00167 00168 unsigned int quality() const { return m_quality; } 00169 bool tmatched() const { return m_tmatched; } 00170 00171 int qtimes1(); 00172 int ttimes1(); 00173 int qtimes2(); 00174 int ttimes2(); 00175 unsigned int eastTimes(); 00176 unsigned int westTimes(); 00177 00178 int qnumber1(); 00179 int tnumber1(); 00180 int qnumber2(); 00181 int tnumber2(); 00182 00183 bool qused1(); 00184 bool tused1(); 00185 bool qused2(); 00186 bool tused2(); 00187 bool used1(); 00188 bool used2(); 00189 bool used(); 00190 00191 double ztdc() const { return m_ztdc; } 00192 double zadc() const { return m_zadc; } 00193 00194 double zpos() const { return m_zpos; } 00195 double energy() const { return m_energy; } 00196 00197 public: 00198 void setIdentify( Identifier identify ); 00199 void setMisLable() { m_misLable = true; } 00200 void setTofTrackId( int tofTrackId ) { m_tofTrackId = tofTrackId; } 00201 void setTimes( unsigned int times ) { m_times = times; } 00202 void setForward( PmtData* pmt ); 00203 void setBackward( PmtData* pmt ); 00204 void setQuality( unsigned int quality ) { m_quality = quality; } 00205 void setTMatched( bool tmatched ) { m_tmatched = tmatched; } 00206 void setUsed(); 00207 void setZTdc( double ztdc ) { m_ztdc = ztdc; } 00208 void setZAdc( double zadc ) { m_zadc = zadc; } 00209 void setZpos( double zpos ) { m_zpos = zpos; } 00210 void setEnergy( double energy ) { m_energy = energy; } 00211 00212 void clear(); 00213 00214 private: 00215 00216 unsigned int m_identify; 00217 bool m_mrpc; 00218 bool m_barrel; 00219 int m_tofId; 00220 int m_layer; 00221 int m_strip; 00222 int m_tofTrackId; 00223 00224 bool m_misLable; 00225 00226 double m_ztdc; 00227 double m_zadc; 00228 00229 double m_zpos; //z-position after calibration 00230 double m_energy; //energy deposit after calibration 00231 00232 unsigned int m_times; 00233 unsigned int m_quality; 00234 // 0x 0...0 1 (East Q) 1 (East T) 1 (West Q) 1 (West T) 00235 // Forward == East ; Backward = West 00236 bool m_tmatched; 00237 // true, will used for Estime and TOF, false, will used only for EMC 00238 00239 PmtData* m_forward; 00240 PmtData* m_backward; 00241 00242 }; 00243 00244 typedef std::multimap<unsigned int, TofData*> TofDataMap; 00245 typedef std::multimap<unsigned int, TofData*>::iterator IterTofDataMap; 00246 00247 typedef std::vector<TofData*> TofDataVector; 00248 typedef std::vector<TofData*>::iterator IterTofDataVector; 00249 00250 #endif