Index: trunk/MagicSoft/Mars/Changelog
===================================================================
--- trunk/MagicSoft/Mars/Changelog	(revision 7219)
+++ trunk/MagicSoft/Mars/Changelog	(revision 7220)
@@ -42,4 +42,26 @@
    * mpointing/MPointingPos.[h,cc]:
      - added option to calculate Rotation angle using MPointingDev 
+
+   * ganymed_onoff.rc, ganymed_wobble.rc:
+     - added example for MPointingDevCalc
+
+   * mjobs/MDataSet.cc:
+     - fixed an endless loop when a sequence is added twice
+
+   * mjobs/MSequence.cc:
+     - fixed an endless loop when a run is added twice
+
+   * mjobs/MJPedestal.cc:
+     - CheckEnv doesn't return kERROR, test for kFALSE instead
+
+   * mpointing/MPointingDev.h:
+     - added fDevX
+     - added fDevY
+
+   * mpointing/MPointingDevCalc.cc:
+     - call SetDevXY instead of the starguider calibration in zd/az
+
+   * mpointing/MSrcPosCalc.cc:
+     - added the DevXY to the source position if fDeviation!=NULL
 
 
Index: trunk/MagicSoft/Mars/NEWS
===================================================================
--- trunk/MagicSoft/Mars/NEWS	(revision 7219)
+++ trunk/MagicSoft/Mars/NEWS	(revision 7220)
@@ -155,4 +155,10 @@
      when calculating the source position. This is especially important
      for wobble data at high zenith angles and culmination data.
+
+   - ganymed: If available the starguider data is taken into account as
+     good as it is possible without a starguider calibration. To switch
+     it off add
+        MPointingDevCalc.MaxAbsDev: -1
+     to your ganymed.rc
 
    - sponde: the zenith angle distribution is now weighted instead of
Index: trunk/MagicSoft/Mars/ganymed_onoff.rc
===================================================================
--- trunk/MagicSoft/Mars/ganymed_onoff.rc	(revision 7219)
+++ trunk/MagicSoft/Mars/ganymed_onoff.rc	(revision 7220)
@@ -39,4 +39,15 @@
 BinningDist.Raw:         25    0    2
 BinningMaxDist.Raw:      25    0    2
+
+# -------------------------------------------------------------------------
+# Using the starguider for pointing correction. 
+# To switch it off use "MPointingDevCalc.MaxAbsDev: -1"
+# -------------------------------------------------------------------------
+#MPointingDevCalc.MaxAbsDev:   15
+#MPointingDevCalc.NumMinStars: 8
+#MPointingDevCalc.NsbLevel:    3.0
+#MPointingDevCalc.NsbMin:      30
+#MPointingDevCalc.NsbMax:      60
+#MPointingDevCalc.MaxAbsDev:   15
 
 # -------------------------------------------------------------------------
Index: trunk/MagicSoft/Mars/ganymed_wobble.rc
===================================================================
--- trunk/MagicSoft/Mars/ganymed_wobble.rc	(revision 7219)
+++ trunk/MagicSoft/Mars/ganymed_wobble.rc	(revision 7220)
@@ -39,4 +39,15 @@
 BinningDist.Raw:         25    0    2
 BinningMaxDist.Raw:      25    0    2
+
+# -------------------------------------------------------------------------
+# Using the starguider for pointing correction. 
+# To switch it off use "MPointingDevCalc.MaxAbsDev: -1"
+# -------------------------------------------------------------------------
+#MPointingDevCalc.MaxAbsDev:   15
+#MPointingDevCalc.NumMinStars: 8
+#MPointingDevCalc.NsbLevel:    3.0
+#MPointingDevCalc.NsbMin:      30
+#MPointingDevCalc.NsbMax:      60
+#MPointingDevCalc.MaxAbsDev:   15
 
 # -------------------------------------------------------------------------
Index: trunk/MagicSoft/Mars/mjobs/MDataSet.cc
===================================================================
--- trunk/MagicSoft/Mars/mjobs/MDataSet.cc	(revision 7219)
+++ trunk/MagicSoft/Mars/mjobs/MDataSet.cc	(revision 7220)
@@ -122,12 +122,11 @@
 
         if (i<n)
+            *fLog << warn << "WARNING - Sequence #" << seq << " alraedy in list... skipped." << endl;
+        else
         {
-            *fLog << warn << "WARNING - Sequence #" << seq << " alraedy in list... skipped." << endl;
-            continue;
+            // set new entry
+            data.Set(n+1);
+            data[n] = seq;
         }
-
-        // set new entry
-        data.Set(n+1);
-        data[n] = seq;
 
         // remove entry from string
Index: trunk/MagicSoft/Mars/mjobs/MJPedestal.cc
===================================================================
--- trunk/MagicSoft/Mars/mjobs/MJPedestal.cc	(revision 7219)
+++ trunk/MagicSoft/Mars/mjobs/MJPedestal.cc	(revision 7220)
@@ -800,5 +800,5 @@
 
     // check the resource file for it
-    if (CheckEnv(tenv)==kERROR)
+    if (!CheckEnv(tenv))
         return kFALSE;
 
@@ -1105,5 +1105,5 @@
 
         // The requested setup might have been overwritten
-        if (CheckEnv(*fExtractor)==kERROR)
+        if (!CheckEnv(*fExtractor))
             return kFALSE;
 
Index: trunk/MagicSoft/Mars/mjobs/MSequence.cc
===================================================================
--- trunk/MagicSoft/Mars/mjobs/MSequence.cc	(revision 7219)
+++ trunk/MagicSoft/Mars/mjobs/MSequence.cc	(revision 7220)
@@ -178,12 +178,11 @@
 
         if (i<n)
+            *fLog << warn << "WARNING - Run #" << run << " alraedy in list... skipped." << endl;
+        else
         {
-            *fLog << warn << "WARNING - Run #" << run << " alraedy in list... skipped." << endl;
-            continue;
+            // set new entry
+            data.Set(n+1);
+            data[n] = run;
         }
-
-        // set new entry
-        data.Set(n+1);
-        data[n] = run;
 
         runs.Remove(0, runs.First(num)+num.Length());
Index: trunk/MagicSoft/Mars/mpointing/MPointingDev.h
===================================================================
--- trunk/MagicSoft/Mars/mpointing/MPointingDev.h	(revision 7219)
+++ trunk/MagicSoft/Mars/mpointing/MPointingDev.h	(revision 7220)
@@ -4,4 +4,7 @@
 #ifndef MARS_MParContainer
 #include "MParContainer.h"
+#endif
+#ifndef ROOT_TVector2
+#include <TVector2.h>
 #endif
 
@@ -11,4 +14,7 @@
     Double_t fDevZd;  // [deg] Pointing offset zenith distance as calculated from starguider data
     Double_t fDevAz;  // [deg] Pointing offset azimuth as calculated from starguider dat
+
+    Double_t fDevX;   // [mm]
+    Double_t fDevY;   // [mm]
 
 public:
@@ -20,7 +26,13 @@
 
     void SetDevZdAz(Double_t devzd, Double_t devaz) { fDevZd=devzd; fDevAz=devaz; }
+    void SetDevXY(Double_t dx, Double_t dy) { fDevX=dx; fDevY=dy; }
 
     Double_t GetDevZd() const  { return fDevZd; }
     Double_t GetDevAz() const  { return fDevAz; }
+
+    Double_t GetDevX() const  { return fDevX; }
+    Double_t GetDevY() const  { return fDevY; }
+
+    TVector2 GetDevXY() const { return TVector2(fDevX, fDevY); }
 
     Double_t GetDevZdRad() const  { return fDevZd*TMath::DegToRad(); }
Index: trunk/MagicSoft/Mars/mpointing/MPointingDevCalc.cc
===================================================================
--- trunk/MagicSoft/Mars/mpointing/MPointingDevCalc.cc	(revision 7219)
+++ trunk/MagicSoft/Mars/mpointing/MPointingDevCalc.cc	(revision 7220)
@@ -176,20 +176,22 @@
     }
 
+    // Calculate absolute deviation
+    const Double_t dev = MAstro::GetDevAbs(fReport->GetNominalZd(), devzd, devaz);
+
+    // Sanity check... larger deviation are strange and ignored
+    if (dev*60>fMaxAbsDev)
+    {
+        fSkip[4]++;
+        return kTRUE;
+    }
+
+    fDeviation->SetDevZdAz(devzd, devaz);
+
     // Linear starguider calibration taken from April/May data
     // For calibration add MDriveReport::GetErrorZd/Az !
-    devzd -= 2.686/60;   // 1arcmin ~ 5mm
-    devaz -= 2.840/60;
-
-    // Calculate absolute deviation
-    const Double_t dev = MAstro::GetDevAbs(fReport->GetNominalZd(), devzd, devaz);
-
-    // Sanity check... larger deviation are strange and ignored
-    if (dev*60>fMaxAbsDev)
-    {
-        fSkip[4]++;
-        return kTRUE;
-    }
-
-    fDeviation->SetDevZdAz(devzd, devaz);
+    fDeviation->SetDevXY(-7.0, 16);
+    //devzd -= 2.686/60;   // 1arcmin ~ 5mm
+    //devaz -= 2.840/60;
+
     fSkip[0]++;
 
Index: trunk/MagicSoft/Mars/mpointing/MSrcPosCalc.cc
===================================================================
--- trunk/MagicSoft/Mars/mpointing/MSrcPosCalc.cc	(revision 7219)
+++ trunk/MagicSoft/Mars/mpointing/MSrcPosCalc.cc	(revision 7220)
@@ -371,5 +371,5 @@
     if (fDeviation)
     {
-        vx = CalcXYinCamera(pos0, pos)*fGeom->GetCameraDist()*1000;
+        //vx = CalcXYinCamera(pos0, pos)*fGeom->GetCameraDist()*1000;
         pos0.SetZdAz(pos0.Theta()-fDeviation->GetDevZdRad(),
                      pos0.Phi()  -fDeviation->GetDevAzRad());
@@ -378,4 +378,8 @@
     // Calculate source position in camera, and convert to mm:
     TVector2 v = CalcXYinCamera(pos0, pos)*fGeom->GetCameraDist()*1000;
+
+    if (fDeviation)
+        v -= fDeviation->GetDevXY();
+
     SetSrcPos(v);
 
