Index: /trunk/MagicSoft/Mars/Changelog
===================================================================
--- /trunk/MagicSoft/Mars/Changelog	(revision 2742)
+++ /trunk/MagicSoft/Mars/Changelog	(revision 2743)
@@ -8,4 +8,16 @@
    * manalysis/MCT1FindSupercuts.cc, manalysis/MFindSupercuts.cc:
      - replaced MFRandomSplit by MFEventSelector
+   
+   * mfilter/FilterLinkDef.h, mfilter/Makefile:
+     - removed MFRandomSplit (functionality already implemented
+       in MFEventSelector)
+       
+   * mfilter/MFEventSelector.[h,cc]:
+     - did some cosmetics
+     - removed some obsolete data members
+     - added some comments
+     
+   * mfilter/MFEventSelector2.[h,cc]:
+     - added some comments
 
 
@@ -90,5 +102,5 @@
      - added many small comment about future development
 
-   * manalysis/MExtractSignal.cc:
+   * manalysis/MExtractSignal.[h,cc]:
      - removed arguments from constructor
      - added corresponding member functions
@@ -96,4 +108,5 @@
          construtor and member functions to change the default
      - removed obsolete PostProcess
+     ! PLEASE update you code accordingly.
      
    * manalysis/MExtractedSignalCam.h, manalysis/MExtractedSignalPix.h:
@@ -141,5 +154,5 @@
        moment
 
-   * mtools/MTMinui.[h,cc]:
+   * mtools/MTMinuit.[h,cc]:
      - added (will replace MMinuitInterface soon)
 
Index: /trunk/MagicSoft/Mars/mfilter/FilterLinkDef.h
===================================================================
--- /trunk/MagicSoft/Mars/mfilter/FilterLinkDef.h	(revision 2742)
+++ /trunk/MagicSoft/Mars/mfilter/FilterLinkDef.h	(revision 2743)
@@ -28,5 +28,4 @@
 
 #pragma link C++ class MFEnergySlope+;
-#pragma link C++ class MFRandomSplit+;
 
 #endif
Index: /trunk/MagicSoft/Mars/mfilter/MFEventSelector.cc
===================================================================
--- /trunk/MagicSoft/Mars/mfilter/MFEventSelector.cc	(revision 2742)
+++ /trunk/MagicSoft/Mars/mfilter/MFEventSelector.cc	(revision 2743)
@@ -30,4 +30,6 @@
 // present implementation you can only use a random selection.
 //
+// This filter can be used for a random split...
+//
 // If you want to fill only 50% of your events into a histogram please use:
 //   MFEventSelector sel;
@@ -60,4 +62,7 @@
 // Remark: You can also use the filter together with MContinue
 //
+//
+// FIXME: Merge MFEventSelector and MFEventSelector2
+//
 /////////////////////////////////////////////////////////////////////////////
 #include "MFEventSelector.h"
@@ -81,16 +86,4 @@
 // --------------------------------------------------------------------------
 //
-// Default Constructor. Don't use.
-//
-/*
-MFEventSelector::MFEventSelector()
-    : fNumTotalEvts(-1), fNumSelectEvts(-1), fSelRatio(-1), fNumSelectedEvts(0)
-{
-    fName  = gsDefName.Data();
-    fTitle = gsDefTitle.Data();
-}
-*/
-// --------------------------------------------------------------------------
-//
 // Constructor. For the text describing the filter rule please see
 // the class description above.
@@ -105,14 +98,36 @@
 // --------------------------------------------------------------------------
 //
+// Set a probability with which events are selected. Eg, f=0.5
+// will select roughly half of all events.
+//
+void MFEventSelector::SetSelectionRatio(Float_t f)
+{
+    if (f < 0)
+    {
+        *fLog << warn << "MFEventSelector::SetSelectionRatio: WARNING - Probability less than 0... set to 0." << endl;
+        f = 0;
+    }
+
+    if (f > 1)
+    {
+        *fLog << warn << "MFEventSelector::SetSelectionRatio: WARNING - Probability greater than 1... set to 1." << endl;
+        f = 1;
+    }
+    fSelRatio = f;
+}
+
+// --------------------------------------------------------------------------
+//
 // PreProcess all filters.
 //
 Int_t MFEventSelector::PreProcess(MParList *plist)
 {
-    memset(fErrors, 0, sizeof(fErrors));
-
     fNumSelectedEvts = 0;
+
+    // In the case a ratio was set by the user we are done.
     if (fSelRatio>0)
         return kTRUE;
 
+    // If the number of total events wasn't set try to get it
     if (fNumTotalEvts<0)
     {
@@ -120,5 +135,5 @@
         if (!tlist)
         {
-            *fLog << err << dbginf << "Sorry can't determin total number of events... no MTaskList." << endl;
+            *fLog << err << "Can't determin total number of events... no MTaskList." << endl;
             return kFALSE;
         }
@@ -127,15 +142,18 @@
         if (!read)
         {
-            *fLog << err << dbginf << "Sorry can't determin total number of events from 'MRead'." << endl;
+            *fLog << err << "Can't determin total number of events from 'MRead'." << endl;
             return kFALSE;
         }
         fNumTotalEvts = read->GetEntries();
 
-        *fLog << "MFEventSelector::PreProcess; fNumTotalEvts = " 
-              << fNumTotalEvts << endl;
-
         SetBit(kNumTotalFromFile);
     }
 
+    // Calculate selection probability
+    fSelRatio = (Double_t)fNumSelectEvts/fNumTotalEvts;
+
+    *fLog << inf << "MFEventSelector:  Selection probability = " << fNumSelectEvts;
+    *fLog << "/" << fNumTotalEvts << " = " << Form("%.2f", fSelRatio) << endl;
+
     return kTRUE;
 }
@@ -143,29 +161,16 @@
 // --------------------------------------------------------------------------
 //
-// Process all filters.
+// Process all filters, FIXME: Make it fit the requested number of events
+// exactly like it is done in MFEventSelector2. This can be done by merging
+// both classes!
 //
 Int_t MFEventSelector::Process()
 {
-    Int_t rc;
-
-    const Float_t evt = gRandom->Uniform();
-
-    if (fNumSelectEvts>0)
-        fResult = evt*fNumTotalEvts < fNumSelectEvts;
-    else
-        fResult = evt < fSelRatio;
-
-    if (fResult)
-    {
-        fNumSelectedEvts++;
-
-        rc = 0;
-        fErrors[rc]++;
+    fResult = gRandom->Uniform() < fSelRatio;
+
+    if (!fResult)
         return kTRUE;
-    }
-    
-    rc = 1;
-    fErrors[rc]++;
-
+
+    fNumSelectedEvts++;
     return kTRUE;
 }
@@ -180,15 +185,16 @@
     if (GetNumExecutions() != 0)
     {
-      *fLog << inf << endl;
-      *fLog << GetDescriptor() << " execution statistics:" << endl;
-      *fLog << dec << setfill(' ');
-      *fLog << " " << setw(7) << fErrors[1] << " (" << setw(3) 
-            << (int)(fErrors[1]*100/GetNumExecutions()) 
-            << "%) Events not selected" << endl;
-
-      *fLog << " " << fErrors[0] << " (" 
-            << (int)(fErrors[0]*100/GetNumExecutions()) 
-            << "%) Events selected!" << endl;
-      *fLog << endl;
+        const Double_t sel = (Double_t)fNumSelectedEvts/GetNumExecutions();
+        const UInt_t   non = GetNumExecutions()-fNumSelectedEvts;
+
+        *fLog << inf << dec << setfill(' ') << endl;
+        *fLog << GetDescriptor() << " execution statistics:" << endl;
+
+        *fLog << " " << setw(7) << non << " (" << setw(3);
+        *fLog << (int)(100*(1-sel)) << "%) Events not selected" << endl;
+
+        *fLog << " " << setw(7) << fNumSelectedEvts << " (";
+        *fLog << (int)(100*sel) << "%) Events selected!" << endl;
+        *fLog << endl;
     }
 
@@ -196,4 +202,5 @@
     if (TestBit(kNumTotalFromFile))
         fNumTotalEvts = -1;
+
     return kTRUE;
 }
@@ -219,4 +226,3 @@
     out << ");" << endl;
     */
-
-}
+}
Index: /trunk/MagicSoft/Mars/mfilter/MFEventSelector.h
===================================================================
--- /trunk/MagicSoft/Mars/mfilter/MFEventSelector.h	(revision 2742)
+++ /trunk/MagicSoft/Mars/mfilter/MFEventSelector.h	(revision 2743)
@@ -1,10 +1,4 @@
 #ifndef MARS_MFEventSelector
 #define MARS_MFEventSelector
-
-/////////////////////////////////////////////////////////////////////////////
-//                                                                         //
-// MFEventSelector                                                         //
-//                                                                         //
-/////////////////////////////////////////////////////////////////////////////
 
 #ifndef MARS_MFilter
@@ -17,11 +11,11 @@
 {
 private:
-    Int_t   fNumTotalEvts;
-    Int_t   fNumSelectEvts;
-    Float_t fSelRatio;
+    Int_t   fNumTotalEvts;    // Number of total events from which are selected
+    Int_t   fNumSelectEvts;   // Number of events to be selected
+    Float_t fSelRatio;        // Selection Probability
 
-    Int_t   fNumSelectedEvts; //!
+    Int_t   fNumSelectedEvts; //! Number of events which have been selected
 
-    Bool_t  fResult;
+    Bool_t  fResult;          //! Reseult of a single selection
 
     void StreamPrimitive(ofstream &out) const;
@@ -33,6 +27,4 @@
     enum { kNumTotalFromFile = BIT(14) };
 
-    Int_t fErrors[2];
-
 public:
     MFEventSelector(const char *name=NULL, const char *title=NULL);
@@ -40,9 +32,9 @@
     Bool_t IsExpressionTrue() const { return fResult; }
 
-    void SetNumTotalEvts(Int_t n) { fNumTotalEvts = n; ResetBit(kNumTotalFromFile); }
+    void SetNumTotalEvts(Int_t n)  { fNumTotalEvts = n; ResetBit(kNumTotalFromFile); }
     void SetNumSelectEvts(Int_t n) { fNumSelectEvts = n; }
-    void SetSelectionRatio(Float_t f) { fSelRatio = f; }
+    void SetSelectionRatio(Float_t f);
 
-    ClassDef(MFEventSelector, 0) // A Filter to select events from files
+    ClassDef(MFEventSelector, 0) // A filter to do a random selection of events
 };
 
Index: /trunk/MagicSoft/Mars/mfilter/MFEventSelector2.cc
===================================================================
--- /trunk/MagicSoft/Mars/mfilter/MFEventSelector2.cc	(revision 2742)
+++ /trunk/MagicSoft/Mars/mfilter/MFEventSelector2.cc	(revision 2743)
@@ -92,4 +92,7 @@
 // Remark: You can also use the filter together with MContinue
 //
+//
+// FIXME: Merge MFEventSelector and MFEventSelector2
+//
 /////////////////////////////////////////////////////////////////////////////
 #include "MFEventSelector2.h"
@@ -225,5 +228,5 @@
     }
 
-    tlist.PrintStatistics(0, kTRUE);
+    tlist.PrintStatistics();
 
     *fLog << inf;
Index: /trunk/MagicSoft/Mars/mfilter/MFEventSelector2.h
===================================================================
--- /trunk/MagicSoft/Mars/mfilter/MFEventSelector2.h	(revision 2742)
+++ /trunk/MagicSoft/Mars/mfilter/MFEventSelector2.h	(revision 2743)
@@ -63,9 +63,6 @@
     Bool_t IsExpressionTrue() const { return fResult; }
 
-    ClassDef(MFEventSelector2, 0)
+    ClassDef(MFEventSelector2, 0) // FIMXE!
 };
 
 #endif
-
-
-
Index: /trunk/MagicSoft/Mars/mfilter/Makefile
===================================================================
--- /trunk/MagicSoft/Mars/mfilter/Makefile	(revision 2742)
+++ /trunk/MagicSoft/Mars/mfilter/Makefile	(revision 2743)
@@ -52,6 +52,5 @@
 	   MFSelFinal.cc \
            MFSoftwareTrigger.cc \
-	   MFEnergySlope.cc \
-	   MFRandomSplit.cc
+	   MFEnergySlope.cc
 
 SRCS    = $(SRCFILES)
