Index: trunk/MagicSoft/Mars/Changelog
===================================================================
--- trunk/MagicSoft/Mars/Changelog	(revision 7357)
+++ trunk/MagicSoft/Mars/Changelog	(revision 7358)
@@ -18,4 +18,37 @@
 
                                                  -*-*- END OF LINE -*-*-
+ 2005/09/21 Thomas Bretz
+
+   * datacenter/macros/plotdb.C:
+     - changed some resolution values
+
+   * mfileio/MWriteRootFile.cc:
+     - added a FIXME comment
+
+   * mhvstime/MHSectorVsTime.h:
+     - added new function GetGraph
+     - increased version number (increase was forgotten some time ago)
+
+   * mimage/MImgCleanStd.cc:
+     - added some comments
+     - replaced IsPixelUsed/Core(int) by [int].IsPixelUsed/Core for
+       acceleration (some obsolete range checks are skipped)
+     - now the core status is explicily set in any case
+     - removed an obsolete range check in the ring cleaning
+     - the range checks became obsolete because with the new format
+       all pixels must exist.
+
+   * mjobs/MDataSet.cc:
+     - sort the sequence numbers instead of the file names (the file
+       name sort might be biased due to different paths)
+
+   * mjobs/MJob.[h,cc]:
+     - new ststic functions: SortArray
+
+   * mjobs/MSequence.cc:
+     - sort run-numbers as the sequences are sorted in MDataSet
+
+
+
  2005/09/20 Daniela Dorner
 
Index: trunk/MagicSoft/Mars/NEWS
===================================================================
--- trunk/MagicSoft/Mars/NEWS	(revision 7357)
+++ trunk/MagicSoft/Mars/NEWS	(revision 7358)
@@ -30,4 +30,8 @@
      two types of pedestal in callisto got exchanged. The bug only effects
      the first seconds of data of each sequence.
+
+   - ganymed: The sequences were still not sorted correctly in any case, 
+     because they were sorted by the full qualified path name. Now they
+     are sorted by their sequence number.
 
 
Index: trunk/MagicSoft/Mars/datacenter/macros/plotdb.C
===================================================================
--- trunk/MagicSoft/Mars/datacenter/macros/plotdb.C	(revision 7357)
+++ trunk/MagicSoft/Mars/datacenter/macros/plotdb.C	(revision 7358)
@@ -292,5 +292,5 @@
     //from signal*.root
     plot.SetDescription("Mean Pedestal RMS inner Camera;\\sigma_{P,I} [phe]", "PedRmsI");
-    plot.Plot("Calibration.fMeanPedRmsInner",  0, 3.5, 0.1);
+    plot.Plot("Calibration.fMeanPedRmsInner",  0, 3.5, 0.05);
     //from star*.root
     //muon
@@ -303,7 +303,7 @@
     //imgpar
     plot.SetDescription("Mean Number of Islands after cleaning;N [#]", "NumIsl");
-    plot.Plot("Star.fMeanNumberIslands",       0.5, 4.5, 0.1);
+    plot.Plot("Star.fMeanNumberIslands",       0.5, 4.5, 0.01);
     plot.SetDescription("Measures effective on time;T_{eff} [s]", "EffOn");
-    plot.Plot("Star.fEffOnTime",               0, 10000, 60);
+    plot.Plot("Star.fEffOnTime",               0, 10000, 150);
     plot.SetDescription("Datarate [Hz]", "Rate");
     plot.Plot("Star.fDataRate",                0, 600, 10);
@@ -323,5 +323,5 @@
     //from signal*.root
     plot.SetDescription("Mean Pedestal RMS outer Camera;\\sigma_{P,O} [phe]", "PedRmsO");
-    plot.Plot("Calibration.fMeanPedRmsOuter",  0, 4.0, 0.1);
+    plot.Plot("Calibration.fMeanPedRmsOuter",  0, 4.0, 0.05);
 }
 
Index: trunk/MagicSoft/Mars/mfileio/MWriteRootFile.cc
===================================================================
--- trunk/MagicSoft/Mars/mfileio/MWriteRootFile.cc	(revision 7357)
+++ trunk/MagicSoft/Mars/mfileio/MWriteRootFile.cc	(revision 7358)
@@ -711,4 +711,5 @@
         return kTRUE;
 
+    // FIXME: THIS IS EMITTED FOR ALL CONSEQUTIVE EVENTS!
     *fLog << warn << endl;
     *fLog << "WARNING - MWriteRootFile:   Root's  TTree/TFile   has  opened   a  new  file" << endl;
Index: trunk/MagicSoft/Mars/mhvstime/MHSectorVsTime.h
===================================================================
--- trunk/MagicSoft/Mars/mhvstime/MHSectorVsTime.h	(revision 7357)
+++ trunk/MagicSoft/Mars/mhvstime/MHSectorVsTime.h	(revision 7358)
@@ -71,5 +71,5 @@
     // Getter
     TH1 *GetHistByName(const TString name="") const;
-    //TGraph *GetGraph() { return fGraph; }
+    TGraph *GetGraph() { return fGraph; }
 
     // TObject
@@ -80,9 +80,6 @@
     void Paint(Option_t *o=NULL);
 
-    ClassDef(MHSectorVsTime, 1) // Histogram to sum camera events
+    ClassDef(MHSectorVsTime, 2) // Histogram to sum camera events
 };
 
 #endif
-
-
-
Index: trunk/MagicSoft/Mars/mimage/MImgCleanStd.cc
===================================================================
--- trunk/MagicSoft/Mars/mimage/MImgCleanStd.cc	(revision 7357)
+++ trunk/MagicSoft/Mars/mimage/MImgCleanStd.cc	(revision 7358)
@@ -377,7 +377,11 @@
     for (UInt_t idx=0; idx<npixevt; idx++)
     {
+        // The default for pixels is "used" set by
+        // MParContainer::Reset before processing
         if (data[idx]>fCleanLvl1)
             continue;
 
+        // Setting a pixel to unused if it is unmapped would overwrite
+        // the unmapped-status. Therefor this pixels are excluded.
         MSignalPix &pix = (*fEvt)[idx];
         if (!pix.IsPixelUnmapped())
@@ -401,4 +405,5 @@
     for (UInt_t idx=0; idx<npixevt; idx++)
     {
+        // Exclude all unused (this includes all unmapped) pixels
         MSignalPix &pix = (*fEvt)[idx];
         if (!pix.IsPixelUsed())
@@ -416,6 +421,7 @@
             const Int_t idx2 = gpix.GetNeighbor(j);
 
-	    // when you find an used neighbor, break the loop
-            if (fEvt->IsPixelUsed(idx2))
+            // when you find an used neighbor (this excludes unused
+            // and unmapped pixels) break the loop
+            if ((*fEvt)[idx2].IsPixelUsed())
             {
                 hasNeighbor = kTRUE;
@@ -424,18 +430,26 @@
         }
 
-        if (hasNeighbor == kFALSE)
-        {
-            if (!fKeepSinglePixels)
-                pix.SetPixelUnused();
-            size += pix.GetNumPhotons();
-            n++;
-        }
-    }
-
+        // If the pixel has at least one core-neighbor
+        // go on with the next pixel
+        if (hasNeighbor)
+            continue;
+
+        // If the pixel has no neighbors and the single pixels
+        // should not be kept turn the used- into an unused-status
+        if (!fKeepSinglePixels)
+            pix.SetPixelUnused();
+
+        // count size and number of single core-pixels
+        size += pix.GetNumPhotons();
+        n++;
+    }
+
+    // Now turn the used-status into the core-status
+    // (FIXME: A more intelligent handling of used/core in clean step1/2
+    //         would make this loop obsolete!)
     for (UInt_t idx=0; idx<npixevt; idx++)
     {
         MSignalPix &pix = (*fEvt)[idx];
-	if (pix.IsPixelUsed())
-            pix.SetPixelCore();
+        pix.SetPixelCore(pix.IsPixelUsed());
     }
 
@@ -458,5 +472,7 @@
         const Int_t idx2 = gpix.GetNeighbor(j);
 
-	if (!fEvt->IsPixelCore(idx2))
+        // Check if the neighbor pixel is a core pixel. (Rem: Unampped
+        // pixels are never assigned the core-pixel status)
+	if (!(*fEvt)[idx2].IsPixelCore())
             continue;
 
@@ -475,5 +491,5 @@
 //   If a value<2 for fCleanRings is used, no CleanStep4 is done.
 //
-void MImgCleanStd::CleanStep4(UShort_t r, Int_t idx/*MSignalPix &pix*/)
+void MImgCleanStd::CleanStep4(UShort_t r, Int_t idx)
 {
     MSignalPix &pix = (*fEvt)[idx];
@@ -490,5 +506,5 @@
     // and tell to which ring it belongs to.
     //
-    MGeomPix  &gpix  = (*fCam)[idx];
+    MGeomPix  &gpix = (*fCam)[idx];
 
     const Int_t nnmax = gpix.GetNumNeighbors();
@@ -498,6 +514,6 @@
         const Int_t idx2 = gpix.GetNeighbor(j);
 
-        MSignalPix *npix = fEvt->GetPixById(idx2);
-        if (!npix || !npix->IsPixelUsed() || npix->GetRing()>r-1 ) 
+        const MSignalPix &npix = (*fEvt)[idx2];
+        if (!npix.IsPixelUsed() || npix.GetRing()>r-1 )
             continue;
 
Index: trunk/MagicSoft/Mars/mjobs/MDataSet.cc
===================================================================
--- trunk/MagicSoft/Mars/mjobs/MDataSet.cc	(revision 7357)
+++ trunk/MagicSoft/Mars/mjobs/MDataSet.cc	(revision 7358)
@@ -86,4 +86,5 @@
 
 #include "MRead.h"
+#include "MJob.h"
 #include "MAstro.h"
 #include "MDirIter.h"
@@ -139,4 +140,6 @@
         runs.Remove(0, runs.First(num)+num.Length());
     }
+
+    MJob::SortArray(data);
 }
 
@@ -175,5 +178,5 @@
     // For the synchronization we must make sure, that all sequences are
     // in the correct order...
-    list.Sort();
+    // list.Sort();
 }
 
@@ -298,5 +301,5 @@
     // Filenames MUST begin with an appropriate string which allow
     // to order them correctly in time!
-    files.Sort();
+    // files.Sort();
 
     if (gLog.GetDebugLevel()>4)
Index: trunk/MagicSoft/Mars/mjobs/MJob.cc
===================================================================
--- trunk/MagicSoft/Mars/mjobs/MJob.cc	(revision 7357)
+++ trunk/MagicSoft/Mars/mjobs/MJob.cc	(revision 7358)
@@ -359,2 +359,13 @@
     return path;
 }
+
+void MJob::SortArray(TArrayI &arr)
+{
+    TArrayI idx(arr.GetSize());
+    TArrayI srt(arr);
+
+    TMath::Sort(arr.GetSize(), srt.GetArray(), idx.GetArray(), kFALSE);
+
+    for (int i=0; i<arr.GetSize(); i++)
+        arr[i] = srt[idx[i]];
+}
Index: trunk/MagicSoft/Mars/mjobs/MJob.h
===================================================================
--- trunk/MagicSoft/Mars/mjobs/MJob.h	(revision 7357)
+++ trunk/MagicSoft/Mars/mjobs/MJob.h	(revision 7358)
@@ -77,4 +77,5 @@
 
     static TString ExpandPath(TString fname);
+    static void SortArray(TArrayI &arr);
 
     ClassDef(MJob, 0) // Bas class for Jobs
Index: trunk/MagicSoft/Mars/mjobs/MSequence.cc
===================================================================
--- trunk/MagicSoft/Mars/mjobs/MSequence.cc	(revision 7357)
+++ trunk/MagicSoft/Mars/mjobs/MSequence.cc	(revision 7358)
@@ -130,4 +130,5 @@
 #include "MLogManip.h"
 
+#include "MJob.h"
 #include "MAstro.h"
 #include "MString.h"
@@ -194,4 +195,6 @@
         runs.Remove(0, runs.First(num)+num.Length());
     }
+
+    MJob::SortArray(data);
 }
 
