From 73636a9b10b197a03bb6618a310ad39c0c67e426 Mon Sep 17 00:00:00 2001
From: Jan David Mol <mol@astron.nl>
Date: Wed, 13 Mar 2013 15:21:07 +0000
Subject: [PATCH] Task #4255: Removed obsolete keys and cache a few more

---
 RTCP/Cobalt/CoInterface/src/Parset.cc      | 38 ++++++----------------
 RTCP/Cobalt/CoInterface/src/Parset.h       | 20 +++++++-----
 RTCP/Cobalt/OutputProc/src/OutputThread.cc |  1 -
 RTCP/Cobalt/OutputProc/src/OutputThread.h  |  1 -
 4 files changed, 21 insertions(+), 39 deletions(-)

diff --git a/RTCP/Cobalt/CoInterface/src/Parset.cc b/RTCP/Cobalt/CoInterface/src/Parset.cc
index c3d59d29920..273401847d7 100644
--- a/RTCP/Cobalt/CoInterface/src/Parset.cc
+++ b/RTCP/Cobalt/CoInterface/src/Parset.cc
@@ -147,6 +147,7 @@ namespace LOFAR
 
       vector<string>   emptyVectorString;
       vector<unsigned> emptyVectorUnsigned;
+      vector<double>   emptyVectorDouble;
 
       // Generic information
       settings.realTime = getBool("OLAP.realTime", false);
@@ -163,9 +164,11 @@ namespace LOFAR
         settings.nrBitsPerSample = getUint32("OLAP.nrBitsPerSample", 16);
       }
 
-      settings.corrections.delayCompensation = getBool("OLAP.delayCompensation", true);
-      settings.corrections.bandPass          = getBool("OLAP.correctBandPass", true);
-      settings.corrections.clock             = getBool("OLAP.correctClocks", true);
+      settings.corrections.bandPass = getBool("OLAP.correctBandPass", true);
+      settings.corrections.clock    = getBool("OLAP.correctClocks", true);
+
+      settings.delayCompensation.enabled              = getBool("OLAP.delayCompensation", true);
+      settings.delayCompensation.referencePhaseCenter = getDoubleVector("Observation.referencePhaseCenter", emptyVectorDouble, true);
 
       // Station information
       settings.antennaSet = getString("Observation.antennaSet", "LBA");
@@ -201,6 +204,7 @@ namespace LOFAR
         sap.direction.type   = getString(str(boost::format("Observation.Beam[%u].directionType") % i), "J2000");
         sap.direction.angle1 = getDouble(str(boost::format("Observation.Beam[%u].angle1") % i), 0.0);
         sap.direction.angle2 = getDouble(str(boost::format("Observation.Beam[%u].angle2") % i), 0.0);
+        sap.target           = getString(str(boost::format("Observation.Beam[%u].target") % i), "");
       }
 
       settings.anaBeam.enabled = settings.antennaSet.substr(0,3) == "HBA";
@@ -528,7 +532,7 @@ namespace LOFAR
 
     std::vector<double> Parset::getRefPhaseCentre() const
     {
-      return getDoubleVector("Observation.referencePhaseCenter");
+      return cache.delayCompensation.referencePhaseCenter;
     }
 
 
@@ -545,9 +549,7 @@ namespace LOFAR
 
     string Parset::beamTarget(unsigned beam) const
     {
-      string key = str(boost::format("Observation.Beam[%u].target") % beam);
-
-      return getString(key, "");
+      return cache.SAPs[beam].target;
     }
 
 
@@ -725,16 +727,6 @@ namespace LOFAR
       return names;
     }
 
-    bool Parset::hasStorage() const
-    {
-      return getString("OLAP.OLAP_Conn.IONProc_Storage_Transport") != "NULL";
-    }
-
-    string Parset::getTransportType(const string& prefix) const
-    {
-      return getString(prefix + "_Transport");
-    }
-
     unsigned Parset::nrStations() const
     {
       return cache.stations.size();
@@ -933,16 +925,6 @@ namespace LOFAR
       return getBool("OLAP.CNProc.onlinePostCorrelationFlaggingDetectBrokenStations", false);
     }
 
-    bool Parset::fakeInputData() const
-    {
-      return getBool("OLAP.CNProc.fakeInputData", false);
-    }
-
-    bool Parset::checkFakeInputData() const
-    {
-      return getBool("OLAP.CNProc.checkFakeInputData", false);
-    }
-
     double Parset::CNintegrationTime() const
     {
       return nrSamplesPerSubband() / subbandBandwidth();
@@ -1032,7 +1014,7 @@ namespace LOFAR
 
     bool Parset::delayCompensation() const
     {
-      return cache.corrections.delayCompensation;
+      return cache.delayCompensation.enabled;
     }
 
     unsigned Parset::nrCalcDelays() const
diff --git a/RTCP/Cobalt/CoInterface/src/Parset.h b/RTCP/Cobalt/CoInterface/src/Parset.h
index 25d02f491ad..59ef07f425d 100644
--- a/RTCP/Cobalt/CoInterface/src/Parset.h
+++ b/RTCP/Cobalt/CoInterface/src/Parset.h
@@ -87,9 +87,6 @@ namespace LOFAR
       unsigned nrBitsPerSample;
 
       struct Corrections {
-        // Whether geometric delays should be compensated for
-        bool delayCompensation;
-
         // Whether the station band pass should be corrected for
         bool bandPass;
 
@@ -97,6 +94,14 @@ namespace LOFAR
         bool clock;
       } corrections;
 
+      struct DelayCompensation {
+        // Whether geometric delays should be compensated for
+        bool enabled;
+
+        // The ITRF position to compensate delays to
+        std::vector<double> referencePhaseCenter;
+      } delayCompensation;
+
       /*
        * Station information
        */
@@ -143,6 +148,9 @@ namespace LOFAR
       struct SAP {
         // Direction in which the SAP points
         struct Direction direction;
+
+        // Name of target
+        std::string target;
       };
 
       // All station beams
@@ -272,7 +280,6 @@ namespace LOFAR
       bool                        correctClocks() const;
       double                      clockCorrectionTime(const std::string &station) const;
       bool                        correctBandPass() const;
-      bool                        hasStorage() const;
       std::string                 stationName(int index) const;
       int                         stationIndex(const std::string &name) const;
       std::vector<std::string>    allStationNames() const;
@@ -280,8 +287,6 @@ namespace LOFAR
       std::vector<unsigned>       phaseOnePsets() const;
       std::vector<unsigned>       tabList() const;
 
-      std::string                 getTransportType(const std::string &prefix) const;
-
       bool                        outputCorrelatedData() const;
       bool                        outputBeamFormedData() const;
       bool                        outputTrigger() const;
@@ -304,9 +309,6 @@ namespace LOFAR
       std::string getFileName(OutputType, unsigned streamNr) const;
       std::string getDirectoryName(OutputType, unsigned streamNr) const;
 
-      bool                        fakeInputData() const;
-      bool                        checkFakeInputData() const;
-
       std::string                 coherentStokes() const;
       std::string                 incoherentStokes() const;
       std::string                 bandFilter() const;
diff --git a/RTCP/Cobalt/OutputProc/src/OutputThread.cc b/RTCP/Cobalt/OutputProc/src/OutputThread.cc
index b975c480518..3682adf38b5 100644
--- a/RTCP/Cobalt/OutputProc/src/OutputThread.cc
+++ b/RTCP/Cobalt/OutputProc/src/OutputThread.cc
@@ -105,7 +105,6 @@ namespace LOFAR
       itsStreamNr(streamNr),
       itsIsBigEndian(isBigEndian),
       itsLogPrefix(logPrefix + "[OutputThread] "),
-      itsCheckFakeData(parset.checkFakeInputData()),
       itsTargetDirectory(targetDirectory),
       itsFreeQueue(freeQueue),
       itsReceiveQueue(receiveQueue),
diff --git a/RTCP/Cobalt/OutputProc/src/OutputThread.h b/RTCP/Cobalt/OutputProc/src/OutputThread.h
index bc227746a14..2886998115d 100644
--- a/RTCP/Cobalt/OutputProc/src/OutputThread.h
+++ b/RTCP/Cobalt/OutputProc/src/OutputThread.h
@@ -67,7 +67,6 @@ namespace LOFAR
       const unsigned itsStreamNr;
       const bool itsIsBigEndian;
       const std::string itsLogPrefix;
-      const bool itsCheckFakeData;
       const std::string itsTargetDirectory;
 
       Queue<SmartPtr<StreamableData> > &itsFreeQueue, &itsReceiveQueue;
-- 
GitLab