Index: trunk/MagicSoft/Mars/Changelog
===================================================================
--- trunk/MagicSoft/Mars/Changelog	(revision 1656)
+++ trunk/MagicSoft/Mars/Changelog	(revision 1657)
@@ -1,3 +1,10 @@
                                                                   -*-*- END -*-*-
+ 2002/11/21: Thomas Bretz
+
+   * mbase/MAGIC.h, mbase/MEvtLoop.[h,cc], MTask.cc, MTaskList.cc:
+     - introduced kERROR to stop an eventloop with an error
+
+
+
  2002/11/20: Abelardo Moralejo
 
@@ -6,4 +13,6 @@
        error message.
 
+
+
  2002/11/19: Abelardo Moralejo
 
@@ -11,4 +20,6 @@
      - Removed some strange pieces of text which somehow got into the
        file (anyone knows how?)
+
+
 
  2002/11/19: Thomas Bretz
@@ -24,4 +35,6 @@
      - removed also the corresponding AddToList for the tasklist
 
+
+
  2002/11/19: Abelardo Moralejo
 
@@ -29,4 +42,5 @@
      - Added 2nd argument to write an output file containing the 
        collection area histogram.
+
 
 
Index: trunk/MagicSoft/Mars/mbase/MAGIC.h
===================================================================
--- trunk/MagicSoft/Mars/mbase/MAGIC.h	(revision 1656)
+++ trunk/MagicSoft/Mars/mbase/MAGIC.h	(revision 1657)
@@ -18,4 +18,5 @@
 const Int_t kCONTINUE = 2;
 const Int_t kSKIP     = 2;
+const Int_t kERROR    = 3;
 
 //
Index: trunk/MagicSoft/Mars/mbase/MEvtLoop.cc
===================================================================
--- trunk/MagicSoft/Mars/mbase/MEvtLoop.cc	(revision 1656)
+++ trunk/MagicSoft/Mars/mbase/MEvtLoop.cc	(revision 1657)
@@ -191,5 +191,5 @@
 // for developers or use in special jobs only!
 //
-void MEvtLoop::Process(Int_t maxcnt) const
+Bool_t MEvtLoop::Process(Int_t maxcnt) const
 {
     //
@@ -233,8 +233,9 @@
     // else only maxcnt events are processed
     //
+    Bool_t rc = kTRUE;
     if (maxcnt<0)
         // process first and increment if sucessfull
         if (fProgress)
-            while (fTaskList->Process())
+            while ((rc=fTaskList->Process())==kTRUE)
             {
                 fProgress->SetPosition(++dummy);
@@ -246,9 +247,9 @@
             }
         else
-            while (fTaskList->Process()) dummy++;
+            while ((rc=fTaskList->Process())==kTRUE) dummy++;
     else
         // check for number and break if unsuccessfull
         if (fProgress)
-            while (dummy-- && fTaskList->Process())
+            while (dummy-- && (rc=fTaskList->Process())==kTRUE)
             {
                 fProgress->SetPosition(maxcnt - dummy);
@@ -260,5 +261,5 @@
             }
         else
-            while (dummy-- && fTaskList->Process());
+            while (dummy-- && (rc=fTaskList->Process())==kTRUE);
 
     //
@@ -279,4 +280,6 @@
         << " --> " << (maxcnt<0?dummy:maxcnt)/clock.RealTime() << " Events/s"
         << endl << endl;
+
+    return rc!=kERROR;
 }
 
@@ -306,5 +309,5 @@
     //
     if (rc)
-        Process(maxcnt);
+        rc = Process(maxcnt);
 
     //
Index: trunk/MagicSoft/Mars/mbase/MEvtLoop.h
===================================================================
--- trunk/MagicSoft/Mars/mbase/MEvtLoop.h	(revision 1656)
+++ trunk/MagicSoft/Mars/mbase/MEvtLoop.h	(revision 1657)
@@ -52,5 +52,5 @@
 
     Bool_t PreProcess(const char *tlist="MTaskList");
-    void   Process(Int_t maxcnt) const;
+    Bool_t Process(Int_t maxcnt) const;
     Bool_t PostProcess() const;
 
Index: trunk/MagicSoft/Mars/mbase/MTask.cc
===================================================================
--- trunk/MagicSoft/Mars/mbase/MTask.cc	(revision 1656)
+++ trunk/MagicSoft/Mars/mbase/MTask.cc	(revision 1657)
@@ -56,5 +56,7 @@
 //                     are executed. A task can return kFALSE to           //
 //                     stop the execuition of the tasklist or              //
-//                     kCONTINUE to skip the pending tasks.                //
+//                     kCONTINUE to skip the pending tasks. If you want    //
+//                     to stop the eventloop and wants the eventloop to    //
+//                     return the status 'failed' return kERROR.           //
 //                                                                         //
 //   - PostProcess():  executed after the eventloop. Here you can close    //
Index: trunk/MagicSoft/Mars/mbase/MTaskList.cc
===================================================================
--- trunk/MagicSoft/Mars/mbase/MTaskList.cc	(revision 1656)
+++ trunk/MagicSoft/Mars/mbase/MTaskList.cc	(revision 1657)
@@ -426,4 +426,12 @@
             break;
 
+        case kERROR:
+            //
+            // an error occured: stop eventloop and return: failed
+            //
+            *fLog << err << dbginf << "Fatal error occured... stopped." << endl;
+            rc = kERROR;
+            break;
+
         case kCONTINUE:
             //
@@ -434,5 +442,5 @@
 
         default:
-            *fLog << warn << "MTaskList::Process: Unknown return value from MTask::Process()... ignored." << endl;
+            *fLog << warn << dbginf << "Unknown return value from MTask::Process()... ignored." << endl;
             continue;
         }
