Index: trunk/MagicSoft/Mars/Changelog
===================================================================
--- trunk/MagicSoft/Mars/Changelog	(revision 7204)
+++ trunk/MagicSoft/Mars/Changelog	(revision 7205)
@@ -69,4 +69,7 @@
    * ganymed_onoff.rc, ganymed_wobble.rc:
      - added
+
+   * ganymed.rc: 
+     - updated
 
 
Index: trunk/MagicSoft/Mars/NEWS
===================================================================
--- trunk/MagicSoft/Mars/NEWS	(revision 7204)
+++ trunk/MagicSoft/Mars/NEWS	(revision 7205)
@@ -93,4 +93,16 @@
      photo-electrons for the spline extractor by 1-2% (correctly).
 
+   - callisto: The intercalibration is now done using a full f-factor
+     method instead of a simple update. This makes things slower but
+     more reliable in terms of gain-fluctuations and sudden VCSEL gain
+     changes.
+
+   - callisto: MPedestalY3 now uses the same extraction range as the data
+     as calculated by MPedestalY2
+
+   - callisto: A check of the fraction of allowed unsuitable (10%) and
+     unreliable (30%) pixels has been addded when the conversion is 
+     calculated from interleaved events
+
    - star: fixed a bug which caused MEffectiveOnTime containers not to
      be written. In the worst case they were skipped almost all, in the
@@ -103,8 +115,10 @@
    - star: corrects now (correctly?) for the misspointing in May/April 05
 
+   - star: Output now contains MReportStarguider
+
    - ganymed: Two new default templates for ganymed.rc are avilable:
               ganymed_onoff.rc and ganymed_wobble.rc
 
-   - ganymed: The first version of MFMagicCuts have been released
+   - ganymed: The first version of MFMagicCuts has been released
 
    - ganymed: the Conc1 plot was incorrectly scaled in MHVsSize
@@ -116,23 +130,19 @@
    - ganymed: optimized palettes for MHDisp
 
-   - ganymed: MPedestalY3 now uses the same extraction range as the data
-     as calculated by MPedestalY2
-
-   - ganymed: A check of the fraction of allowed unsuitable (10%) and
-     unreliable (30%) pixels has been addded when the conversion is 
-     calculated from interleaved events
-
    - ganymed: Fixed an important bug when using ThetaSq as fit function:
      The result for the sigma of the gauss(sqrt(x)) fit was a factor
      sqrt(2) to large
 
-   - ganymed: The intercalibration is now done using a full f-factor
-     method instead of a simple update. This makes things slower but
-     more reliable in terms of gain-fluctuations and sudden VCSEL gain
-     changes.
-
    - ganymed: The false source plot (MHDisp) is now based on Disp
-     and a background model determied in the first loop is
+     and a background model determined in the first loop is
      subtracted
+
+   - ganymed: MFMagicCuts are now available in the cvs. The correct
+     solution for the disp ambiguity problem is now calculated using
+     the third moment. The third moment cut therefor is skipped.
+
+   - ganymed: Output now contains "Disp [MParameterD]" which sign is
+     already determined by the third moment along the major axis and
+     so its actual sign is aligned along the major axis of the shower.
 
    - sponde: the zenith angle distribution is now weighted instead of
Index: trunk/MagicSoft/Mars/ganymed.rc
===================================================================
--- trunk/MagicSoft/Mars/ganymed.rc	(revision 7204)
+++ trunk/MagicSoft/Mars/ganymed.rc	(revision 7205)
@@ -32,8 +32,11 @@
 # Use this to setup binnings. For more details see: MBinning::ReadEnv
 # -------------------------------------------------------------------------
-#BinningAlpha.Raw:        9   0    90
-#BinningFalseSource.Raw: 30  -1.2  1.2
-#BinningEnergyEst.Raw:   25   10   1000000 log
-#BinningTheta.Raw:       50   0    60      cos
+BinningAlpha.Raw:        36    0    90
+BinningFalseSource.Raw:  91   -1.5  1.5
+#BinningTheta.Raw:       50    0    60      cos
+BinningWidth.Raw:        50    0    1
+BinningLength.Raw:       25    0    1
+BinningDist.Raw:         25    0    2
+BinningMaxDist.Raw:      25    0    2
 
 # -------------------------------------------------------------------------
@@ -47,5 +50,5 @@
 #MAlphaFitter.ScaleMax:             80
 #MAlphaFitter.PolynomOrder:         2
-#MAlphaFitter.ScaleMode:            kSignificance
+#MAlphaFitter.ScaleMode:            None
 
 # -------------------------------------------------------------------------
@@ -55,4 +58,14 @@
 #MJCut.NameHist: MHAlpha
 
+# -------------------------------------------------------------------------
+# To get a meaningfull false source plot in wobble mode use magic cuts
+# and the following two lines. Remark: You'll get worse results
+# for you significance
+# -------------------------------------------------------------------------
+MJCut.NameHistFS: MHDisp
+#Cut1.HadronnessCut: Area
+
+MHDisp.Smearing: 0.03
+#MHDisp.Wobble:   Yes
 
 # -------------------------------------------------------------------------
@@ -69,30 +82,51 @@
 Cut3.Inverted: Yes
 
-#Cut0.Condition: MCameraCooling.fTempCenter < 55
+# Get rid of triangular events...
+Cut0.Condition: ({0} || {1}) && {2} && {3} && {4} && {5}
+Cut0.0: MImagePar.fNumSatPixelsHG < 1
+Cut0.1: MHillas.GetArea*(MGeomCam.fConvMm2Deg^2) > (0.0014*MImagePar.fNumSatPixelsHG) + 0.02
+Cut0.2: MNewImagePar.fNumUsedPixels>5
+Cut0.3: MNewImagePar.fLeakage1 < 0.3
+Cut0.4: MImagePar.fNumSatPixelsLG<2
+Cut0.5: MImagePar.fNumIslands<3
 
-# Get rid of triangular events...
-Cut0.Condition: {0}
-Cut0.0: log10(MNewImagePar.fConc1) < (-0.467)*log10(MHillas.fSize) +0.75
+# ---------- SETUP FOR ONOFF-MODE -----------
+MAlphaFitter.BackgroundFitMin: 0.137
+MAlphaFitter.BackgroundFitMax: 0.64
+MAlphaFitter.PolynomOrder: 1
+MAlphaFitter.ScaleMode: Background
+MAlphaFitter.SignalFunction: ThetaSq
 
-# If you could setup MFEventSelector by resource file you could use it here
-# To produce trainings and test sample use:  "{MMcEvt.fEvtNumber%2}>0.5"
-#Cut1.Condition: <MFSupercuts>
-#Cut1.Param0:  0.056
-#Cut1.Param8:  0.222
-#Cut1.Param16: 0.042
-#Cut1.Param24: 0.087
-#Cut1.Param32: 0.33
+Cut1.Condition: MFMagicCuts
+Cut1.ThetaCut: None
+Cut1.Param0:  1.3245
+Cut1.Param1:  0.189
+Cut1.Param2:  0.230
+Cut1.Param3:  5.320
+Cut1.Param4:  0.100
+Cut1.Param5: -0.0636
+Cut1.Param6:  8.2957
+Cut1.Param7:  0.8677
 
-Cut1.Condition: {0} && {1} && {2} && {3} && {4}
+# ---------- SETUP FOR WOBBLE-MODE -----------
+#MAlphaFitter.ScaleMode: none
+#MAlphaFitter.BackgroundFitMin: 0.09
+#MAlphaFitter.BackgroundFitMax: 0.25
+#MAlphaFitter.SignalFunction: ThetaSq
+#Cut1.Condition: MFMagicCuts
+#Cut1.ThetaCut: Off
+#Cut1.Param0:  1.221
+#Cut1.Param1:  0.233161
+#Cut1.Param2:  0.234233
+#Cut1.Param3:  5.23611
+#Cut1.Param4:  0.109593
+#Cut1.Param5: -0.095321
+#Cut1.Param6:  13.425
+#Cut1.Param7:  1.04343
 
-Cut1.0: MHillas.fLength*MGeomCam.fConvMm2Deg > 0.0063*log10(MHillas.fSize)+0.0974
-Cut1.1: MHillas.fLength*MGeomCam.fConvMm2Deg < 0.0040*log10(MHillas.fSize)+0.1791
-Cut1.2: MHillas.fWidth *MGeomCam.fConvMm2Deg > 0.0067*log10(MHillas.fSize)+0.0511
-Cut1.3: MHillas.fWidth *MGeomCam.fConvMm2Deg < 0.0050*log10(MHillas.fSize)+0.1203
-Cut1.4: MHillas.fSize>95
-
-Cut2.Condition: MHillasSrc.fDist*MGeomCam.fConvMm2Deg>0.55
-
-Cut3.Condition: abs(MHillasSrc.fAlpha)<10
+# Be carefull: The spectrum might be done with a different binning
+# This might change the scale factor
+MHThetaSq.NumBinsSignal:   3
+MHThetaSq.NumBinsTotal:   75
 
 # -------------------------------------------------------------------------
@@ -101,6 +135,6 @@
 #MHFalseSource.DistMin: 0.55
 #MHFalseSource.DistMax: 0.55
-#MHFalseSource.DWMin: 0.55
-#MHFalseSource.DWMax: 0.55
+#MHFalseSource.DWMin:   0.55
+#MHFalseSource.DWMax:   0.55
 
 # -------------------------------------------------------------------------
Index: trunk/MagicSoft/Mars/mpointing/MPointingDevCalc.cc
===================================================================
--- trunk/MagicSoft/Mars/mpointing/MPointingDevCalc.cc	(revision 7204)
+++ trunk/MagicSoft/Mars/mpointing/MPointingDevCalc.cc	(revision 7205)
@@ -27,4 +27,27 @@
 // MPointingDevCalc
 //
+// Calculates the pointing deviation from the starguider information.
+//
+// There are some quality parameters to steer which are the valid
+// starguider data points:
+//  * MPointingDevCalc.NumMinStars: 8
+//    Minimum number of identified stars required to accep the data
+//  * MPointingDevCalc.NsbLevel:    3.0
+//    Minimum deviation (in rms) from the the mean allowed for the measured
+//    NSB (noise in the ccd camera)
+//  * MPointingDevCalc.NsbMin:      30
+//    - minimum NSB to be used in mean/rms calculation
+//  * MPointingDevCalc.NsbMax:      60
+//    - maximum NSB to be used in mean/rms calculation
+//  * MPointingDevCalc.MaxAbsDev:   15
+//    - Maximum absolute deviation which is consideres as valid (arcmin)
+//
+// Starguider data which doens't fullfill this requirements is ignored.
+// If the measures NSB==0 (file too old, starguider didn't write down
+// these values) the checks based on NSB and NumMinStar are skipped.
+//
+// The calculation of NSB mean and rms is reset for each file (ReInit)
+//
+//
 // Input Container:
 //   MReportStarguider
@@ -129,5 +152,5 @@
     if (nsb>0)
     {
-        if (nsb>30 && nsb<60)
+        if (nsb>fNsbMin && nsb<fNsbMax)
         {
             fNsbSum += nsb;
@@ -141,7 +164,7 @@
             const Double_t sq  = fNsbSq /fNsbCount;
 
-            const Double_t rms = TMath::Sqrt(sq - sum*sum);
-
-            if (nsb<sum-3*rms || nsb>sum+3*rms)
+            const Double_t rms = fNsbLevel*TMath::Sqrt(sq - sum*sum);
+
+            if (nsb<sum-rms || nsb>sum+rms)
             {
                 fSkip[2]++;
@@ -150,5 +173,5 @@
         }
 
-        if (fReport->GetNumIdentifiedStars()<8)
+        if (fReport->GetNumIdentifiedStars()<fNumMinStars)
         {
             fSkip[3]++;
@@ -166,5 +189,5 @@
 
     // Sanity check... larger deviation are strange and ignored
-    if (dev>0.25)
+    if (dev*60>fMaxAbsDev)
     {
         fSkip[4]++;
@@ -213,7 +236,7 @@
     *fLog << GetDescriptor() << " execution statistics:" << endl;
     PrintSkipped(fSkip[1], "Starguider deviation not set, is exactly 0/0");
-    PrintSkipped(fSkip[2], "NSB out of 3 sigma range");
-    PrintSkipped(fSkip[3], "Number of identified stars < 8");
-    PrintSkipped(fSkip[4], "Absolute deviation > 0.25deg");
+    PrintSkipped(fSkip[2], Form("NSB out of %.1f sigma range", fNsbLevel));
+    PrintSkipped(fSkip[3], Form("Number of identified stars < %d", fNumMinStars));
+    PrintSkipped(fSkip[4], Form("Absolute deviation > %.1farcmin", fMaxAbsDev));
     *fLog << " " << (int)fSkip[0] << " (" << Form("%5.1f", 100.*fSkip[0]/GetNumExecutions()) << "%) Evts survived calculation!" << endl;
     *fLog << endl;
@@ -221,2 +244,42 @@
     return kTRUE;
 }
+
+// --------------------------------------------------------------------------
+//
+// MPointingDevCalc.NumMinStars: 8
+// MPointingDevCalc.NsbLevel:    3.0
+// MPointingDevCalc.NsbMin:      30
+// MPointingDevCalc.NsbMax:      60
+// MPointingDevCalc.MaxAbsDev:   15
+//
+Int_t MPointingDevCalc::ReadEnv(const TEnv &env, TString prefix, Bool_t print)
+{
+    Bool_t rc = kFALSE;
+    if (IsEnvDefined(env, prefix, "NumMinStars", print))
+    {
+        SetNumMInStars(GetEnvValue(env, prefix, "NumMinStars", fNumMinStars));
+        rc = kTRUE;
+    }
+    if (IsEnvDefined(env, prefix, "NsbLevel", print))
+    {
+        SetNsbLevel(GetEnvValue(env, prefix, "NsbLevel", fNsbLevel));
+        rc = kTRUE;
+    }
+    if (IsEnvDefined(env, prefix, "NsbMin", print))
+    {
+        SetNsbMin(GetEnvValue(env, prefix, "NsbMin", fNsbMin));
+        rc = kTRUE;
+    }
+    if (IsEnvDefined(env, prefix, "NsbMax", print))
+    {
+        SetNsbMax(GetEnvValue(env, prefix, "NsbMax", fNsbMax));
+        rc = kTRUE;
+    }
+    if (IsEnvDefined(env, prefix, "MaxAbsDev", print))
+    {
+        SetMaxAbsDev(GetEnvValue(env, prefix, "MaxAbsDev", fMaxAbsDev));
+        rc = kTRUE;
+    }
+
+    return rc;
+}
Index: trunk/MagicSoft/Mars/mpointing/MPointingDevCalc.h
===================================================================
--- trunk/MagicSoft/Mars/mpointing/MPointingDevCalc.h	(revision 7204)
+++ trunk/MagicSoft/Mars/mpointing/MPointingDevCalc.h	(revision 7205)
@@ -27,6 +27,14 @@
     TArrayI  fSkip;                //! Counter for execution statistics
 
+    UInt_t  fNumMinStars;          // Minimum number of identified stars
+    Float_t fNsbLevel;             // Minimum deviation from mean in sigma
+    Float_t fNsbMin;               // Minimum NSB to calc mean and rms
+    Float_t fNsbMax;               // Maximum NSB to calc mean and rms
+    Float_t fMaxAbsDev;            // [arcmin] Maximum considered absolute deviation
+
     // MPointingDevCalc
     Int_t ProcessStarguiderReport();
+
+    // MParContainer
 
     // MTask
@@ -37,5 +45,6 @@
 
 public:
-    MPointingDevCalc() : fReport(0), fDeviation(0), fSkip(5)
+    MPointingDevCalc() : fReport(0), fDeviation(0), fSkip(5), fNumMinStars(8),
+        fNsbLevel(3), fNsbMin(30), fNsbMax(60), fMaxAbsDev(15)
     {
         fName  = "MPointingDevCalc";
@@ -43,4 +52,10 @@
     }
 
+    void SetNumMinStars(UInt_t n)  { fNumMinStars=8; }
+    void SetNsbLevel(Float_t lvl)  { fNsbLevel=lvl;  }
+    void SetNsbMin(Float_t nsb)    { fNsbMin=nsb;    }
+    void SetNsbMax(Float_t nsb)    { fNsbMax=nsb;    }
+    void SetMaxAbsDev(Float_t max) { fMaxAbsDev=max; }
+
     ClassDef(MPointingDevCalc, 0) //Task calculating the pointing deviation
 };
Index: trunk/MagicSoft/Mars/mpointing/MPointingPos.h
===================================================================
--- trunk/MagicSoft/Mars/mpointing/MPointingPos.h	(revision 7204)
+++ trunk/MagicSoft/Mars/mpointing/MPointingPos.h	(revision 7205)
@@ -6,5 +6,5 @@
 #endif
 
-// FIXME: Should not be here...
+// FIXME: Should not be here... (ZdAz)
 #ifndef MARS_MPointing
 #include "MPointing.h"
Index: trunk/MagicSoft/Mars/mpointing/MPointingPosCalc.h
===================================================================
--- trunk/MagicSoft/Mars/mpointing/MPointingPosCalc.h	(revision 7204)
+++ trunk/MagicSoft/Mars/mpointing/MPointingPosCalc.h	(revision 7205)
@@ -1,4 +1,4 @@
-#ifndef MARS_MPointingPositionCalc
-#define MARS_MPointingPositionCalc
+#ifndef MARS_MPointingPosCalc
+#define MARS_MPointingPosCalc
 
 #ifndef MARS_MTask
