Index: trunk/MagicSoft/Mars/mjobs/MJSimulation.cc
===================================================================
--- trunk/MagicSoft/Mars/mjobs/MJSimulation.cc	(revision 9303)
+++ trunk/MagicSoft/Mars/mjobs/MJSimulation.cc	(revision 9309)
@@ -27,4 +27,18 @@
 //  MJSimulation
 //
+//
+// Force reading a corsika file even if the footer (RUNE-section) is missing
+// by setting fForceMode to kTRUE or from the resource file by
+//
+//    ForceMode: Yes
+//
+//
+// In case of a pedestal or calibration run the artificial trigger can
+// be "switched off" and the cosmics trrigger "switched on" by setting
+// fForceTrigger to kTRUE or from the resource file by
+//
+//    ForceTrigger: Yes
+//
+//
 /////////////////////////////////////////////////////////////////////////////
 #include "MJSimulation.h"
@@ -95,5 +109,6 @@
 // Sets fRuns to 0, fExtractor to NULL, fDataCheck to kFALSE
 //
-MJSimulation::MJSimulation(const char *name, const char *title) : fForceMode(kFALSE)
+MJSimulation::MJSimulation(const char *name, const char *title)
+    : fForceMode(kFALSE), fForceTrigger(kFALSE)
 {
     fName  = name  ? name  : "MJSimulation";
@@ -103,5 +118,6 @@
 Bool_t MJSimulation::CheckEnvLocal()
 {
-    fForceMode = GetEnv("ForceMode", fForceMode);
+    fForceMode    = GetEnv("ForceMode",    fForceMode);
+    fForceTrigger = GetEnv("ForceTrigger", fForceTrigger);
 
     return kTRUE;
@@ -231,5 +247,6 @@
 
     MRawRunHeader header;
-    header.InitFadcType(3);
+    header.SetValidMagicNumber();
+    //header.InitFadcType(3);
 
     header.SetRunInfo(/*MRawRunHeader::kRTMonteCarlo|*/MRawRunHeader::kRTData,        1, 1);
@@ -237,7 +254,13 @@
     {
         if (!args.GetArgumentStr(0).CompareTo("pedestal", TString::kIgnoreCase))
+        {
             header.SetRunInfo(/*MRawRunHeader::kRTMonteCarlo|*/MRawRunHeader::kRTPedestal,    1, 1);
+            header.SetSourceInfo("Pedestal");
+        }
         if (!args.GetArgumentStr(0).CompareTo("calibration", TString::kIgnoreCase))
+        {
             header.SetRunInfo(/*MRawRunHeader::kRTMonteCarlo|*/MRawRunHeader::kRTCalibration,    1, 1);
+            header.SetSourceInfo("Calibration");
+        }
         if (!args.GetArgumentStr(0).CompareTo("pointrun", TString::kIgnoreCase))
             header.SetRunInfo(/*MRawRunHeader::kRTMonteCarlo|*/MRawRunHeader::kRTPointRun,    1, 1);
@@ -288,6 +311,6 @@
     MBinning binszd( 70,     0,       70, "BinningZd");
     MBinning binsvc(155,     0,       31, "BinningViewCone");
-    MBinning binstr(150,   -25,      125, "BinningTrigger");
     MBinning binsew(150,     0,       25, "BinningEvtWidth");
+    MBinning binstr("BinningTrigPos");
 
     plist.AddToList(&binse);
@@ -298,6 +321,6 @@
     plist.AddToList(&binsaz);
     plist.AddToList(&binsvc);
+    plist.AddToList(&binsew);
     plist.AddToList(&binstr);
-    plist.AddToList(&binsew);
 
     MHn mhn1, mhn2, mhn3;
@@ -307,5 +330,5 @@
 
     MH3 mhtp("TriggerPos.fVal-IntendedPulsePos.fVal-MPulseShape.GetPulseWidth");
-    mhtp.SetName("Trigger");
+    mhtp.SetName("TrigPos");
     mhtp.SetTitle("Trigger position w.r.t. the first photon hitting an APD");
 
@@ -456,9 +479,12 @@
     hcalc.Disable(MHillasCalc::kCalcConc);
 
-    MHCamEvent evt0a(/*10*/0, "Signal",   "Average signal;;S [ph]");
-    MHCamEvent evt0d(/*11*/8, "ArrTm",    "Time after first photon;;T [ns]");
+    MHCamEvent evt0a(/*10*/0, "Signal",    "Average signal;;S [ph]");
+    MHCamEvent evt0c(/*10*/0, "MaxSignal", "Maximum signal;;S [ph]");
+    MHCamEvent evt0d(/*11*/8, "ArrTm",     "Time after first photon;;T [ns]");
     evt0a.SetErrorSpread(kFALSE);
-
-    MFillH fillx0a(&evt0a,             "MSignalCam",      "FillSignal");
+    evt0c.SetCollectMax();
+
+    MFillH fillx0a(&evt0a,             "MSignalCam",      "FillAvgSignal");
+    MFillH fillx0c(&evt0c,             "MSignalCam",      "FillMaxSignal");
     MFillH fillx0d(&evt0d,             "MSignalCam",      "FillArrTm");
     MFillH fillx1("MHHillas",          "MHillas",         "FillHillas");
@@ -517,5 +543,5 @@
     tasks.AddToList(&simsum);
     tasks.AddToList(&simcam);
-    if (header.IsDataRun())
+    if (header.IsDataRun() || fForceTrigger)
         tasks.AddToList(&simtrig);
     tasks.AddToList(&conttrig);
@@ -525,5 +551,6 @@
     {
         tasks.AddToList(&write1);
-        tasks.AddToList(&write2);
+        if (!header.IsPedestalRun())
+            tasks.AddToList(&write2);
         tasks.AddToList(&write3);
     }
@@ -532,14 +559,19 @@
         tasks.AddToList(&fillh3);
     tasks.AddToList(&filltp);
-    tasks.AddToList(&fillew);
-    tasks.AddToList(&fillx0a);
-//    tasks.AddToList(&clean);
-    tasks.AddToList(&hcalc);
-    tasks.AddToList(&fillx0d);
-    tasks.AddToList(&fillx1);
-    //tasks.AddToList(&fillx2);
-    tasks.AddToList(&fillx3);
-    //tasks.AddToList(&fillx4);
-    //tasks.AddToList(&fillx5);
+    if (header.IsDataRun())
+        tasks.AddToList(&fillew);
+    if (!header.IsPedestalRun())
+    {
+        tasks.AddToList(&fillx0a);
+        tasks.AddToList(&fillx0c);
+        //tasks.AddToList(&clean);
+        tasks.AddToList(&hcalc);
+        tasks.AddToList(&fillx0d);
+        tasks.AddToList(&fillx1);
+        //tasks.AddToList(&fillx2);
+        tasks.AddToList(&fillx3);
+        //tasks.AddToList(&fillx4);
+        //tasks.AddToList(&fillx5);
+    }
 
     //-------------------------------------------
@@ -555,4 +587,10 @@
         return kFALSE;
 
+    if (binstr.IsDefault())
+        binstr.SetEdgesLin(150, -shape.GetPulseWidth(),
+                           header.GetFreqSampling()/1000.*header.GetNumSamples()+shape.GetPulseWidth());
+
+    header.Print();
+
     // Execute first analysis
     if (!evtloop.Eventloop(fMaxEvents))
Index: trunk/MagicSoft/Mars/mjobs/MJSimulation.h
===================================================================
--- trunk/MagicSoft/Mars/mjobs/MJSimulation.h	(revision 9303)
+++ trunk/MagicSoft/Mars/mjobs/MJSimulation.h	(revision 9309)
@@ -12,5 +12,7 @@
 {
 private:
-    Bool_t fForceMode;
+    Bool_t fForceMode;      // Force execution even if RUNE-section was not found
+
+    Bool_t fForceTrigger;   // Force the use of the trigger "electronics"
 
     Bool_t WriteResult();
