Index: /trunk/MagicSoft/Mars/Changelog
===================================================================
--- /trunk/MagicSoft/Mars/Changelog	(revision 8617)
+++ /trunk/MagicSoft/Mars/Changelog	(revision 8618)
@@ -34,4 +34,18 @@
    * mmain/Makefile:
      - added inlcude of mjobs for MSequence
+
+   * mbadpixels/MBadPixelsTreat.cc:
+     - we assume now that the maximum arrival time difference 
+       is calibrated already in nanoseconds
+
+   * mcalib/MCalibrateRelTimes.[h,cc]:
+     - the arrival time is now converted from slices into nanoseconds
+
+   * mfilter/MFSoftwareTrigger.cc:
+     - the arrival time is now assumed to be in nanoseconds.
+       the default is changed accordingly from 0.5 to 1.7
+
+   * mjobs/MJCalibrateSignal.cc:
+     - changed axis label of PulsePos plot (now in nanosec)
 
 
Index: /trunk/MagicSoft/Mars/NEWS
===================================================================
--- /trunk/MagicSoft/Mars/NEWS	(revision 8617)
+++ /trunk/MagicSoft/Mars/NEWS	(revision 8618)
@@ -29,4 +29,14 @@
      use the summary file instead.
 
+   - mars: new ways to call mars are implemented. Instead
+     of calling
+         mars filename.root
+     you can now also use
+         mars sequence.txt
+     or
+         mars sequence.txt inputpath
+     or replace sequence.txt by the sequence number if the default
+     sequence file should be used.
+
    - callisto: was broken for MCs... fixed.
 
@@ -47,4 +57,12 @@
      pixel treatment is now in units of nanoseconds, which leads to 3.0ns
      for both, old FADC and MUX-FADC, data.
+
+   - callisto: Be aware that callisto is now calibrating the arrival time
+     in nanoseconds rather than time slices. Also all following tasks
+     have been changed to assume ns units now. If you star data 
+     calibrated with an older version it might be necessary to adapt 
+     some timimng parameters (Muon Analysis and MFSoftwareTrigger)
+     to obtain optimal results. The plot in the PulsePos tab 
+     will now be in ns, too.
 
    - ganymed: From XXXX on a real starguider calibration with a real
Index: /trunk/MagicSoft/Mars/ganymed_onoff.rc
===================================================================
--- /trunk/MagicSoft/Mars/ganymed_onoff.rc	(revision 8617)
+++ /trunk/MagicSoft/Mars/ganymed_onoff.rc	(revision 8618)
@@ -100,10 +100,13 @@
 # -------------------------------------------------------------------------
 # There are three cuts:
-#   Cut0: After energy estimation, before writing summary file
+#   CutQ: Cut after reading file
+#   Cut0: After calculation of src dependant parameters, energy estimation
+#         and disp calculation, before writing summary file
 #   Cut1: After writing summary file before filling false source plots
 #   Cut2: After filling false source plots before filling alpha plots
 #   Cut3: After filling alpha plots (eg. Alpha cuts) for image parameter
-#         display
+#         display, eg. write only events after alpha cut to ganymed file
 # -------------------------------------------------------------------------
+CutQ.Inverted: Yes
 Cut0.Inverted: Yes
 Cut1.Inverted: Yes
@@ -112,12 +115,12 @@
 
 # Get rid of triangular events...
-Cut0.Condition: ({0} || {1}) && {2} && {3} && {4} && {5} && {6}
-Cut0.0: MImagePar.fNumSatPixelsHG < 1
-Cut0.1: MHillas.GetArea*(MGeomCam.fConvMm2Deg^2) > (0.003*MImagePar.fNumSatPixelsHG) + 0.0325
-Cut0.2: MNewImagePar.fNumUsedPixels>5
-Cut0.3: MNewImagePar.fLeakage1 < 0.3
-Cut0.4: MImagePar.fNumSatPixelsLG<2
-Cut0.5: MImagePar.fNumIslands<3
-Cut0.6: log10(MNewImagePar.fConc1) < (-0.371)*log10(MHillas.fSize) + 0.596
+CutQ.Condition: ({0} || {1}) && {2} && {3} && {4} && {5} && {6}
+CutQ.0: MImagePar.fNumSatPixelsHG < 1
+CutQ.1: MHillas.GetArea*(MGeomCam.fConvMm2Deg^2) > (0.003*MImagePar.fNumSatPixelsHG) + 0.0325
+CutQ.2: MNewImagePar.fNumUsedPixels>5
+CutQ.3: MNewImagePar.fLeakage1 < 0.3
+CutQ.4: MImagePar.fNumSatPixelsLG<2
+CutQ.5: MImagePar.fNumIslands<3
+CutQ.6: log10(MNewImagePar.fConc1) < (-0.371)*log10(MHillas.fSize) + 0.596
 
 # ---------- SETUP FOR ONOFF-MODE -----------
Index: /trunk/MagicSoft/Mars/mbadpixels/MBadPixelsTreat.cc
===================================================================
--- /trunk/MagicSoft/Mars/mbadpixels/MBadPixelsTreat.cc	(revision 8617)
+++ /trunk/MagicSoft/Mars/mbadpixels/MBadPixelsTreat.cc	(revision 8618)
@@ -1,4 +1,4 @@
 /* ======================================================================== *\
-! $Name: not supported by cvs2svn $:$Id: MBadPixelsTreat.cc,v 1.39 2007-06-18 14:11:08 tbretz Exp $
+! $Name: not supported by cvs2svn $:$Id: MBadPixelsTreat.cc,v 1.40 2007-06-28 20:13:17 tbretz Exp $
 ! --------------------------------------------------------------------------
 !
@@ -445,6 +445,4 @@
 void MBadPixelsTreat::InterpolateTimes() const
 {
-    const Double_t maxdiff = fMaxArrivalTimeDiff*fRawRunHeader->GetFreqSampling()/1000.;
-
     const Int_t n = fEvt->GetNumPixels();
     for (int i=0; i<n; i++)
@@ -491,5 +489,5 @@
 
             // Calculate mean arrival time of pixel probably inside the shower
-            if (TMath::Abs(tm1 - tm2)<maxdiff)
+            if (TMath::Abs(tm1 - tm2)<fMaxArrivalTimeDiff)
             {
                 sum2 += tm1+tm2;
Index: /trunk/MagicSoft/Mars/mbase/MTaskList.cc
===================================================================
--- /trunk/MagicSoft/Mars/mbase/MTaskList.cc	(revision 8617)
+++ /trunk/MagicSoft/Mars/mbase/MTaskList.cc	(revision 8618)
@@ -89,5 +89,5 @@
 // this name in the parameter list (by MEvtLoop::SetParList)
 //
-MTaskList::MTaskList(const char *name, const char *title)
+MTaskList::MTaskList(const char *name, const char *title) : fNumPasses(0), fNumPass(0)
 {
     fName  = name  ? name  : gsDefName.Data();
@@ -108,5 +108,5 @@
 //   TaskList in the new TaskList.
 //
-MTaskList::MTaskList(MTaskList &ts) : MTask()
+MTaskList::MTaskList(const MTaskList &ts) : MTask(), fNumPasses(ts.fNumPasses)
 {
     fTasks->AddAll(ts.fTasks);
@@ -612,35 +612,6 @@
 }
 
-// --------------------------------------------------------------------------
-//
-// do the event execution of all tasks in the task-list
-//
-Int_t MTaskList::Process()
-{
-    //
-    // Check whether there is something which can be processed, otherwise
-    // stop the eventloop.
-    //
-    if (fTasksProcess.GetSize()==0)
-    {
-        *fLog << warn << "Warning: No entries in " << GetDescriptor() << " for Processing." << endl;
-        return kFALSE;
-    }
-
-    //
-    // Reset the ReadyToSave flag.
-    // Reset all containers.
-    //
-    // Make sure, that the parameter list is not reset from a tasklist
-    // running as a task in another tasklist.
-    //
-    const Bool_t noreset = fParList->TestBit(MParList::kIsProcessing);
-    if (!noreset)
-    {
-        fParList->SetBit(MParList::kIsProcessing);
-        if (!HasAccelerator(kAccDontReset))
-            fParList->Reset();
-    }
-
+Int_t MTaskList::ProcessTaskList()
+{
     //
     //  create the Iterator for the TaskList
@@ -707,4 +678,56 @@
     }
 
+    return rc;
+}
+
+// --------------------------------------------------------------------------
+//
+// do the event execution of all tasks in the task-list.
+//
+// If a task returns kCONTINUE, kCONTINUE is propagated if the
+// number of passes==0, otherwise kTRUE is returned instead.
+//
+Int_t MTaskList::Process()
+{
+    //
+    // Check whether there is something which can be processed, otherwise
+    // stop the eventloop.
+    //
+    if (fTasksProcess.GetSize()==0)
+    {
+        *fLog << warn << "Warning: No entries in " << GetDescriptor() << " for Processing." << endl;
+        return kFALSE;
+    }
+
+    //
+    // Reset the ReadyToSave flag.
+    // Reset all containers.
+    //
+    // Make sure, that the parameter list is not reset from a tasklist
+    // running as a task in another tasklist.
+    //
+    const Bool_t noreset = fParList->TestBit(MParList::kIsProcessing);
+    if (!noreset)
+    {
+        fParList->SetBit(MParList::kIsProcessing);
+        if (!HasAccelerator(kAccDontReset))
+            fParList->Reset();
+    }
+
+    // Initialize storage variable for the return code
+    Int_t rc = kTRUE;
+
+    // Execute the task list at least once
+    const UInt_t cnt = fNumPasses==0 ? 1 : fNumPasses;
+    for (fNumPass=0; fNumPass<cnt; fNumPass++)
+    {
+        // Execute the tasklist once
+        rc = ProcessTaskList();
+        // In cae of error or a stop-request leave loop
+        if (rc==kERROR || rc==kFALSE)
+            break;
+    }
+
+    // Reset to the default
     if (!noreset)
     {
@@ -713,4 +736,9 @@
     }
 
+    // If the number of passes==0 <default> propagete kCONTINUE
+    if (rc==kCONTINUE)
+        return fNumPasses==0 ? kCONTINUE : kTRUE;
+
+    // Return return code
     return rc;
 }
Index: /trunk/MagicSoft/Mars/mbase/MTaskList.h
===================================================================
--- /trunk/MagicSoft/Mars/mbase/MTaskList.h	(revision 8617)
+++ /trunk/MagicSoft/Mars/mbase/MTaskList.h	(revision 8618)
@@ -28,4 +28,7 @@
     MParList *fParList;      //! The parameter list given in PreProcess
 
+    UInt_t fNumPasses;
+    UInt_t fNumPass; //!
+
     enum { kIsOwner = BIT(14) };
 
@@ -33,8 +36,9 @@
     void   StreamPrimitive(ostream &out) const;
     Bool_t CheckAddToList(MTask *task, /*const char *tType,*/ const MTask *where=NULL) const;
+    Int_t  ProcessTaskList();
 
 public:
     MTaskList(const char *name=NULL, const char *title=NULL);
-    MTaskList(MTaskList &ts);
+    MTaskList(const MTaskList &ts);
 
     ~MTaskList();
@@ -43,4 +47,8 @@
     void SetDisplay(MStatusDisplay *d);
     void SetAccelerator(Byte_t acc=kAccStandard);
+    void SetNumPasses(UInt_t cnt=0) { fNumPasses=cnt; }
+
+    UInt_t GetNumPass() const { return fNumPass; }
+    UInt_t GetNumPasses() const { return fNumPasses; }
 
     Bool_t AddToListBefore(MTask *task, const MTask *where, const char *tType="All");
Index: /trunk/MagicSoft/Mars/mcalib/MCalibrateRelTimes.cc
===================================================================
--- /trunk/MagicSoft/Mars/mcalib/MCalibrateRelTimes.cc	(revision 8617)
+++ /trunk/MagicSoft/Mars/mcalib/MCalibrateRelTimes.cc	(revision 8618)
@@ -60,4 +60,6 @@
 #include "MSignalPix.h"
 
+#include "MRawRunHeader.h"
+
 ClassImp(MCalibrateRelTimes);
 
@@ -86,5 +88,4 @@
 {
     fSignals = (MArrivalTimeCam*)pList->FindObject(AddSerialNumber("MArrivalTimeCam"));
-
     if (!fSignals)
     {
@@ -99,8 +100,8 @@
     fCalibrations = (MCalibrationRelTimeCam*)pList->FindObject(AddSerialNumber("MCalibrationRelTimeCam"));
     if (!fCalibrations)
-      {
+    {
         *fLog << err << AddSerialNumber("MCalibrationRelTimeCam") << " not found ... aborting." << endl;
         return kFALSE;
-      }
+    }
 
     fArrivalTime = (MSignalCam*)pList->FindCreateObj(AddSerialNumber("MSignalCam"));
@@ -108,4 +109,18 @@
         return kFALSE;
     
+    return kTRUE;
+}
+
+Bool_t MCalibrateRelTimes::ReInit(MParList *pList)
+{
+    MRawRunHeader *runheader = (MRawRunHeader*)pList->FindObject(AddSerialNumber("MRawRunHeader"));
+    if (!runheader)
+    {
+        *fLog << err << AddSerialNumber("MRawRunHeader") << " not found ... aborting." << endl;
+        return kFALSE;
+    }
+
+    fFreq = runheader->GetFreqSampling();
+
     return kTRUE;
 }
@@ -131,5 +146,8 @@
         const Float_t offset = pix.GetTimeOffset();
 
-        (*fArrivalTime)[idx].SetArrivalTime(signal-offset);
+        // convert from slices to ns
+        const Float_t time = 1000*(signal-offset)/fFreq; // [ns]
+
+        (*fArrivalTime)[idx].SetArrivalTime(time);
 
         // FIXME: Is this necessary or explicitly done by the signal-
Index: /trunk/MagicSoft/Mars/mcalib/MCalibrateRelTimes.h
===================================================================
--- /trunk/MagicSoft/Mars/mcalib/MCalibrateRelTimes.h	(revision 8617)
+++ /trunk/MagicSoft/Mars/mcalib/MCalibrateRelTimes.h	(revision 8618)
@@ -10,4 +10,5 @@
 class MCalibrationRelTimeCam;
 class MArrivalTimeCam;
+class MRawRunHeader;
 class MSignalCam;
 
@@ -21,6 +22,9 @@
     MSignalCam             *fArrivalTime;  // Calibrated arrival times
 
-    Int_t PreProcess(MParList *pList);
-    Int_t Process();
+    UShort_t fFreq;                        //! [MHz] Sampling Frequency
+
+    Int_t  PreProcess(MParList *pList);
+    Bool_t ReInit(MParList *pList);
+    Int_t  Process();
 
 public:
Index: /trunk/MagicSoft/Mars/mfilter/MFSoftwareTrigger.cc
===================================================================
--- /trunk/MagicSoft/Mars/mfilter/MFSoftwareTrigger.cc	(revision 8617)
+++ /trunk/MagicSoft/Mars/mfilter/MFSoftwareTrigger.cc	(revision 8618)
@@ -88,5 +88,5 @@
 MFSoftwareTrigger::MFSoftwareTrigger(const char *name, const char *title)
     : fCam(NULL), fEvt(NULL), fThreshold(5),
-    fTimeWindow(0.5), fNumNeighbors(4), fType(kSinglePixelNeighbors)
+    fTimeWindow(1.7), fNumNeighbors(4), fType(kSinglePixelNeighbors)
 {
     fName  = name  ? name  : "MFSoftwareTrigger";
@@ -435,5 +435,5 @@
     *fLog << " Threshold=" << fThreshold << ", Number=" << (int)fNumNeighbors;
     if (fTimeWindow>0)
-        *fLog << ", Time Window=" << fTimeWindow;
+        *fLog << ", Time Window=" << fTimeWindow << "ns";
     *fLog << endl;
     *fLog << dec << setfill(' ');
Index: /trunk/MagicSoft/Mars/mhbase/MFillH.h
===================================================================
--- /trunk/MagicSoft/Mars/mhbase/MFillH.h	(revision 8617)
+++ /trunk/MagicSoft/Mars/mhbase/MFillH.h	(revision 8618)
@@ -62,4 +62,5 @@
     void SetRuleForIdx(MData *rule);
 
+    void ResetWeight() { fWeight=0; fWeightName=""; }
     void SetWeight(MParameterD *w)   { fWeight = w; }
     void SetWeight(const char *name="MWeight") { fWeightName = name; }
Index: /trunk/MagicSoft/Mars/mjobs/MJCalibrateSignal.cc
===================================================================
--- /trunk/MagicSoft/Mars/mjobs/MJCalibrateSignal.cc	(revision 8617)
+++ /trunk/MagicSoft/Mars/mjobs/MJCalibrateSignal.cc	(revision 8618)
@@ -573,5 +573,5 @@
     // MHCamEvent evt7(  6, "Times",      "Calibrated Arrival Time;;T [fadc sl]");
     MHCamEvent evt8(  0, "Conv",       "Calibration Conv. Factors;;[phe/cnts]");
-    MHCamEvent evt9(  7, "PulsePos",   "Pulse Position of cosmics (>50phe);;T");
+    MHCamEvent evt9(  7, "PulsePos",   "Pulse Position of cosmics (>50phe);;T [ns]");
     MHCamEvent evtR(  4, "HiLoCal",    "Hi-/Lo-Gain ratio;;Ratio");
     MHCamEvent evtO(  7, "HiLoOff",    "Lo-/Hi-Gain Offset;;Offset");
Index: /trunk/MagicSoft/Mars/mjobs/MJCut.cc
===================================================================
--- /trunk/MagicSoft/Mars/mjobs/MJCut.cc	(revision 8617)
+++ /trunk/MagicSoft/Mars/mjobs/MJCut.cc	(revision 8618)
@@ -89,6 +89,6 @@
 MJCut::MJCut(const char *name, const char *title)
     : fStoreSummary(kFALSE), fStoreResult(kTRUE), fWriteOnly(kFALSE),
-    fFullDisplay(kTRUE),
-    fRndmSrcPos(kFALSE), fNameHist("MHThetaSq"),
+    fFullDisplay(kTRUE), fRndmSrcPos(kFALSE), fNumOffSourcePos(3),
+    fNameHist("MHThetaSq"),
     fCalcHadronness(0), fCalcDisp(0), fEstimateEnergy(0)
 {
@@ -347,4 +347,6 @@
     EnableFullDisplay(GetEnv("FullDisplay", fFullDisplay));
     EnableRandomSrcPos(GetEnv("RandomSourcePosition", fRndmSrcPos));
+
+    fNumOffSourcePos = GetEnv("NumOffSourcePositions", (Int_t)fNumOffSourcePos);
     //EnableSubstraction(GetEnv("HistogramSubstraction", fSubstraction));
 
@@ -626,9 +628,15 @@
     // --------------------------------------------------------------------------------
 
+    MParameterD scale;
+    scale.SetVal(1./fNumOffSourcePos);
+
     // Setup fitter and histograms
     MAlphaFitter fit;
     plist.AddToList(&fit);
     if (set.IsWobbleMode())
+    {
         fit.SetScaleMode(MAlphaFitter::kNone);
+        fit.SetScaleUser(1./fNumOffSourcePos);
+    }
 
     MHAlpha *halphaoff = CreateNewHist(plist, "Off");
@@ -638,8 +646,10 @@
 
     // FIXME: If fPathIn read cuts and energy estimator from file!
+    MContinue contq("", "CutQ");
     MContinue cont0("", "Cut0");
     MContinue cont1("", "Cut1");
     MContinue cont2("", "Cut2");
     MContinue cont3("", "Cut3");
+    contq.SetAllowEmpty();
     cont0.SetAllowEmpty();
     cont1.SetAllowEmpty();
@@ -691,5 +701,4 @@
     setrunnum.SetNameParameter("RunNumber");
 
-    //    MFillH fill0a("OnPos [MHSrcPosCam]", "MSrcPosCam", "FillSrcPosCam");
     MFillH fill1a("MHHillasOffPre  [MHHillas]",      "MHillas",      "FillHillasPre");
     MFillH fill2a("MHHillasOffPost [MHHillas]",      "MHillas",      "FillHillasPost");
@@ -715,7 +724,20 @@
     print2.EnableSkip();
 
+    MTaskList tlist2;
+    if (set.IsWobbleMode())
+    {
+        tlist2.SetNumPasses(fNumOffSourcePos);
+        fill2a.SetWeight(&scale);
+        fill3a.SetWeight(&scale);
+        fill4a.SetWeight(&scale);
+        fill5a.SetWeight(&scale);
+        fill6a.SetWeight(&scale);
+        fill7a.SetWeight(&scale);
+    }
+
     // How to get source position from off- and on-data?
     MSrcPosCalc scalc;
     scalc.SetMode(set.IsWobbleMode()?MSrcPosCalc::kWobble:MSrcPosCalc::kOffData); /********************/
+    scalc.SetCallback(&tlist2);
 
     MSrcPosCorrect scor;
@@ -730,15 +752,12 @@
     MSrcPosRndm srcrndm;
 
-    MTaskList tlist2;
     tlist2.AddToList(&scalc);
     tlist2.AddToList(&scor);
     tlist2.AddToList(&srcrndm);
-    //if (fRndmSrcPos && !set.IsWobbleMode())
-    //   tlist2.AddToList(&fill0a);
     tlist2.AddToList(&hcalc);
     if (set.IsWobbleMode())
         tlist2.AddToList(&hcalc2);
     //tlist2.AddToList(&taskenv1);
-    tlist2.AddToList(&cont0);
+    tlist2.AddToList(&cont0);  
     tlist2.AddToList(&taskenv2);
     tlist2.AddToList(&taskenv3);
@@ -747,6 +766,4 @@
     if (write0)
         tlist2.AddToList(write0);
-    if (!fWriteOnly)
-        tlist2.AddToList(&fill1a);
     tlist2.AddToList(&cont1);
     if (!fWriteOnly && (!set.IsWobbleMode() || !fNameHistFS.IsNull()))
@@ -786,4 +803,7 @@
         tlist.AddToList(&print2, "EffectiveOnTime");
     tlist.AddToList(&devcalc, "Starguider");
+    tlist.AddToList(&contq,   "Events");
+    if (!fWriteOnly)
+        tlist.AddToList(&fill1a, "Events");
     tlist.AddToList(&tlist2,  "Events");
 
@@ -802,4 +822,5 @@
 
     TObjArray cont;
+    cont.Add(&contq);
     cont.Add(&cont0);
     cont.Add(&cont1);
@@ -879,5 +900,4 @@
     fill6b.SetDrawOption(set.HasOffSequences()||set.IsWobbleMode()?"same":"");
     fill7b.SetDrawOption(set.HasOffSequences()||set.IsWobbleMode()?"same":"");
-
     //fill9b.SetFilter(&fbin);
 
@@ -922,10 +942,9 @@
     fillphi.SetDrawOption("anticut");
 
+    tlist2.SetNumPasses();
+
     tlist.Replace(&readon);
     if (fRndmSrcPos && !set.IsWobbleMode())
-    {
-//        tlist2.RemoveFromList(&fill0a);
         tlist2.RemoveFromList(&srcrndm);
-    }
 
     MFillH fillsrc(&hsrcpos, "MSrcPosCam", "FillSrcPosCam");
@@ -936,5 +955,5 @@
     if (!fWriteOnly)
     {
-        tlist2.Replace(&fill1b);
+        tlist.Replace(&fill1b);
 /*        if (fIsWobble)
         {
Index: /trunk/MagicSoft/Mars/mjobs/MJCut.h
===================================================================
--- /trunk/MagicSoft/Mars/mjobs/MJCut.h	(revision 8617)
+++ /trunk/MagicSoft/Mars/mjobs/MJCut.h	(revision 8618)
@@ -24,4 +24,6 @@
     Bool_t  fRndmSrcPos;
     //Bool_t  fSubstraction;
+
+    UInt_t fNumOffSourcePos;
 
     TString fNameSummary;
Index: /trunk/MagicSoft/Mars/mpointing/MSrcPosCalc.cc
===================================================================
--- /trunk/MagicSoft/Mars/mpointing/MSrcPosCalc.cc	(revision 8617)
+++ /trunk/MagicSoft/Mars/mpointing/MSrcPosCalc.cc	(revision 8618)
@@ -68,4 +68,5 @@
 
 #include "MParList.h"
+#include "MTaskList.h"
 
 #include "MLog.h"
@@ -94,5 +95,6 @@
 MSrcPosCalc::MSrcPosCalc(const char *name, const char *title)
     : fObservatory(NULL), fPointPos(NULL), fSourcePos(NULL), fDeviation(NULL),
-    fSrcPosCam(NULL), fSrcPosAnti(NULL), fGeom(NULL), fTime(NULL), fMode(kDefault)
+    fSrcPosCam(NULL), fSrcPosAnti(NULL), fGeom(NULL), fTime(NULL), fCallback(NULL),
+    fMode(kDefault)
 {
     fName  = name  ? name  : "MSrcPosCalc";
@@ -196,4 +198,6 @@
     //*fLog << "Pointing Position: " << GetRaDec(*fPointPos)  << endl;
     *fLog << "Source Position: " << GetRaDec(*fSourcePos) << endl;
+    if (fCallback)
+        *fLog << "Using " << fCallback->GetNumPasses() << " off-regions." << endl;
 
     // For the case ReInit is never called we try:
@@ -215,5 +219,13 @@
     {
         fSrcPosAnti->SetXY(v);
-        v *= -1;
+
+        if (fCallback)
+        {
+            const Double_t step = TMath::TwoPi()/(fCallback->GetNumPasses()+1);
+            v = v.Rotate(step*(fCallback->GetNumPass()+1));
+        }
+        else
+            v *= -1;
+
         fSrcPosCam->SetXY(v);
     }
Index: /trunk/MagicSoft/Mars/mpointing/MSrcPosCalc.h
===================================================================
--- /trunk/MagicSoft/Mars/mpointing/MSrcPosCalc.h	(revision 8617)
+++ /trunk/MagicSoft/Mars/mpointing/MSrcPosCalc.h	(revision 8618)
@@ -17,4 +17,5 @@
 class MTime;
 class MVector3;
+class MTaskList;
 
 class MSrcPosCalc : public MTask
@@ -39,4 +40,5 @@
     MGeomCam     *fGeom;
     MTime        *fTime;
+    MTaskList    *fCallback;
 
     UShort_t fRunType;            //! Run Type to decide where to get pointing position from
@@ -68,4 +70,5 @@
     void SetOwner(Bool_t b=kTRUE) { b ? SetBit(kIsOwner) : ResetBit(kIsOwner); } // Make MSrcPosCalc owner of fSourcePos
     void SetMode(Mode_t m=kDefault) { fMode = m; }
+    void SetCallback(MTaskList *list) { fCallback=list; }
 
     ClassDef(MSrcPosCalc, 0) // Calculates the source position in the camera
