Commit 9243b6a7 authored by Achim Morschhauser's avatar Achim Morschhauser
Browse files

Add error logging timestamp for data

parent 34463b00
......@@ -678,6 +678,7 @@ int data_obs::filter_fir_sym_data(std::vector <data_obs*>* data,
double data_in[N_data];
//std::string datastr;
std::string timestamp;
// Number of data
int N=data->size();
......@@ -701,6 +702,13 @@ int data_obs::filter_fir_sym_data(std::vector <data_obs*>* data,
if (data_in[j] == MD) {
missing[j]+=win->at(i);
missing_N[j]++;
timestamp=data->at(i)->get_time("%Y-%m-%d %H:%M:%S",true);
std::cerr << "[" << timestamp << "]: "
<< "Found missing data in filter: "
<< j << " " << missing[j] << " "
<< missing_N[j] << " "
<< data->size()
<< std::endl;
// Calculate filtered data
} else {
sum[j] += (data_in[j]);
......@@ -718,14 +726,12 @@ int data_obs::filter_fir_sym_data(std::vector <data_obs*>* data,
if (missing_N[j] == N){
this->data[j]=MD;
} else {
/*std::cerr << "DEBUG FILTER: "
<< filtered[j] << " "
<< missing_N[j] << " "
<< missing[j] << " "
<< sum[j] << " "
<< std::endl;
*/
this->data[j]=filtered[j]+1/(N-missing_N[j])*missing[j]*sum[j];
timestamp=this->get_time("%Y-%m-%d %H:%M:%S",true);
std::cerr << "[" << timestamp << "]: ";
this->data[j]=filtered[j]/(1-missing[j]);
std::cerr << "FILTERED DATA SET TO : "
<< this->data[j] <<
std::endl;
}
}
......
......@@ -1030,6 +1030,8 @@ int driver_obs_obsdaq::parse_data_bin(data_obs_vector* data, char* buf) {
// Check 7th bits
for (int i=0; i<reclen;i++){
if ((unsigned char) buf[i]<32 || (unsigned char) buf[i]>159){
std::string timestamp=data->get_time("%Y-%m-%d %H:%M:%S",true);
std::cerr << "[" << timestamp << "]: ";
fprintf(stderr,"Faulty data: 7th bit check failed for byte "
"%d: %d.\n",i,(unsigned char) buf[i]);
fprintf(stderr,"%d%d%d%d%d%d%d%d\n",buf[i]&1,(buf[i]&2)/2,
......@@ -1047,6 +1049,8 @@ int driver_obs_obsdaq::parse_data_bin(data_obs_vector* data, char* buf) {
}
// Last byte must contain sum of last (N-1) bytes in bits 0-6
if ( (tmp_d&0x7F) != (buf[reclen-1]&0x7F) ){
std::string timestamp=data->get_time("%Y-%m-%d %H:%M:%S",true);
std::cerr << "[" << timestamp << "]: ";
fprintf(stderr,"Faulty data: Control sum check failed for ");
for (int i=0; i<reclen-1;i++){
fprintf(stderr,"%02X ",buf[i]);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment