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