00001 #ifndef CALIB_ETF_WEIGHT_H 00002 #define CALIB_ETF_WEIGHT_H 00003 00004 #include "tofcalgsec/TofCalib.h" 00005 00006 const int nEtfWeight = 4; 00007 00008 class calib_etf_weight:public TofCalib { 00009 public: 00010 calib_etf_weight():TofCalib( nEtfWeight ) { 00011 m_name = string("calib_etf_weight"); 00012 } 00013 00014 void calculate_funcs( const Record* r ) { 00015 double tleft = r->tleft(); 00016 double tright = r->tright(); 00017 double z = r->zrhit(); 00018 00019 funcs[0] = tright-tleft; 00020 funcs[1] = funcs[0]*z; 00021 funcs[2] = funcs[1]*z; 00022 funcs[3] = funcs[2]*z; 00023 00024 return; 00025 } 00026 00027 void calculate_y(const Record* r) { 00028 y = 0.0 - (r->tright()); 00029 return; 00030 } 00031 00032 void updateData( RecordSet*& data ) { 00033 if( data->size() > 0 ) { 00034 std::vector<Record*>::iterator iter = data->begin(); 00035 for( ; iter!=data->end(); iter++ ) { 00036 calculate_funcs( (*iter) ); 00037 double tcorr = 0.0; 00038 for( int i=0; i<X.num_row(); i++ ) { 00039 tcorr += X[i]*funcs[i]; 00040 } 00041 (*iter)->setT0( tcorr + (*iter)->tright() ); 00042 } 00043 } 00044 return; 00045 } 00046 00047 }; 00048 00049 #endif