00001 #ifndef CALIB_BARREL_ATTEN_H 00002 #define CALIB_BARREL_ATTEN_H 00003 00004 #include "tofcalgsec/TofCalib.h" 00005 00006 const int nBarrelAtten = 2; 00007 00008 class calib_barrel_atten:public TofCalib { 00009 public: 00010 calib_barrel_atten():TofCalib( nBarrelAtten ) { 00011 m_name = string("calib_barrel_atten"); 00012 } 00013 00014 void calculate_funcs( const Record* r ) { 00015 double z = r->zrhit(); 00016 double q1 = r->qleft(); 00017 double q2 = r->qright(); 00018 00019 if( q1>0.0 && q2>0.0 ) { 00020 funcs[0] = 2.0*z; 00021 funcs[1] = 1.0; 00022 } 00023 else { 00024 funcs[0] = 0.0; 00025 funcs[1] = 0.0; 00026 } 00027 00028 return; 00029 } 00030 00031 void calculate_y(const Record* r) { 00032 double q1 = r->qleft(); 00033 double q2 = r->qright(); 00034 if( q1>0.0 && q2>0.0 ) { 00035 y = log(q1/q2); 00036 } 00037 else { 00038 y = 0.0; 00039 } 00040 return; 00041 } 00042 00043 void updateData( RecordSet*& data ) { 00044 if( data->size() > 0 ) { 00045 std::vector<Record*>::iterator iter = data->begin(); 00046 for( ; iter!=data->end(); iter++ ) { 00047 double z = (*iter)->zrhit(); 00048 double sintheta = (*iter)->theta(); 00049 double q1 = (*iter)->qleft(); 00050 double q2 = (*iter)->qright(); 00051 double latten = 1.0/X[0]; 00052 double a1overa2 = exp(X[1]); 00053 double q0 = sintheta*(q1*exp((115.0-z)/latten)+q2*exp((115.0+z)/latten))/(1.0+a1overa2); 00054 (*iter)->setQ0( q0 ); 00055 } 00056 } 00057 return; 00058 } 00059 00060 }; 00061 00062 #endif