Skip to content
Snippets Groups Projects
Commit cbb0f22d authored by Wuttke, Joachim's avatar Wuttke, Joachim
Browse files

migration acq51 -> acq52

parent b25bec24
No related branches found
No related tags found
No related merge requests found
...@@ -31,8 +31,8 @@ class CRawfileSpheres { ...@@ -31,8 +31,8 @@ class CRawfileSpheres {
int measured_at; int measured_at;
double measured_during; double measured_during;
bool incremental; bool incremental;
uint ndet;
vector<double> rawdata[6]; vector<double> rawdata[6];
vector<double> angles;
int maj_syntax, min_syntax, maj_outform, min_outform; int maj_syntax, min_syntax, maj_outform, min_outform;
}; };
...@@ -46,13 +46,11 @@ void CRawfileSpheres::RdRawYam( ifstream& F_in ) ...@@ -46,13 +46,11 @@ void CRawfileSpheres::RdRawYam( ifstream& F_in )
CSpec sout; CSpec sout;
double num; double num;
vector<double> numvec; vector<double> numvec;
uint ndet;
maj_outform = 5; maj_outform = 5;
min_outform = 1; min_outform = 1;
daq_time_step=0; daq_time_step=0;
angles.clear();
YAML::Parser parser(F_in); YAML::Parser parser(F_in);
YAML::Node doc; YAML::Node doc;
...@@ -68,8 +66,8 @@ void CRawfileSpheres::RdRawYam( ifstream& F_in ) ...@@ -68,8 +66,8 @@ void CRawfileSpheres::RdRawYam( ifstream& F_in )
if(!doc["Meta"].FindValue("format")) if(!doc["Meta"].FindValue("format"))
throw "DATA BUG: no format in Meta"; throw "DATA BUG: no format in Meta";
doc["Meta"]["format"] >> val; doc["Meta"]["format"] >> val;
if( strncmp( val.c_str(), "acq5.1 for yaml1", 16 ) ) if( strncmp( val.c_str(), "acq5.2 for yaml1", 16 ) )
throw "UNEXPECTED DATA: format: " + val + " instead of acq5.1"; throw "UNEXPECTED DATA: format: " + val + " instead of acq5.2";
} catch(YAML::ParserException& e) { } catch(YAML::ParserException& e) {
throw string("DATA BUG: failed to read Meta section") + e.what(); throw string("DATA BUG: failed to read Meta section") + e.what();
} }
...@@ -91,7 +89,7 @@ void CRawfileSpheres::RdRawYam( ifstream& F_in ) ...@@ -91,7 +89,7 @@ void CRawfileSpheres::RdRawYam( ifstream& F_in )
else else
throw string( "DATA BUG: invalid value [" ) + val + throw string( "DATA BUG: invalid value [" ) + val +
"] of 'incremental'"; "] of 'incremental'";
} else if ( key=="measured_until" ){ } else if ( key=="subs_until" ){
char date_string[24]; char date_string[24];
sscanf( val.c_str(), "%24c", date_string ); sscanf( val.c_str(), "%24c", date_string );
struct tm date_broken; struct tm date_broken;
...@@ -108,31 +106,6 @@ void CRawfileSpheres::RdRawYam( ifstream& F_in ) ...@@ -108,31 +106,6 @@ void CRawfileSpheres::RdRawYam( ifstream& F_in )
if( !daq_time_step ) if( !daq_time_step )
throw string( "DATA BUG: daq time step not found" ); throw string( "DATA BUG: daq time step not found" );
// ignore Longpar.
// read Detectors:
if(!doc.FindValue("Detectors"))
throw "DATA BUG: no Detectors";
if ( doc["Detectors"].Type() != YAML::NodeType::Sequence )
throw "DATA BUG: Detectors is not a SEQUENCE";
if( doc["Detectors"].size()!=ndet )
throw "DATA BUG: Detectors has not size ndet";
for (uint iDet = 0; iDet<ndet; iDet++) {
if ( doc["Detectors"][iDet].Type() != YAML::NodeType::Map )
throw "DATA BUG: Detector " + strg(iDet) + " is not a MAP";
if( const YAML::Node *pName =
doc["Detectors"][iDet].FindValue("angle") ){
*pName >> val;
if( !mystd::any2dbl( val, &num ) ){
num = 0;
printf( "WARNING: invalid angle %s\n", val.c_str() );
}
}else
throw "DATA BUG: missing angle";
// path_offset ?
angles.push_back( num );
}
// read EnergyHistograms: // read EnergyHistograms:
if( !doc.FindValue("EnergyHistograms") ) if( !doc.FindValue("EnergyHistograms") )
throw "DATA BUG: no EnergyHistograms"; throw "DATA BUG: no EnergyHistograms";
...@@ -221,7 +194,7 @@ void NRSSM::ReadSpec( int flag ) ...@@ -221,7 +194,7 @@ void NRSSM::ReadSpec( int flag )
double tstep = R.daq_time_step; double tstep = R.daq_time_step;
vector<double> *raw = R.rawdata; vector<double> *raw = R.rawdata;
int ndet = R.angles.size(); uint ndet = R.ndet;
// *** set file headers *** // *** set file headers ***
...@@ -257,7 +230,7 @@ void NRSSM::ReadSpec( int flag ) ...@@ -257,7 +230,7 @@ void NRSSM::ReadSpec( int flag )
for( int j=0; j<ndet; ++j ){ for( int j=0; j<ndet; ++j ){
PSpec S( new CSpec ); PSpec S( new CSpec );
S->z.resize( 1 ); S->z.resize( 1 );
S->z[0] = R.angles[j]; S->z[0] = j;
olf[iolf]->V.push_back(S); olf[iolf]->V.push_back(S);
} }
} }
...@@ -395,15 +368,15 @@ void NRSSM::ReadSeries( int flag ) ...@@ -395,15 +368,15 @@ void NRSSM::ReadSeries( int flag )
RR[0].measured_until + (int) (mean_time/2); RR[0].measured_until + (int) (mean_time/2);
// Get parameters, check consistency: // Get parameters, check consistency:
int ndet = RR[0].angles.size(); int ndet = RR[0].ndet;
printf( "used %i detectors\n", ndet ); printf( "used %i detectors\n", ndet );
double tstep = RR[0].daq_time_step; double tstep = RR[0].daq_time_step;
bool incremental_in = RR[0].incremental; bool incremental_in = RR[0].incremental;
for( isub=1; isub<nsub; ++isub ){ for( isub=1; isub<nsub; ++isub ){
if( RR[isub].angles.size()!=ndet ) if( RR[isub].ndet!=ndet )
throw string( "inconsistent no of det: file " ) + strg(isub) throw string( "inconsistent no of det: file " ) + strg(isub)
+ " has " + strg(RR[isub].angles.size()) + " instead of " + " has " + strg(RR[isub].ndet) + " instead of "
+ strg(ndet); + strg(ndet);
if( RR[isub].daq_time_step!=tstep ) if( RR[isub].daq_time_step!=tstep )
throw string( "inconsistent time step" ); throw string( "inconsistent time step" );
...@@ -438,7 +411,7 @@ void NRSSM::ReadSeries( int flag ) ...@@ -438,7 +411,7 @@ void NRSSM::ReadSeries( int flag )
PSpec S( new CSpec ); PSpec S( new CSpec );
S->z.resize( 2 ); S->z.resize( 2 );
S->z[0] = isub; S->z[0] = isub;
S->z[1] = RR[isub].angles[j]; S->z[1] = j;
for( iolf=0; iolf<2; ++iolf ) for( iolf=0; iolf<2; ++iolf )
olf[iolf]->V.push_back( S ); olf[iolf]->V.push_back( S );
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment