Index: trunk/MagicSoft/Mars/mjobs/MJCalib.cc
===================================================================
--- trunk/MagicSoft/Mars/mjobs/MJCalib.cc	(revision 8428)
+++ trunk/MagicSoft/Mars/mjobs/MJCalib.cc	(revision 8434)
@@ -48,11 +48,9 @@
 // - fPulsePosCheck to kFALSE
 //
-MJCalib::MJCalib() : fDataFlag(kIsUseRawData), fStorage(0),
-                     fIsPixelCheck(kFALSE), fIsPulsePosCheck(kFALSE)/*,
-                     fIsHiLoCalibration(kFALSE)*/
+MJCalib::MJCalib() : fStorage(0), fIsPixelCheck(kFALSE), fIsPulsePosCheck(kFALSE)
 {
   SetUseBlindPixel(kFALSE);
   SetUsePINDiode(kFALSE);
-  
+
   SetCheckedPixId();
 }
@@ -63,5 +61,4 @@
     SetPulsePosCheck(GetEnv("PulsePosCheck", fIsPulsePosCheck));
     SetCheckedPixId(GetEnv("CheckedPixId",fCheckedPixId));
-    //SetHiLoCalibration(GetEnv("HiLoCalibration", fIsHiLoCalibration));
 
     if (HasEnv("StorageType"))
@@ -81,17 +78,4 @@
         return kTRUE;
 
-    TString dat = GetEnv("DataType", "");
-    dat = dat.Strip(TString::kBoth);
-    dat.ToLower();
-
-    if (dat == (TString)"raw")
-        SetUseRawData();
-
-    if (dat == (TString)"mc" || dat == (TString)"montecarlo")
-        SetUseMC();
-
-    if (dat == (TString)"root")
-        SetUseRootData();
-
     return kTRUE;
 }
Index: trunk/MagicSoft/Mars/mjobs/MJCalibTest.cc
===================================================================
--- trunk/MagicSoft/Mars/mjobs/MJCalibTest.cc	(revision 8428)
+++ trunk/MagicSoft/Mars/mjobs/MJCalibTest.cc	(revision 8434)
@@ -287,5 +287,5 @@
   if (fSequence.IsValid())
     {
-        if (fSequence.SetupCalRuns(iter, 0, IsUseRawData())<=0)
+        if (fSequence.SetupCalRuns(iter, 0, !fSequence.IsMonteCarlo())<=0)
             return kFALSE;
     }
@@ -369,5 +369,5 @@
   read.DisableAutoScheme();
 
-  if (IsUseRawData())
+  if (!fSequence.IsMonteCarlo())
     rawread.AddFiles(iter);
   else
Index: trunk/MagicSoft/Mars/mjobs/MJCalibrateSignal.cc
===================================================================
--- trunk/MagicSoft/Mars/mjobs/MJCalibrateSignal.cc	(revision 8428)
+++ trunk/MagicSoft/Mars/mjobs/MJCalibrateSignal.cc	(revision 8434)
@@ -80,5 +80,4 @@
 #include "MCalibCalcFromPast.h"
 
-#include "MReadReports.h"
 #include "MReadMarsFile.h"
 #include "MRawFileRead.h"
@@ -90,5 +89,4 @@
 #include "MGeomApply.h"
 #include "MPedestalSubtract.h"
-//#include "MMcPedestalCopy.h"
 #include "MPointingPosCalc.h"
 #include "MPedCalcFromLoGain.h"
@@ -102,5 +100,4 @@
 #include "MCalibrateData.h"
 #include "MCalibrateRelTimes.h"
-//#include "MBadPixelsMerge.h"
 #include "MBadPixelsCalc.h"
 #include "MBadPixelsTreat.h"
@@ -248,5 +245,5 @@
     if (fSequence.IsValid())
     {
-        if (fSequence.SetupDatRuns(iter, 0, IsUseRawData())<=0)
+        if (fSequence.SetupDatRuns(iter, 0, !fSequence.IsMonteCarlo())<=0)
             return kFALSE;
     }
@@ -362,12 +359,4 @@
     plist.AddToList(&tlist);
 
-    MReadReports readreal;
-    readreal.AddTree("Events", "MTime.", MReadReports::kMaster);
-    readreal.AddTree("Trigger");
-    readreal.AddTree("Camera");
-    readreal.AddTree("Drive");
-    readreal.AddTree("CC");
-    readreal.AddTree("Currents");
-
     MReadMarsFile readmc("Events");
     readmc.DisableAutoScheme();
@@ -375,16 +364,9 @@
     MRawFileRead rawread(NULL);
 
-    MRead *read = 0;
-    switch (GetDataFlag())
-    {
-    case kIsUseRawData:  read = &rawread;  break;
-    case kIsUseMC:       read = &readmc;   break;
-    case kIsUseRootData: read = &readreal; break;
-    }
+    MRead *read = fSequence.IsMonteCarlo() ? (MRead*)&readmc : (MRead*)&rawread;
     read->AddFiles(iter);
 
     const TString fname(Form("%s{s/_D_/_Y_}{s/\\.raw$/.root}{s/\\.raw\\.gz$/.root}", fPathOut.Data()));
 
-    
     // Skips MC which have no contents. This are precisely the
     // events which fullfilled the MC Lvl1 trigger and an
@@ -808,5 +790,5 @@
     movwrite.SetFilter(&movfilt);
 
-    MTaskList tlistmov;
+    MTaskList tlistmov("MovieEncoder");
     tlistmov.AddToList(&movprep);
     tlistmov.AddToList(&movfilt);
@@ -835,7 +817,8 @@
     tlist.AddToList(read);
 
-    if (IsUseMC())
-    {
-        tlist.AddToList(&writemc);
+    if (fSequence.IsMonteCarlo())
+    {
+        if (!fIsMovieMode)
+            tlist.AddToList(&writemc);
         tlist.AddToList(&contmc);
     }
@@ -843,10 +826,11 @@
     //if (IsUseRootData())
     //  tlist2.AddToList(&pextr);
-    tlist.AddToList(&tlist2, IsUseRootData() ? "Events" : "All");
-
-    //if (IsUseMC())
+    tlist.AddToList(&tlist2, fSequence.IsMonteCarlo() ? "Events" : "Alls");
+
+    //if (fSequence.IsMonteCarlo())
     //  tlist.AddToList(&pcalc, "Drive");
 
-    tlist.AddToList(&write);
+    if (!fIsMovieMode)
+        tlist.AddToList(&write);
 
     // Create and setup the eventloop
@@ -901,5 +885,5 @@
 
     if (!WriteResult(interlacedcont))
-      return kFALSE;
+        return kFALSE;
 
     // return if job went ok
Index: trunk/MagicSoft/Mars/mjobs/MJCalibration.cc
===================================================================
--- trunk/MagicSoft/Mars/mjobs/MJCalibration.cc	(revision 8428)
+++ trunk/MagicSoft/Mars/mjobs/MJCalibration.cc	(revision 8434)
@@ -1458,5 +1458,5 @@
 
     // Defined resource id
-    const TString id = IsUseMC() ? "MC" : Form("%02d", period);
+    const TString id = fSequence.IsMonteCarlo() ? "MC" : Form("%02d", period);
 
     // Check for a valid entry for the correct period
@@ -1707,5 +1707,5 @@
 
     MDirIter iter;
-    if (fSequence.SetupCalRuns(iter, 0, IsUseRawData())<=0)
+    if (fSequence.SetupCalRuns(iter, 0, !fSequence.IsMonteCarlo())<=0)
         return kFALSE;
 
@@ -1746,5 +1746,5 @@
     MRawFileRead rawread(NULL);
 
-    if (IsUseRawData())
+    if (!fSequence.IsMonteCarlo())
     {
         rawread.AddFiles(iter);
@@ -1948,5 +1948,5 @@
         SetUsePINDiode(kFALSE);
 
-    const Int_t numexec = IsUseRawData() ? rawread.GetNumExecutions() : read.GetNumExecutions();
+    const Int_t numexec = !fSequence.IsMonteCarlo() ? rawread.GetNumExecutions() : read.GetNumExecutions();
     if (numexec>0)
     {
Index: trunk/MagicSoft/Mars/mjobs/MJStar.cc
===================================================================
--- trunk/MagicSoft/Mars/mjobs/MJStar.cc	(revision 8428)
+++ trunk/MagicSoft/Mars/mjobs/MJStar.cc	(revision 8434)
@@ -119,5 +119,5 @@
 }
 
-Bool_t MJStar::Process(Bool_t ismc)
+Bool_t MJStar::Process()
 {
     if (!fSequence.IsValid())
@@ -275,5 +275,5 @@
     write.AddContainer("MMuonSetup",                "RunHeaders");
 
-    if (ismc)
+    if (fSequence.IsMonteCarlo())
     {
         // Monte Carlo Data
@@ -311,5 +311,5 @@
     writem.AddContainer("MRawEvtHeader",            "Muons");
     writem.AddContainer("MPointingPos",             "Muons");
-    if (ismc)
+    if (fSequence.IsMonteCarlo())
     {
         // Monte Carlo Data
@@ -318,5 +318,5 @@
     }
 
-    if (ismc)
+    if (fSequence.IsMonteCarlo())
         if (fMuonAnalysis)
             writem.AddCopySource("OriginalMC");
@@ -326,8 +326,8 @@
     MTaskList tlist2("Events");
     tlist2.AddToList(&apply);
-    if (!ismc)
+    if (!fSequence.IsMonteCarlo())
         tlist2.AddToList(&cont);
     tlist2.AddToList(&contsw);
-    if (!ismc)
+    if (!fSequence.IsMonteCarlo())
     {
         // Calibration events don't enter star at all.
@@ -450,9 +450,9 @@
     // ------------------------------------------------------------
 
-    tlist.AddToList(ismc ? (MTask*)&readmc : (MTask*)&readreal);
-    tlist.AddToList(&pcalc,  ismc ? "Events" : "Drive");
+    tlist.AddToList(fSequence.IsMonteCarlo() ? (MTask*)&readmc : (MTask*)&readreal);
+    tlist.AddToList(&pcalc,  fSequence.IsMonteCarlo() ? "Events" : "Drive");
     //tlist.AddToList(&filltst, "Events");
     tlist.AddToList(&tlist2, "Events");
-    if (!ismc)
+    if (!fSequence.IsMonteCarlo())
     {
         // initiate task list
Index: trunk/MagicSoft/Mars/mjobs/MJStar.h
===================================================================
--- trunk/MagicSoft/Mars/mjobs/MJStar.h	(revision 8428)
+++ trunk/MagicSoft/Mars/mjobs/MJStar.h	(revision 8434)
@@ -21,5 +21,5 @@
 
     // Process
-    Bool_t Process(Bool_t ismc=kFALSE);
+    Bool_t Process();
 
     ClassDef(MJStar, 0) // Tool to create a pedestal file (MPedestalCam)
Index: trunk/MagicSoft/Mars/mjobs/MSequence.cc
===================================================================
--- trunk/MagicSoft/Mars/mjobs/MSequence.cc	(revision 8428)
+++ trunk/MagicSoft/Mars/mjobs/MSequence.cc	(revision 8434)
@@ -118,4 +118,9 @@
 //    seq.SetupPedRuns(iter, "/mypath", "[DPC]");
 //
+// ===========================================================================
+//
+//  Class Version 2:
+//   + fMonteCarlo
+//
 /////////////////////////////////////////////////////////////////////////////
 #include "MSequence.h"
@@ -220,16 +225,13 @@
         switch (type)
         {
-        case kRawDat:
+        case kRawDat:  // rawdata
         case kRawPed:
         case kRawCal:
         case kRawAll:
-            d += "rawfiles/";
-            d += fNight.GetStringFmt("%Y/%m/%d");
-            break;
-        case kRootDat:
+        case kRootDat: // mcdata
         case kRootPed:
         case kRootCal:
         case kRootAll:
-            d += "merpp/";
+            d += "rawfiles/";
             d += fNight.GetStringFmt("%Y/%m/%d");
             break;
@@ -253,5 +255,5 @@
         // Changes to read the DAQ numbering format. Changes takes place
         // between runs 35487 and 00035488 (2004_08_30)
-        const char *fmt = arr[i]>35487 ? "%08d_%s_*_E" : "%05d_%s_*_E";
+        const char *fmt = arr[i]>35487 || fMonteCarlo ? "%08d_%s_*_E" : "%05d_%s_*_E";
 
         TString n;
@@ -447,4 +449,5 @@
     fTriggerTable = env.GetValue("TriggerTable", "");
     fHvSettings   = env.GetValue("HvSettings", "");
+    fMonteCarlo   = env.GetValue("MonteCarlo", kFALSE);
 
     str = env.GetValue("Runs", "");
@@ -488,4 +491,6 @@
     }
     gLog << "Sequence:       " << fSequence << endl;
+    if (fMonteCarlo)
+        gLog << "MonteCarlo:     Yes" << endl;
     gLog << "Period:         " << fPeriod << endl;
     gLog << "Night:          " << fNight << endl << endl;
@@ -646,2 +651,28 @@
     fPeriod = MAstro::GetMagicPeriod(fNight.GetMjd());
 }
+
+// --------------------------------------------------------------------------
+//
+// If the sequence name seq is just a digit it is inflated to a full
+// path following the datacenter standard.
+//
+// Returns if file accessible or not.
+//
+Bool_t MSequence::InflatePath(TString &seq, Bool_t ismc)
+{
+    if (seq.IsDigit())
+    {
+        const Int_t numseq = seq.Atoi();
+        seq = "/magic/";
+        if (ismc)
+            seq += "montecarlo/";
+        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;
+}
Index: trunk/MagicSoft/Mars/mjobs/MSequence.h
===================================================================
--- trunk/MagicSoft/Mars/mjobs/MSequence.h	(revision 8428)
+++ trunk/MagicSoft/Mars/mjobs/MSequence.h	(revision 8434)
@@ -51,4 +51,6 @@
     TArrayI fDatRuns;
 
+    Bool_t fMonteCarlo;
+
     //TExMap fFileNames;
 
@@ -65,5 +67,5 @@
 public:
     MSequence() : fSequence((UInt_t)-1), fLastRun((UInt_t)-1),
-        fNumEvents((UInt_t)-1), fPeriod((UInt_t)-1) { }
+        fNumEvents((UInt_t)-1), fPeriod((UInt_t)-1), fMonteCarlo(kFALSE) { }
     MSequence(const char *fname, const char *path="");
     MSequence(const MSequence &s) : fSequence(s.fSequence), fStart(s.fStart),
@@ -72,5 +74,5 @@
         fTriggerTable(s.fTriggerTable), fHvSettings(s.fHvSettings),
         fRuns(s.fRuns), fCalRuns(s.fCalRuns), fPedRuns(s.fPedRuns),
-        fDatRuns(s.fDatRuns) { }
+        fDatRuns(s.fDatRuns), fMonteCarlo(s.fMonteCarlo) { }
     ~MSequence();
 
@@ -80,4 +82,7 @@
     // Genaral interface
     Bool_t IsValid() const { return fSequence!=(UInt_t)-1; }
+    Bool_t IsMonteCarlo() const { return fMonteCarlo; }
+
+    void SetMonteCarlo(Bool_t ismc=kTRUE) { fMonteCarlo=ismc; }
 
     UInt_t SetupPedRuns(MDirIter &iter, const char *path=0, Bool_t raw=kFALSE) const;
@@ -115,5 +120,5 @@
     const TString &GetSource() const { return fSource; } 
 
-    const TString GetStandardPath() const { return "/magic/data/"; }
+    const TString GetStandardPath() const { return fMonteCarlo?"/magic/montecarlo/":"/magic/data/"; }
 
     const TString &GetFileName() const { return fFileName; }
@@ -133,5 +138,7 @@
     UInt_t AddDatRuns(UInt_t num) { return AddDatRuns(num, num); }
 
-    ClassDef(MSequence, 1)
+    static Bool_t InflatePath(TString &seq, Bool_t ismc=kFALSE);
+
+    ClassDef(MSequence, 2)
 };
 
