Index: trunk/MagicSoft/Mars/mpointing/MSrcPosCalc.cc
===================================================================
--- trunk/MagicSoft/Mars/mpointing/MSrcPosCalc.cc	(revision 6903)
+++ trunk/MagicSoft/Mars/mpointing/MSrcPosCalc.cc	(revision 6912)
@@ -66,4 +66,6 @@
 #include "MSrcPosCalc.h"
 
+#include <TVector2.h>
+
 #include "MParList.h"
 
@@ -75,4 +77,6 @@
 #include "MPointingPos.h"
 #include "MSrcPosCam.h"
+#include "MRawRunHeader.h"
+#include "MMcCorsikaRunHeader.h"
 
 #include "MAstro.h"
@@ -138,10 +142,11 @@
 // --------------------------------------------------------------------------
 //
-// Search and if necessary create MSrcPosCam in the parameter list. Search MSourcePos.
-// If not found, do nothing else, and skip the task. If MSrcPosCam did not exist
-// before and has been created here, it will contain as source position the camera
-// center (0,0).
-// In the case that MSourcePos is found, go ahead in searching the rest of necessary 
-// containers. The source position will be calculated for each event in Process.
+// Search and if necessary create MSrcPosCam in the parameter list. Search
+// MSourcePos. If not found, do nothing else, and skip the task. If MSrcPosCam
+// did not exist before and has been created here, it will contain as source
+// position the camera center (0,0).
+// In the case that MSourcePos is found, go ahead in searching the rest of
+// necessary containers. The source position will be calculated for each
+// event in Process.
 //
 Int_t MSrcPosCalc::PreProcess(MParList *pList)
@@ -160,8 +165,9 @@
         if (!fSourcePos)
         {
-            *fLog << warn << "MSourcePos [MPointPos] not found... The source position" << endl;
-            *fLog << warn << "set in MSrcPosCam (camera center if not set explicitely) will" << endl;
-            *fLog << warn << "be left unchanged, same for all events." << endl;
-            return kSKIP;
+            *fLog << warn;
+            *fLog << "MSourcePos [MPointPos] not found... The source position" << endl;
+            *fLog << "set in MSrcPosCam (camera center if not set explicitely)" << endl;
+            *fLog << "will be left unchanged if not wobble mode Monte Carlo." << endl;
+            return kTRUE;
         }
     }
@@ -199,4 +205,67 @@
     //*fLog << "Pointing Position: " << GetRaDec(*fPointPos)  << endl;
     *fLog << "Source Position: " << GetRaDec(*fSourcePos) << endl;
+
+    return kTRUE;
+}
+
+// --------------------------------------------------------------------------
+//
+// If fIsWobbleMode==kFALSE set source position to v and anto-source
+// position to -v, if fIsWobbleMode==kTRUE vice versa.
+//
+void MSrcPosCalc::SetSrcPos(TVector2 v) const
+{
+    if (fIsWobbleMode)
+    {
+        fSrcPosAnti->SetXY(v);
+        v *= -1;
+        fSrcPosCam->SetXY(v);
+    }
+    else
+    {
+        fSrcPosCam->SetXY(v);
+        v *= -1;
+        fSrcPosAnti->SetXY(v);
+    }
+}
+
+// --------------------------------------------------------------------------
+//
+// Checking for file type. If the file type is Monte Carlo the
+// source position is arbitrarily determined from the MC headers.
+//
+Bool_t MSrcPosCalc::ReInit(MParList *plist)
+{
+    MRawRunHeader *run = (MRawRunHeader*)plist->FindObject("MRawRunHeader");
+    if (!run)
+    {
+        *fLog << err << "MRawRunHeader not found... aborting." << endl;
+        return kFALSE;
+    }
+
+    fRunType = run->GetRunType();
+
+    if (fRunType!=MRawRunHeader::kRTMonteCarlo)
+        return kTRUE;
+
+    MMcCorsikaRunHeader *h = (MMcCorsikaRunHeader*)plist->FindObject("MMcCorsikaRunHeader");
+    if (!h)
+    {
+        *fLog << err << "MMcCorsikaRunHeader not found... aborting." << endl;
+        return kFALSE;
+    }
+
+    TVector2 v(0, 0);
+    if (h->GetWobbleMode()>0.5)
+        v.Set(120., 0.);
+    if (h->GetWobbleMode()<-0.5)
+        v.Set(-120., 0.);
+
+
+    SetSrcPos(v);
+
+    *fLog << inf;
+    *fLog << "Source Position set to x=" << fSrcPosCam->GetX() << "mm ";
+    *fLog << "y=" << fSrcPosCam->GetY() << "mm" << endl;
 
     return kTRUE;
@@ -243,4 +312,7 @@
 Int_t MSrcPosCalc::Process()
 {
+    if (fRunType==MRawRunHeader::kRTMonteCarlo)
+        return kTRUE;
+
   //     *fLog << dbg << "Camera center : Zd=" << fPointPos->GetZd() << " Az=" << fPointPos->GetAz() << endl;
   //     *fLog << dbg << "Camera center : RA=" << fPointPos->GetRa() << " Dec=" << fPointPos->GetDec() << endl;
@@ -287,16 +359,5 @@
   // Calculate source position in camera, and convert to mm:
   TVector2 v = CalcXYinCamera(pos0, pos)*fGeom->GetCameraDist()*1000;
-  if (fIsWobbleMode)
-  {
-      fSrcPosAnti->SetXY(v);
-      v *= -1;
-      fSrcPosCam->SetXY(v);
-  }
-  else
-  {
-      fSrcPosCam->SetXY(v);
-      v *= -1;
-      fSrcPosAnti->SetXY(v);
-  }
+  SetSrcPos(v);
 
   //     v *= fGeom->GetConvMm2Deg();
@@ -326,5 +387,8 @@
 
     if (str.First(':')<0)
-        return atof(str);
+    {
+        ret = atof(str);
+        return kTRUE;
+    }
 
     if (MAstro::Coordinate2Angle(str, ret))
Index: trunk/MagicSoft/Mars/mpointing/MSrcPosCalc.h
===================================================================
--- trunk/MagicSoft/Mars/mpointing/MSrcPosCalc.h	(revision 6903)
+++ trunk/MagicSoft/Mars/mpointing/MSrcPosCalc.h	(revision 6912)
@@ -32,7 +32,10 @@
     MTime        *fTime;
 
+    UShort_t fRunType;            //! Run Type to decide where to get pointing position from
+
     Bool_t fIsWobbleMode;
 
     // MSrcPosCalc
+    void     SetSrcPos(TVector2 v) const;
     TVector2 CalcXYinCamera(const MVector3 &pos0, const MVector3 &pos) const;
     TString  GetRaDec(const MPointingPos &pos) const;
@@ -44,6 +47,7 @@
 
     // MTask
-    Int_t PreProcess(MParList *pList);
-    Int_t Process();
+    Bool_t ReInit(MParList *pList);
+    Int_t  PreProcess(MParList *pList);
+    Int_t  Process();
 
 public:
