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