Index: trunk/MagicSoft/Mars/Changelog
===================================================================
--- trunk/MagicSoft/Mars/Changelog	(revision 8616)
+++ trunk/MagicSoft/Mars/Changelog	(revision 8617)
@@ -18,4 +18,21 @@
 
                                                  -*-*- END OF LINE -*-*-
+
+
+ 2007/06/28 Thomas Bretz
+
+   * mars.cc:
+     - added new options to use a sequence file instead of a run
+
+   * mhbase/MFillH.h:
+     - added new member function to reset weights
+
+   * mmain/MEventDisplay.[h,cc]:
+     - added path argument to allow to give an input path
+     - added to allow to setup a sequence file for reading
+
+   * mmain/Makefile:
+     - added inlcude of mjobs for MSequence
+
 
 
Index: trunk/MagicSoft/Mars/mars.cc
===================================================================
--- trunk/MagicSoft/Mars/mars.cc	(revision 8616)
+++ trunk/MagicSoft/Mars/mars.cc	(revision 8617)
@@ -45,9 +45,38 @@
     gLog << all << endl;
     gLog << "Sorry the usage is:" << endl;
-    gLog << " mars [options] [filename]" << endl << endl;
+    gLog << " mars [options] filename|number [path]" << endl << endl;
+    gLog << " Arguments:" << endl;
+    gLog << "   filename: Name of a merpped raw file, a calibrated (Y)," << endl;
+    gLog << "             sequence file or sequence number." << endl;
+    gLog << "   path:     Path where the data is stored in case of a" << endl;
+    gLog << "             sequence (datacenter default if omitted)." << endl << endl;
     gLog << " Options:" << endl;
+    gLog.Usage();
+    gLog << "   --config=mars.rc: Change configuration file" << endl;
+    gLog << "                     <not yet implemented!>" << endl;
     gLog.Usage();
     gLog << "     -?/-h: This help" << endl << endl;
 }
+
+/*
+Bool_t InflateRun(TString &run, Bool_t ismc)
+{
+    if (run.IsDigit())
+    {
+        const Int_t numrun = run.Atoi();
+        seq = "/magic/";
+        if (ismc)
+            seq += ismc ? "montecarlo/" : "rawfiles/";
+        seq += Form("sequences/%04d/sequence%08d.txt", numseq/10000, numseq);
+        gLog << inf << "Inflated sequence file: " << seq << endl;
+    }
+
+    if (!gSystem->AccessPathName(seq, kFileExists))
+        return kTRUE;
+
+    gLog << err << "Sorry, sequence file '" << seq << "' doesn't exist." << endl;
+    return kFALSE;
+}
+*/
 
 int main(int argc, char **argv)
@@ -70,8 +99,32 @@
     }
 
+    //const Bool_t  kIsSequence = arg.HasOnlyAndRemove("--seq");
+    const TString kConfig = arg.GetStringAndRemove("--config=", "mars.rc");
+
+    if (arg.GetNumOptions()>0)
+    {
+        gLog << warn << "WARNING - Unknown commandline options..." << endl;
+        arg.Print("options");
+        gLog << endl;
+        return 2;
+    }
+
+    //
+    // check for the right usage of the program
+    //
+    if (arg.GetNumArguments()>2)
+    {
+        Usage();
+        return 2;
+    }
+
     //
     // This is to make argv[i] more readable inside the code
     //
-    const TString kFilename = arg.GetArgumentStr(0);
+    TString kFilename = arg.GetArgumentStr(0);
+    TString kInpathD  = arg.GetArgumentStr(1);
+
+    //if (!kIsSequence && !InflateRun(kFilename))
+    //    return 3;
 
 #ifdef HAVE_XPM
@@ -100,4 +153,13 @@
 #endif
 
+    /*
+    MEnv env(kConfig);
+    if (!env.IsValid())
+    {
+        gLog << err << "Configuration file " << kConfig << " not found." << endl;
+        return 0xfe;
+    }
+    */
+
     //
     // start the main window
@@ -107,5 +169,5 @@
     else
     {
-        MEventDisplay *d = new MEventDisplay(kFilename);
+        MEventDisplay *d = new MEventDisplay(kFilename, kInpathD);
         d->SetBit(MStatusDisplay::kExitLoopOnExit);
         d->SetTitle(kFilename);
Index: trunk/MagicSoft/Mars/mmain/MEventDisplay.cc
===================================================================
--- trunk/MagicSoft/Mars/mmain/MEventDisplay.cc	(revision 8616)
+++ trunk/MagicSoft/Mars/mmain/MEventDisplay.cc	(revision 8617)
@@ -1,4 +1,4 @@
 /* ======================================================================== *\
-! $Name: not supported by cvs2svn $:$Id: MEventDisplay.cc,v 1.60 2007-06-26 16:59:21 tbretz Exp $
+! $Name: not supported by cvs2svn $:$Id: MEventDisplay.cc,v 1.61 2007-06-28 19:49:30 tbretz Exp $
 ! --------------------------------------------------------------------------
 !
@@ -95,4 +95,6 @@
 // Container
 //
+#include "MSequence.h"                 // MSequence
+#include "MDirIter.h"                  // MDirIter
 #include "MHillas.h"                   // MHillas::Print(const MGeomCam&)
 #include "MHillasExt.h"                // MHillasExt::Print(const MGeomCam&)
@@ -118,10 +120,10 @@
 //  Constructor.
 //
-MEventDisplay::MEventDisplay(const char *fname) : MStatusDisplay(), fEvtLoop(0)
+MEventDisplay::MEventDisplay(const char *fname, const char *path) : MStatusDisplay(), fEvtLoop(0)
 {
     //
     // Setup Task list for hillas calculation
     //
-    SetupTaskList("Events", fname);
+    SetupTaskList("Events", fname, path);
 
     //
@@ -163,4 +165,7 @@
 {
     TFile f(fname, "READ");
+    if (f.IsZombie())
+        return 0; // Not a root file
+
     TTree *t = (TTree*)f.Get(tree);
     if (!t)
@@ -181,12 +186,9 @@
 //  preprocess tasks and read in first event (process)
 //
-void MEventDisplay::SetupTaskList(const char *tname, const char *fname)
-{
-//    MCalibrationChargeCam *ccam=0;
-//    MPedPhotCam           *pcam=0;
-
+void MEventDisplay::SetupTaskList(const char *tname, TString fname, const char *path)
+{
     MBadPixelsCam *badpix = new MBadPixelsCam;
 
-    const Int_t type = GetFileType(tname, fname);
+    Int_t type = GetFileType(tname, fname);
     switch (type)
     {
@@ -195,5 +197,14 @@
     case -2: gLog << err << "File type unknown... abort." << endl; return;
     case -1: gLog << err << "Tree " << tname << " not found... abort." << endl; return;
-    }
+    case  0: gLog << inf << "Assuming Sequence file." << endl; break;
+    }
+
+    if (type==0 && !MSequence::InflatePath(fname))
+        return;
+
+    // Check if file is a sequence...
+    MSequence *seq = type==0 ? new MSequence(fname, path) : new MSequence;
+    if (type==0)
+        type = 1;
 
     //
@@ -209,7 +220,17 @@
     plist->AddToList(tlist);
     plist->AddToList(badpix);
-
-    MReadMarsFile *read = new MReadMarsFile(tname, fname);
+    plist->AddToList(seq);
+
+    MReadMarsFile *read = new MReadMarsFile(tname);
     read->DisableAutoScheme();
+    if (seq->IsValid())
+    {
+        MDirIter iter;
+        if (seq->SetupDatRuns(iter, MSequence::kCalibrated)<=0)
+            return;
+        read->AddFiles(iter);
+    }
+    else
+        read->AddFile(fname);
     tlist->AddToList(read);
 
Index: trunk/MagicSoft/Mars/mmain/MEventDisplay.h
===================================================================
--- trunk/MagicSoft/Mars/mmain/MEventDisplay.h	(revision 8616)
+++ trunk/MagicSoft/Mars/mmain/MEventDisplay.h	(revision 8617)
@@ -38,5 +38,5 @@
 
     void UpdateDisplay();
-    void SetupTaskList(const char *tname, const char *fname);
+    void SetupTaskList(const char *tname, TString fname, const char *path);
 
     void ReadFirstEvent();
@@ -48,5 +48,5 @@
 
 public:
-    MEventDisplay(const char *fname);
+    MEventDisplay(const char *fname, const char *path="");
     ~MEventDisplay();
 
Index: trunk/MagicSoft/Mars/mmain/Makefile
===================================================================
--- trunk/MagicSoft/Mars/mmain/Makefile	(revision 8616)
+++ trunk/MagicSoft/Mars/mmain/Makefile	(revision 8617)
@@ -23,5 +23,5 @@
            -I../mfileio -I../mimage -I../mhistmc -I../mgbase -I../mfbase  \
            -I../mdata -I../msignal -I../mcalib -I../mbadpixels            \
-           -I../mpointing -I../mpedestal -I../mmuon -I../mfilter
+           -I../mpointing -I../mpedestal -I../mmuon -I../mfilter -I../mjobs
 
 SRCFILES = MBrowser.cc \
