Index: /trunk/MagicSoft/Mars/Changelog
===================================================================
--- /trunk/MagicSoft/Mars/Changelog	(revision 9440)
+++ /trunk/MagicSoft/Mars/Changelog	(revision 9441)
@@ -18,4 +18,29 @@
 
                                                  -*-*- END OF LINE -*-*-
+ 2009/05/10 Thomas Bretz
+
+   * ceres.cc:
+     - added usage of sequence files
+     - added new options for pedestal and calibration mode
+
+   * mbase/MDirIter.[h,cc]:
+     - added AddFile member function
+
+   * mgeom/MGeomPix.h:
+     - added Getter for Width in x and y
+
+   * mjobs/MJSimulation.[h,cc]:
+     - added fOperationMode
+     - added use of sequence
+     - name ceres file according to sequence number
+     - changes to the binnings 
+
+   * mjobs/MSequence.[h,cc]:
+     - unified the usual and the default constructor
+     - don't output default values in Print
+     - added kCorsika files
+
+
+
  2009/04/29 Thomas Bretz
 
Index: /trunk/MagicSoft/Mars/NEWS
===================================================================
--- /trunk/MagicSoft/Mars/NEWS	(revision 9440)
+++ /trunk/MagicSoft/Mars/NEWS	(revision 9441)
@@ -41,4 +41,9 @@
      initialized. The effect might be random but seems to be small.
 
+   * Now accepts sequence files as input
+
+   * creation of pedestal and calibration files is now steered by
+     --mode (see ceres help)
+
  ;callisto:
 
@@ -46,5 +51,5 @@
      calibrated (ceres files worked)
 
- ;star;
+ ;star:
 
    * allow to run thru even if discriminator threshold are missing
Index: /trunk/MagicSoft/Mars/ceres.cc
===================================================================
--- /trunk/MagicSoft/Mars/ceres.cc	(revision 9440)
+++ /trunk/MagicSoft/Mars/ceres.cc	(revision 9441)
@@ -15,4 +15,5 @@
 #include "MEnv.h"
 #include "MArgs.h"
+#include "MDirIter.h"
 
 #include "MJSimulation.h"
@@ -39,6 +40,7 @@
     gLog << all << endl;
     gLog << "Sorry the usage is:" << endl;
-    gLog << "   ceres [options] inputfile" << endl << endl;
-    gLog << "     inputfile               MMCS (CORSIKA) binary (cherenkov) file." << endl;
+    gLog << "   ceres [options] [inputfiles|sequence.txt]" << endl << endl;
+    gLog << "     inputfiles              MMCS (CORSIKA) binary (cherenkov) files, wildcards allowed." << endl;
+    gLog << "     sequence.txt            A sequence file." << endl;
     gLog << " Root Options:" << endl;
     gLog << "   -b                        Batch mode (no graphical output to screen)" << endl<<endl;
@@ -49,5 +51,5 @@
     gLog << "   --debug-env=2             Display untouched resources after eventloop setup" << endl;
     gLog << "   --debug-env=3             Debug setting resources from resource file and" << endl;
-    gLog << "                             command line" << endl;
+    gLog << "                              command line" << endl;
     gLog << "   --debug-mem               Debug memory usage" << endl << endl;
     gLog << "   --rc=Name:option          Set or overwrite a resource of the resource file." << endl;
@@ -59,6 +61,15 @@
     gLog << "   -ff                       Force reading of file even if problems occur" << endl;
     gLog << "   --out=path                Path to write the all results to [def=local path]" << endl;
+    gLog << "   --ind=path                Input path of Corsika files if sequence used" << endl;
+    gLog << "                              [def=standard path in datacenter]" << endl;
     gLog << "   --dev-null                Suppress output of files (for test purpose)" << endl;
+    gLog << "   --print-seq               Print Sequence information [sequence only]" << endl;
+    gLog << "   --print-files             Print Files taken from Sequence" << endl;
+    gLog << "   --print-found             Print Files found from Sequence" << endl;
     gLog << "   --config=ceres.rc         Resource file [default=reflector.rc]" << endl;
+    gLog << endl;
+    gLog << "   --mode=pedestal           Execution mode. Produce either pedestals," << endl;
+    gLog << "   --mode=calibration        calibration data (no input files required) or" << endl;
+    gLog << "   --mode=data               process data files [default]" << endl;
     gLog << endl;
 //    gLog << "     -f:  force reading of runheader" << endl;
@@ -86,4 +97,30 @@
 }
 
+static void PrintFiles(const MArgs &arg, Bool_t allopt)
+{
+    const char *prep = allopt ? "Found" : "Scheduled";
+
+    gLog << all;
+    gLog.Separator(Form("%s Data Files", prep));
+    for (int i=0; i<arg.GetNumArguments(); i++)
+        if (!allopt || gSystem->AccessPathName(arg.GetArgumentStr(i), kFileExists)==0)
+            gLog << arg.GetArgumentStr(i) << endl;
+    gLog << endl;
+}
+
+
+static void PrintFiles(const MSequence &seq, const TString &kInpathD, Bool_t allopt)
+{
+    const char *prep = allopt ? "Found" : "Scheduled";
+
+    MDirIter Next;
+    seq.GetRuns(Next, MSequence::kCorsika, kInpathD);
+
+    gLog << all;
+    gLog.Separator(Form("%s Data Files", prep));
+    Next.Print(allopt?"all":"");
+    gLog << endl;
+}
+
 int main(int argc, char **argv)
 {
@@ -110,23 +147,71 @@
     }
 
-    const Bool_t  kBatch     = arg.HasOnlyAndRemove("-b");
+    const Bool_t  kBatch      = arg.HasOnlyAndRemove("-b");
     //const Int_t   kCompLvl   = arg.GetIntAndRemove("--comp=", 1);
-    const Bool_t  kForce     = arg.HasOnlyAndRemove("-ff");
-    const Bool_t  kDebugMem  = arg.HasOnlyAndRemove("--debug-mem");
-    const Bool_t  kNullOut   = arg.HasOnlyAndRemove("--dev-null");
+    const Bool_t  kForce      = arg.HasOnlyAndRemove("-ff");
+    const Bool_t  kDebugMem   = arg.HasOnlyAndRemove("--debug-mem");
+    const Bool_t  kNullOut    = arg.HasOnlyAndRemove("--dev-null");
     Int_t kDebugEnv = arg.HasOnlyAndRemove("--debug-env") ? 1 : 0;
     kDebugEnv = arg.GetIntAndRemove("--debug-env=", kDebugEnv);
 
-    const Bool_t  kQuit      = arg.HasOnlyAndRemove("-q");
-    const Bool_t  kOverwrite = arg.HasOnlyAndRemove("-f");
-
-    const TString kConfig    = arg.GetStringAndRemove("--config=", "ceres.rc");
-    const TString kOutpath   = arg.GetStringAndRemove("--out=", ".");
+    const Bool_t  kPrintSeq   = arg.HasOnlyAndRemove("--print-seq");
+    const Bool_t  kPrintFiles = arg.HasOnlyAndRemove("--print-files");
+    const Bool_t  kPrintFound = arg.HasOnlyAndRemove("--print-found");
+
+    const Bool_t  kQuit       = arg.HasOnlyAndRemove("-q");
+    const Bool_t  kOverwrite  = arg.HasOnlyAndRemove("-f");
+
+    const TString kConfig     = arg.GetStringAndRemove("--config=", "ceres.rc");
+    const TString kInpath     = arg.GetStringAndRemove("--ind=", "");
+    const TString kOutpath    = arg.GetStringAndRemove("--out=", ".");
+
+    const TString kOpMode     = arg.GetStringAndRemove("--mode=", "data");
+
+    Int_t opmode = -1;
+    if (TString("data").BeginsWith(kOpMode, TString::kIgnoreCase))
+        opmode = MJSimulation::kModeData;
+    if (TString("pointrun").BeginsWith(kOpMode, TString::kIgnoreCase))
+        opmode = MJSimulation::kModePointRun;
+    if (TString("pedestal").BeginsWith(kOpMode, TString::kIgnoreCase))
+        opmode = MJSimulation::kModePed;
+    if (TString("calibration").BeginsWith(kOpMode, TString::kIgnoreCase))
+        opmode = MJSimulation::kModeCal;
+
+    if (opmode<0)
+    {
+        gLog << err << "ERROR - Wrong mode specified..." << endl;
+        Usage();
+        return 2;
+    }
 
     //
     // check for the right usage of the program (number of arguments)
-    if (arg.GetNumArguments()<1/* || arg.GetNumArguments()>2*/)
+    if (arg.GetNumArguments()<1 && opmode==MJSimulation::kModeData)
     {
         gLog << warn << "WARNING - Wrong number of arguments..." << endl;
+        Usage();
+        return 2;
+    }
+
+    //
+    // for compatibility with the first version of ceres
+    //
+    if (arg.GetNumArguments()==1 && opmode==MJSimulation::kModeData)
+    {
+        if (arg.GetArgumentStr(0)=="pedestal")
+        {
+            opmode = MJSimulation::kModePed;
+            arg.RemoveArgument(0);
+        }
+        if (arg.GetArgumentStr(0)=="calibration")
+        {
+            opmode = MJSimulation::kModeCal;
+            arg.RemoveArgument(0);
+        }
+    }
+
+    if (arg.GetNumArguments()>0 && opmode!=MJSimulation::kModeData)
+    {
+        gLog << warn << "WARNING - No arguments allowed in this mode..." << endl;
         Usage();
         return 2;
@@ -160,4 +245,61 @@
 
     //
+    // Setup sequence file and check for its existance
+    //
+    TString kSequence = arg.GetNumArguments()==1 ? arg.GetArgumentStr(0) : "";
+
+    //
+    // Check if the first argument (if any) is a sequence file or not
+    //
+    if (!kSequence.EndsWith(".txt"))
+        kSequence = "";
+
+    //
+    // Something special for datacenter access
+    //
+    if (!kSequence.IsNull() && !MSequence::InflateSeq(kSequence, kTRUE))
+        return 2;
+
+    //
+    // Setup sequence and check its validity
+    //
+    MSequence seq(kSequence, kInpath);
+    if (!kSequence.IsNull())
+    {
+        if (kPrintSeq)
+        {
+            gLog << all;
+            gLog.Separator(kSequence);
+            seq.Print();
+            gLog << endl;
+        }
+        if (seq.IsValid() && !seq.IsMonteCarlo())
+        {
+            gLog << err << "Sequence is not a Monte Carlo Sequence." << endl << endl;
+            return 2;
+        }
+        if (!seq.IsValid())
+        {
+            gLog << err << "Sequence read but not valid!" << endl << endl;
+            return 2;
+        }
+
+        //
+        // Process print options
+        //
+        if (kPrintFiles)
+            PrintFiles(seq, kInpath, kFALSE);
+        if (kPrintFound)
+            PrintFiles(seq, kInpath, kTRUE);
+    }
+    else
+    {
+        if (kPrintFiles)
+            PrintFiles(arg, kFALSE);
+        if (kPrintFound)
+            PrintFiles(arg, kTRUE);
+    }
+
+    //
     // Initialize root
     //
@@ -180,5 +322,5 @@
     // From now on each 'Exit' means: Terminate the application
     d->SetBit(MStatusDisplay::kExitLoopOnExit);
-    d->SetTitle(Form("-- Ceres: %s --", ""/*kNamein.Data()*/));
+    d->SetTitle(seq.IsValid() ? Form("-- Ceres: %s --", kSequence.Data()) : "-- Ceres --");
 
     if (kDebugMem)
@@ -189,6 +331,5 @@
     //
     {
-
-        MJSimulation job("Ceres"/*Form("MJSimulation #%d", seq.GetSequence())*/);
+        MJSimulation job(seq.IsValid() ? Form("Ceres #%d", seq.GetSequence()) : "Ceres");
         //job.SetSequence(seq);
         job.SetEnv(&env);
@@ -199,7 +340,8 @@
         job.SetNullOut(kNullOut);
         job.SetForceMode(kForce);
+        job.SetMode(opmode);
         // job.SetPathIn(kInpath); // not yet needed
 
-        if (!job.Process(arg))
+        if (!job.Process(arg, seq))
         {
             gLog << err << "Calculation of ceres failed." << endl << endl;
Index: /trunk/MagicSoft/Mars/mbase/MDirIter.cc
===================================================================
--- /trunk/MagicSoft/Mars/mbase/MDirIter.cc	(revision 9440)
+++ /trunk/MagicSoft/Mars/mbase/MDirIter.cc	(revision 9441)
@@ -152,4 +152,13 @@
 // --------------------------------------------------------------------------
 //
+// Add a single file to the iterator
+//
+Int_t MDirIter::AddFile(const char *name)
+{
+    return AddDirectory(gSystem->DirName(name), gSystem->BaseName(name));
+}
+
+// --------------------------------------------------------------------------
+//
 // Adds all entries from iter to this object
 //
Index: /trunk/MagicSoft/Mars/mbase/MDirIter.h
===================================================================
--- /trunk/MagicSoft/Mars/mbase/MDirIter.h	(revision 9440)
+++ /trunk/MagicSoft/Mars/mbase/MDirIter.h	(revision 9441)
@@ -52,4 +52,5 @@
 
     Int_t AddDirectory(const char *dir, const char *filter="", Int_t recursive=0);
+    Int_t AddFile(const char *name);
     void  Add(const MDirIter &iter);
     void  Reset();
Index: /trunk/MagicSoft/Mars/mgeom/MGeomPix.h
===================================================================
--- /trunk/MagicSoft/Mars/mgeom/MGeomPix.h	(revision 9440)
+++ /trunk/MagicSoft/Mars/mgeom/MGeomPix.h	(revision 9441)
@@ -45,4 +45,7 @@
     Float_t GetT() const  { return fD/gsTan60; } // Distance between two opposite edges (traverse)
 
+    Float_t GetDx() const { return fD; }           // Distance of two rows in x-direction (without rotation)
+    Float_t GetDy() const { return fD*gsTan60/2; } // Distance of two rows in y-direction (without rotation)
+
     Bool_t  IsInside(Float_t px, Float_t py) const;
     void    PaintPrimitive(const TAttLine &line, const TAttFill &fill, Double_t scalexy=1, Double_t scaled=1) const;
Index: /trunk/MagicSoft/Mars/mjobs/MJSimulation.cc
===================================================================
--- /trunk/MagicSoft/Mars/mjobs/MJSimulation.cc	(revision 9440)
+++ /trunk/MagicSoft/Mars/mjobs/MJSimulation.cc	(revision 9441)
@@ -62,5 +62,5 @@
 
 #include "MArgs.h"
-//#include "MDirIter.h"
+#include "MDirIter.h"
 #include "MParList.h"
 #include "MTaskList.h"
@@ -126,5 +126,6 @@
 //
 MJSimulation::MJSimulation(const char *name, const char *title)
-    : fForceMode(kFALSE), fCamera(kTRUE) ,fForceTrigger(kFALSE)
+    : fForceMode(kFALSE), fCamera(kTRUE), fForceTrigger(kFALSE),
+    fOperationMode(kModeData)
 {
     fName  = name  ? name  : "MJSimulation";
@@ -140,6 +141,12 @@
     return kTRUE;
 }
-
-Bool_t MJSimulation::WriteResult(const MParList &plist)
+/*
+TString MJSimulation::GetOutFile(const MSequence &seq) const
+{
+    return seq.IsValid() ? Form("ceres%08d.root", seq.GetSequence()) : "ceres.root";
+}
+*/
+
+Bool_t MJSimulation::WriteResult(const MParList &plist, const MSequence &seq)
 {
     if (fPathOut.IsNull())
@@ -151,5 +158,6 @@
     TObjArray cont;
     cont.Add(const_cast<TEnv*>(GetEnv()));
-    //cont.Add(const_cast<MSequence*>(&fSequence));
+    if (seq.IsValid())
+        cont.Add(const_cast<MSequence*>(&seq));
 
     cont.Add(plist.FindObject("PulseShape"));
@@ -160,8 +168,11 @@
     if (fDisplay)
     {
-//        TString title = "--  Reflector: ";
-//        title += fSequence.GetSequence();
-//        title += "  --";
-//        fDisplay->SetTitle(title, kFALSE);
+        TString title = "--  Ceres";
+        if (seq.IsValid())
+        {
+            title += ": ";
+            title += seq.GetSequence();
+        }
+        title += "  --";
         fDisplay->SetTitle("Ceres", kFALSE);
 
@@ -169,7 +180,6 @@
     }
 
-//    const TString oname = Form("reflector%08d.root", fSequence.GetSequence());
-    const TString oname = "ceres.root";
-    return WriteContainer(cont, oname, "RECREATE");
+    const TString name = seq.IsValid() ? Form("ceres%08d.root", seq.GetSequence()) : "ceres.root";
+    return WriteContainer(cont, name, "RECREATE");
 }
 
@@ -235,5 +245,5 @@
 }
 
-Bool_t MJSimulation::Process(const MArgs &args)
+Bool_t MJSimulation::Process(const MArgs &args, const MSequence &seq)
 {
     /*
@@ -245,6 +255,6 @@
     */
 
-    //if (!HasWritePermission(GetPathOut()))
-    //    return kFALSE;
+//    if (!HasWritePermission(CombinePath(fPathOut, GetOutFile(seq))))
+//        return kFALSE;
 
     *fLog << inf;
@@ -254,13 +264,18 @@
         return kFALSE;
 
-    *fLog << warn << "FIXME: Monte Carlo simulation: Sequences not supported yet.";
-    //*fLog << fSequence.GetFileName() << endl;
+    if (seq.IsValid())
+        *fLog << fSequence.GetFileName() << endl;
+    else
+        *fLog << args.GetNumArguments() << "-files" << endl;
     *fLog << endl;
 
+    MDirIter iter;
+    if (seq.IsValid() && seq.GetRuns(iter, MSequence::kCorsika)<=0)
+    {
+        *fLog << err << "ERROR - Sequence valid but without files." << endl;
+        return kFALSE;
+    }
+
     // --------------------------------------------------------------------------------
-
-    //MDirIter iter;
-    //if (fSequence.GetRuns(iter, MSequence::kCalibrated)<=0)
-    //    return kFALSE;
 
     // Setup Parlist
@@ -297,19 +312,23 @@
     //header.InitFadcType(3);
 
-    header.SetRunType(MRawRunHeader::kRTMonteCarlo|MRawRunHeader::kRTData);
-    if (args.GetNumArguments()==1)
-    {
-        if (!args.GetArgumentStr(0).CompareTo("pedestal", TString::kIgnoreCase))
-        {
-            header.SetRunType(MRawRunHeader::kRTMonteCarlo|MRawRunHeader::kRTPedestal);
-            header.SetSourceInfo("Pedestal");
-        }
-        if (!args.GetArgumentStr(0).CompareTo("calibration", TString::kIgnoreCase))
-        {
-            header.SetRunType(MRawRunHeader::kRTMonteCarlo|MRawRunHeader::kRTCalibration);
-            header.SetSourceInfo("Calibration");
-        }
-        if (!args.GetArgumentStr(0).CompareTo("pointrun", TString::kIgnoreCase))
-            header.SetRunType(MRawRunHeader::kRTMonteCarlo|MRawRunHeader::kRTPointRun);
+    switch (fOperationMode)
+    {
+    case kModeData:
+        header.SetRunType(MRawRunHeader::kRTMonteCarlo|MRawRunHeader::kRTData);
+        break;
+
+    case kModePed:
+        header.SetRunType(MRawRunHeader::kRTMonteCarlo|MRawRunHeader::kRTPedestal);
+        header.SetSourceInfo("Pedestal");
+        break;
+
+    case kModeCal:
+        header.SetRunType(MRawRunHeader::kRTMonteCarlo|MRawRunHeader::kRTCalibration);
+        header.SetSourceInfo("Calibration");
+        break;
+
+    case kModePointRun:
+        header.SetRunType(MRawRunHeader::kRTMonteCarlo|MRawRunHeader::kRTPointRun);
+        break;
     }
 
@@ -333,6 +352,11 @@
     read.SetForceMode(fForceMode);
 
-    for (int i=0; i<args.GetNumArguments(); i++)
-        read.AddFile(args.GetArgumentStr(i));
+    if (!seq.IsValid())
+    {
+        for (int i=0; i<args.GetNumArguments(); i++)
+            read.AddFile(args.GetArgumentStr(i));
+    }
+    else
+        read.AddFiles(iter);
 
     MSimMMCS simmmcs;
@@ -366,14 +390,14 @@
     // -------------------------------------------------------------------
 
-    MBinning binse( 100,     1,   100000, "BinningEnergy",    "log");
-    MBinning binsth( 70,   0.9,   900000, "BinningThreshold", "log");
-    MBinning binsee( 35,   0.9,   900000, "BinningEnergyEst", "log");
+    MBinning binse( 120,     1,  1000000, "BinningEnergy",    "log");
+    MBinning binsth( 60,   0.9,   900000, "BinningThreshold", "log");
+    MBinning binsee( 36,   0.9,   900000, "BinningEnergyEst", "log");
     MBinning binss( 100,     1, 10000000, "BinningSize",      "log");
 //    MBinning binsi( 100,  -500,      500, "BinningImpact");
-    MBinning binsi(  55,     0,     1100, "BinningImpact");
+    MBinning binsi(  32,     0,      800, "BinningImpact");
     MBinning binsh( 150,     0,       50, "BinningHeight");
     MBinning binsaz(720,  -360,      360, "BinningAz");
     MBinning binszd( 70,     0,       70, "BinningZd");
-    MBinning binsvc( 45,     0,        9, "BinningViewCone");
+    MBinning binsvc( 35,     0,        7, "BinningViewCone");
     MBinning binsel(150,     0,       50, "BinningTotLength");
     MBinning binsew(150,     0,       15, "BinningMedLength");
@@ -845,5 +869,5 @@
     //-------------------------------------------
 
-    if (!WriteResult(plist))
+    if (!WriteResult(plist, seq))
         return kFALSE;
 
Index: /trunk/MagicSoft/Mars/mjobs/MJSimulation.h
===================================================================
--- /trunk/MagicSoft/Mars/mjobs/MJSimulation.h	(revision 9440)
+++ /trunk/MagicSoft/Mars/mjobs/MJSimulation.h	(revision 9441)
@@ -9,8 +9,12 @@
 class MArgs;
 class MParList;
+class MSequence;
 class MWriteRootFile;
 
 class MJSimulation : public MJob
 {
+public:
+    enum Mode_t { kModeData, kModePed, kModeCal, kModePointRun };
+
 private:
     Bool_t fForceMode;      // Force execution even if RUNE-section was not foundm
@@ -19,5 +23,7 @@
     Bool_t fForceTrigger;   // Force the use of the trigger "electronics"
 
-    Bool_t WriteResult(const MParList &plist);
+    Int_t fOperationMode;   // Operation mode (data, ped, cal, pointrun)
+
+    Bool_t WriteResult(const MParList &plist, const MSequence &seq);
     Bool_t CheckEnvLocal();
 
@@ -30,6 +36,8 @@
     void SetForceMode(Bool_t force=kTRUE) { fForceMode = force; }
 
+    void SetMode(Int_t mode) { fOperationMode = mode; }
+
     // Process
-    Bool_t Process(const MArgs &args);
+    Bool_t Process(const MArgs &args, const MSequence &seq);
 
     ClassDef(MJSimulation, 0) // Job to run the simulation (ceres)
Index: /trunk/MagicSoft/Mars/mjobs/MSequence.cc
===================================================================
--- /trunk/MagicSoft/Mars/mjobs/MSequence.cc	(revision 9440)
+++ /trunk/MagicSoft/Mars/mjobs/MSequence.cc	(revision 9441)
@@ -447,4 +447,7 @@
 TString MSequence::InflateFileName(const MTime &night, UShort_t tel, Int_t run, Int_t file, Int_t type)
 {
+    if (!night && type==kCorsika)
+        return MString::Format("cer%06d", -run);
+
     const char *id="_";
     switch ((RunType_t)(type&kRunType))
@@ -711,5 +714,5 @@
     const TArrayI *r=0, *f=0;
     GetArrays(r, f, type);
-    return GetRuns(iter, *r, *f, type, path);
+    return r==0 ? 0 : GetRuns(iter, *r, *f, type, path);
 }
 
@@ -859,5 +862,5 @@
     const Bool_t rc = !fDataPath.IsNull() && gSystem->AccessPathName(fDataPath, kFileExists);
     if (rc)
-        gLog << err << "ERROR - Directory '" << path << "' doesn't exist." << endl;
+        gLog << err << "ERROR - Directory '" << fDataPath << "' doesn't exist." << endl;
 
     return !rc;
@@ -942,5 +945,14 @@
 //
 MSequence::MSequence(const char *fname, const char *path, UInt_t seq)
-{
+   : fTelescope(1), fSequence((UInt_t)-1), fLastRun((UInt_t)-1),
+     fNumEvents((UInt_t)-1), fPeriod((UInt_t)-1), fLightCondition(kNA),
+     fMonteCarlo(kFALSE)
+{
+    fName  = "MSequence";
+    fTitle = "Sequence file";
+
+    if (TString(fname).IsNull() && TString(path).IsNull() && seq==(UInt_t)-1)
+        return;
+
     // regular expression to distinguish beween a mysql-path and
     // a filename from where the sequence should be retrieved
@@ -951,7 +963,4 @@
     const Bool_t rc1 = db.IsNull() ? ReadFile(fname, seq) : ReadDatabase(fname, seq);
     const Bool_t rc2 = SetDataPath(path);
-
-    fName  = "MSequence";
-    fTitle = "Sequence file";
 
     if (!rc1 || !rc2)
@@ -1353,19 +1362,22 @@
         out << pre << "Night:          " << fNight.GetStringFmt("%Y-%m-%d") << endl;
     out << endl;
-    out << pre << "LightCondition: ";
-    switch (fLightCondition)
-    {
-    case kNA:       out << "n/a" << endl;      break;
-    case kNoMoon:   out << "NoMoon" << endl;   break;
-    case kTwilight: out << "Twilight" << endl; break;
-    case kMoon:     out << "Moon" << endl;     break;
-    case kDay:      out << "Day" << endl;      break;
+    if (fLightCondition!=kNA)
+    {
+        out << pre << "LightCondition: ";
+        switch (fLightCondition)
+        {
+        case kNA:       out << "n/a" << endl;      break;
+        case kNoMoon:   out << "NoMoon" << endl;   break;
+        case kTwilight: out << "Twilight" << endl; break;
+        case kMoon:     out << "Moon" << endl;     break;
+        case kDay:      out << "Day" << endl;      break;
+        }
     }
 
     if (fStart!=MTime())
         out << pre << "Start:          " << fStart.GetSqlDateTime() << endl;
-    if (fLastRun>=0)
+    if (fLastRun!=(UInt_t)-1)
         out << pre << "LastRun:        " << fLastRun << endl;
-    if (fNumEvents>=0)
+    if (fNumEvents!=(UInt_t)-1)
         out << pre << "NumEvents:      " << fNumEvents << endl;
     if (!fProject.IsNull())
Index: /trunk/MagicSoft/Mars/mjobs/MSequence.h
===================================================================
--- /trunk/MagicSoft/Mars/mjobs/MSequence.h	(revision 9440)
+++ /trunk/MagicSoft/Mars/mjobs/MSequence.h	(revision 9441)
@@ -23,17 +23,18 @@
         kRoot  =BIT(1),
         kReport=BIT(2),
+        kCer   =BIT(3),  // Corsika files
     };
     enum RunType_t {
-        kPed   =BIT(3),
-        kCal   =BIT(4),
-        kDat   =BIT(5),
-        kExcl  =BIT(6),
+        kPed   =BIT(4),  // Don't use overlapping bits!
+        kCal   =BIT(5),
+        kDat   =BIT(6),
+        kExcl  =BIT(7),
         kAll   =kPed|kDat|kCal,
-        kImage =BIT(7),
-        kCalib =BIT(8)
+        kImage =BIT(8),
+        kCalib =BIT(9)
     };
 
     enum { kRunType   = kPed|kCal|kDat|kImage|kCalib };
-    enum { kFileType  = kRaw|kRoot|kReport };
+    enum { kFileType  = kRaw|kRoot|kReport|kCer };
     enum { kFilePaths = kFileType|kImage|kCalib };
 
@@ -53,4 +54,5 @@
         kCalibrated = kRoot  |kCalib,
         kImages     = kRoot  |kImage,
+        kCorsika    = kCer   |kDat,
     };
 
@@ -131,4 +133,5 @@
 
 public:
+/*
     MSequence() : fTelescope(1), fSequence((UInt_t)-1), fLastRun((UInt_t)-1),
         fNumEvents((UInt_t)-1), fPeriod((UInt_t)-1), fLightCondition(kNA), fMonteCarlo(kFALSE)
@@ -137,5 +140,6 @@
         fTitle = "Sequence file";
     }
-    MSequence(const char *fname, const char *path="", UInt_t id=(UInt_t)-1);
+    */
+    MSequence(const char *fname=0, const char *path=0, UInt_t id=(UInt_t)-1);
     MSequence(const char *fname, UInt_t seq, UShort_t tel=0);
     MSequence(const MSequence &s) : MParContainer(s),
