Index: trunk/MagicSoft/Mars/mtools/MTFillMatrix.cc
===================================================================
--- trunk/MagicSoft/Mars/mtools/MTFillMatrix.cc	(revision 8996)
+++ trunk/MagicSoft/Mars/mtools/MTFillMatrix.cc	(revision 9041)
@@ -76,4 +76,17 @@
 // fill.WriteMatrices("myfile.root");
 //
+//
+// Task List execution
+// ----------------------------------------------
+//
+// The tasklist is excuted in the follwowing order:
+//   - fReader      set by SetReader
+//   - fPreTasks    in the order as set with the SetPreTask functions
+//   - fPreCuts     in the order as set with the SetPreCut  functions
+//   - Selection    the event selection
+//   - fPostTasks   in the order as set with the SetPostTask functions
+//   - Fill Matrix
+//   - Write output
+//
 /////////////////////////////////////////////////////////////////////////////
 #include "MTFillMatrix.h"
@@ -163,5 +176,6 @@
 MTFillMatrix::MTFillMatrix(const char *name, const char *title)
 : fReference(0), fReader(0), fDestMatrix1(0), fDestMatrix2(0),
-  fNumDestEvents1(0), fNumDestEvents2(0), fWriteFile1(0), fWriteFile2(0)
+  fNumDestEvents1(0), fNumDestEvents2(0), fNumMaxEvents(0),
+  fWriteFile1(0), fWriteFile2(0)
 {
     Init(name, title);
@@ -180,5 +194,6 @@
 MTFillMatrix::MTFillMatrix(const MH3 *ref, const char *name, const char *title)
 : fReference(0), fReader(0), fDestMatrix1(0), fDestMatrix2(0),
-  fNumDestEvents1(0), fNumDestEvents2(0), fWriteFile1(0), fWriteFile2(0)
+  fNumDestEvents1(0), fNumDestEvents2(0), fNumMaxEvents(0),
+  fWriteFile1(0), fWriteFile2(0)
 {
     Init(name, title);
@@ -413,5 +428,5 @@
     evtloop.SetLogStream(fLog);
 
-    const Bool_t rc = evtloop.Eventloop();
+    const Bool_t rc = evtloop.Eventloop(fNumMaxEvents);
 
     if (selector)
Index: trunk/MagicSoft/Mars/mtools/MTFillMatrix.h
===================================================================
--- trunk/MagicSoft/Mars/mtools/MTFillMatrix.h	(revision 8996)
+++ trunk/MagicSoft/Mars/mtools/MTFillMatrix.h	(revision 9041)
@@ -27,4 +27,6 @@
     Int_t     fNumDestEvents2;
 
+    Int_t     fNumMaxEvents;
+
     MTask    *fWriteFile1;
     MTask    *fWriteFile2;
@@ -52,5 +54,5 @@
         fDestMatrix1 = matrix;
         if (num>0)
-            fNumDestEvents1 = num;
+            SetNumDestEvents1(num);
     }
     void SetWriteFile1(MTask *write, UInt_t num=0)
@@ -58,9 +60,5 @@
         fWriteFile1 = write;
         if (num>0)
-            fNumDestEvents1 = num;
-    }
-    void SetNumDestEvents1(UInt_t num)
-    {
-        fNumDestEvents1 = num;
+            SetNumDestEvents1(num);
     }
     void SetDestMatrix2(MHMatrix *matrix, UInt_t num=0)
@@ -68,5 +66,5 @@
         fDestMatrix2 = matrix;
         if (num>0)
-            fNumDestEvents2 = num;
+            SetNumDestEvents2(num);
     }
     void SetWriteFile2(MTask *write, UInt_t num=0)
@@ -74,10 +72,9 @@
         fWriteFile2 = write;
         if (num>0)
-            fNumDestEvents2 = num;
+            SetNumDestEvents2(num);
     }
-    void SetNumDestEvents2(UInt_t num)
-    {
-        fNumDestEvents2 = num;
-    }
+    void SetNumDestEvents1(UInt_t num) { fNumDestEvents1 = num; }
+    void SetNumDestEvents2(UInt_t num) { fNumDestEvents2 = num; }
+    void SetMaxEvents(UInt_t num)      { fNumMaxEvents = num; }
 
     void SetReader(MRead *task) { fReader = task; }
