Index: trunk/MagicSoft/Mars/Changelog
===================================================================
--- trunk/MagicSoft/Mars/Changelog	(revision 8309)
+++ trunk/MagicSoft/Mars/Changelog	(revision 8310)
@@ -19,4 +19,23 @@
                                                  -*-*- END OF LINE -*-*-
 
+ 2007/02/09 Thomas Bretz
+
+   * star.rc:
+     - added new options 
+     - reordering
+
+   * mbase/MStatusDisplay.cc:
+     - updated from 2006 to 2007
+
+   * mfbase/MFDataPhrase.cc:
+     - fixed ReadEnv to correctly return true/false
+
+   * mjobs/MJStar.cc:
+     - added new tabs "Spakless" and "Sparks" dividing the average
+       signal tab into two distributions by a SparkCut
+     - replaced all MF by MFDataPhrase
+
+
+
  2007/02/06 Thomas Bretz
 
Index: trunk/MagicSoft/Mars/NEWS
===================================================================
--- trunk/MagicSoft/Mars/NEWS	(revision 8309)
+++ trunk/MagicSoft/Mars/NEWS	(revision 8310)
@@ -45,4 +45,6 @@
      + the hi-gain window was extended to slice 16. This allows extraction
        of very late pulses in single pixels or of huge hadron showers.
+     + Now uses the lo-gain extraction range for pedestal extraction,
+       not the hi-gain range in the lo-gain
 
    - callisto: New hi-/lo-gain calibration constants have been produced
@@ -60,4 +62,10 @@
    - callisto: Fixed a bug in the seuqence handling which caused the
      light condition to be ignored
+
+   - star: Added two new tabs "Sparkless" and "Sparks" these tabs show
+     basically the same as "Cleaned" but the distribution devided into
+     the events fullfilling a spark cut or being rejected by it.
+     This cut can be changed from star.rc (see example inside) by
+     the "SparkCut" directive
 
    - optim: fixed a problem with the optim-macros which was due to a bug
Index: trunk/MagicSoft/Mars/mfbase/MFDataPhrase.cc
===================================================================
--- trunk/MagicSoft/Mars/mfbase/MFDataPhrase.cc	(revision 8309)
+++ trunk/MagicSoft/Mars/mfbase/MFDataPhrase.cc	(revision 8310)
@@ -18,5 +18,5 @@
 !   Author(s): Thomas Bretz  01/2002 <mailto:tbretz@astro.uni-wuerzburg.de>
 !
-!   Copyright: MAGIC Software Development, 2000-2005
+!   Copyright: MAGIC Software Development, 2000-2007
 !
 !
@@ -273,6 +273,6 @@
 Int_t MFDataPhrase::ReadEnv(const TEnv &env, TString prefix, Bool_t print)
 {
-    Int_t rc = MFilter::ReadEnv(env, prefix, print);
-    if (rc==kERROR)
+    Int_t rc1 = MFilter::ReadEnv(env, prefix, print);
+    if (rc1==kERROR)
         return kERROR;
 
@@ -329,4 +329,6 @@
             *fLog << endl;
         }
+
+        rc1 = kTRUE;
     }
     else
@@ -340,5 +342,6 @@
     }
 
-    if (fData->ReadEnv(env, prefix, print)==kERROR)
+    const Int_t rc2 = fData->ReadEnv(env, prefix, print);
+    if (rc2==kERROR)
         return kERROR;
 
@@ -351,4 +354,4 @@
             SetInverted(kFALSE);*/
 
-    return kTRUE;
-}
+    return rc1 || rc2;
+}
Index: trunk/MagicSoft/Mars/mjobs/MJCalibrateSignal.cc
===================================================================
--- trunk/MagicSoft/Mars/mjobs/MJCalibrateSignal.cc	(revision 8309)
+++ trunk/MagicSoft/Mars/mjobs/MJCalibrateSignal.cc	(revision 8310)
@@ -465,7 +465,16 @@
         // The window size of the extractor is not yet initialized,
         // so we have to stick to the extraction range
-        const Int_t f = extractor1->GetHiGainFirst();
-        const Int_t l = extractor1->GetHiGainLast();
-        const Int_t w = (l-f+1)&~1;
+        //
+        // Even if we would like to use a range comparable to the
+        // hi-gain extraction we use the lo-gain range to make
+        // sure that exclusions (eg. due to switching noise)
+        // are correctly handled.
+        //
+        const Int_t f = extractor1->GetLoGainFirst();
+        const Int_t l = extractor1->GetLoGainLast();
+        const Int_t w = (l-f+1);
+        //const Int_t f = extractor1->GetHiGainFirst();
+        //const Int_t l = extractor1->GetHiGainLast();
+        //const Int_t w = (l-f+1)&~1;
 
         pedlo1.SetExtractWindow(f, w);
Index: trunk/MagicSoft/Mars/mjobs/MJStar.cc
===================================================================
--- trunk/MagicSoft/Mars/mjobs/MJStar.cc	(revision 8309)
+++ trunk/MagicSoft/Mars/mjobs/MJStar.cc	(revision 8310)
@@ -18,5 +18,5 @@
 !   Author(s): Thomas Bretz, 1/2004 <mailto:tbretz@astro.uni-wuerzburg.de>
 !
-!   Copyright: MAGIC Software Development, 2000-2004
+!   Copyright: MAGIC Software Development, 2000-2007
 !
 !
@@ -51,5 +51,6 @@
 #include "MReadReports.h"
 #include "MReadMarsFile.h"
-#include "MF.h"
+#include "MFDataPhrase.h"
+#include "MFilterList.h"
 #include "MFDataMember.h"
 #include "MFDeltaT.h"
@@ -209,7 +210,11 @@
     // ------------------ Setup histograms and fill tasks ----------------
     MHCamEvent evt0a(0, "Cleaned", "Signal after Cleaning;;S [\\gamma]");
+    MHCamEvent evt0c(0, "Cleaned", "Signal after Cleaning and Spark cuts;;S [\\gamma]");
+    MHCamEvent evt0d(0, "Cleaned", "Signal after Cleaning for Spark cuts;;S [\\gamma]");
     MHCamEvent evt0b(0, "UsedPix", "Fraction of Events in which Pixels are used;;Fraction");
     evt0a.SetErrorSpread(kFALSE);
     evt0b.SetErrorSpread(kFALSE);
+    evt0c.SetErrorSpread(kFALSE);
+    evt0d.SetErrorSpread(kFALSE);
     evt0b.SetThreshold(0);
 
@@ -223,4 +228,6 @@
     MFillH fill0a(&evt0a,             "MSignalCam",      "FillSignalCam");
     MFillH fill0b(&evt0b,             "MSignalCam",      "FillCntUsedPixels");
+    MFillH fill0c(&evt0c,             "MSignalCam",      "FillSignalCamSparkless");
+    MFillH fill0d(&evt0d,             "MSignalCam",      "FillSignalCamSparks");
     MFillH fill1("MHHillas",          "MHillas",         "FillHillas");
     MFillH fill2("MHHillasExt",       "",                "FillHillasExt");
@@ -232,4 +239,6 @@
     //fillvs.SetNameTab("Rate");
     fill9.SetNameTab("EffOnTime");
+    fill0c.SetNameTab("Sparkless");
+    fill0d.SetNameTab("Sparks");
 
     // ------------------ Setup write task ----------------
@@ -327,9 +336,22 @@
         tlist2.AddToList(&writet);
     }
+
+    // Spark cut
+    MFDataPhrase fsparks("log10(MNewImagePar.fConc1) < (-0.371)*log10(MHillas.fSize) + 0.596", "SparkCut");
+    fill0c.SetFilter(&fsparks);
+
+    // Inverted spark cut (need not to be a member of the task list
+    // because it fsparks is
+    MFilterList fnsparks(&fsparks);
+    fill0d.SetFilter(&fnsparks);
+
     tlist2.AddToList(&clean);
-    tlist2.AddToList(&fill0a);
-    tlist2.AddToList(&fill0b);
     tlist2.AddToList(&poscalc);
     tlist2.AddToList(&hcalc);
+    tlist2.AddToList(&fsparks);
+    tlist2.AddToList(&fill0a);
+    tlist2.AddToList(&fill0c);
+    tlist2.AddToList(&fill0d);
+    tlist2.AddToList(&fill0b);
     tlist2.AddToList(&fill1);
     tlist2.AddToList(&fill2);
@@ -340,12 +362,12 @@
     // ----------------------- Muon Analysis ----------------------
     // Filter to start muon analysis
-    MF fmuon1("MHillas.fSize>150", "MuonPreCut");
+    MFDataPhrase fmuon1("MHillas.fSize>150", "MuonPreCut");
     // Filter to calculate further muon parameters
-    MF fmuon2("(MMuonSearchPar.fRadius>180) && (MMuonSearchPar.fRadius<400) &&"
-              "(MMuonSearchPar.fDeviation<45)", "MuonSearchCut");
+    MFDataPhrase fmuon2("(MMuonSearchPar.fRadius>180) && (MMuonSearchPar.fRadius<400) &&"
+                        "(MMuonSearchPar.fDeviation<45)", "MuonSearchCut");
     // Filter to fill the MHMuonPar
-    MF fmuon3("(MMuonCalibPar.fArcPhi>190) && (MMuonSearchPar.fDeviation<35) &&"
-              "(MMuonCalibPar.fArcWidth<0.20) && (MMuonCalibPar.fArcWidth>0.04)",
-              "MuonFinalCut");
+    MFDataPhrase fmuon3("(MMuonCalibPar.fArcPhi>190) && (MMuonSearchPar.fDeviation<35) &&"
+                        "(MMuonCalibPar.fArcWidth<0.20) && (MMuonCalibPar.fArcWidth>0.04)",
+                        "MuonFinalCut");
     // Filter to write Muons to Muon tree
     MFDataMember fmuon4("MMuonCalibPar.fArcPhi", '>', -0.5, "MuonWriteCut");
Index: trunk/MagicSoft/Mars/star.rc
===================================================================
--- trunk/MagicSoft/Mars/star.rc	(revision 8309)
+++ trunk/MagicSoft/Mars/star.rc	(revision 8310)
@@ -44,4 +44,31 @@
 
 # -------------------------------------------------------------------------
+# Setup the image cleaning here
+# -------------------------------------------------------------------------
+MImgCleanStd.CleanLevel1: 8.5
+MImgCleanStd.CleanLevel2: 4.0
+MImgCleanStd.CleanMethod: Absolute
+#MImgCleanStd.CleanRings: 1
+#MImgCleanStd.KeepSinglePixels: No
+
+# -------------------------------------------------------------------------
+# Setup the cut applied to the Sparkless tab
+# -------------------------------------------------------------------------
+
+# This is the simple default
+#SparkCut.Condition: log10(MNewImagePar.fConc1) < (-0.371)*log10(MHillas.fSize) + 0.596
+
+# This is the more complicated cut from ganymed.rc
+#SparkCut.Condition: ({0} || {1}) && {2}
+#SparkCut.0: MImagePar.fNumSatPixelsHG < 1
+#SparkCut.1: MHillas.GetArea*(MGeomCam.fConvMm2Deg^2) > (0.003*MImagePar.fNumSatPixelsHG) + 0.0325
+#SparkCut.2: log10(MNewImagePar.fConc1) < (-0.371)*log10(MHillas.fSize) + 0.596
+
+# -------------------------------------------------------------------------
+# setup the image parameter calculation here
+# -------------------------------------------------------------------------
+#MHillasCalc.IdxIsland: 0
+
+# -------------------------------------------------------------------------
 # Setup or switch off the muon analysis here
 # -------------------------------------------------------------------------
@@ -62,16 +89,2 @@
 #MuonSearcCut.Condition: (MMuonSearchPar.fRadius>180) && (MMuonSearchPar.fRadius<400) && (MMuonSearchPar.fDeviation<45)
 #MuonFinalCut.Condition: (MMuonCalibPar.fArcPhi>190)  && (MMuonSearchPar.fDeviation<35) && (MMuonCalibPar.fArcWidth<0.20) && (MMuonCalibPar.fArcWidth>0.04)
-
-# -------------------------------------------------------------------------
-# Setup the image cleaning here
-# -------------------------------------------------------------------------
-MImgCleanStd.CleanLevel1: 8.5
-MImgCleanStd.CleanLevel2: 4.0
-MImgCleanStd.CleanMethod: Absolute
-#MImgCleanStd.KeepSinglePixels: No
-
-# -------------------------------------------------------------------------
-# setup the image parameter calculation here
-# -------------------------------------------------------------------------
-#MHillasCalc.IdxIsland: 0
-
