#include <calib_barrel_atten.h>
Inheritance diagram for calib_barrel_atten:
Public Member Functions | |
virtual void | calculate (RecordSet *&data, unsigned int icounter) |
virtual void | calculate (RecordSet *&data, unsigned int icounter) |
void | calculate_funcs (const Record *r) |
void | calculate_funcs (const Record *r) |
void | calculate_y (const Record *r) |
void | calculate_y (const Record *r) |
calib_barrel_atten () | |
calib_barrel_atten () | |
void | fillTxt (const char *file) |
void | fillTxt (const char *file) |
virtual const string & | name () const |
virtual const string & | name () const |
void | reset () |
void | reset () |
void | updateData (RecordSet *&data) |
void | updateData (RecordSet *&data) |
Protected Attributes | |
HepMatrix | F |
HepVector | funcs |
string | m_name |
std::vector< HepVector > | m_result |
std::vector< HepVector > | m_result |
int | Npar |
HepVector | X |
double | y |
HepVector | Y |
|
|
|
|
|
|
|
00017 { 00018 00019 std::cout << setiosflags(ios::left) << setw(10) << icounter << setw(8) << data->size() << setw(30) << name() << std::endl; 00020 00021 if( data->size() <= 0 ) { 00022 X = HepVector(Npar,1.0); 00023 } 00024 else { 00025 std::vector<Record*>::iterator iter = data->begin(); 00026 for( ; iter!=data->end(); iter++ ) { 00027 calculate_funcs( (*iter) ); 00028 for( int i=0; i<F.num_col(); i++ ) { 00029 for( int j=0; j<F.num_col(); j++ ) { 00030 F[i][j]+=funcs[i]*funcs[j]; 00031 } 00032 } 00033 00034 calculate_y( (*iter) ); 00035 for( int k=0; k<Y.num_row(); k++ ) { 00036 Y[k]+=y*funcs[k]; 00037 } 00038 } 00039 00040 // if( abs(F.determinant())>0. ) { 00041 if( abs(F[0][0])>0. ) { 00042 X = (qr_solve(F,Y)); 00043 } 00044 else { 00045 X = HepVector(Npar,1.0); // one side has no data 00046 } 00047 } 00048 00049 m_result.push_back(X); 00050 00051 updateData( data ); 00052 00053 return; 00054 }
|
|
Implements TofCalib. 00014 { 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 }
|
|
Implements TofCalib. 00014 { 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 }
|
|
Implements TofCalib. 00031 { 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 }
|
|
Implements TofCalib. 00031 { 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 }
|
|
|
|
00057 { 00058 std::ofstream out(file,ios::out); 00059 if( out ) { 00060 std::vector<HepVector>::iterator it; 00061 for( it=m_result.begin(); it!=m_result.end(); it++ ) { 00062 for( unsigned int i=0; i<(*it).num_row(); i++ ) { 00063 out << (*it)[i] << " "; 00064 } 00065 out << std::endl; 00066 } 00067 out.close(); 00068 } 00069 else{ 00070 cerr << "error when open file " << file << " for write in " << name() << "::fillTxt()" << std::endl; 00071 cout << "print all parameters to srceen: in total " << m_result.size() << " items" << std::endl; 00072 std::vector<HepVector>::iterator it; 00073 for( it=m_result.begin(); it!=m_result.end(); it++ ) { 00074 for( unsigned int i=0; i<(*it).num_row(); i++ ) { 00075 cout << (*it)[i] << " "; 00076 } 00077 cout << std::endl; 00078 } 00079 } 00080 00081 return; 00082 }
|
|
00027 { return m_name;}
|
|
00027 { return m_name;}
|
|
|
|
00008 { 00009 F = HepMatrix(Npar,Npar,0); 00010 Y = HepVector(Npar,0); 00011 X = HepVector(Npar,0); 00012 funcs = HepVector(Npar,0); 00013 return; 00014 }
|
|
Implements TofCalib. 00043 { 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 }
|
|
Implements TofCalib. 00043 { 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 }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|