Index: trunk/MagicSoft/Mars/Changelog
===================================================================
--- trunk/MagicSoft/Mars/Changelog	(revision 8243)
+++ trunk/MagicSoft/Mars/Changelog	(revision 8244)
@@ -25,4 +25,46 @@
    * mbase/MLogManip.h:
      - encapsulated an include in ifdefs
+
+   * mhcalib/MHCalibrationCam.cc, mhcalib/MHCalibrationChargeCam.cc:
+     - updated log-output
+
+   * mhflux/MHEnergyEst.cc:
+     - replaced difficult to see green by blue
+
+   * mjobs/MDataSet.[h,cc]:
+     - added datat members for path of sequences and path of data files
+       to be able to store overwritten defaults 
+     - check completeness of dataset files
+     - store a MSequence object in the list instead of the name and dir
+       (this is necessary to have all important information for a dataset
+        file, including the sequence number! - available)
+     - some changes to the output
+     - allow to print a perfect copy of the read dataset file to the console
+       just from the contents of the object
+
+   * mjobs/MJStar.cc:
+     - updated to use MSequence::GetFileName instead of MSequence:GetName
+
+   * mjobs/MSequence.[h,cc]:
+     - keep filename and datapath in header, this has some advantages
+       for sanity checks
+     - many improvements of sanity checking in case of missing or
+       unaccessible files
+     - Fixed "lightConditions" (was "LightCondition")
+     - Fixed "No_Moon"         (was "NoMoon")
+     - allow to set the data path as second argument in the constructor
+     - implemented a check whether the sequence file is complete
+
+   * mjobs/MJCut.[h,cc]:
+     - added some code (still commented out) to display the excess rate
+     - with the other changes we can now store the original dataset in
+       the output
+
+   * mjoptim/MJOptimize.cc:
+     - Keep the sequence files in the file list instead of just the
+       filename and the directory
+
+   * mjtrain/MJTrainDisp.cc:
+     - use return value of MDataSet::AddFilesOn/Off for a sanity check
 
 
Index: trunk/MagicSoft/Mars/mjobs/MDataSet.cc
===================================================================
--- trunk/MagicSoft/Mars/mjobs/MDataSet.cc	(revision 8243)
+++ trunk/MagicSoft/Mars/mjobs/MDataSet.cc	(revision 8244)
@@ -87,4 +87,5 @@
 #include "MRead.h"
 #include "MJob.h"
+#include "MEnv.h"
 #include "MAstro.h"
 #include "MDirIter.h"
@@ -155,6 +156,9 @@
 // The entries are sorted by filename.
 //
-void MDataSet::ResolveSequences(TEnv &env, const TArrayI &num, TList &list, const TString &sequences, const TString &data) const
-{
+void MDataSet::ResolveSequences(TEnv &env, const TArrayI &num, TList &list) const
+{
+    TString sequences = fPathSequences;
+    TString data      = fPathDataFiles;
+
     for (int i=0; i<num.GetSize(); i++)
     {
@@ -168,14 +172,11 @@
             dir = Form("%s%04d/%08d", data.Data(), num[i]/10000, num[i]);
 
-        gSystem->ExpandPathName(name);
-        gSystem->ExpandPathName(dir);
-
-        if (gSystem->AccessPathName(name, kFileExists))
-            gLog << warn << "WARNING - Sequence file '" << name << "' doesn't exist." << endl;
-
-        if (gSystem->AccessPathName(dir, kFileExists))
-            gLog << warn << "WARNING - Directory '" << dir << "' doesn't exist." << endl;
-
-        list.Add(new TNamed(name, dir));
+        // FIXME: The sequence number from the sequence file is assigned!!!
+        MSequence *seq = new MSequence(name, dir);
+
+        if (seq->IsValid() && seq->GetSequence()!=(UInt_t)num[i])
+            *fLog << warn << "WARNING - Sequence number " << num[i] << " in dataset file doesn't match sequence number " << seq->GetSequence() << " in sequence file!" << endl;
+
+        list.Add(seq);
     }
 
@@ -204,5 +205,5 @@
         gLog << err << "ERROR - Dataset file " << expname << " not accessible!" << endl;
 
-    TEnv env(expname);
+    MEnv env(expname);
     delete [] expname;
 
@@ -218,6 +219,9 @@
     SetupDefaultPath(data,      fgPathDataFiles);
 
-    ResolveSequences(env, fNumSequencesOn,  fSequencesOn,  sequences, data);
-    ResolveSequences(env, fNumSequencesOff, fSequencesOff, sequences, data);
+    fPathSequences = sequences;
+    fPathDataFiles = data;
+
+    ResolveSequences(env, fNumSequencesOn,  fSequencesOn);
+    ResolveSequences(env, fNumSequencesOff, fSequencesOff);
 
     fNameSource   = env.GetValue("SourceName", "");
@@ -228,4 +232,10 @@
     fNameSource = fNameSource.Strip(TString::kBoth);
     fCatalog    = fCatalog.Strip(TString::kBoth);
+
+    if (env.GetNumUntouched()>0)
+    {
+        gLog << warn << "WARNING - At least one resource in the dataset-file has not been touched!" << endl;
+        env.PrintUntouched();
+    }
 }
 
@@ -234,11 +244,11 @@
 // Return '+' if both can be accessed, '-' otherwise.
 //
-void MDataSet::PrintFile(const TObject &obj)
+void MDataSet::PrintFile(const MSequence &seq)
 {
     const Char_t access =
-        !gSystem->AccessPathName(obj.GetName(), kFileExists) &&
-        !gSystem->AccessPathName(obj.GetTitle(), kFileExists) ? '+' : '-';
-
-    gLog << " " << access << " " << obj.GetName() << " <" << obj.GetTitle() << ">" << endl;
+        !gSystem->AccessPathName(seq.GetFileName(), kFileExists) &&
+        !gSystem->AccessPathName(seq.GetDataPath(), kFileExists) ? '+' : '-';
+
+    gLog << "#  " << access << " " << seq.GetFileName() << " <" << seq.GetDataPath() << ">" << endl;
 }
 
@@ -272,19 +282,36 @@
     gLog << "Comment: " << fComment << endl;
 
+    if (fSequencesOn.GetEntries()>0)
+        gLog << endl;
+
+    TIter NextOn(&fSequencesOn);
+    TIter NextOff(&fSequencesOff);
+    MSequence *seq=0;
+    while ((seq=(MSequence*)NextOn()))
+    {
+        gLog << "Sequence" << Form("%08d", seq->GetSequence()) << ".File: " << seq->GetFileName() << endl;
+        gLog << "Sequence" << Form("%08d", seq->GetSequence()) << ".Dir:  " << seq->GetDataPath() << endl;
+    }
+    if (fSequencesOff.GetEntries()>0)
+        gLog << endl;
+    while ((seq=(MSequence*)NextOff()))
+    {
+        gLog << "Sequence" << Form("%08d", seq->GetSequence()) << ".File: " << seq->GetFileName() << endl;
+        gLog << "Sequence" << Form("%08d", seq->GetSequence()) << ".Dir:  " << seq->GetDataPath() << 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 << "# On-Data Files:" << endl;
+        NextOn.Reset();
+        while ((seq=(MSequence*)NextOn()))
+            PrintFile(*seq);
 
         gLog << endl;
-        gLog << "Off-Data Files:" << endl;
-        TIter NextOff(&fSequencesOff);
-        while ((obj=NextOff()))
-            PrintFile(*obj);
+        gLog << "# Off-Data Files:" << endl;
+        NextOff.Reset();
+        while ((seq=(MSequence*)NextOff()))
+            PrintFile(*seq);
 
         return;
@@ -300,20 +327,18 @@
 {
     TIter Next(const_cast<TList*>(&list));
-    TObject *o=0;
-
-    while ((o=Next()))
-    {
-        MSequence seq(o->GetName());
-        if (!seq.IsValid())
+
+    MSequence *seq=0;
+    while ((seq=(MSequence*)Next()))
+    {
+        if (!seq->IsValid())
         {
-            gLog << warn;
-            gLog << "WARNING - MDataSet::AddSequencesFromList: Sequence invalid!" << endl;
-            gLog << "  + File: " << o->GetName() << endl;
-            gLog << "  + Dir:  " << o->GetTitle() << endl;
+            gLog << err;
+            gLog << "ERROR - MDataSet::AddSequencesFromList: Sequence invalid!" << endl;
+            gLog << "  + File: " << seq->GetFileName() << endl;
+            gLog << "  + Dir:  " << seq->GetDataPath() << endl;
             return kFALSE;
         }
 
-        const TString dir(o->GetTitle());
-        if (seq.SetupDatRuns(files, MSequence::kImages, dir.IsNull() ? 0 : dir.Data())<=0)
+        if (seq->SetupDatRuns(files, MSequence::kImages)<=0)
             return kFALSE;
     }
Index: trunk/MagicSoft/Mars/mjobs/MDataSet.h
===================================================================
--- trunk/MagicSoft/Mars/mjobs/MDataSet.h	(revision 8243)
+++ trunk/MagicSoft/Mars/mjobs/MDataSet.h	(revision 8244)
@@ -14,4 +14,5 @@
 class MRead;
 class MDirIter;
+class MSequence;
 class MPointingPos;
 
@@ -24,4 +25,7 @@
 
     UInt_t  fNumAnalysis;     // Analysis number (artificial)
+
+    TString fPathSequences;
+    TString fPathDataFiles;
 
     TArrayI fNumSequencesOn;  // number of on-sequences
@@ -39,6 +43,6 @@
 
     void Split(TString &runs, TArrayI &data) const;
-    void ResolveSequences(TEnv &env, const TArrayI &num, TList &list, const TString &sequences, const TString &data) const;
-    static void PrintFile(const TObject &obj);
+    void ResolveSequences(TEnv &env, const TArrayI &num, TList &list/*, const TString &sequences, const TString &data*/) const;
+    static void PrintFile(const MSequence &obj);
 
     void ReplaceDir(TList &list, const TString &old, const TString &news) const;
Index: trunk/MagicSoft/Mars/mjobs/MJCut.cc
===================================================================
--- trunk/MagicSoft/Mars/mjobs/MJCut.cc	(revision 8243)
+++ trunk/MagicSoft/Mars/mjobs/MJCut.cc	(revision 8244)
@@ -62,4 +62,7 @@
 #include "MWriteRootFile.h"
 
+// Filter
+//#include "MFDataMember.h"
+
 // Fit signal environment
 #include "../mhflux/MAlphaFitter.h"
@@ -270,5 +273,5 @@
 // analysis number num, see GetOutputFile()
 //
-Bool_t MJCut::WriteResult(const MParList &plist, UInt_t num) const
+Bool_t MJCut::WriteResult(const MParList &plist, const MDataSet &set) const
 {
     TObjArray arr;
@@ -286,4 +289,8 @@
         arr.Add((TObject*)(&halpha->GetAlphaFitter()));
 
+    // Save also the dataset
+    arr.Add(const_cast<MDataSet*>(&set));
+
+    const Int_t num = set.GetNumAnalysis();
     const TString fname(fNameOutput.IsNull() ? Form("ganymed%08d.root", num) : fNameOutput.Data());
 
@@ -577,7 +584,8 @@
 
     // Initialize default binnings
-    MBinning bins1(18,  0,     90,    "BinningAlpha", "lin");
-    MBinning bins2(15, 10,     1e6 ,  "BinningSize",  "log");
-    MBinning bins3(67, -0.005, 0.665, "BinningTheta", "asin");
+    MBinning bins1( 18,  0,     90,    "BinningAlpha",  "lin");
+    MBinning bins2( 15, 10,     1e6 ,  "BinningSize",   "log");
+    MBinning bins3( 67, -0.005, 0.665, "BinningTheta",  "asin");
+    //MBinning binsT(150,  0,     150,   "BinningDeltaT", "lin");
     MBinning bins4("BinningFalseSource");
     MBinning bins5("BinningWidth");
@@ -597,5 +605,5 @@
     plist.AddToList(&bins9);
     plist.AddToList(&bins0);
-    //plist.AddToList(&binsa);
+    //plist.AddToList(&binsT);
 
     // --------------------------------------------------------------------------------
@@ -662,4 +670,5 @@
     MFillH fill6a("MHImgParOffPost [MHImagePar]",    "MImagePar",    "FillImgParPost");
     MFillH fill7a("MHNewParOffPost [MHNewImagePar]", "MNewImagePar", "FillNewParPost");
+    //MFillH fill9a("MHEffOffTime    [MHEffectiveOnTime]", "MTime",        "FillEffOnTime");
     fill1a.SetNameTab("PreCut");
     fill2a.SetNameTab("PostCut");
@@ -669,4 +678,8 @@
     fill6a.SetNameTab("ImgPar");
     fill7a.SetNameTab("NewPar");
+    //fill9a.SetNameTab("EffOffT");
+
+    //MFDataMember fbin("Bin.fVal", '>', 0);
+    //fill9a.SetFilter(&fbin);
 
     MPrint print2("MEffectiveOnTime");
@@ -722,5 +735,12 @@
     }
     if (!fWriteOnly)
+    {
         tlist2.AddToList(&falpha);
+        /* if (!fIsMonteCarlo)
+        {
+            tlist2.AddToList(&fbin);
+            tlist2.AddToList(&fill9a);
+        } */
+    }
     tlist2.AddToList(&cont3);
     if (write1)
@@ -810,4 +830,5 @@
     MFillH fill6b("MHImgParOnPost [MHImagePar]",    "MImagePar",    "FillImgParPost");
     MFillH fill7b("MHNewParOnPost [MHNewImagePar]", "MNewImagePar", "FillNewParPost");
+    //MFillH fill9b("MHEffOnTime    [MHEffectiveOnTime]", "MTime",        "FillEffOnTime");
     fill1b.SetNameTab("PreCut");
     fill2b.SetNameTab("PostCut");
@@ -817,4 +838,5 @@
     fill6b.SetNameTab("ImgPar");
     fill7b.SetNameTab("NewPar");
+    //fill9b.SetNameTab("EffOnT");
     fill1b.SetDrawOption(set.HasOffSequences()||fIsWobble?"same":"");
     fill2b.SetDrawOption(set.HasOffSequences()||fIsWobble?"same":"");
@@ -824,4 +846,6 @@
     fill6b.SetDrawOption(set.HasOffSequences()||fIsWobble?"same":"");
     fill7b.SetDrawOption(set.HasOffSequences()||fIsWobble?"same":"");
+
+    //fill9b.SetFilter(&fbin);
 
     /*
@@ -891,4 +915,6 @@
         }
         tlist2.Replace(&falpha2);
+        //if (!fIsMonteCarlo)
+        //    tlist2.Replace(&fill9b);
         if (!fIsWobble || !fNameHist.IsNull())
             tlist2.Replace(&ffs2);
@@ -925,5 +951,5 @@
     // FIXME: Perform fit and plot energy dependant alpha plots
     // and fit result to new tabs!
-    if (!WriteResult(plist, set.GetNumAnalysis()))
+    if (!WriteResult(plist, set))
         return kFALSE;
 
Index: trunk/MagicSoft/Mars/mjobs/MJCut.h
===================================================================
--- trunk/MagicSoft/Mars/mjobs/MJCut.h	(revision 8243)
+++ trunk/MagicSoft/Mars/mjobs/MJCut.h	(revision 8244)
@@ -42,5 +42,5 @@
     void     SetupWriter(MWriteRootFile *write, const char *name) const;
     Bool_t   WriteTasks(UInt_t num, TObjArray &cont) const;
-    Bool_t   WriteResult(const MParList &plist, UInt_t num) const;
+    Bool_t   WriteResult(const MParList &plist, const MDataSet &set) const;
     MHAlpha *CreateNewHist(MParList &plist, const char *name="") const;
     MH      *CreateNewHistFS(MParList &plist, const char *name="") const;
Index: trunk/MagicSoft/Mars/mjobs/MJStar.cc
===================================================================
--- trunk/MagicSoft/Mars/mjobs/MJStar.cc	(revision 8243)
+++ trunk/MagicSoft/Mars/mjobs/MJStar.cc	(revision 8244)
@@ -136,5 +136,5 @@
     fLog->Separator(GetDescriptor());
     *fLog << "Calculate image parameters of sequence ";
-    *fLog << fSequence.GetName() << endl;
+    *fLog << fSequence.GetFileName() << endl;
     *fLog << endl;
 
Index: trunk/MagicSoft/Mars/mjobs/MSequence.cc
===================================================================
--- trunk/MagicSoft/Mars/mjobs/MSequence.cc	(revision 8243)
+++ trunk/MagicSoft/Mars/mjobs/MSequence.cc	(revision 8244)
@@ -130,4 +130,5 @@
 #include "MLogManip.h"
 
+#include "MEnv.h"
 #include "MJob.h"
 #include "MAstro.h"
@@ -202,4 +203,6 @@
 {
     TString d(path);
+    if (d.IsNull())
+        d = fDataPath;
 
     const Bool_t def = d.IsNull();
@@ -207,5 +210,5 @@
     // For this particular case we assume that the files are added one by
     // one without wildcards.
-    const Int_t n0  = iter.GetNumEntries();
+    const Int_t n0 = iter.GetNumEntries();
 
     // Setup path
@@ -291,4 +294,21 @@
         }
 
+        // Check existance and accessibility of file
+        MDirIter file(d, n, 0);
+        TString name = file();
+        gSystem->ExpandPathName(name);
+        if (gSystem->AccessPathName(name, kFileExists))
+        {
+            *fLog << err;
+            *fLog << "ERROR - File " << d << n << " not accessible!" << endl;
+            return 0;
+        }
+        if (!file().IsNull())
+        {
+            *fLog << err;
+            *fLog << "ERROR - Searching for file " << d << n << " gave more than one result!" << endl;
+            return 0;
+        }
+
         // Add Path/File to TIter
         iter.AddDirectory(d, n, 0);
@@ -358,8 +378,8 @@
 MSequence::LightCondition_t MSequence::ReadLightCondition(TEnv &env) const
 {
-    TString str = env.GetValue("LightCondition", "n/a");
+    TString str = env.GetValue("LightConditions", "n/a");
     if (!str.CompareTo("n/a", TString::kIgnoreCase))
         return kNA;
-    if (!str.CompareTo("NoMoon", TString::kIgnoreCase))
+    if (!str.CompareTo("No_Moon", TString::kIgnoreCase))
         return kNoMoon;
     if (!str.CompareTo("Twilight", TString::kIgnoreCase))
@@ -370,5 +390,7 @@
         return kDay;
 
-    gLog << warn << "MSequence: LightCondition-tag not n/a, nomoon, twilight, moon or day." << endl;
+    gLog << warn;
+    gLog << "WARNING - in " << fFileName << ":" << endl;
+    gLog << "          LightCondition-tag is '" << str << "' but must be n/a, no_moon, twilight, moon or day." << endl;
     return kNA;
 }
@@ -378,22 +400,29 @@
 // Read the file fname as setup file for the sequence.
 //
-MSequence::MSequence(const char *fname)
+MSequence::MSequence(const char *fname, const char *path)
 {
     fName  = fname;
-
-    const char *expname = gSystem->ExpandPathName(fname);
-
-    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);
-    delete [] expname;
-
-    TString str;
-
-    fSequence  = env.GetValue("Sequence",  -1);
+    fTitle = path;
+
+    fFileName = fname;
+    fDataPath = path;
+
+    gSystem->ExpandPathName(fName);
+    gSystem->ExpandPathName(fTitle);
+
+    const Bool_t rc1 = gSystem->AccessPathName(fName, kFileExists);
+    const Bool_t rc2 = gSystem->AccessPathName(fTitle, kFileExists);
+
+    if (rc1)
+        gLog << err << "ERROR - Sequence file '" << fName << "' doesn't exist." << endl;
+    if (rc2)
+        gLog << err << "ERROR - Directory '" << fTitle << "' doesn't exist." << endl;
+
+    MEnv env(fName);
+
+    fSequence  = env.GetValue("Sequence", -1);
+    if (rc1 || rc2)
+        fSequence = (UInt_t)-1;
+
     fLastRun   = env.GetValue("LastRun",   -1);
     fNumEvents = env.GetValue("NumEvents", -1);
@@ -402,4 +431,5 @@
     fLightCondition = ReadLightCondition(env);
 
+    TString str;
     str = env.GetValue("Start", "");
     fStart.SetSqlDateTime(str);
@@ -426,4 +456,16 @@
     GetFileNames(env, fPedRuns);
     GetFileNames(env, fDatRuns);
+
+    // Dummies:
+    env.GetValue("ZdMin", 0);
+    env.GetValue("ZdMax", 0);
+    env.GetValue("L1TriggerTable", 0);
+    env.GetValue("L2TriggerTable", 0);
+
+    if (env.GetNumUntouched()>0)
+    {
+        gLog << warn << "WARNING - At least one resource in the dataset-file has not been touched!" << endl;
+        env.PrintUntouched();
+    }
 }
 
@@ -437,5 +479,5 @@
     if (!IsValid())
     {
-        gLog << "Sequence: " << fName << " <invalid>" << endl;
+        gLog << "Sequence: " << fFileName << " <invalid>" << endl;
         return;
     }
@@ -475,4 +517,7 @@
         gLog << " " << fDatRuns[i];
     gLog << endl;
+
+    if (!fDataPath.IsNull())
+        gLog << endl << "DataPath: " << fDataPath << endl;
 }
 
@@ -480,8 +525,10 @@
 //
 // Add all ped runs from the sequence to MDirIter.
-// If path==0 the standard path of the data-center is assumed.
+// If path==0 fDataPath is used instead. If it is also empty
+// the standard path of the data-center is assumed.
 // If you have the runs locally use path="."
 // Using raw=kTRUE you get correspodning raw-files setup.
 // Return the number of files added.
+//
 UInt_t MSequence::SetupPedRuns(MDirIter &iter, const char *path, Bool_t raw) const
 {
@@ -492,5 +539,6 @@
 //
 // Add all data runs from the sequence to MDirIter.
-// If path==0 the standard path of the data-center is assumed.
+// If path==0 fDataPath is used instead. If it is also empty
+// the standard path of the data-center is assumed.
 // If you have the runs locally use path="."
 // Using raw=kTRUE you get correspodning raw-files setup.
@@ -505,5 +553,6 @@
 //
 // Add all runs from the sequence to MDirIter.
-// If path==0 the standard path of the data-center is assumed.
+// If path==0 fDataPath is used instead. If it is also empty
+// the standard path of the data-center is assumed.
 // If you have the runs locally use path="."
 // Using raw=kTRUE you get correspodning raw-files setup.
@@ -518,5 +567,6 @@
 //
 // Add all calibration runs from the sequence to MDirIter.
-// If path==0 the standard path of the data-center is assumed.
+// If path==0 fDataPath is used instead. If it is also empty
+// the standard path of the data-center is assumed.
 // If you have the runs locally use path="."
 // Using raw=kTRUE you get correspodning raw-files setup.
@@ -531,5 +581,6 @@
 //
 // Add all data runs from the sequence to MDirIter.
-// If path==0 the standard path of the data-center is assumed.
+// If path==0 fDataPath is used instead. If it is also empty
+// the standard path of the data-center is assumed.
 // If you have the runs locally use path="."
 // Using raw=kTRUE you get correspodning raw-files setup.
Index: trunk/MagicSoft/Mars/mjoptim/MJOptimize.cc
===================================================================
--- trunk/MagicSoft/Mars/mjoptim/MJOptimize.cc	(revision 8243)
+++ trunk/MagicSoft/Mars/mjoptim/MJOptimize.cc	(revision 8244)
@@ -236,5 +236,5 @@
 //------------------------------------------------------------------------
 //
-// Add seqeunces from list to reader
+// Add sequences from list to reader
 //
 Bool_t MJOptimize::AddSequences(MRead &read, TList &list) const
@@ -243,11 +243,10 @@
 
     TIter Next(&list);
-    TObject *o=0;
-    while ((o=Next()))
-    {
-        MSequence seq(o->GetName());
-        if (!seq.IsValid())
+    MSequence *seq=0;
+    while ((seq=(MSequence*)Next()))
+    {
+        if (!seq->IsValid())
             return kFALSE;
-        if (seq.SetupDatRuns(files, o->GetTitle(), "I")<=0)
+        if (seq->SetupDatRuns(files)<=0)
             return kFALSE;
     }
@@ -264,5 +263,5 @@
 void MJOptimize::AddSequenceOn(const char *fname, const char *dir)
 {
-    fNamesOn.Add(new TNamed(fname, dir));
+    fNamesOn.Add(new MSequence(fname, dir));
 }
 
@@ -275,5 +274,5 @@
 void MJOptimize::AddSequenceOff(const char *fname, const char *dir)
 {
-    fNamesOff.Add(new TNamed(fname, dir));
+    fNamesOff.Add(new MSequence(fname, dir));
 }
 
Index: trunk/MagicSoft/Mars/mjtrain/MJTrainDisp.cc
===================================================================
--- trunk/MagicSoft/Mars/mjtrain/MJTrainDisp.cc	(revision 8243)
+++ trunk/MagicSoft/Mars/mjtrain/MJTrainDisp.cc	(revision 8244)
@@ -109,6 +109,8 @@
     readtst.DisableAutoScheme();
 
-    set.AddFilesOn(readtrn);
-    set.AddFilesOff(readtst);
+    if (!set.AddFilesOn(readtrn))
+        return kFALSE;
+    if (!set.AddFilesOff(readtst))
+        return kFALSE;
 
     // ----------------------- Setup Matrix ------------------
