Index: /trunk/MagicSoft/Mars/Changelog
===================================================================
--- /trunk/MagicSoft/Mars/Changelog	(revision 7379)
+++ /trunk/MagicSoft/Mars/Changelog	(revision 7380)
@@ -18,4 +18,19 @@
 
                                                  -*-*- END OF LINE -*-*-
+
+ 2005/10/01 Thomas Bretz
+
+   * mjobs/MDataSet.[h,cc]:
+     - implemented two new options for constructor allowing to
+       change the default path to image data and sequence files
+     - fixed some typos
+
+   * mjobs/MSequence.[h,cc]:
+     - implemented new light condition "day" for completeness
+
+   * ganymed.cc:
+     - implemented twonew options --ind and --ins
+
+
 
  2005/10/01
Index: /trunk/MagicSoft/Mars/NEWS
===================================================================
--- /trunk/MagicSoft/Mars/NEWS	(revision 7379)
+++ /trunk/MagicSoft/Mars/NEWS	(revision 7380)
@@ -2,4 +2,10 @@
 
  *** Version  <cvs>
+
+   - ganymed: Implemented two new options which allow
+     to overwrite the default path to search for the sequence files
+       --ins=/magic/sequences
+     and where to search for the image data
+       --ind=/magic/data/star
 
 
Index: /trunk/MagicSoft/Mars/ganymed.cc
===================================================================
--- /trunk/MagicSoft/Mars/ganymed.cc	(revision 7379)
+++ /trunk/MagicSoft/Mars/ganymed.cc	(revision 7380)
@@ -63,4 +63,6 @@
     gLog << "   --n=[n]                   Analysis number" << endl;
     gLog << "   --out=path                Path to write the all output to [def=local path]" << endl;
+    gLog << "   --ind=path                Path to data/star files [default=datacenter path]" << endl;
+    gLog << "   --ins=path                Path to sequence files [default=datacenter path]" << endl;
     gLog << "   --outf=filename           Filename for output file (eg. status display)" << endl;
     gLog << "   --sum[=filename]          Enable writing of summary file (events after cut0)" << endl;
@@ -127,4 +129,6 @@
     const TString kOutpath       = arg.GetStringAndRemove("--out=",  ".");
     const TString kOutfile       = arg.GetStringAndRemove("--outf=",  "");
+    const TString kPathDataFiles = arg.GetStringAndRemove("--ind=",  "");
+    const TString kPathSequences = arg.GetStringAndRemove("--ins=",  "");
     const Bool_t  kWriteSummary  = arg.HasOnlyAndRemove("--sum");
     const TString kNameSummary   = arg.GetStringAndRemove("--sum=");
@@ -180,5 +184,5 @@
     // Setup sequence and check its validity
     //
-    MDataSet seq(kSequences);
+    MDataSet seq(kSequences, kPathSequences, kPathDataFiles);
     if (kNumAnalysis>=0)
         seq.SetNumAnalysis(kNumAnalysis);
Index: /trunk/MagicSoft/Mars/mjobs/MDataSet.cc
===================================================================
--- /trunk/MagicSoft/Mars/mjobs/MDataSet.cc	(revision 7379)
+++ /trunk/MagicSoft/Mars/mjobs/MDataSet.cc	(revision 7380)
@@ -96,4 +96,8 @@
 using namespace std;
 
+const TString MDataSet::fgCatalog       = "/magic/datacenter/setup/magic_favorites.edb";
+const TString MDataSet::fgPathDataFiles = "/magic/data/star";
+const TString MDataSet::fgPathSequences = "/magic/sequences";
+
 // --------------------------------------------------------------------------
 //
@@ -151,5 +155,5 @@
 // The entries are sorted by filename.
 //
-void MDataSet::ResolveSequences(TEnv &env, const TArrayI &num, TList &list) const
+void MDataSet::ResolveSequences(TEnv &env, const TArrayI &num, TList &list, const TString &sequences, const TString &data) const
 {
     for (int i=0; i<num.GetSize(); i++)
@@ -158,12 +162,12 @@
         TString dir  = env.GetValue(Form("Sequence%08d.Dir",  num[i]), "");
 
+        // Set default sequence file and dir name
+        if (name.IsNull())
+            name = Form("%s%04d/sequence%08d.txt", sequences.Data(), num[i]/10000, num[i]);
+        if (dir.IsNull())
+            dir = Form("%s%04d/%08d", data.Data(), num[i]/10000, num[i]);
+
         gSystem->ExpandPathName(name);
         gSystem->ExpandPathName(dir);
-
-        // Set default sequence file and dir name
-        if (name.IsNull())
-            name = Form("/magic/sequences/%04d/sequence%08d.txt", num[i]/10000, num[i]);
-        if (dir.IsNull())
-            dir = Form("/magic/data/star/%04d/%08d", num[i]/10000, num[i]);
 
         if (gSystem->AccessPathName(name, kFileExists))
@@ -185,5 +189,5 @@
 // Read the file fname as setup file for the sequence.
 //
-MDataSet::MDataSet(const char *fname)
+MDataSet::MDataSet(const char *fname, TString sequences, TString data)
 {
     fName  = fname;
@@ -191,31 +195,31 @@
     const char *expname = gSystem->ExpandPathName(fname);
 
-    fTitle = Form("Sequences contained in file %s", expname);
+    fTitle = Form("Dataset contained in file %s", expname);
+
+    const Bool_t access = !gSystem->AccessPathName(expname, kFileExists);
+    if (!access)
+        gLog << err << "ERROR - Dataset file " << expname << " not accessible!" << endl;
 
     TEnv env(expname);
     delete [] expname;
 
+    fNumAnalysis = env.GetValue("AnalysisNumber",  -1);
+
     TString str;
-
-    fNumAnalysis = env.GetValue("AnalysisNumber",  -1);
-
-    str = env.GetValue("SequencesOn", "");
+    str = env.GetValue("SequencesOn",  "");
     Split(str, fNumSequencesOn);
     str = env.GetValue("SequencesOff", "");
     Split(str, fNumSequencesOff);
 
-    ResolveSequences(env, fNumSequencesOn,  fSequencesOn);
-    ResolveSequences(env, fNumSequencesOff, fSequencesOff);
-
+    SetupDefaultPath(sequences, fgPathSequences);
+    SetupDefaultPath(data,      fgPathDataFiles);
+
+    ResolveSequences(env, fNumSequencesOn,  fSequencesOn,  sequences, data);
+    ResolveSequences(env, fNumSequencesOff, fSequencesOff, sequences, data);
 
     fNameSource   = env.GetValue("SourceName", "");
-    fCatalog      = env.GetValue("Catalog",    "~/Software/data/magic_favorites.edb");
+    fCatalog      = env.GetValue("Catalog",    fgCatalog);
     fIsWobbleMode = env.GetValue("WobbleMode", kFALSE);
-
-    //Print();
-    /*
-     GetFileNames(env, fSequencesOn);
-     GetFileNames(env, fSequencesOff);
-     */
+    fComment      = env.GetValue("Comment",    "");
 }
 
@@ -226,6 +230,9 @@
 void MDataSet::PrintFile(const TObject &obj)
 {
-    const Bool_t access = !gSystem->AccessPathName(obj.GetName(), kFileExists) && !gSystem->AccessPathName(obj.GetTitle(), kFileExists) ? '+' : '-';
-    gLog << " " << (access?"+":"-") << " " << obj.GetName() << " <" << obj.GetTitle() << ">" << endl;
+    const Char_t access =
+        !gSystem->AccessPathName(obj.GetName(), kFileExists) &&
+        !gSystem->AccessPathName(obj.GetTitle(), kFileExists) ? '+' : '-';
+
+    gLog << " " << access << " " << obj.GetName() << " <" << obj.GetTitle() << ">" << endl;
 }
 
@@ -242,35 +249,39 @@
         return;
     }
-    gLog << "Analysis Number: " << fNumAnalysis << endl;
-    gLog << "Sequences On:   ";
+    gLog << "AnalysisNumber: " << fNumAnalysis << endl << endl;
+    gLog << "SequencesOn:   ";
     for (int i=0; i<fNumSequencesOn.GetSize(); i++)
         gLog << " " << fNumSequencesOn[i];
     gLog << endl;
-    gLog << "Sequences Off:  ";
+    gLog << "SequencesOff:  ";
     for (int i=0; i<fNumSequencesOff.GetSize(); i++)
         gLog << " " << fNumSequencesOff[i];
-    gLog << endl;
+    gLog << endl << endl;
 
     gLog << "SourceName: " << fNameSource << endl;
-    gLog << "Catalog:    " << fCatalog << endl;
-
-    gLog << "WobbleMode: " << (fIsWobbleMode?"On":"Off") << endl;
-
-    if (!TString(o).Contains("files", TString::kIgnoreCase))
+    gLog << "Catalog: " << fCatalog << endl;
+
+    gLog << "WobbleMode: " << (fIsWobbleMode?"On":"Off") << endl << endl;
+
+    gLog << "Comment: " << fComment << endl;
+
+    if (TString(o).Contains("files", TString::kIgnoreCase))
+    {
+        TObject *obj=0;
+
+        gLog << endl;
+        gLog << "On-Data Files:" << endl;
+        TIter NextOn(&fSequencesOn);
+        while ((obj=NextOn()))
+            PrintFile(*obj);
+
+        gLog << endl;
+        gLog << "Off-Data Files:" << endl;
+        TIter NextOff(&fSequencesOff);
+        while ((obj=NextOff()))
+            PrintFile(*obj);
+
         return;
-
-    TObject *obj=0;
-
-    gLog << endl;
-    gLog << "On-Data Files:" << endl;
-    TIter NextOn(&fSequencesOn);
-    while ((obj=NextOn()))
-        PrintFile(*obj);
-
-    gLog << endl;
-    gLog << "Off-Data Files:" << endl;
-    TIter NextOff(&fSequencesOff);
-    while ((obj=NextOff()))
-        PrintFile(*obj);
+    }
 }
 
@@ -481,2 +492,34 @@
     return kTRUE;
 }
+
+// --------------------------------------------------------------------------
+//
+// Calls ReplaceAll(old, news) for all Dir-entries
+//
+void MDataSet::ReplaceDir(TList &list, const TString &old, const TString &news) const
+{
+    TIter Next(&list);
+    TNamed *name = 0;
+    while ((name=(TNamed*)Next()))
+    {
+        TString dir = name->GetTitle();
+        dir.ReplaceAll(old, news);
+        name->SetTitle(dir);
+    }
+}
+
+// --------------------------------------------------------------------------
+//
+// Calls ReplaceAll(old, news) for all File-entries
+//
+void MDataSet::ReplaceFile(TList &list, const TString &old, const TString &news) const
+{
+    TIter Next(&list);
+    TNamed *name = 0;
+    while ((name=(TNamed*)Next()))
+    {
+        TString file = name->GetName();
+        file.ReplaceAll(old, news);
+        name->SetName(file);
+    }
+}
Index: /trunk/MagicSoft/Mars/mjobs/MDataSet.h
===================================================================
--- /trunk/MagicSoft/Mars/mjobs/MDataSet.h	(revision 7379)
+++ /trunk/MagicSoft/Mars/mjobs/MDataSet.h	(revision 7380)
@@ -19,4 +19,8 @@
 {
 private:
+    static const TString fgCatalog;       //! Default Catalog path
+    static const TString fgPathDataFiles; //! Default path to data files
+    static const TString fgPathSequences; //! Default path to sequences
+
     UInt_t  fNumAnalysis;     // Analysis number (artificial)
 
@@ -30,13 +34,26 @@
     TString fCatalog;         // edb catalog (magic_favourites.edb)
 
+    TString fComment;         // Comment from DS file
+
     Bool_t  fIsWobbleMode;    // Wobble Mode for this dataset?
 
     void Split(TString &runs, TArrayI &data) const;
-    void ResolveSequences(TEnv &env, const TArrayI &num, TList &list) const;
+    void ResolveSequences(TEnv &env, const TArrayI &num, TList &list, const TString &sequences, const TString &data) const;
     static void PrintFile(const TObject &obj);
+
+    void ReplaceDir(TList &list, const TString &old, const TString &news) const;
+    void ReplaceFile(TList &list, const TString &old, const TString &news) const;
+
+    void SetupDefaultPath(TString &path, const TString &def) const
+    {
+        if (path.IsNull())
+            path = def;
+        if (!path.EndsWith("/"))
+            path += "/";
+    }
 
 public:
     MDataSet() : fNumAnalysis((UInt_t)-1) { }
-    MDataSet(const char *fname);
+    MDataSet(const char *fname, TString sequences="", TString data="");
 
     // Getter
@@ -71,4 +88,16 @@
     Bool_t AddFilesOff(TChain &read) const;
 
+    void ReplaceDir(const TString &old, const TString &news)
+    {
+        ReplaceDir(fSequencesOn,  old, news);
+        ReplaceDir(fSequencesOff, old, news);
+    }
+
+    void ReplaceFile(const TString &old, const TString &news)
+    {
+        ReplaceFile(fSequencesOn,  old, news);
+        ReplaceFile(fSequencesOff, old, news);
+    }
+
     // TObject
     void Print(Option_t *o="") const;
Index: /trunk/MagicSoft/Mars/mjobs/MSequence.cc
===================================================================
--- /trunk/MagicSoft/Mars/mjobs/MSequence.cc	(revision 7379)
+++ /trunk/MagicSoft/Mars/mjobs/MSequence.cc	(revision 7380)
@@ -337,6 +337,8 @@
     if (!str.CompareTo("Moon", TString::kIgnoreCase))
         return kMoon;
-
-    gLog << warn << "MSequence: LightCondition-tag not n/a, nomoon, twilight or moon." << endl;
+    if (!str.CompareTo("Day", TString::kIgnoreCase))
+        return kDay;
+
+    gLog << warn << "MSequence: LightCondition-tag not n/a, nomoon, twilight, moon or day." << endl;
     return kNA;
 }
@@ -353,4 +355,8 @@
 
     fTitle = Form("Sequence contained in file %s", expname);
+
+    const Bool_t access = !gSystem->AccessPathName(expname, kFileExists);
+    if (!access)
+        gLog << err << "ERROR - Dataset file " << expname << " not accessible!" << endl;
 
     TEnv env(expname);
@@ -414,4 +420,5 @@
     case kTwilight: gLog << "Twilight" << endl; break;
     case kMoon:     gLog << "Moon" << endl;     break;
+    case kDay:      gLog << "Day" << endl;     break;
     }
     gLog << "Start:          " << fStart << endl;
Index: /trunk/MagicSoft/Mars/mjobs/MSequence.h
===================================================================
--- /trunk/MagicSoft/Mars/mjobs/MSequence.h	(revision 7379)
+++ /trunk/MagicSoft/Mars/mjobs/MSequence.h	(revision 7380)
@@ -19,5 +19,5 @@
 {
 public:
-    enum LightCondition_t { kNA, kNoMoon, kTwilight, kMoon };
+    enum LightCondition_t { kNA, kNoMoon, kTwilight, kMoon, kDay };
     enum FileType_t {
         kRawDat, kRawPed, kRawCal, kRawAll,
