Index: trunk/MagicSoft/Mars/mjobs/MJCalibrateSignal.cc
===================================================================
--- trunk/MagicSoft/Mars/mjobs/MJCalibrateSignal.cc	(revision 9309)
+++ trunk/MagicSoft/Mars/mjobs/MJCalibrateSignal.cc	(revision 9317)
@@ -380,5 +380,5 @@
     read->AddFiles(iter);
 
-    const TString fname(Form("s/([0-9]+(_M[12])?_[0-9.]+)_D_(.*[.])(raw([.]gz)?)$/%s\\/$1_Y_$3root/",
+    const TString fname(Form("s/([0-9]+(_M[12])?_[0-9.]+)_D_(.*[.])(raw|raw[.]gz|root)$/%s\\/$1_Y_$3root/",
                              Esc(fPathOut).Data()));
 
@@ -758,5 +758,7 @@
     MWriteRootFile writemc(2, fname, fOverwrite?"RECREATE":"NEW", "Calibrated Data");
     writemc.SetName("WriteMC");
-    writemc.AddContainer("MMcEvtBasic", "OriginalMC");
+    writemc.AddContainer("MMcEvtBasic", "OriginalMC", kFALSE);
+    if (fSequence.IsMonteCarlo())
+        writemc.AddCopySource("OriginalMC");
 
     // Write the special calib tree
Index: trunk/MagicSoft/Mars/mjobs/MJCalibration.cc
===================================================================
--- trunk/MagicSoft/Mars/mjobs/MJCalibration.cc	(revision 9309)
+++ trunk/MagicSoft/Mars/mjobs/MJCalibration.cc	(revision 9317)
@@ -19,5 +19,5 @@
 !   Author(s): Markus Gaug, 02/2004 <mailto:markus@ifae.es>
 !
-!   Copyright: MAGIC Software Development, 2000-2008
+!   Copyright: MAGIC Software Development, 2000-2009
 !
 !
@@ -105,4 +105,5 @@
 
 #include "MEnv.h"
+#include "MString.h"
 #include "MDirIter.h"
 #include "MSequence.h"
@@ -551,176 +552,72 @@
     if (fDisplayType == kDataCheckDisplay)
     {
+      // -------------------- FitCharge -------------------
 
       TCanvas &c1 = fDisplay->AddTab("FitCharge");
       c1.Divide(3, 3);
 
-      //
-      // MEAN CHARGES
-      // 
-      c1.cd(1);
-      gPad->SetBorderMode(0);
-      gPad->SetTicks();
-      MHCamera *obj1=(MHCamera*)disp1.DrawCopy("hist");
-      FixDataCheckHist(*obj1/*, fChargeMin, fChargeMax*/);
-      // DisplayReferenceLines(obj1,0);
-
-      c1.cd(4);
-      gPad->SetBorderMode(0);
-      obj1->SetPrettyPalette();
-      obj1->Draw();
-
-      c1.cd(7);
-      gPad->SetBorderMode(0);
-      gPad->SetTicks();
-      TH1D *obj2 = (TH1D*)obj1->Projection();
-      obj2->SetBit(kCanDelete);
-      obj2->Draw();
-      FixDataCheckHist(*obj2);
-      //obj2->SetStats(1);
-
-      //
-      // RMS per Charge
-      // 
-      c1.cd(2);
-      gPad->SetBorderMode(0);
-      gPad->SetTicks();
-      MHCamera *obj3=(MHCamera*)disp36.DrawCopy("hist");
-      FixDataCheckHist(*obj3/*, 0, fChargeMax*/);
-      //  DisplayReferenceLines(obj3,0);
-
-      c1.cd(5);
-      gPad->SetBorderMode(0);
-      obj3->SetPrettyPalette();
-      obj3->Draw();
-
-      c1.cd(8);
-      gPad->SetBorderMode(0);
-      if (geomcam.InheritsFrom("MGeomCamMagic"))
-          DisplayDoubleProject(disp36/*, "dead", "noisy"*/);
-
-      //
-      // PHOTO ELECTRONS
-      // 
-      c1.cd(3);
-      gPad->SetBorderMode(0);
-      gPad->SetTicks();
-      MHCamera *obj4=(MHCamera*)disp5.DrawCopy("hist");
-      FixDataCheckHist(*obj4/*, fChargeMin, fChargeMax*/);
-      // DisplayReferenceLines(obj3,0);
-
-      c1.cd(6);
-      gPad->SetBorderMode(0);
-      obj4->SetPrettyPalette();
-      obj4->Draw();
-
-      c1.cd(9);
-      gPad->SetBorderMode(0);
-      if (geomcam.InheritsFrom("MGeomCamMagic"))
-          DisplayDoubleProject(disp5/*, "dead", "noisy"*/);
-
-      //
-      // CONVERSION FACTORS
-      // 
+      disp1.CamDraw( c1, 1, 3, 6);   // MEAN CHARGES
+      disp36.CamDraw(c1, 2, 3, 6);   // RMS per Charge
+      disp5.CamDraw( c1, 3, 3, 6);   // PHOTO ELECTRONS
+
+      // -------------------- Conversion -------------------
+
       TCanvas &c2 = fDisplay->AddTab("Conversion");
       c2.Divide(3,3);
 
+      disp6.SetMinMax(fConvFADC2PheMin, fConvFADC2PheMax);
+      disp8.SetMinMax(fQEMin, fQEMax);
+      disp37.SetMinMax(fConvFADC2PheMin, fConvFADC2PheMax);
+
+      disp6.CamDraw( c2, 1, 3, 6);   // CONVERSION FACTORS
+      disp8.CamDraw( c2, 2, 3, 6);   // QUANTUM EFFICIENCY
+      disp37.CamDraw(c2, 3, 3, 6);   // CONVERSION FADC TO PHOTONS
+
       c2.cd(1);
-      gPad->SetBorderMode(0);
-      gPad->SetTicks();
-      MHCamera *obj5=(MHCamera*)disp6.DrawCopy("hist");
-      FixDataCheckHist(*obj5, fConvFADC2PheMin, fConvFADC2PheMax);
-      DisplayReferenceLines(obj5,2);
-
-      c2.cd(4);
-      gPad->SetBorderMode(0);
-      obj5->SetPrettyPalette();
-      obj5->Draw();
-
-      c2.cd(7);
-      gPad->SetBorderMode(0);
-      if (geomcam.InheritsFrom("MGeomCamMagic"))
-          DisplayDoubleProject(disp6/*, "noisy", "dead"*/);
-
-      //
-      // QUANTUM EFFICIENCY
-      //
+      DisplayReferenceLines(disp6, 2);
+
       c2.cd(2);
-      gPad->SetBorderMode(0);
-      gPad->SetTicks();
-      MHCamera *obj6=(MHCamera*)disp8.DrawCopy("hist");
-      FixDataCheckHist(*obj6, fQEMin, fQEMax);
-      DisplayReferenceLines(obj6,0);
-
-      c2.cd(5);
-      gPad->SetBorderMode(0);
-      obj6->SetPrettyPalette();
-      obj6->Draw();
-
-      c2.cd(8);
-      gPad->SetBorderMode(0);
-      if (geomcam.InheritsFrom("MGeomCamMagic"))
-          DisplayDoubleProject(disp8/*, "noisy", "dead"*/);
-
-      //
-      // CONVERSION FADC TO PHOTONS
-      // 
+      DisplayReferenceLines(disp8, 0);
+
       c2.cd(3);
-      gPad->SetBorderMode(0);
-      gPad->SetTicks();
-      MHCamera *obj7=(MHCamera*)disp37.DrawCopy("hist");
-      FixDataCheckHist(*obj7, fConvFADC2PheMin, fConvFADC2PheMax);
-      DisplayReferenceLines(obj7,1);
-
-      c2.cd(6);
-      gPad->SetBorderMode(0);
-      obj7->SetPrettyPalette();
-      obj7->Draw();
-      c2.cd(9);
-      gPad->SetBorderMode(0);
-      if (geomcam.InheritsFrom("MGeomCamMagic"))
-          DisplayDoubleProject(disp37/*, "noisy", "dead"*/);
-
-      //
-      // ARRIVAL TIMES
-      // 
+      DisplayReferenceLines(disp37, 1);
+
+      // -------------------- AbsTimes -------------------
+
       TCanvas &c3 = fDisplay->AddTab("AbsTimes");
       c3.Divide(2,3);
 
+      disp28.SetMinMax(fArrivalTimeMin, fArrivalTimeMax);
+
+      disp28.CamDraw(c3, 1, 2, 6);  // Arrival times
+      disp29.CamDraw(c3, 2, 2, 6);  // Arrival times rms
+
       c3.cd(1);
-      gPad->SetBorderMode(0);
-      gPad->SetTicks();
-      MHCamera *obj10=(MHCamera*)disp28.DrawCopy("hist");
-      FixDataCheckHist(*obj10, fArrivalTimeMin, fArrivalTimeMax);
-      DisplayReferenceLines(obj10,3);
-
-      c3.cd(3);
-      gPad->SetBorderMode(0);
-      obj10->SetPrettyPalette();
-      obj10->Draw();
-
-      c3.cd(5);
-      gPad->SetBorderMode(0);
-      if (geomcam.InheritsFrom("MGeomCamMagic"))
-          DisplayDoubleProject(disp28/*, "early", "late"*/);
-
-      //
-      // ARRIVAL TIMES JITTER
-      // 
+      DisplayReferenceLines(disp28, 3);
+
       c3.cd(2);
-      gPad->SetBorderMode(0);
-      gPad->SetTicks();
-      MHCamera *obj11=(MHCamera*)disp29.DrawCopy("hist");
-      FixDataCheckHist(*obj11/*, fArrivalTimeMin, fArrivalTimeMax*/);
-      DisplayReferenceLines(obj11,4);
-
-      c3.cd(4);
-      gPad->SetBorderMode(0);
-      obj11->SetPrettyPalette();
-      obj11->Draw();
-
-      c3.cd(6);
-      gPad->SetBorderMode(0);
-      if (geomcam.InheritsFrom("MGeomCamMagic"))
-          DisplayDoubleProject(disp29/*, "", "jittering"*/);
+      DisplayReferenceLines(disp29, 4);
+
+      if (IsRelTimes())
+      {
+          // -------------------- RelTimes -------------------
+
+          TCanvas &c5 = fDisplay->AddTab("RelTimes");
+          c5.Divide(2,3);
+
+          disp30.SetMinMax(fTimeOffsetMin, fTimeOffsetMax);
+          disp31.SetMinMax(fTimeResolutionMin, fTimeResolutionMax);
+
+          disp30.CamDraw(c5, 1, 2, 6); // MEAN REL. ARR. TIMES
+          disp31.CamDraw(c5, 2, 2, 6); // JITTER Rel. Arr. Times
+
+          c5.cd(1);
+          DisplayReferenceLines(disp30, 5);
+
+          c5.cd(2);
+          DisplayReferenceLines(disp31, 6);
+      }
+
+      // -------------------- Unsuitable -------------------
 
       //
@@ -754,51 +651,4 @@
       obj9->SetPrettyPalette();
       obj9->Draw();
-
-      if (IsRelTimes())
-        {
-          TCanvas &c5 = fDisplay->AddTab("RelTimes");
-          c5.Divide(2,3);
-
-          //
-          // MEAN REL. ARR. TIMES
-          //
-          c5.cd(1);
-          gPad->SetBorderMode(0);
-          gPad->SetTicks();
-          MHCamera *obj12=(MHCamera*)disp30.DrawCopy("hist");
-          FixDataCheckHist(*obj12, fTimeOffsetMin, fTimeOffsetMax);
-          DisplayReferenceLines(obj12,5);
-
-          c5.cd(3);
-          gPad->SetBorderMode(0);
-          obj10->SetPrettyPalette();
-          obj10->Draw();
-
-          c5.cd(5);
-          gPad->SetBorderMode(0);
-          if (geomcam.InheritsFrom("MGeomCamMagic"))
-              DisplayDoubleProject(disp30/*, "early", "late"*/);
-
-          //
-          // JITTER Rel. Arr. Times
-          //
-          c5.cd(2);
-          gPad->SetBorderMode(0);
-          gPad->SetTicks();
-          MHCamera *obj13=(MHCamera*)disp31.DrawCopy("hist");
-          FixDataCheckHist(*obj13, fTimeResolutionMin, fTimeResolutionMax);
-          DisplayReferenceLines(obj13,6);
-
-          c5.cd(4);
-          gPad->SetBorderMode(0);
-          obj13->SetPrettyPalette();
-          obj13->Draw();
-
-          c5.cd(6);
-          gPad->SetBorderMode(0);
-          if (geomcam.InheritsFrom("MGeomCamMagic"))
-              DisplayDoubleProject(disp31/*, "too stable", "jittering"*/);
-
-        }
       return;
     }
@@ -989,12 +839,14 @@
     }
 }
-    
-
-void  MJCalibration::DisplayReferenceLines(const MHCamera *cam, const Int_t what) const
+
+void  MJCalibration::DisplayReferenceLines(const MHCamera &hist, const Int_t what) const
 {
+    MHCamera *cam = dynamic_cast<MHCamera*>(gPad->FindObject(hist.GetName()));
+    if (!cam)
+        return;
 
   const MGeomCam *geom = cam->GetGeometry();
 
-  Double_t x = geom->InheritsFrom("MGeomCamMagic") ? 397 : cam->GetNbinsX() ;
+  const Double_t x = geom->InheritsFrom("MGeomCamMagic") ? 397 : cam->GetNbinsX() ;
 
   TLine line;
@@ -1728,4 +1580,5 @@
         SetUsePINDiode(kFALSE);
 
+    // Only display result if PreProcessing was successfull
     const Int_t numexec = !fSequence.IsMonteCarlo() ? rawread.GetNumExecutions() : read.GetNumExecutions();
     if (numexec>0)
@@ -1877,10 +1730,13 @@
 }
 
+
 void MJCalibration::DisplayDoubleProject(const MHCamera &cam)
 {
+    const UInt_t n = cam.GetGeometry()->GetNumAreas();
+
     TVirtualPad *pad = gPad;
-    pad->Divide(2, 1, 1e-5, 1e-5);;
-
-    for (int i=0; i<2; i++)
+    pad->Divide(n, 1, 1e-5, 1e-5);;
+
+    for (UInt_t i=0; i<n; i++)
     {
         pad->cd(i+1);
@@ -1888,7 +1744,7 @@
         gPad->SetTicks();
 
-        TH1D &h = *cam.ProjectionS(TArrayI(), TArrayI(1, &i), Form("%s_%s", cam.GetName(), i==0?"Inner":"Outer"));
+        TH1D &h = *cam.ProjectionS(TArrayI(), TArrayI(1, (Int_t*)&i), MString::Format("%s_%d", cam.GetName(), i));
         FixDataCheckHist(h);
-        h.SetTitle(Form("%s %s",cam.GetTitle(), i==0?"Inner":"Outer"));
+        h.SetTitle(MString::Format("%s %d",cam.GetTitle(), i));
         h.SetDirectory(NULL);
         h.SetBit(kCanDelete);
Index: trunk/MagicSoft/Mars/mjobs/MJCalibration.h
===================================================================
--- trunk/MagicSoft/Mars/mjobs/MJCalibration.h	(revision 9309)
+++ trunk/MagicSoft/Mars/mjobs/MJCalibration.h	(revision 9317)
@@ -122,5 +122,5 @@
   
   void DisplayResult(MParList &plist);
-  void DisplayReferenceLines(const MHCamera *cam, const Int_t what) const;
+  void DisplayReferenceLines(const MHCamera &hist, const Int_t what) const;
   //void   DisplayOutliers      ( TH1D     *hist, const char* whatsmall, const char* whatbig ) const;
 
Index: trunk/MagicSoft/Mars/mjobs/MJPedestal.cc
===================================================================
--- trunk/MagicSoft/Mars/mjobs/MJPedestal.cc	(revision 9309)
+++ trunk/MagicSoft/Mars/mjobs/MJPedestal.cc	(revision 9317)
@@ -93,7 +93,4 @@
 #include "MFDataMember.h"
 
-// Display helpers
-#include "MJCalibration.h"
-
 ClassImp(MJPedestal);
 
@@ -365,111 +362,52 @@
 */
     if (fDisplayType == kDisplayDataCheck)
-      {
+    {
 
         TCanvas &c3 = fDisplay->AddTab(fExtractionType!=kFundamental/*fExtractorResolution*/ ? "PedExtrd" : "Ped");
         c3.Divide(2,3);
 
+        if (fExtractionType==kFundamental)
+            disp0.SetMinMax(fPedestalMin, fPedestalMax);
+        disp1.SetMinMax(fPedRmsMin, fPedRmsMax);
+
+        disp0.CamDraw(c3, 1, 2, 0);  // Don't devide, don't fit
+        disp1.CamDraw(c3, 2, 2, 6);  // Divide, fit
+
         c3.cd(1);
-        gPad->SetBorderMode(0);
-        gPad->SetTicks();
-        MHCamera *obj1=(MHCamera*)disp0.DrawCopy("hist");
-        //
-        // for the datacheck, fix the ranges!!
-        //
-        if (fExtractionType==kFundamental/*!fExtractorResolution*/)
-          {
-            obj1->SetMinimum(fPedestalMin);
-            obj1->SetMaximum(fPedestalMax);
-	  }
-	//
-	// Set the datacheck sizes:
-	//
-	FixDataCheckHist((TH1D*)obj1);
-	//
-	// set reference lines
-	//
-	DisplayReferenceLines(obj1,0);
-        //
-        // end reference lines
-        //
-        c3.cd(3);
-        gPad->SetBorderMode(0);
-        obj1->SetPrettyPalette();
-        obj1->Draw();
-
-        c3.cd(5);
-        gPad->SetBorderMode(0);
-        gPad->SetTicks();
-        TH1D *obj2 = (TH1D*)obj1->Projection();
-        obj2->Draw();
-        obj2->SetBit(kCanDelete);
-        obj2->Fit("gaus","Q");
-        obj2->GetFunction("gaus")->SetLineColor(kYellow);
-        //
-        // Set the datacheck sizes:
-        //
-        FixDataCheckHist(obj2);
-        obj2->SetStats(1);
+        if (fExtractionType==kFundamental)
+            DisplayReferenceLines(disp0, 0);
 
         c3.cd(2);
-        gPad->SetBorderMode(0);
-        gPad->SetTicks();
-        MHCamera *obj3=(MHCamera*)disp1.DrawCopy("hist");
-        //
-        // for the datacheck, fix the ranges!!
-        //
-        obj3->SetMinimum(fPedRmsMin);
-        obj3->SetMaximum(fPedRmsMax);
-        //
-        // Set the datacheck sizes:
-        //
-        FixDataCheckHist((TH1D*)obj3);
-        //
-        // set reference lines
-        //
-        DisplayReferenceLines(obj3,1);
-
-        c3.cd(4);
-        gPad->SetBorderMode(0);
-        obj3->SetPrettyPalette();
-        obj3->Draw();
-
-        c3.cd(6);
-        gPad->SetBorderMode(0);
-
-        if (geomcam.InheritsFrom("MGeomCamMagic"))
-        {
-            MJCalibration::DisplayDoubleProject(disp1);
-            return;
-        }
-      }
+        DisplayReferenceLines(disp1, 1);
+
+        return;
+    }
 
     if (fExtractionType!=kFundamental/*fExtractorResolution*/)
-      {
+    {
 
           TCanvas &c3 = fDisplay->AddTab(fExtractionType==kWithExtractor?"PedExtrd":"PedRndm");
           c3.Divide(2,3);
 
-          disp0.CamDraw(c3, 1, 2, 1);
-          disp1.CamDraw(c3, 2, 2, 6);
+          disp0.CamDraw(c3, 1, 2, 1);  // Don't divide, fit
+          disp1.CamDraw(c3, 2, 2, 6);  // Divide, fit
 
           TCanvas &c13 = fDisplay->AddTab(fExtractionType==kWithExtractor?"DiffExtrd":"DiffRndm");
           c13.Divide(2,3);
 
-          disp9.CamDraw(c13, 1, 2, 5);
-          disp10.CamDraw(c13, 2, 2, 5);
-          return;
-      }
-}
-
-void  MJPedestal::DisplayReferenceLines(MHCamera *cam, const Int_t what) const
-{
-
-  Double_t x = cam->GetNbinsX();
-  
+          disp9.CamDraw(c13,  1, 2, 1);
+          disp10.CamDraw(c13, 2, 2, 1);
+    }
+}
+
+void  MJPedestal::DisplayReferenceLines(const MHCamera &hist, const Int_t what) const
+{
+    MHCamera *cam = dynamic_cast<MHCamera*>(gPad->FindObject(hist.GetName()));
+    if (!cam)
+        return;
+
   const MGeomCam *geom = cam->GetGeometry();
 
-  if (geom->InheritsFrom("MGeomCamMagic"))
-    x = what ? 397 : cam->GetNbinsX();
+  const Double_t x = geom->InheritsFrom("MGeomCamMagic") && what ? 397 : cam->GetNbinsX() ;
 
   TLine line;
@@ -478,5 +416,5 @@
   line.SetLineColor(kBlue);
   
-  TLegend *leg = new TLegend(0.6,0.75,0.9,0.99);
+  TLegend *leg = new TLegend(0.75,0.75,0.999,0.99);
   leg->SetBit(kCanDelete);
 
@@ -522,6 +460,6 @@
   
     
-  leg->AddEntry(l1, "Galactic Source","l");
-  leg->AddEntry(l2, "Extra-Galactic Source","l");
+  leg->AddEntry(l1, "Galactic","l");
+  leg->AddEntry(l2, "Extra-Galactic","l");
   leg->AddEntry(l3, "Closed Lids","l");
   leg->Draw();
Index: trunk/MagicSoft/Mars/mjobs/MJPedestal.h
===================================================================
--- trunk/MagicSoft/Mars/mjobs/MJPedestal.h	(revision 9309)
+++ trunk/MagicSoft/Mars/mjobs/MJPedestal.h	(revision 9317)
@@ -87,5 +87,5 @@
 
     void   DisplayResult(const MParList &plist);
-    void   DisplayReferenceLines(MHCamera *cam, const Int_t what) const;
+    void   DisplayReferenceLines(const MHCamera &hist, const Int_t what) const;
     //void   DisplayOutliers(TH1D *hist) const;
     void   FixDataCheckHist(TH1D *hist) const;
Index: trunk/MagicSoft/Mars/mjobs/MJSimulation.cc
===================================================================
--- trunk/MagicSoft/Mars/mjobs/MJSimulation.cc	(revision 9309)
+++ trunk/MagicSoft/Mars/mjobs/MJSimulation.cc	(revision 9317)
@@ -34,4 +34,14 @@
 //
 //
+// To switch off the simulation of the camera electronics, use:
+//
+//    Camera: Off
+//
+// Note, that the border of the camera and the propertied of the cones
+// are still simulated (simply because it is fast). Furthermore, this
+// switches off the trigger for the output, i.e. all data which deposits
+// at least one photon in at least one pixel is written to the output file.
+//
+//
 // In case of a pedestal or calibration run the artificial trigger can
 // be "switched off" and the cosmics trrigger "switched on" by setting
@@ -45,4 +55,5 @@
 
 #include <TEnv.h>
+#include <TCanvas.h>
 
 // Core
@@ -86,4 +97,5 @@
 
 #include "MHn.h"
+#include "MHCamera.h"
 #include "MHCamEvent.h"
 #include "MHPhotonEvent.h"
@@ -95,4 +107,5 @@
 #include "MParEnv.h"
 #include "MPulseShape.h"
+#include "MGeomCam.h"
 
 #include "MPedestalCam.h"
@@ -110,5 +123,5 @@
 //
 MJSimulation::MJSimulation(const char *name, const char *title)
-    : fForceMode(kFALSE), fForceTrigger(kFALSE)
+    : fForceMode(kFALSE), fCamera(kTRUE) ,fForceTrigger(kFALSE)
 {
     fName  = name  ? name  : "MJSimulation";
@@ -120,9 +133,10 @@
     fForceMode    = GetEnv("ForceMode",    fForceMode);
     fForceTrigger = GetEnv("ForceTrigger", fForceTrigger);
+    fCamera       = GetEnv("Camera",       fCamera);
 
     return kTRUE;
 }
 
-Bool_t MJSimulation::WriteResult()
+Bool_t MJSimulation::WriteResult(const MParList &plist)
 {
     if (fPathOut.IsNull())
@@ -135,4 +149,9 @@
     cont.Add(const_cast<TEnv*>(GetEnv()));
     //cont.Add(const_cast<MSequence*>(&fSequence));
+
+    cont.Add(plist.FindObject("MPulseShape"));
+    cont.Add(plist.FindObject("MReflector"));
+    cont.Add(plist.FindObject("MGeomCam"));
+    cont.Add(plist.FindObject("GeomAPDs"));
 
     if (fDisplay)
@@ -246,26 +265,30 @@
     plist.AddToList(&shape);
 
+    // *** FIXME *** FIXME *** FIXME ***
+    plist.FindCreateObj("MMcRunHeader");
+
     MRawRunHeader header;
     header.SetValidMagicNumber();
     //header.InitFadcType(3);
 
-    header.SetRunInfo(/*MRawRunHeader::kRTMonteCarlo|*/MRawRunHeader::kRTData,        1, 1);
+    header.SetRunType(MRawRunHeader::kRTMonteCarlo|MRawRunHeader::kRTData);
     if (args.GetNumArguments()==1)
     {
         if (!args.GetArgumentStr(0).CompareTo("pedestal", TString::kIgnoreCase))
         {
-            header.SetRunInfo(/*MRawRunHeader::kRTMonteCarlo|*/MRawRunHeader::kRTPedestal,    1, 1);
+            header.SetRunType(MRawRunHeader::kRTMonteCarlo|MRawRunHeader::kRTPedestal);
             header.SetSourceInfo("Pedestal");
         }
         if (!args.GetArgumentStr(0).CompareTo("calibration", TString::kIgnoreCase))
         {
-            header.SetRunInfo(/*MRawRunHeader::kRTMonteCarlo|*/MRawRunHeader::kRTCalibration,    1, 1);
+            header.SetRunType(MRawRunHeader::kRTMonteCarlo|MRawRunHeader::kRTCalibration);
             header.SetSourceInfo("Calibration");
         }
         if (!args.GetArgumentStr(0).CompareTo("pointrun", TString::kIgnoreCase))
-            header.SetRunInfo(/*MRawRunHeader::kRTMonteCarlo|*/MRawRunHeader::kRTPointRun,    1, 1);
+            header.SetRunType(MRawRunHeader::kRTMonteCarlo|MRawRunHeader::kRTPointRun);
     }
 
     // FIXME: Move to MSimPointingPos, MSimCalibrationSignal
+    //        Can we use this as input for MSimPointingPos?
     header.SetObservation("On", "MonteCarlo");
     plist.AddToList(&header);
@@ -287,4 +310,6 @@
     for (int i=0; i<args.GetNumArguments();i ++)
         read.AddFile(args.GetArgumentStr(i));
+
+    MSimMMCS simmmcs;
 
     MSimAbsorption absapd("AbsorptionAPDs");
@@ -385,20 +410,28 @@
     const TString rule3(Form("s/cer([0-9]+)/%s\\/cam$1.root/", Esc(fPathOut).Data()));
 
-    MWriteRootFile write1( 2, rule1, fOverwrite?"RECREATE":"NEW", "Reflector file");
-    MWriteRootFile write2( 2, rule2, fOverwrite?"RECREATE":"NEW", "Signal file");
-    MWriteRootFile write3( 2, rule3, fOverwrite?"RECREATE":"NEW", "Camera file");
-
-    write1.SetName("WriteRef");
-    write2.SetName("WriteSig");
-    write3.SetName("WriteCam");
-
-    write1.AddContainer("MCorsikaEvtHeader", "Events", kFALSE);
-    write1.AddContainer("MPhotonEvent",      "Events");
-
-    write2.AddContainer("MRawRunHeader",             "RunHeaders");
-    write2.AddContainer("MGeomCam",                  "RunHeaders");
-    write2.AddContainer("MSignalCam",                "Events");
-    write2.AddContainer("MRawEvtHeader",             "Events");
-    write2.AddContainer("MPedPhotFromExtractorRndm", "RunHeaders");
+    MWriteRootFile write3a( 2, rule3, fOverwrite?"RECREATE":"NEW", "Camera file");
+    MWriteRootFile write3b( 2, rule3, fOverwrite?"RECREATE":"NEW", "Camera file");
+    MWriteRootFile write2a( 2, rule2, fOverwrite?"RECREATE":"NEW", "Signal file");
+    MWriteRootFile write2b( 2, rule2, fOverwrite?"RECREATE":"NEW", "Signal file");
+    MWriteRootFile write1a( 2, rule1, fOverwrite?"RECREATE":"NEW", "Reflector file");
+    MWriteRootFile write1b( 2, rule1, fOverwrite?"RECREATE":"NEW", "Reflector file");
+
+    write1a.SetName("WriteRefData");
+    write1b.SetName("WriteRefMC");
+    write2a.SetName("WriteSigData");
+    write2b.SetName("WriteSigMC");
+    write3a.SetName("WriteCamData");
+    write3b.SetName("WriteCamMC");
+
+    write1a.AddContainer("MCorsikaEvtHeader", "Events", kFALSE);
+    write1a.AddContainer("MPhotonEvent",      "Events");
+
+    write2a.AddContainer("MCorsikaRunHeader", "RunHeaders", kFALSE);
+    write2a.AddContainer("MRawRunHeader",     "RunHeaders");
+    write2a.AddContainer("MGeomCam",          "RunHeaders");
+    write2a.AddContainer("MSignalCam",        "Events");
+    write2a.AddContainer("MRawEvtHeader",     "Events",    kFALSE);
+    write2a.AddContainer("MPedPhotFromExtractorRndm", "RunHeaders"); // FIXME: Needed for the signal files to be display in MARS
+    write2a.AddContainer("MMcRunHeader",       "RunHeaders");
     /* Monte Carlo Headers
     write.AddContainer("MMcRunHeader",              "RunHeaders", kFALSE);
@@ -417,9 +450,16 @@
     //write.AddContainer("MTriggerPattern",           "Events");
 
-    write3.AddContainer("MRawEvtData",   "Events");
-    write3.AddContainer("MRawRunHeader", "RunHeaders");
-    write3.AddContainer("MGeomCam",      "RunHeaders");
-    write3.AddContainer("MRawEvtHeader", "Events");
-    write3.AddContainer("MPedestalCam",  "RunHeaders", kFALSE);
+    write3a.AddContainer("MRawEvtData",         "Events");
+    write3a.AddContainer("MRawRunHeader",       "RunHeaders");
+    write3a.AddContainer("MGeomCam",            "RunHeaders");
+    write3a.AddContainer("MRawEvtHeader",       "Events",     kFALSE);
+    //write3.AddContainer("MPedestalCam",  "RunHeaders", kFALSE);
+    write3a.AddContainer("MMcRunHeader",        "RunHeaders");
+    write3a.AddContainer("MMcCorsikaRunHeader", "RunHeaders", kFALSE);
+    write3a.AddContainer("MMcEvt",              "Events",     kFALSE);
+
+    write1b.AddContainer("MMcEvtBasic",         "OriginalMC");
+    write2b.AddContainer("MMcEvtBasic",         "OriginalMC");
+    write3b.AddContainer("MMcEvtBasic",         "OriginalMC");
 
     // -------------------------------------------------------------------
@@ -500,4 +540,12 @@
         tasks.AddToList(&read);
         tasks.AddToList(&pointing);
+        tasks.AddToList(&simmmcs);
+        if (!fPathOut.IsNull() && !HasNullOut())
+        {
+            tasks.AddToList(&write1b);
+            tasks.AddToList(&write2b);
+            if (fCamera)
+                tasks.AddToList(&write3b);
+        }
         //    if (header.IsPointRun())
         //        tasks.AddToList(&stars);
@@ -536,27 +584,37 @@
         tasks.AddToList(&cont2);
     }
-    if (header.IsPedestalRun() || header.IsCalibrationRun())
-        tasks.AddToList(&simcal);
-    tasks.AddToList(&simnsb);
-    tasks.AddToList(&simapd);
-    tasks.AddToList(&simexcnoise);
+    if (fCamera)
+    {
+        if (header.IsPedestalRun() || header.IsCalibrationRun())
+            tasks.AddToList(&simcal);
+        tasks.AddToList(&simnsb);
+        tasks.AddToList(&simapd);
+        tasks.AddToList(&simexcnoise);
+    }
     tasks.AddToList(&simsum);
-    tasks.AddToList(&simcam);
-    if (header.IsDataRun() || fForceTrigger)
-        tasks.AddToList(&simtrig);
-    tasks.AddToList(&conttrig);
+    if (fCamera)
+    {
+        tasks.AddToList(&simcam);
+        if (header.IsDataRun() || fForceTrigger)
+            tasks.AddToList(&simtrig);
+        tasks.AddToList(&conttrig);
+        tasks.AddToList(&simdaq);
+    }
     tasks.AddToList(&simsignal);  // What do we do if signal<0?
-    tasks.AddToList(&simdaq);
     if (!fPathOut.IsNull() && !HasNullOut())
     {
-        tasks.AddToList(&write1);
+        tasks.AddToList(&write1a);
         if (!header.IsPedestalRun())
-            tasks.AddToList(&write2);
-        tasks.AddToList(&write3);
+            tasks.AddToList(&write2a);
+        if (fCamera)
+            tasks.AddToList(&write3a);
     }
     // -------------------------------
-    if (header.IsDataRun())
-        tasks.AddToList(&fillh3);
-    tasks.AddToList(&filltp);
+    if (fCamera)
+    {
+        if (header.IsDataRun())
+            tasks.AddToList(&fillh3);
+        tasks.AddToList(&filltp);
+    }
     if (header.IsDataRun())
         tasks.AddToList(&fillew);
@@ -574,5 +632,4 @@
         //tasks.AddToList(&fillx5);
     }
-
     //-------------------------------------------
 
@@ -587,4 +644,6 @@
         return kFALSE;
 
+    //-------------------------------------------
+
     if (binstr.IsDefault())
         binstr.SetEdgesLin(150, -shape.GetPulseWidth(),
@@ -592,4 +651,66 @@
 
     header.Print();
+
+    if (fDisplay)
+    {
+        TCanvas &c = fDisplay->AddTab("Info");
+        c.Divide(2,2);
+
+        c.cd(1);
+        gPad->SetBorderMode(0);
+        gPad->SetFrameBorderMode(0);
+        gPad->SetGridx();
+        gPad->SetGridy();
+        gROOT->SetSelectedPad(0);
+        shape.DrawClone()->SetBit(kCanDelete);
+
+        if (header.IsDataRun() || header.IsPointRun())
+        {
+            c.cd(3);
+            gPad->SetBorderMode(0);
+            gPad->SetFrameBorderMode(0);
+            gPad->SetGridx();
+            gPad->SetGridy();
+            gROOT->SetSelectedPad(0);
+            reflector.DrawClone("line")->SetBit(kCanDelete);
+
+        }
+
+        if (fCamera)
+        {
+            if (dynamic_cast<MGeomCam*>(env1.GetCont()))
+            {
+                c.cd(2);
+                gPad->SetBorderMode(0);
+                gPad->SetFrameBorderMode(0);
+                gPad->SetGridx();
+                gPad->SetGridy();
+                gROOT->SetSelectedPad(0);
+                MHCamera *c = new MHCamera(static_cast<MGeomCam&>(*env1.GetCont()));
+                c->SetStats(kFALSE);
+                c->SetBit(MHCamera::kNoLegend);
+                c->SetBit(kCanDelete);
+                c->Draw();
+
+            }
+
+            if (dynamic_cast<MGeomCam*>(env2.GetCont()))
+            {
+                c.cd(4);
+                gPad->SetBorderMode(0);
+                gPad->SetFrameBorderMode(0);
+                gPad->SetGridx();
+                gPad->SetGridy();
+                gROOT->SetSelectedPad(0);
+                MHCamera *c = new MHCamera(static_cast<MGeomCam&>(*env2.GetCont()));
+                c->SetStats(kFALSE);
+                c->SetBit(MHCamera::kNoLegend);
+                c->SetBit(kCanDelete);
+                c->Draw();
+            }
+        }
+    }
+
+    //-------------------------------------------
 
     // Execute first analysis
@@ -607,5 +728,5 @@
     //-------------------------------------------
 
-    if (!WriteResult())
+    if (!WriteResult(plist))
         return kFALSE;
 
Index: trunk/MagicSoft/Mars/mjobs/MJSimulation.h
===================================================================
--- trunk/MagicSoft/Mars/mjobs/MJSimulation.h	(revision 9309)
+++ trunk/MagicSoft/Mars/mjobs/MJSimulation.h	(revision 9317)
@@ -8,13 +8,15 @@
 class MHn;
 class MArgs;
+class MParList;
 
 class MJSimulation : public MJob
 {
 private:
-    Bool_t fForceMode;      // Force execution even if RUNE-section was not found
+    Bool_t fForceMode;      // Force execution even if RUNE-section was not foundm
 
+    Bool_t fCamera;         // Switch on/off camera (for fast reflector processing)
     Bool_t fForceTrigger;   // Force the use of the trigger "electronics"
 
-    Bool_t WriteResult();
+    Bool_t WriteResult(const MParList &plist);
     Bool_t CheckEnvLocal();
 
