From cbb0f22d972939fb70bd1d1ee5ac92421c95540a Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (office)" <j.wuttke@fz-juelich.de>
Date: Wed, 28 Dec 2011 16:43:47 +0100
Subject: [PATCH] migration acq51 -> acq52

---
 pub/src/rssm.cpp | 47 ++++++++++-------------------------------------
 1 file changed, 10 insertions(+), 37 deletions(-)

diff --git a/pub/src/rssm.cpp b/pub/src/rssm.cpp
index 1f458015..b4596caf 100644
--- a/pub/src/rssm.cpp
+++ b/pub/src/rssm.cpp
@@ -31,8 +31,8 @@ class CRawfileSpheres {
     int    measured_at;
     double measured_during;
     bool   incremental;
+    uint   ndet;
     vector<double> rawdata[6];
-    vector<double> angles;
     int    maj_syntax, min_syntax, maj_outform, min_outform;
 };
 
@@ -46,13 +46,11 @@ void CRawfileSpheres::RdRawYam( ifstream& F_in )
     CSpec sout;
     double num;
     vector<double> numvec;
-    uint ndet;
 
     maj_outform = 5;
     min_outform = 1;
 
     daq_time_step=0;
-    angles.clear();
 
     YAML::Parser parser(F_in);
     YAML::Node doc;
@@ -68,8 +66,8 @@ void CRawfileSpheres::RdRawYam( ifstream& F_in )
         if(!doc["Meta"].FindValue("format"))
             throw "DATA BUG: no format in Meta";
         doc["Meta"]["format"] >> val;
-        if( strncmp( val.c_str(), "acq5.1 for yaml1", 16 ) )
-            throw "UNEXPECTED DATA: format: " + val + " instead of acq5.1";
+        if( strncmp( val.c_str(), "acq5.2 for yaml1", 16 ) )
+            throw "UNEXPECTED DATA: format: " + val + " instead of acq5.2";
     } catch(YAML::ParserException& e) {
         throw string("DATA BUG: failed to read Meta section") + e.what();
     }
@@ -91,7 +89,7 @@ void CRawfileSpheres::RdRawYam( ifstream& F_in )
             else
                 throw string( "DATA BUG: invalid value [" ) + val +
                     "] of 'incremental'";
-        } else if ( key=="measured_until" ){
+        } else if ( key=="subs_until" ){
             char date_string[24];
             sscanf( val.c_str(), "%24c", date_string );
             struct tm date_broken;
@@ -108,31 +106,6 @@ void CRawfileSpheres::RdRawYam( ifstream& F_in )
     if( !daq_time_step )
         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:
     if( !doc.FindValue("EnergyHistograms") )
         throw "DATA BUG: no EnergyHistograms";
@@ -221,7 +194,7 @@ void NRSSM::ReadSpec( int flag )
 
     double tstep = R.daq_time_step;
     vector<double> *raw = R.rawdata;
-    int ndet = R.angles.size();
+    uint ndet = R.ndet;
 
     // *** set file headers ***
 
@@ -257,7 +230,7 @@ void NRSSM::ReadSpec( int flag )
         for( int j=0; j<ndet; ++j ){
             PSpec S( new CSpec );
             S->z.resize( 1 );
-            S->z[0] = R.angles[j];
+            S->z[0] = j;
             olf[iolf]->V.push_back(S);
         }
     }
@@ -395,15 +368,15 @@ void NRSSM::ReadSeries( int flag )
             RR[0].measured_until + (int) (mean_time/2);
 
     // Get parameters, check consistency:
-    int ndet = RR[0].angles.size();
+    int ndet = RR[0].ndet;
     printf( "used %i detectors\n", ndet );
     double tstep = RR[0].daq_time_step;
     bool incremental_in = RR[0].incremental;
 
     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)
-                + " has " + strg(RR[isub].angles.size()) + " instead of "
+                + " has " + strg(RR[isub].ndet) + " instead of "
                 + strg(ndet);
         if( RR[isub].daq_time_step!=tstep )
             throw string( "inconsistent time step" );
@@ -438,7 +411,7 @@ void NRSSM::ReadSeries( int flag )
             PSpec S( new CSpec );
             S->z.resize( 2 );
             S->z[0] = isub;
-            S->z[1] = RR[isub].angles[j];
+            S->z[1] = j;
             for( iolf=0; iolf<2; ++iolf )
                 olf[iolf]->V.push_back( S );
         }
-- 
GitLab