Index: /trunk/MagicSoft/Mars/Changelog
===================================================================
--- /trunk/MagicSoft/Mars/Changelog	(revision 8433)
+++ /trunk/MagicSoft/Mars/Changelog	(revision 8434)
@@ -19,4 +19,64 @@
                                                  -*-*- END OF LINE -*-*-
 
+ 2007/04/23 Thomas Bretz
+
+   * callisto.cc, star.cc:
+     - removed "-raw" and "-root" option
+     - replaced inflating sequence path by new InflatePath
+       function
+     - removed MJCalib::kUse* usage, use MSequence::IsMonteCarlo
+       instead
+
+   * mhcalib/MHCalibrationChargeBlindCam.cc,
+     mhcalib/MHCalibrationHiLoCam.cc, 
+     mhcalib/MHCalibrationPulseTimeCam.cc:
+     - removed obsolete include of MCalibrationIntensityCam
+
+   * mhcalib/MHPedestalCam.cc:
+     - removed obsolete usage of fIntensCam
+
+   * mhist/MHEvent.cc:
+     - replacedcompilation of description string by new 
+       MMcEvt::GetDescription memeber function
+
+   * mjobs/MJCalib.[h,cc]:
+     - removed fDataFlag and corresponding member functions and 
+       handling
+
+   * mjobs/MJCalibTest.cc, mjobs/MJCalibrateSignal.cc,
+     mjobs/MJCalibration.cc, mjobs/MJPedestal.cc, mjobs/MJStar.[h,cc]:
+     - replaced IsUseRawData and IsUseRootData by 
+       MSequence::IsMonteCarlo
+     - use fSequence to determin whether it is MC sequence or not
+
+   * mjobs/MJCalibrateSignal.cc:
+     - renamed movie encoding task list
+     - do not write output files if encoding movie
+
+   * mjobs/MSequence.[h,cc]:
+     - removed "merpp"-path
+     - monte carlo files now always have 8digits run numbers
+     - added new resource "MonteCarlo"
+     - added new static member function InflatePath
+     - increased version number to 2
+
+   * mmc/MMcEvt.[hxx,cxx]:
+     - added new member function GetDescription
+
+   * mmovie/MMovieWrite.[h,cc]:
+     - added a sanity check for strange rms values
+     - search for MMcEvt in the parlist and improve output
+       in case of monte carlo data
+     - fixed some typos in the comments of ReadEnv
+
+   * mmovie/Makefile:
+     - added mmc search path 
+
+   * mraw/MRawRunHeader.cc:
+     - set new defaults of fTelescopeNumber, fCameraVersion,
+       fFreqSampling and fNumSignificantBits for old MC data
+
+
+
  2007/04/23 Daniela Dorner
 
Index: /trunk/MagicSoft/Mars/NEWS
===================================================================
--- /trunk/MagicSoft/Mars/NEWS	(revision 8433)
+++ /trunk/MagicSoft/Mars/NEWS	(revision 8434)
@@ -17,4 +17,13 @@
    - merpp: When reading raw data the data is now stored in a single
      array. The lo-gain array is obsolete. The interface stays the same.
+
+   - callisto: The -root and -raw options to read merpped data have been
+     removed
+
+   - callisto: If the -mc option is given the sequence-name can now be
+     replaced by the MC sequence number
+
+   - callisto: If the sequence file contains "MonteCarlo: Yes" the
+     -mc option can now be omitted
 
    - callisto: Started further simplification by removing obsolete
Index: /trunk/MagicSoft/Mars/callisto.cc
===================================================================
--- /trunk/MagicSoft/Mars/callisto.cc	(revision 8433)
+++ /trunk/MagicSoft/Mars/callisto.cc	(revision 8434)
@@ -55,7 +55,5 @@
     gLog << "   -y                        Extract and calibrate signal" << endl << endl;
     gLog << " Data Type (exclusive):" << endl;
-    gLog << "   -raw                      Read input from raw-data <default>" << endl;
     gLog << "   -mc                       Input root-files are monte carlo files" << endl;
-    gLog << "   -root                     Read input from root-files (merpped)" << endl << endl;
     gLog << " Options:" << endl;
     gLog.Usage();
@@ -192,12 +190,5 @@
           Bool_t  kModeC      = arg.HasOnlyAndRemove("-c");
           Bool_t  kModeY      = arg.HasOnlyAndRemove("-y");
-
-    MJCalib::DataType_t kDataType = MJCalib::kIsUseRawData; // root
-    if (arg.HasOnlyAndRemove("-root"))
-        kDataType = MJCalib::kIsUseRootData; // root
-    if (arg.HasOnlyAndRemove("-raw"))
-        kDataType = MJCalib::kIsUseRawData;  // raw
-    if (arg.HasOnlyAndRemove("-mc"))
-        kDataType = MJCalib::kIsUseMC;       // monte carlo
+    const Bool_t  kIsMC       = arg.HasOnlyAndRemove("-mc");
 
     if (!kInpathY.IsNull() || !kOutpathY.IsNull() || !kOutpath.IsNull() || !kPath.IsNull())
@@ -267,16 +258,6 @@
     TString kSequence = arg.GetArgumentStr(0);
 
-    if (kSequence.IsDigit())
-    {
-        const Int_t numseq = kSequence.Atoi();
-        kSequence = Form("/magic/sequences/%04d/sequence%08d.txt", numseq/10000, numseq);
-        gLog << inf << "Inflated sequence file: " << kSequence << endl;
-    }
-
-    if (gSystem->AccessPathName(kSequence, kFileExists))
-    {
-        gLog << err << "Sorry, sequence file '" << kSequence << "' doesn't exist." << endl;
+    if (!MSequence::InflatePath(kSequence, kIsMC))
         return 3;
-    }
 
     if (gSystem->AccessPathName(kConfig, kFileExists))
@@ -293,4 +274,6 @@
     //
     MSequence seq(kSequence, kInpathD);
+    if (!seq.IsMonteCarlo())
+        seq.SetMonteCarlo(kIsMC);
     if (kPrintSeq)
     {
@@ -310,7 +293,7 @@
     //
     if (kPrintFiles)
-        PrintFiles(seq, kInpathD, kDataType==MJCalib::kIsUseRawData, kFALSE);
+        PrintFiles(seq, kInpathD, !seq.IsMonteCarlo(), kFALSE);
     if (kPrintFound)
-        PrintFiles(seq, kInpathD, kDataType==MJCalib::kIsUseRawData, kTRUE);
+        PrintFiles(seq, kInpathD, !seq.IsMonteCarlo(), kTRUE);
 
     if (seq.HasMoon())
@@ -381,5 +364,4 @@
         job1.SetDisplay(d);
         job1.SetOverwrite(kOverwrite);
-        job1.SetDataType(kDataType);
         job1.SetUseHists(kMoon);
 
@@ -411,5 +393,4 @@
         job2.SetDisplay(d);;
         job2.SetOverwrite(kOverwrite);
-        job2.SetDataType(kDataType);
         job2.SetUseHists(kMoon);
         job2.SetDeadPixelCheck();
@@ -447,5 +428,4 @@
         job3.SetOverwrite(kOverwrite);
         job3.SetPathOut(kOutpathC);
-        job3.SetDataType(kDataType);
         // job2.SetPathIn(kInpathC); // not yet needed
 
@@ -479,5 +459,4 @@
             job4.SetOverwrite(kOverwrite);
             job4.SetPathOut(kOutpathC);
-            job4.SetDataType(kDataType);
 
             if (!job4.Process(job1.GetPedestalCam()))
@@ -514,5 +493,4 @@
         job1.SetOverwrite(kOverwrite);
         job1.SetPathIn(kInpathY);   // --> READ Extractor from calib-file
-        job1.SetDataType(kDataType);
         //job1.SetPathOut(kOutpathY);   // not yet needed
         job1.SetUseData();
@@ -544,6 +522,5 @@
         job2.SetOverwrite(kOverwrite);
         job2.SetPathIn(kInpathY);
-        job2.SetDataType(kDataType);
-        job2.SetPulsePosCheck(kDataType!=MJCalib::kIsUseMC);
+        job2.SetPulsePosCheck(!seq.IsMonteCarlo());
         job2.SetPathOut(kOutpathY); // for updating the extractor
 
@@ -600,5 +577,4 @@
         job3.SetOverwrite(kOverwrite);
         job3.SetPathIn(kInpathY);
-        job3.SetDataType(kDataType);
         // job1.SetPathOut(kOutpathC); // not yet needed
         // job1.SetPathIn(kInpathC);   // not yet needed
@@ -634,7 +610,6 @@
         job4.SetPathIn(kInpathY);
         job4.SetPathOut(kOutpathY);
-        job4.SetDataType(kDataType);
         job4.SetMovieMode(kMovie);
-        if (kDataType!=MJCalib::kIsUseMC)
+        if (!seq.IsMonteCarlo())
             job4.SetExtractor(job2.GetExtractor());
 
Index: /trunk/MagicSoft/Mars/mhcalib/MHCalibrationChargeBlindCam.cc
===================================================================
--- /trunk/MagicSoft/Mars/mhcalib/MHCalibrationChargeBlindCam.cc	(revision 8433)
+++ /trunk/MagicSoft/Mars/mhcalib/MHCalibrationChargeBlindCam.cc	(revision 8434)
@@ -46,5 +46,4 @@
 
 #include "MCalibrationBlindPix.h"
-#include "MCalibrationIntensityCam.h"
 
 #include "MParList.h"
Index: /trunk/MagicSoft/Mars/mhcalib/MHCalibrationHiLoCam.cc
===================================================================
--- /trunk/MagicSoft/Mars/mhcalib/MHCalibrationHiLoCam.cc	(revision 8433)
+++ /trunk/MagicSoft/Mars/mhcalib/MHCalibrationHiLoCam.cc	(revision 8434)
@@ -1,4 +1,4 @@
 /* ======================================================================== *\
-! $Name: not supported by cvs2svn $:$Id: MHCalibrationHiLoCam.cc,v 1.22 2007-04-20 13:55:00 tbretz Exp $
+! $Name: not supported by cvs2svn $:$Id: MHCalibrationHiLoCam.cc,v 1.23 2007-04-23 19:06:28 tbretz Exp $
 ! --------------------------------------------------------------------------
 !
@@ -105,5 +105,4 @@
 #include "MCalibrationHiLoPix.h"
 #include "MCalibrationCam.h"
-#include "MCalibrationIntensityCam.h"
 #include "MCalibrationPix.h"
 
Index: /trunk/MagicSoft/Mars/mhcalib/MHCalibrationPulseTimeCam.cc
===================================================================
--- /trunk/MagicSoft/Mars/mhcalib/MHCalibrationPulseTimeCam.cc	(revision 8433)
+++ /trunk/MagicSoft/Mars/mhcalib/MHCalibrationPulseTimeCam.cc	(revision 8434)
@@ -1,4 +1,4 @@
 /* ======================================================================== *\
-! $Name: not supported by cvs2svn $:$Id: MHCalibrationPulseTimeCam.cc,v 1.36 2007-04-20 13:55:00 tbretz Exp $
+! $Name: not supported by cvs2svn $:$Id: MHCalibrationPulseTimeCam.cc,v 1.37 2007-04-23 19:06:28 tbretz Exp $
 ! --------------------------------------------------------------------------
 !
@@ -123,5 +123,4 @@
 #include "MCalibrationPix.h"
 #include "MHCalibrationPix.h"
-#include "MCalibrationIntensityCam.h"
 
 #include "MGeomCam.h"
Index: /trunk/MagicSoft/Mars/mhcalib/MHPedestalCam.cc
===================================================================
--- /trunk/MagicSoft/Mars/mhcalib/MHPedestalCam.cc	(revision 8433)
+++ /trunk/MagicSoft/Mars/mhcalib/MHPedestalCam.cc	(revision 8434)
@@ -101,5 +101,4 @@
 #include "MPedestalPix.h"
 
-#include "MCalibrationIntensityCam.h"
 #include "MCalibrationPix.h"
 
@@ -394,5 +393,5 @@
                        fFirst, fLast);
         
-        InitHists(pix,fIntensCam ? fIntensCam->GetAverageBadArea(j) : fCam->GetAverageBadArea(j),j);
+        InitHists(pix, fCam->GetAverageBadArea(j), j);
 
       }
@@ -411,5 +410,5 @@
                          fFirst, fLast);
 
-          InitHists(pix,fIntensCam ? fIntensCam->GetAverageBadSector(j) : fCam->GetAverageBadSector(j),j);
+          InitHists(pix, fCam->GetAverageBadSector(j), j);
 
       }
Index: /trunk/MagicSoft/Mars/mhist/MHEvent.cc
===================================================================
--- /trunk/MagicSoft/Mars/mhist/MHEvent.cc	(revision 8433)
+++ /trunk/MagicSoft/Mars/mhist/MHEvent.cc	(revision 8434)
@@ -282,30 +282,5 @@
 
     if (fMcEvt)
-    {
-        TString txt("#splitline{");
-
-        txt += fMcEvt->GetParticleName();
-        txt += " ";
-
-        s.Insert(0, txt);
-
-        s += "}{  E=";
-
-        s+= fMcEvt->GetEnergyStr();
-
-        s += " r=";
-        s += (int)(fMcEvt->GetImpact()/100+.5);
-        s += "m Zd=";
-        s += 0.1*TMath::Nint(fMcEvt->GetTelescopeTheta()*180/TMath::Pi()*10);
-        s += "\\circ ";
-        if (fMcEvt->GetPhotElfromShower()>=10000)
-            s += Form("%dk", (Int_t)(fMcEvt->GetPhotElfromShower()/1000.+.5));
-        else
-            if (fMcEvt->GetPhotElfromShower()>=1000)
-                s += Form("%.1fk", fMcEvt->GetPhotElfromShower()/1000.);
-            else
-                s += fMcEvt->GetPhotElfromShower();
-        s += "PhEl}";
-    }
+        s = fMcEvt->GetDescription(s);
 
     gPad=NULL;
Index: /trunk/MagicSoft/Mars/mjobs/MJCalib.cc
===================================================================
--- /trunk/MagicSoft/Mars/mjobs/MJCalib.cc	(revision 8433)
+++ /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 8433)
+++ /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 8433)
+++ /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 8433)
+++ /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 8433)
+++ /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 8433)
+++ /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 8433)
+++ /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 8433)
+++ /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)
 };
 
Index: /trunk/MagicSoft/Mars/mmovie/MMovieWrite.cc
===================================================================
--- /trunk/MagicSoft/Mars/mmovie/MMovieWrite.cc	(revision 8433)
+++ /trunk/MagicSoft/Mars/mmovie/MMovieWrite.cc	(revision 8434)
@@ -78,4 +78,5 @@
 //   MBadPixelsCam
 //   MMovieData
+//   [MMcEvt]
 //
 /////////////////////////////////////////////////////////////////////////////
@@ -97,4 +98,6 @@
 #include "MGeomCam.h"
 #include "MGeomPix.h"
+
+#include "MMcEvt.hxx"
 
 #include "MH.h"
@@ -279,4 +282,6 @@
         return kFALSE;
     }
+
+    fMC = (MMcEvt*)plist->FindObject("MMcEvt");
 
     return OpenPipe();
@@ -592,7 +597,15 @@
 
     const Double_t rms = fIn->GetMedianPedestalRms();
-
-    h.SetMinimum(fIn->GetMax()-(fIn->GetMax()-rms)*99/98); // rms0
-    h.SetMaximum(fIn->GetMax());
+    const Double_t max = fIn->GetMax();    // scale the lover limit such
+    const Double_t dif = (max-rms)*99/98;  // that everything below rms is
+    const Double_t min = max-dif;          // displayed as white
+
+    // If the maximum is equal or less the
+    // pedestal rms something must be wrong
+    if (dif<=0)
+        return kFALSE;
+
+    h.SetMinimum(min);
+    h.SetMaximum(max);
 
     // -----------------------------------------
@@ -763,8 +776,17 @@
 
     cout << "MED=" << rms0 << endl;
-  */
+    */
+
+    TString s = Form("%d: ", GetNumExecutions()+1);
+    s += "Evt #";
+    s += fHead->GetDAQEvtNumber();
+    s += " of ";
+    s += "Run #";
+    s += fRun->GetRunNumber();
+    if (fMC)
+        s = fMC->GetDescription(s);
+
     MHCamera h(*fCam);
-    h.SetTitle(Form("%d: Run #%d,  Evt %d", GetNumExecutions()+1,
-                    fRun->GetRunNumber(), fHead->GetDAQEvtNumber()));
+    h.SetTitle(s);
     h.SetAllUsed();
     h.SetYTitle("V [au]");
@@ -815,8 +837,8 @@
 //
 // Example:
-//   MMoviePrepare.TargetLength: 5 <seconds>
-//   MMoviePrepare.NumEvents: 500
-//   MMoviePrepare.Threshold: 2 <rms>
-//   MMoviePrepare.Filename: movie.mpg
+//   MMovieWrite.TargetLength: 5 <seconds>
+//   MMovieWrite.NumEvents: 500
+//   MMovieWrite.Threshold: 2 <rms>
+//   MMovieWrite.Filename: movie.mpg
 //
 Int_t MMovieWrite::ReadEnv(const TEnv &env, TString prefix, Bool_t print)
Index: /trunk/MagicSoft/Mars/mmovie/MMovieWrite.h
===================================================================
--- /trunk/MagicSoft/Mars/mmovie/MMovieWrite.h	(revision 8433)
+++ /trunk/MagicSoft/Mars/mmovie/MMovieWrite.h	(revision 8434)
@@ -9,4 +9,5 @@
 class TASImage;
 
+class MMcEvt;
 class MGeomCam;
 class MMovieData;
@@ -26,4 +27,5 @@
     MBadPixelsCam *fBad;   //! Information about bad pixels
     MPedestalCam  *fPed;   //! Fundamental pedestal for palette and cleaning
+    MMcEvt        *fMC;    //! Informatio about MC events
 
     MMovieData    *fIn;    //! Input data with splines for all pixels
Index: /trunk/MagicSoft/Mars/mmovie/Makefile
===================================================================
--- /trunk/MagicSoft/Mars/mmovie/Makefile	(revision 8433)
+++ /trunk/MagicSoft/Mars/mmovie/Makefile	(revision 8434)
@@ -21,5 +21,5 @@
 INCLUDES = -I. -I../mbase -I../mraw -I../mgeom -I../mhbase -I../mgui \
            -I../mcalib -I../msignal -I../mbadpixels -I../mpedestal   \
-           -I../mhist
+           -I../mhist -I../mmc
 
 SRCFILES = MMoviePrepare.cc \
Index: /trunk/MagicSoft/Mars/mraw/MRawRunHeader.cc
===================================================================
--- /trunk/MagicSoft/Mars/mraw/MRawRunHeader.cc	(revision 8433)
+++ /trunk/MagicSoft/Mars/mraw/MRawRunHeader.cc	(revision 8434)
@@ -138,9 +138,13 @@
     fPixAssignment = new MArrayS(0);
 
+    // Remark: If we read old MC data from a root file which do not
+    // yet contain one of these variable, the value given here is
+    // the default. Do not mix files with and without a value if the
+    // files with the value do not match the default!
     fFormatVersion=0;
     fSoftVersion=0;
-    fTelescopeNumber=0;
-    fCameraVersion=0;
-    fFadcType = 0;
+    fTelescopeNumber=1;
+    fCameraVersion=1;
+    fFadcType=0;
     fRunType=kRTNone;  // use 0xffff for invalidation, 0 means: Data run
     fRunNumber=0;
@@ -155,4 +159,7 @@
     fNumSamplesHiGain=0;
     fNumEvents=0;
+    fNumBytesPerSample=1;
+    fFreqSampling=300;
+    fNumSignificantBits=8;
 }
 
Index: /trunk/MagicSoft/Mars/star.cc
===================================================================
--- /trunk/MagicSoft/Mars/star.cc	(revision 8433)
+++ /trunk/MagicSoft/Mars/star.cc	(revision 8434)
@@ -157,16 +157,6 @@
     // Something special for datacenter access
     //
-    if (kSequence.IsDigit())
-    {
-        const Int_t numseq = kSequence.Atoi();
-        kSequence = Form("/magic/sequences/%04d/sequence%08d.txt", numseq/10000, numseq);
-        gLog << inf << "Inflated sequence file: " << kSequence <<  endl;
-    }
-
-    if (gSystem->AccessPathName(kSequence, kFileExists))
-    {
-        gLog << err << "Sorry, sequence file '" << kSequence << "' doesn't exist." << endl;
-        return 2;
-    }
+    if (!MSequence::InflatePath(kSequence, kIsMC))
+        return 2;
 
     if (gSystem->AccessPathName(kConfig, kFileExists))
@@ -180,4 +170,6 @@
     //
     MSequence seq(kSequence, kInpath);
+    if (!seq.IsMonteCarlo())
+        seq.SetMonteCarlo(kIsMC);
     if (kPrintSeq)
     {
@@ -248,5 +240,5 @@
             job.DisableMuonAnalysis();
 
-        if (!job.Process(kIsMC))
+        if (!job.Process())
         {
             gLog << err << "Calculation of image parameters failed." << endl << endl;
Index: /trunk/MagicSoft/include-Classes/MMcFormat/MMcEvt.cxx
===================================================================
--- /trunk/MagicSoft/include-Classes/MMcFormat/MMcEvt.cxx	(revision 8433)
+++ /trunk/MagicSoft/include-Classes/MMcFormat/MMcEvt.cxx	(revision 8434)
@@ -18,5 +18,5 @@
 !   Author(s):
 !
-!   Copyright: MAGIC Software Development, 2000-2005
+!   Copyright: MAGIC Software Development, 2000-2007
 !
 !
@@ -199,5 +199,5 @@
 
     fFadcTimeJitter = fadc_jitter;
-    
+
     fEventReuse = reuse;
 }
@@ -217,7 +217,34 @@
     TString str(opt);
     if (str.IsNull())
-    {
         *fLog << " Photoelectrons: " << fPhotElfromShower << endl;
-        return;
-    }
-}
+}
+
+// --------------------------------------------------------------------------
+//
+// Return a proper description of the monte carlo event
+//
+TString MMcEvt::GetDescription(TString s) const
+{
+    TString txt("#splitline{");
+
+    txt += GetParticleName();
+    txt += " ";
+    txt += s;
+    txt += "}{  E=";
+    txt += GetEnergyStr();
+    txt += " r=";
+    txt += (int)(GetImpact()/100+.5);
+    txt += "m Zd=";
+    txt += 0.1*TMath::Nint(GetTelescopeTheta()*180/TMath::Pi()*10);
+    txt += "\\circ ";
+    if (GetPhotElfromShower()>=10000)
+        txt += Form("%dk", (Int_t)(GetPhotElfromShower()/1000.+.5));
+    else
+        if (GetPhotElfromShower()>=1000)
+            txt += Form("%.1fk", GetPhotElfromShower()/1000.);
+        else
+            txt += GetPhotElfromShower();
+    txt += "PhEl}";
+
+    return txt;
+}
Index: /trunk/MagicSoft/include-Classes/MMcFormat/MMcEvt.hxx
===================================================================
--- /trunk/MagicSoft/include-Classes/MMcFormat/MMcEvt.hxx	(revision 8433)
+++ /trunk/MagicSoft/include-Classes/MMcFormat/MMcEvt.hxx	(revision 8434)
@@ -100,4 +100,6 @@
     Float_t GetMuonCphFraction() const { return fMuonCphFraction; }
 
+    TString GetDescription(TString s="") const;
+
     // Setter
     void SetTheta(Float_t Theta) { fTheta=Theta; }                //Set Theta angle
