Index: trunk/MagicSoft/Mars/mbase/MArgs.cc
===================================================================
--- trunk/MagicSoft/Mars/mbase/MArgs.cc	(revision 2711)
+++ trunk/MagicSoft/Mars/mbase/MArgs.cc	(revision 2728)
@@ -30,4 +30,7 @@
 // This is a helper class for executables to parse command line arguments
 //
+// Arguments beginning with a trailing '-' are called 'options'.
+// Arguments without a trailing '-' are considered 'arguments'
+//
 //////////////////////////////////////////////////////////////////////////////
 #include "MArgs.h"
@@ -82,9 +85,34 @@
 // --------------------------------------------------------------------------
 //
-// Print all arguments parsed.
+// Print everything parsed.
+// Using 'options' as option only 'options' are printed.
+// Using 'arguments' as option only 'arguments' are printed.
 //
 void MArgs::Print(const Option_t *o) const
 {
     gLog << all << underline << fName << ":" << endl;
+
+    const TString str(o);
+
+    if (!str.CompareTo("options", TString::kIgnoreCase))
+    {
+        TIter Next(fArgv);
+        TString *s = NULL;
+        while ((s=dynamic_cast<TString*>(Next())))
+            if (s->BeginsWith("-"))
+                gLog << *s << endl;
+        return;
+    }
+
+    if (!str.CompareTo("arguments", TString::kIgnoreCase))
+    {
+        TIter Next(fArgv);
+        TString *s = NULL;
+        while ((s=dynamic_cast<TString*>(Next())))
+            if (!s->BeginsWith("-"))
+                gLog << *s << endl;
+        return;
+    }
+
     fArgv->Print();
 }
@@ -246,4 +274,30 @@
 // --------------------------------------------------------------------------
 //
+// return the number of arguments with a trainling '-'
+//
+Int_t MArgs::GetNumOptions() const
+{
+    Int_t num = 0;
+
+    TIter Next(fArgv);
+    TString *s = NULL;
+    while ((s=dynamic_cast<TString*>(Next())))
+        if (s->BeginsWith("-"))
+            num++;
+
+    return num;
+}
+
+// --------------------------------------------------------------------------
+//
+// return the total number of entries
+//
+Int_t MArgs::GetNumEntries() const
+{
+    return fArgv->GetSize();
+}
+
+// --------------------------------------------------------------------------
+//
 // Checks whether an argument beginning with 'n' is existing, eg:
 //  executable -value5
@@ -259,4 +313,24 @@
     while ((s=dynamic_cast<TString*>(Next())))
         if (s->BeginsWith(name))
+            return kTRUE;
+    return kFALSE;
+}
+
+// --------------------------------------------------------------------------
+//
+// Checks whether an argument beginning with 'n' is existing, eg:
+//  executable -value5
+//   HasOption("-value") will return false
+//  executable -value
+//   HasOption("-value") will return true
+//
+Bool_t MArgs::HasOnly(const TString n) const
+{
+    const TString name = n.Strip(TString::kBoth);
+
+    TIter Next(fArgv);
+    TString *s = NULL;
+    while ((s=dynamic_cast<TString*>(Next())))
+        if (*s==name)
             return kTRUE;
     return kFALSE;
@@ -284,2 +358,30 @@
     return kFALSE;
 }
+
+// --------------------------------------------------------------------------
+//
+// Checks whether an argument beginning with 'n' is exists and a
+// corresponding option is available, eg.
+//  executable -value5
+//  HasOption("-value") will return false
+// but:
+//  executable -value
+//  HasOption("-value") will return true
+//
+// The argument is removed from the internal list.
+//
+Bool_t MArgs::HasOnlyAndRemove(const TString n)
+{
+    const TString name = n.Strip(TString::kBoth);
+
+    TIter Next(fArgv);
+    TString *s = NULL;
+    while ((s=dynamic_cast<TString*>(Next())))
+        if (*s==name)
+        {
+            delete fArgv->Remove(dynamic_cast<TObject*>(s));
+            return kTRUE;
+        }
+
+    return kFALSE;
+}
Index: trunk/MagicSoft/Mars/mbase/MArgs.h
===================================================================
--- trunk/MagicSoft/Mars/mbase/MArgs.h	(revision 2711)
+++ trunk/MagicSoft/Mars/mbase/MArgs.h	(revision 2728)
@@ -47,11 +47,15 @@
     TString  GetStringAndRemove(const TString name);
 
-    Bool_t Has(const TString name) const;
-    Bool_t HasOption(const TString name) const;
+    Bool_t   Has(const TString name) const;
+    Bool_t   HasOnly(const TString name) const;
+    Bool_t   HasOption(const TString name) const;
+    Bool_t   HasOnlyAndRemove(const TString name);
 
-    TString GetArgumentStr(Int_t i) const;
-    Int_t   GetArgumentInt(Int_t i) const;
-    Float_t GetArgumentFloat(Int_t i) const;
-    Int_t   GetNumArguments() const;
+    TString  GetArgumentStr(Int_t i) const;
+    Int_t    GetArgumentInt(Int_t i) const;
+    Float_t  GetArgumentFloat(Int_t i) const;
+    Int_t    GetNumArguments() const;
+    Int_t    GetNumOptions() const;
+    Int_t    GetNumEntries() const;
 
     ClassDef(MArgs, 0)  //Class to parse command line arguments
Index: trunk/MagicSoft/Mars/mbase/MEvtLoop.cc
===================================================================
--- trunk/MagicSoft/Mars/mbase/MEvtLoop.cc	(revision 2711)
+++ trunk/MagicSoft/Mars/mbase/MEvtLoop.cc	(revision 2728)
@@ -25,45 +25,45 @@
 
 //////////////////////////////////////////////////////////////////////////////
-//                                                                          //
-// MEvtLoop                                                                 //
-//                                                                          //
-// This class is the core of each event processing.                         //
-// First you must set the parameter list to use. The parameter list         //
-// must contain the task list (MTaskList) to use. The name of the task      //
-// list can be specified if you call Eventloop. The standard name is        //
-// "MTaskList". The name you specify must match the name of the MTaskList   //
-// object.                                                                  //
-//                                                                          //
-// If you call Eventloop() first all PreProcess functions - with the        //
-// parameter list as an argument - of the tasks in the task list are        //
-// executed. If one of them returns kFALSE then the execution is stopped.   //
-// If the preprocessing was ok, The Process function of the tasks are       //
-// executed as long as one function returns kSTOP. Only the tasks which     //
-// are marked as "All" or with a string which matches the MInputStreamID    //
-// of MTaskList are executed. If one tasks returns kCONTINUE the pending    //
-// tasks in the list are skipped and the execution in continued with        //
-// the first one in the list.                                               //
-// Afterwards the PostProcess functions are executed.                       //
-//                                                                          //
-// If you want to display the progress in a gui you can use SetProgressBar  //
-// and a TGProgressBar or a MProgressBar. If you set a MStatusDisplay       //
-// using SetDisplay, the Progress bar from this display is used.            //
-//                                                                          //
-// You can create a macro from a completely setup eventloop by:             //
-//   evtloop.MakeMacro("mymacro.C");                                        //
-//                                                                          //
-// You will always need to check the macro, it will not run, but it         //
-// should have al important information.                                    //
-//                                                                          //
-//                                                                          //
-// You can also write all this information to a root file:                  //
-//   TFile file("myfile.root");                                             //
-//   evtloop.Write("MyEvtloopKey");                                         //
-//                                                                          //
-// You can afterwards read the information from an open file by:            //
-//   evtloop.Read("MyEvtloopKey");                                          //
-//                                                                          //
-// To lookup the information write it to a file using MakeMacro             //
-//                                                                          //
+//
+// MEvtLoop
+//
+// This class is the core of each event processing.
+// First you must set the parameter list to use. The parameter list
+// must contain the task list (MTaskList) to use. The name of the task
+// list can be specified if you call Eventloop. The standard name is
+// "MTaskList". The name you specify must match the name of the MTaskList
+// object.
+//
+// If you call Eventloop() first all PreProcess functions - with the
+// parameter list as an argument - of the tasks in the task list are
+// executed. If one of them returns kFALSE then the execution is stopped.
+// If the preprocessing was ok, The Process function of the tasks are
+// executed as long as one function returns kSTOP. Only the tasks which
+// are marked as "All" or with a string which matches the MInputStreamID
+// of MTaskList are executed. If one tasks returns kCONTINUE the pending
+// tasks in the list are skipped and the execution in continued with
+// the first one in the list.
+// Afterwards the PostProcess functions are executed.
+//
+// If you want to display the progress in a gui you can use SetProgressBar
+// and a TGProgressBar or a MProgressBar. If you set a MStatusDisplay
+// using SetDisplay, the Progress bar from this display is used.
+//
+// You can create a macro from a completely setup eventloop by:
+//   evtloop.MakeMacro("mymacro.C");
+//
+// You will always need to check the macro, it will not run, but it
+// should have al important information.
+//
+//
+// You can also write all this information to a root file:
+//   TFile file("myfile.root");
+//   evtloop.Write("MyEvtloopKey");
+//
+// You can afterwards read the information from an open file by:
+//   evtloop.Read("MyEvtloopKey");
+//
+// To lookup the information write it to a file using MakeMacro
+//
 //////////////////////////////////////////////////////////////////////////////
 #include "MEvtLoop.h"
@@ -393,5 +393,5 @@
 // for developers or use in special jobs only!
 //
-Int_t MEvtLoop::Process(Int_t maxcnt)
+Int_t MEvtLoop::Process(UInt_t maxcnt)
 {
     if (!fTaskList)
@@ -404,5 +404,5 @@
     *fLog << all <<"Eventloop running (";
 
-    if (maxcnt<0)
+    if (maxcnt==0)
         *fLog << "all";
     else
@@ -411,5 +411,5 @@
     *fLog << " events)..." << flush;
 
-    Int_t entries = INT_MAX;
+    UInt_t entries = kMaxUInt;
     fNumEvents = 0;
 
@@ -420,5 +420,4 @@
 
 #ifdef __MARS__
-        // limits.h
         MRead *read = (MRead*)fTaskList->FindObject("MRead");
         if (read && read->GetEntries()>0)
@@ -429,5 +428,5 @@
             fNumEvents = TMath::Min(maxcnt, entries);
         else
-            if (entries!=INT_MAX)
+            if (entries!=kMaxUInt)
                 fNumEvents = entries;
     }
@@ -439,6 +438,4 @@
     }
 
-    Int_t dummy = maxcnt<0 ? 0 : maxcnt;
-
     //
     // start a stopwatch
@@ -449,11 +446,12 @@
     //
     // This is the MAIN EVENTLOOP which processes the data
-    // if maxcnt<0 the number of processed events is counted
+    // if maxcnt==0 the number of processed events is counted
     // else only maxcnt events are processed
     //
-    Int_t numcnts = 0;
+    UInt_t numcnts = 0;
+    UInt_t dummy   = maxcnt;
 
     Int_t rc = kTRUE;
-    if (maxcnt<0)
+    if (maxcnt==0)
         // process first and increment if sucessfull
         while ((rc=fTaskList->Process())==kTRUE)
@@ -529,11 +527,15 @@
 // See class description above. Returns kTRUE if PreProcessing,
 // Processing and PostProcessing was successfull, otherwise kFALSE.
-//
-Bool_t MEvtLoop::Eventloop(Int_t maxcnt, const char *tlist)
+// maxcnt==0 means: all events
+// tlist is the name of the task-list to be used. Be carefull, this
+// feature is not finally implemented - it will only work if no
+// task will access the tasklist.
+//
+Bool_t MEvtLoop::Eventloop(UInt_t maxcnt, const char *tlist)
 {
     TDatime d;
     *fLog << inf << underline << "Eventloop: " << fName << " started at " << d.AsString() << endl;
 
-    Bool_t rc = PreProcess();
+    Bool_t rc = PreProcess(tlist);
 
     //
Index: trunk/MagicSoft/Mars/mbase/MEvtLoop.h
===================================================================
--- trunk/MagicSoft/Mars/mbase/MEvtLoop.h	(revision 2711)
+++ trunk/MagicSoft/Mars/mbase/MEvtLoop.h	(revision 2728)
@@ -63,8 +63,8 @@
 
     Bool_t PreProcess(const char *tlist="MTaskList");
-    Int_t  Process(Int_t maxcnt);
+    Int_t  Process(UInt_t maxcnt);
     Bool_t PostProcess() const;
 
-    Bool_t Eventloop(Int_t maxcnt=-1, const char *tlist="MTaskList");
+    Bool_t Eventloop(UInt_t maxcnt=0, const char *tlist="MTaskList");
 
     void MakeMacro(const char *filename="evtloop.C");
Index: trunk/MagicSoft/Mars/mbase/MTime.cc
===================================================================
--- trunk/MagicSoft/Mars/mbase/MTime.cc	(revision 2711)
+++ trunk/MagicSoft/Mars/mbase/MTime.cc	(revision 2728)
@@ -27,8 +27,11 @@
 // MTime
 //
-// A generalized MARS time stamp
+// A generalized MARS time stamp.
 //
 // WARNING: Be carefull changing this class. It is also used in the
 //          MAGIC drive software cosy!
+//
+// Remarke: If you encounter strange behaviour, check the casting.
+//          Note, that on Linux machines ULong_t and UInt_t is the same.
 //
 // Version 1:
@@ -206,4 +209,27 @@
 
     fMjd = mjd+1;
+}
+
+// --------------------------------------------------------------------------
+//
+// Update the magic time. Make sure, that the MJD is set correctly.
+// It must be the MJD of the corresponding night. You can set it
+// by Set(2003, 12, 24);
+//
+// It is highly important, that the time correspoding to the night is
+// between 13:00:00.0 (day of dawning) and 12:59:59.999 (day of sunrise)
+//
+Bool_t MTime::UpdMagicTime(Byte_t h, Byte_t m, Byte_t s, UShort_t ms)
+{
+    if (h>23 || m>59 || s>59 || ms>999)
+         return kFALSE;
+
+    const ULong_t tm = ((((h*60+m)*60)+s)*1000)+ms;
+
+    fTime = (Long_t)(tm < kHour*13 ? tm  : tm-kDay); // day of sunrise?
+    //fNanoSec = ns;
+
+    return kTRUE;
+
 }
 
Index: trunk/MagicSoft/Mars/mbase/MTime.h
===================================================================
--- trunk/MagicSoft/Mars/mbase/MTime.h	(revision 2711)
+++ trunk/MagicSoft/Mars/mbase/MTime.h	(revision 2728)
@@ -26,8 +26,9 @@
 class MTime : public MParContainer
 {
-private:
+public:
     static const UInt_t kHour; // [ms] one hour
     static const UInt_t kDay;  // [ms] one day
 
+private:
     UInt_t fMjd;     // [d]  Day in the century        (Day of sun rise)
     TTime  fTime;    // [ms] Time of Day               (-11h<=x<13h)
@@ -74,7 +75,8 @@
 
     Bool_t   Set(UInt_t mjd, ULong_t ms, UInt_t ns=0);
-    Bool_t   Set(UShort_t y, Byte_t m, Byte_t d, Byte_t h, Byte_t min, Byte_t s, UShort_t ms, UInt_t ns=0);
+    Bool_t   Set(UShort_t y, Byte_t m, Byte_t d, Byte_t h=13, Byte_t min=0, Byte_t s=0, UShort_t ms=0, UInt_t ns=0);
     void     Set(const struct timeval &tv);
     void     SetCT1Time(UInt_t mjd, UInt_t t1, UInt_t t0);
+    Bool_t   UpdMagicTime(Byte_t h, Byte_t m, Byte_t s, UShort_t ms);
     void     SetMjd(Double_t m);
     Double_t GetMjd() const;
