Index: trunk/MagicSoft/Cosy/Changelog
===================================================================
--- trunk/MagicSoft/Cosy/Changelog	(revision 9522)
+++ trunk/MagicSoft/Cosy/Changelog	(revision 9523)
@@ -2,7 +2,12 @@
  2009/12/01 Thomas Bretz
 
-   * catalog/SlaStars.h:
+   * catalog/SlaStars.[h,cc]:
      - fixed unit of GetZdAz
      - added GetZdAzRad and GetRaDecRad
+     - added some comments
+     - added TT
+     - use TT instead of UTC in slaMappa. This should be more
+       accurate but is not needed according to the documentation
+       (maybe for the moon?)
 
    * main/MTracking.cc:
@@ -17,4 +22,10 @@
    * tcpip/MDriveCom.cc:
      - fixed the number of expected arguments in CELEST command
+
+   * catalog/SlaPlanets.[h,cc]:
+     - moved TT to the base class
+     - commented out the calculation of the earth's heliocentric
+       coordinates which were never used.
+     - removed fDt which was not used either
 
 
Index: trunk/MagicSoft/Cosy/catalog/SlaPlanets.cc
===================================================================
--- trunk/MagicSoft/Cosy/catalog/SlaPlanets.cc	(revision 9522)
+++ trunk/MagicSoft/Cosy/catalog/SlaPlanets.cc	(revision 9523)
@@ -9,5 +9,5 @@
 using namespace std;
 
-SlaPlanets::SlaPlanets(MObservatory::LocationName_t key) : SlaStars(key), fDt(slaDt(2000.0)/60./60./24.)
+SlaPlanets::SlaPlanets(MObservatory::LocationName_t key) : SlaStars(key)//, fDt(slaDt(2000.0)/60./60./24.)
 {
 }
@@ -17,9 +17,8 @@
     SlaStars::SetMjd(mjd);
 
-    fTt = GetMjd() + slaDtt(GetMjd())/60./60./24.;
-
     //
-    // coordinates of earth: heliocentric, equatoril, J2000
+    // coordinates of earth: heliocentric, equatorial, J2000
     //
+    /*
     double veb[3]; // barycentric velocity
     double ceb[3]; // barycentric coordinates
@@ -27,4 +26,5 @@
 
     slaEvp(GetMjd() + fDt, 2000.0, veb, ceb, veh, fEarth);
+    */
 }
 
@@ -40,5 +40,5 @@
     // One can use TT instead of TDB for all planets (except the moon?)
     // TDB, planet, elong, phi, *ra, *dec, *diam
-    slaRdplan(fTt, planet, GetElong(), GetPhi(), &ra, &dec, &diam);
+    slaRdplan(GetTT(), planet, GetElong(), GetPhi(), &ra, &dec, &diam);
 
     return RaDec(ra, dec);
Index: trunk/MagicSoft/Cosy/catalog/SlaPlanets.h
===================================================================
--- trunk/MagicSoft/Cosy/catalog/SlaPlanets.h	(revision 9522)
+++ trunk/MagicSoft/Cosy/catalog/SlaPlanets.h	(revision 9523)
@@ -27,12 +27,11 @@
 {
 private:
-    double fDt;        // [mjd] const: rootcint/TMemberInspector
-    double fTt;        // [mjd] timescale TT
+    //double fDt;        // [mjd] The result is a rough estimate of ET-UT (after 1984, TT-UT1) at the given epoch, in seconds
 
     ZdAz fZdAz[10];    // [rad]
 
-    double fEarth[3];  // heliocentric coordinates
+    //double fEarth[3];  // heliocentric coordinates
 
-    ZdAz   GetMoonPos() const;
+    //ZdAz   GetMoonPos() const;
 
 public:
Index: trunk/MagicSoft/Cosy/catalog/SlaStars.cc
===================================================================
--- trunk/MagicSoft/Cosy/catalog/SlaStars.cc	(revision 9522)
+++ trunk/MagicSoft/Cosy/catalog/SlaStars.cc	(revision 9523)
@@ -12,8 +12,4 @@
 }
 
-SlaStars::~SlaStars()
-{
-}
-
 void SlaStars::Set(const AltAz &altaz)
 {
@@ -42,4 +38,6 @@
     Slalib::SetMjd(mjd);
 
+    fTt = GetMjd() + slaDtt(GetMjd())/60./60./24.;
+
     //
     // ----- calculate star independent parameters ----------
@@ -47,5 +45,6 @@
 
     // prepare calculation: Mean Place to geocentric apperent
-    slaMappa(2000.0, GetMjd(), fAmprms);   // Epoche, TDB
+    // (UTC would also do, except for the moon?)
+    slaMappa(2000.0, fTt, fAmprms);        // Epoche, TDB
 
     // prepare: Apperent to observed place
@@ -54,8 +53,11 @@
              0, 0,                         // polar motion x, y-coordinate (radians)
              // 273.155, 1013.25, 0.5,     // temp, pressure, humidity
-             273.155+10, 780.0, 0.25,     // temp, pressure, humidity
+             273.155+10, 780.0, 0.25,      // temp, pressure, humidity
              // 0.2, 0.0065,               // wavelength, tropo lapse rate
              0.55, 0.0065,                 // wavelength, tropo lapse rate
              fAoprms);
+
+    // Delta UT should be less than 0.9s which is its definition
+    // so we can fairly assume it to be neglegible
 }
 
Index: trunk/MagicSoft/Cosy/catalog/SlaStars.h
===================================================================
--- trunk/MagicSoft/Cosy/catalog/SlaStars.h	(revision 9522)
+++ trunk/MagicSoft/Cosy/catalog/SlaStars.h	(revision 9523)
@@ -21,7 +21,9 @@
     double   fAoprms[14];
 
+    double   fTt;        // [mjd] timescale TT
+
 public:
     SlaStars(MObservatory::LocationName_t key);
-    virtual ~SlaStars();
+    virtual ~SlaStars() { }
 
     //    const AltAz GetAltAz() const { return fAltAz*360/D2PI; }
@@ -31,4 +33,6 @@
     const RaDec  GetRaDecRad() const  { return fRaDec; }
     const double GetHourAngle() const { return fHourAngle; }
+
+    const double GetTT() const        { return fTt; }
 
     virtual void SetMjd(double mjd);
Index: trunk/MagicSoft/Cosy/main/MTracking.cc
===================================================================
--- trunk/MagicSoft/Cosy/main/MTracking.cc	(revision 9522)
+++ trunk/MagicSoft/Cosy/main/MTracking.cc	(revision 9523)
@@ -225,9 +225,7 @@
 //    if (fCosy->fStarguider)
 //        fCosy->fStarguider->SetPointingPosition(sla.GetRaDec());
-
-//    gLog << all << "=====> " << (int)(&sla==&fSlalib) << " " << fTrackType << " MJD=" << Form("%.13f", sla.GetMjd()) << " HA=" << sla.GetHourAngle() << " Alpha=" << sla.GetAlpha() << " fTrackPos.Ra()=" << fTrackPos.Ra() << " fTrackPos.Dec()=" << fTrackPos.Dec() << " Alt=" << sla.GetZdAzRad().Zd() << " Az=" << sla.GetZdAzRad().Az() << endl;
-}
-
-void MTracking::UpdateSlalib(Double_t dt=0)
+}
+
+void MTracking::UpdateSlalib(Double_t dt)
 {
     fSlalib.Now(dt);
@@ -248,8 +246,8 @@
     const RaDec &dst = fSlalib.GetRaDecRad();
 
-    ZdAz dest = fSlalib.GetZdAzRad();//fSlalib.CalcZdAz(dst);
-
-    if (fTrackType<0)
-       gLog << all << fSlalib.GetTime() << ": Tracking Planet" << endl;
+    ZdAz dest = fSlalib.GetZdAzRad();
+
+    if (fTrackType>=0)
+       gLog << all << fSlalib.GetTime() << ": Tracking Planet with Id " << fTrackType << endl;
     gLog << all << fSlalib.GetTime() << ": Track Position " << dst.Ra()*kRad2Deg/15 << "h, " << dst.Dec()*kRad2Deg <<"deg" << endl;
 
@@ -279,7 +277,4 @@
 void MTracking::TrackPosition(const RaDec &dst)
 {
-
-//    gLog << all << "=====> dst.Ra()=" << dst.Ra() << " dst.Dec()=" << dst.Dec() << "   (deg?)" << endl;
-
     fTrackPos  = dst;
     fTrackType = -1;
@@ -322,7 +317,6 @@
     // Get current nominal local position
     UpdateSlalib();
-    //fCosy->fRaDec = fSlalib.GetRaDec();
-
-    ZdAz pos = fSlalib.GetZdAzRad();//fSlalib.CalcZdAz(fSlalib.GetRaDec());
+
+    ZdAz pos = fSlalib.GetZdAzRad();
 
     // Some output
@@ -363,10 +357,9 @@
         //
         UpdateSlalib(dt);
-        //fCosy->fRaDec = fSlalib.GetRaDec();
 
         //
         // Request nominal position for this time in the future (To+dt)
         //
-        const ZdAz pointing = fSlalib.GetZdAzRad(); //fSlalib.CalcZdAz(fSlalib.GetRaDec()); // [rad]
+        const ZdAz pointing = fSlalib.GetZdAzRad();
         ZdAz dest = fCosy->AlignTrackingPos(pointing);     // fix ambiguity
 
@@ -461,9 +454,6 @@
     //SlaPlanets sla(fSlalib.GetObservatoryKey());
     SlaPlanets sla(MObservatory::kMagic1);
-//    gLog << all << "====> KEYS " << (int)fSlalib.GetObservatoryKey() << " " << (int)sla.GetObservatoryKey() << " " << (int)fCosy->fObservatory << endl;
 
     UpdateSlalib(sla);
-
-    //ZdAz soll = sla.GetZdAz(); //sla.CalcZdAz(sla.GetRaDec()); // [rad]
 
     //
@@ -507,5 +497,5 @@
             UpdateSlalib(sla, mjdzd);
 
-            ZdAz dummy = sla.GetZdAzRad();//sla.CalcZdAz(radec, mjdzd);
+            ZdAz dummy = sla.GetZdAzRad();
             dummy = fCosy->AlignTrackingPos(dummy);
             fCosy->fZdAzSoll.Zd(dummy.Zd());
@@ -518,5 +508,5 @@
             UpdateSlalib(sla, mjdaz);
 
-            ZdAz dummy = sla.GetZdAzRad();//sla.CalcZdAz(radec, mjdaz);
+            ZdAz dummy = sla.GetZdAzRad();
             dummy = fCosy->AlignTrackingPos(dummy);
             fCosy->fZdAzSoll.Az(dummy.Az());
Index: trunk/MagicSoft/Cosy/main/MTracking.h
===================================================================
--- trunk/MagicSoft/Cosy/main/MTracking.h	(revision 9522)
+++ trunk/MagicSoft/Cosy/main/MTracking.h	(revision 9523)
@@ -31,5 +31,5 @@
 
     void UpdateSlalib(SlaPlanets &sla);
-    void UpdateSlalib(Double_t dt);
+    void UpdateSlalib(Double_t dt=0);
     void UpdateSlalib(SlaPlanets &sla, Double_t mjd);
 
