Index: trunk/MagicSoft/Mars/Makefile
===================================================================
--- trunk/MagicSoft/Mars/Makefile	(revision 9517)
+++ trunk/MagicSoft/Mars/Makefile	(revision 9518)
@@ -16,8 +16,6 @@
 #
 
-OSTYPE=$(shell uname -s | tr '[:upper:]' '[:lower:]')
-
+include Makefile.conf.general
 include Makefile.conf.$(OSTYPE)
-include Makefile.conf.general
 
 #
@@ -26,5 +24,5 @@
 SOLIB    := libmars.so
 
-CINT     = M
+CINT      = M
 
 #
Index: trunk/MagicSoft/Mars/Makefile.conf.general
===================================================================
--- trunk/MagicSoft/Mars/Makefile.conf.general	(revision 9517)
+++ trunk/MagicSoft/Mars/Makefile.conf.general	(revision 9518)
@@ -17,4 +17,6 @@
 #   export MARSLIBS="-lX11 -lXpm -L/usr/X11R6/lib"
 #
+OSTYPE   = $(shell uname -s | tr '[:upper:]' '[:lower:]')
+
 DEFINES	 := -DMARSVER=\"\<cvs\>\" -D__MARS__ $(ARCHDEF) $(MARSDEFINES)
 
Index: trunk/MagicSoft/Mars/callisto.cc
===================================================================
--- trunk/MagicSoft/Mars/callisto.cc	(revision 9517)
+++ trunk/MagicSoft/Mars/callisto.cc	(revision 9518)
@@ -87,4 +87,6 @@
     gLog << "   --movie                   Write a movie in addition to Mode-Y (this might " << endl;
     gLog << "                             stop the eventloop before all evts are processed)" << endl;
+    gLog << "   --test                    Use this to calibrate the callibration files" << endl;
+    gLog << "                             instead of the data files (for test purposes)" << endl;
 //    gLog << "   --moon                    Force using pedestal fits instead of calculated RMS" << endl;
     gLog << "   --config=callisto.rc      Resource file [default=callisto.rc]" << endl;
@@ -177,4 +179,5 @@
     const Bool_t  kDebugMem   = arg.HasOnlyAndRemove("--debug-mem");
     const Bool_t  kNullOut    = arg.HasOnlyAndRemove("--dev-null");
+    const Bool_t  kTestMode   = arg.HasOnlyAndRemove("--test");
 //          Bool_t  kMoon       = arg.HasOnlyAndRemove("--moon");
     Int_t kDebugEnv = arg.HasOnlyAndRemove("--debug-env") ? 1 : 0;
@@ -510,5 +513,4 @@
         job1.SetUseData();
         job1.SetExtractionFundamental();
-//        job1.SetUseHists(kMoon);
 
         if (!job1.Process())
@@ -627,4 +629,5 @@
         job4.SetNullOut(kNullOut);
         job4.SetCommandLine(MArgs::GetCommandLine(argc, argv));
+        job4.SetTestMode(kTestMode);
         if (!seq.IsMonteCarlo())
             job4.SetExtractor(job2.GetExtractor());
Index: trunk/MagicSoft/Mars/ceres.rc
===================================================================
--- trunk/MagicSoft/Mars/ceres.rc	(revision 9517)
+++ trunk/MagicSoft/Mars/ceres.rc	(revision 9518)
@@ -48,5 +48,5 @@
 # BinningZd.Raw:           70      0        70
 # BinningViewCone.Raw:    155      0        31
-# BinningTrigPod.Raw:     150    -25       125
+# BinningTrigPos.Raw:     150    -25       125
 # BinningEvtWidth.Raw:    150      0        25
 # BinningDist.Raw:        100      0       2.5
@@ -137,4 +137,5 @@
 PhotonDetectionEfficiency.FileName:    resmc/dwarf-pde-gapd.txt
 ConesAngularAcceptance.FileName:       resmc/dwarf-cones.txt
+ConesTransmission.FileName:            resmc/dwarf-cones-trans.txt
 
 
Index: trunk/MagicSoft/Mars/condor/program.submit
===================================================================
--- trunk/MagicSoft/Mars/condor/program.submit	(revision 9517)
+++ trunk/MagicSoft/Mars/condor/program.submit	(revision 9518)
@@ -2,5 +2,5 @@
 Arguments     = $(args)
 
-Out           = $(out)
+Output        = $(out)
 Error         = $(err)
 
@@ -8,5 +8,6 @@
 copy_to_spool = false
 getenv        = True
-Log           = /tmp/delme.log
+#Log           = /tmp/dag.log
+#Log           = $(out)
 notification  = Error
 
Index: trunk/MagicSoft/Mars/manalysis/Makefile
===================================================================
--- trunk/MagicSoft/Mars/manalysis/Makefile	(revision 9517)
+++ trunk/MagicSoft/Mars/manalysis/Makefile	(revision 9518)
@@ -6,6 +6,6 @@
 #
 ##################################################################
+include ../Makefile.conf.general
 include ../Makefile.conf.$(OSTYPE)
-include ../Makefile.conf.general
 
 #------------------------------------------------------------------------------
Index: trunk/MagicSoft/Mars/mastro/MAstroCatalog.cc
===================================================================
--- trunk/MagicSoft/Mars/mastro/MAstroCatalog.cc	(revision 9517)
+++ trunk/MagicSoft/Mars/mastro/MAstroCatalog.cc	(revision 9518)
@@ -1,4 +1,4 @@
 /* ======================================================================== *\
-! $Name: not supported by cvs2svn $:$Id: MAstroCatalog.cc,v 1.33 2009-02-07 20:40:01 tbretz Exp $
+! $Name: not supported by cvs2svn $:$Id: MAstroCatalog.cc,v 1.34 2009-10-26 14:31:17 tbretz Exp $
 ! --------------------------------------------------------------------------
 !
@@ -170,5 +170,5 @@
 
 // Datacenter default path for catalogs
-const TString MAstroCatalog::kDefaultPath="/magic/datacenter/setup";
+const TString MAstroCatalog::kDefaultPath="/magic/datacenter/setup/";
 
 // --------------------------------------------------------------------------
Index: trunk/MagicSoft/Mars/mastro/Makefile
===================================================================
--- trunk/MagicSoft/Mars/mastro/Makefile	(revision 9517)
+++ trunk/MagicSoft/Mars/mastro/Makefile	(revision 9518)
@@ -6,6 +6,6 @@
 #
 ##################################################################
+include ../Makefile.conf.general
 include ../Makefile.conf.$(OSTYPE)
-include ../Makefile.conf.general
 
 #------------------------------------------------------------------------------
Index: trunk/MagicSoft/Mars/mbadpixels/Makefile
===================================================================
--- trunk/MagicSoft/Mars/mbadpixels/Makefile	(revision 9517)
+++ trunk/MagicSoft/Mars/mbadpixels/Makefile	(revision 9518)
@@ -6,6 +6,6 @@
 #
 ##################################################################
+include ../Makefile.conf.general
 include ../Makefile.conf.$(OSTYPE)
-include ../Makefile.conf.general
 
 #------------------------------------------------------------------------------
Index: trunk/MagicSoft/Mars/mbase/MAGIC.cc
===================================================================
--- trunk/MagicSoft/Mars/mbase/MAGIC.cc	(revision 9517)
+++ trunk/MagicSoft/Mars/mbase/MAGIC.cc	(revision 9518)
@@ -40,4 +40,11 @@
 bool MARS::CheckRootVer()
 {
+    if (strcmp(gROOT->GetVersion(), "5.22/00")>0)
+    {
+        cout << "WARNING - Especially root 5.24/00 has a severe bug in projection 2D histograms" << endl;
+        cout << "          which might cause unexpected crashes and could also affect the results." << endl;
+        cout << "          Please, avoid using these root versions." << endl;
+    }
+
     if (!strcmp(gROOT->GetVersion(), ROOT_RELEASE))
         return true;
Index: trunk/MagicSoft/Mars/mbase/MEnv.h
===================================================================
--- trunk/MagicSoft/Mars/mbase/MEnv.h	(revision 9517)
+++ trunk/MagicSoft/Mars/mbase/MEnv.h	(revision 9518)
@@ -41,5 +41,5 @@
     Int_t       GetValue(const char *name, Int_t dflt);
     Double_t    GetValue(const char *name, Double_t dflt);
-    const char *GetValue(const char *name, const char *dflt);
+    const char *GetValue(const char *name, const char *dflt="");
 
     // GetValue: regexp
Index: trunk/MagicSoft/Mars/mbase/MLut.cc
===================================================================
--- trunk/MagicSoft/Mars/mbase/MLut.cc	(revision 9517)
+++ trunk/MagicSoft/Mars/mbase/MLut.cc	(revision 9518)
@@ -38,4 +38,6 @@
 #include <stdlib.h>  // atoi (Ubuntu 8.10)
 
+#include <TRegexp.h>
+
 #include "MLog.h"
 #include "MLogManip.h"
@@ -286,5 +288,9 @@
 Int_t MLut::ReadStream(istream &fin)
 {
+    static const TRegexp reg("[^ 1234567890]");
+
     Delete();
+
+    Int_t n = 0;
 
     while (1)
@@ -294,4 +300,12 @@
         if (!fin)
             break;
+
+        n++;
+
+        if (line.Contains(reg))
+        {
+            gLog << warn << "WARNING - MLut::ReadStream: Line #" << n << " contains invalid character... ignored." << endl;
+            continue;
+        }
 
         // Split line by whitespaces
Index: trunk/MagicSoft/Mars/mbase/MParSpline.cc
===================================================================
--- trunk/MagicSoft/Mars/mbase/MParSpline.cc	(revision 9517)
+++ trunk/MagicSoft/Mars/mbase/MParSpline.cc	(revision 9518)
@@ -322,2 +322,8 @@
     fSpline->Paint("PC");
 }
+
+void MParSpline::RecursiveRemove(TObject *obj)
+{
+    if (obj==fSpline)
+        fSpline=0;
+}
Index: trunk/MagicSoft/Mars/mbase/MParSpline.h
===================================================================
--- trunk/MagicSoft/Mars/mbase/MParSpline.h	(revision 9517)
+++ trunk/MagicSoft/Mars/mbase/MParSpline.h	(revision 9518)
@@ -23,4 +23,5 @@
 public:
     MParSpline(const char *name=0, const char *title=0);
+    ~MParSpline()  { Clear(); }
 
     // MParSpline
@@ -50,4 +51,6 @@
     void Paint(Option_t *o="");
 
+    void RecursiveRemove(TObject *obj);
+
     ClassDef(MParSpline, 1) // Container to hold a MSpline3
 };
Index: trunk/MagicSoft/Mars/mbase/MSpline3.cc
===================================================================
--- trunk/MagicSoft/Mars/mbase/MSpline3.cc	(revision 9517)
+++ trunk/MagicSoft/Mars/mbase/MSpline3.cc	(revision 9518)
@@ -157,5 +157,5 @@
 //     W := fX[i+1]-fX[i]
 //
-Double_t MSpline3::Integral(Int_t i, Double_t x) const
+Double_t MSpline3::IntegralBin(Int_t i, Double_t x) const
 {
     Double_t x0, y, b, c, d;
@@ -171,5 +171,5 @@
 // Return the integral of the spline's bin i.
 //
-Double_t MSpline3::Integral(Int_t i) const
+Double_t MSpline3::IntegralBin(Int_t i) const
 {
     Double_t x, y;
@@ -177,5 +177,5 @@
     GetKnot(i+1, x, y);
 
-    return Integral(i, x);
+    return IntegralBin(i, x);
 }
 
@@ -189,10 +189,10 @@
     const Int_t m = FindX(b);
 
-    Double_t sum = -Integral(n, a);
+    Double_t sum = -IntegralBin(n, a);
 
     for (int i=n; i<=m-1; i++)
-        sum += Integral(i);
-
-    sum += Integral(m, b);
+        sum += IntegralBin(i);
+
+    sum += IntegralBin(m, b);
 
     return sum;
@@ -208,5 +208,5 @@
 
     for (int i=0; i<GetNp()-1; i++)
-        sum += Integral(i);
+        sum += IntegralBin(i);
 
     return sum;
Index: trunk/MagicSoft/Mars/mbase/MSpline3.h
===================================================================
--- trunk/MagicSoft/Mars/mbase/MSpline3.h	(revision 9517)
+++ trunk/MagicSoft/Mars/mbase/MSpline3.h	(revision 9518)
@@ -15,6 +15,6 @@
     MArrayD &ConvertFunc(const TF1 &f, Float_t freq) const;
 
-    Double_t Integral(Int_t i, Double_t x) const;
-    Double_t Integral(Int_t i) const;
+    Double_t IntegralBin(Int_t i, Double_t x) const;
+    Double_t IntegralBin(Int_t i) const;
 
 public:
Index: trunk/MagicSoft/Mars/mbase/Makefile
===================================================================
--- trunk/MagicSoft/Mars/mbase/Makefile	(revision 9517)
+++ trunk/MagicSoft/Mars/mbase/Makefile	(revision 9518)
@@ -6,6 +6,6 @@
 #
 ##################################################################
+include ../Makefile.conf.general
 include ../Makefile.conf.$(OSTYPE)
-include ../Makefile.conf.general
 
 #------------------------------------------------------------------------------
Index: trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.cc
===================================================================
--- trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.cc	(revision 9517)
+++ trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.cc	(revision 9518)
@@ -1,4 +1,4 @@
 /* ======================================================================== *\
-! $Name: not supported by cvs2svn $:$Id: MCalibrationChargeCalc.cc,v 1.187 2009-03-02 14:32:49 tbretz Exp $
+! $Name: not supported by cvs2svn $:$Id: MCalibrationChargeCalc.cc,v 1.188 2009-10-26 14:31:18 tbretz Exp $
 ! --------------------------------------------------------------------------
 !
@@ -1357,5 +1357,5 @@
         {
           areavars[i] = (areavars[i] - areaphes[i]*areaphes[i]/numareavalid[i]) / (numareavalid[i]-1);
-          areaphes[i] = areaphes[i] / numareavalid[i];
+          areaphes[i] /= numareavalid[i];
         }
       
Index: trunk/MagicSoft/Mars/mcalib/Makefile
===================================================================
--- trunk/MagicSoft/Mars/mcalib/Makefile	(revision 9517)
+++ trunk/MagicSoft/Mars/mcalib/Makefile	(revision 9518)
@@ -6,6 +6,6 @@
 #
 ##################################################################
+include ../Makefile.conf.general
 include ../Makefile.conf.$(OSTYPE)
-include ../Makefile.conf.general
 
 #------------------------------------------------------------------------------
Index: trunk/MagicSoft/Mars/mcamera/Makefile
===================================================================
--- trunk/MagicSoft/Mars/mcamera/Makefile	(revision 9517)
+++ trunk/MagicSoft/Mars/mcamera/Makefile	(revision 9518)
@@ -6,6 +6,6 @@
 #
 ##################################################################
+include ../Makefile.conf.general
 include ../Makefile.conf.$(OSTYPE)
-include ../Makefile.conf.general
 
 #------------------------------------------------------------------------------
Index: trunk/MagicSoft/Mars/mcorsika/MCorsikaRead.h
===================================================================
--- trunk/MagicSoft/Mars/mcorsika/MCorsikaRead.h	(revision 9517)
+++ trunk/MagicSoft/Mars/mcorsika/MCorsikaRead.h	(revision 9518)
@@ -17,7 +17,7 @@
 {
 private:
-    MCorsikaRunHeader *fRunHeader;  // run header information container to fill from file
-    MCorsikaEvtHeader *fEvtHeader;  // event header information container to fill from file
-    MPhotonEvent      *fEvent;      // event information
+    MCorsikaRunHeader *fRunHeader;  //! run header information container to fill from file
+    MCorsikaEvtHeader *fEvtHeader;  //! event header information container to fill from file
+    MPhotonEvent      *fEvent;      //! event information
 
     Bool_t          fForceMode;     // Force mode skipping defect RUNE
Index: trunk/MagicSoft/Mars/mcorsika/Makefile
===================================================================
--- trunk/MagicSoft/Mars/mcorsika/Makefile	(revision 9517)
+++ trunk/MagicSoft/Mars/mcorsika/Makefile	(revision 9518)
@@ -6,6 +6,6 @@
 #
 ##################################################################
+include ../Makefile.conf.general
 include ../Makefile.conf.$(OSTYPE)
-include ../Makefile.conf.general
 
 #------------------------------------------------------------------------------
Index: trunk/MagicSoft/Mars/mdata/MDataMember.h
===================================================================
--- trunk/MagicSoft/Mars/mdata/MDataMember.h	(revision 9517)
+++ trunk/MagicSoft/Mars/mdata/MDataMember.h	(revision 9518)
@@ -17,6 +17,6 @@
     TString fDataMember;
 
-    MParContainer *fObject;
-    TMethodCall   *fCall;
+    MParContainer *fObject; //! A pointer to the container from the paramater list
+    TMethodCall   *fCall;   //! The corresponding method call to the member function
 
     enum { kIsInt = BIT(14) };
@@ -48,5 +48,5 @@
     void SetVariables(const TArrayD &arr) { }
 
-    ClassDef(MDataMember, 1) // MData object corresponding to a single data member of a Mars container
+    ClassDef(MDataMember, 2) // MData object corresponding to a single data member of a Mars container
 };
 
Index: trunk/MagicSoft/Mars/mdata/Makefile
===================================================================
--- trunk/MagicSoft/Mars/mdata/Makefile	(revision 9517)
+++ trunk/MagicSoft/Mars/mdata/Makefile	(revision 9518)
@@ -6,6 +6,6 @@
 #
 ##################################################################
+include ../Makefile.conf.general
 include ../Makefile.conf.$(OSTYPE)
-include ../Makefile.conf.general
 
 #------------------------------------------------------------------------------
Index: trunk/MagicSoft/Mars/melectronics/Makefile
===================================================================
--- trunk/MagicSoft/Mars/melectronics/Makefile	(revision 9517)
+++ trunk/MagicSoft/Mars/melectronics/Makefile	(revision 9518)
@@ -6,6 +6,6 @@
 #
 ##################################################################
+include ../Makefile.conf.general
 include ../Makefile.conf.$(OSTYPE)
-include ../Makefile.conf.general
 
 #------------------------------------------------------------------------------
Index: trunk/MagicSoft/Mars/mextralgo/Makefile
===================================================================
--- trunk/MagicSoft/Mars/mextralgo/Makefile	(revision 9517)
+++ trunk/MagicSoft/Mars/mextralgo/Makefile	(revision 9518)
@@ -6,6 +6,6 @@
 #
 ##################################################################
+include ../Makefile.conf.general
 include ../Makefile.conf.$(OSTYPE)
-include ../Makefile.conf.general
 
 #------------------------------------------------------------------------------
Index: trunk/MagicSoft/Mars/mfbase/Makefile
===================================================================
--- trunk/MagicSoft/Mars/mfbase/Makefile	(revision 9517)
+++ trunk/MagicSoft/Mars/mfbase/Makefile	(revision 9518)
@@ -6,6 +6,6 @@
 #
 ##################################################################
+include ../Makefile.conf.general
 include ../Makefile.conf.$(OSTYPE)
-include ../Makefile.conf.general
 
 #------------------------------------------------------------------------------
Index: trunk/MagicSoft/Mars/mfileio/Makefile
===================================================================
--- trunk/MagicSoft/Mars/mfileio/Makefile	(revision 9517)
+++ trunk/MagicSoft/Mars/mfileio/Makefile	(revision 9518)
@@ -6,11 +6,11 @@
 #
 ##################################################################
+include ../Makefile.conf.general
 include ../Makefile.conf.$(OSTYPE)
-include ../Makefile.conf.general
 
 #------------------------------------------------------------------------------
 
 INCLUDES = -I. -I../mbase -I../mraw -I../mmc -I../mreflector -I../mgui \
-	   -I../mdata -I../mbadpixels
+	   -I../mdata -I../mbadpixels -I../msim
 #mraw:       MRawRunHeader (MReadMaraFile)
 #mmc:        MMcRunHeader  (MReadMarsFile)
Index: trunk/MagicSoft/Mars/mfilter/MFSoftwareTrigger.cc
===================================================================
--- trunk/MagicSoft/Mars/mfilter/MFSoftwareTrigger.cc	(revision 9517)
+++ trunk/MagicSoft/Mars/mfilter/MFSoftwareTrigger.cc	(revision 9518)
@@ -388,4 +388,17 @@
     memset(fCut, 0, sizeof(fCut));
 
+    switch (fType)
+    {
+    case kSinglePixelNeighbors:
+        if (fNumNeighbors<2)
+            *fLog << inf << "Software trigger switched off (fNumNeighbors<2)." << endl;
+        else
+            *fLog << inf << fNumNeighbors << " required above " << fThreshold << " within " << fTimeWindow << "ns." << endl;
+        break;
+    case kAnyPattern:
+        *fLog << inf << "Cluster trigger switched on." << endl;
+        break;
+    }
+
     return kTRUE;
 }
@@ -400,5 +413,5 @@
     {
     case kSinglePixelNeighbors:
-        fResult = SwTrigger();
+        fResult = fNumNeighbors>1 ? SwTrigger() : kTRUE;
         break;
     case kAnyPattern:
Index: trunk/MagicSoft/Mars/mfilter/Makefile
===================================================================
--- trunk/MagicSoft/Mars/mfilter/Makefile	(revision 9517)
+++ trunk/MagicSoft/Mars/mfilter/Makefile	(revision 9518)
@@ -6,6 +6,6 @@
 #
 ##################################################################
+include ../Makefile.conf.general
 include ../Makefile.conf.$(OSTYPE)
-include ../Makefile.conf.general
 
 #------------------------------------------------------------------------------
Index: trunk/MagicSoft/Mars/mgeom/Makefile
===================================================================
--- trunk/MagicSoft/Mars/mgeom/Makefile	(revision 9517)
+++ trunk/MagicSoft/Mars/mgeom/Makefile	(revision 9518)
@@ -6,6 +6,6 @@
 #
 ##################################################################
+include ../Makefile.conf.general
 include ../Makefile.conf.$(OSTYPE)
-include ../Makefile.conf.general
 
 #------------------------------------------------------------------------------
Index: trunk/MagicSoft/Mars/mgui/Makefile
===================================================================
--- trunk/MagicSoft/Mars/mgui/Makefile	(revision 9517)
+++ trunk/MagicSoft/Mars/mgui/Makefile	(revision 9518)
@@ -6,6 +6,6 @@
 #
 ##################################################################
+include ../Makefile.conf.general
 include ../Makefile.conf.$(OSTYPE)
-include ../Makefile.conf.general
 
 #------------------------------------------------------------------------------
Index: trunk/MagicSoft/Mars/mhbase/MH3.cc
===================================================================
--- trunk/MagicSoft/Mars/mhbase/MH3.cc	(revision 9517)
+++ trunk/MagicSoft/Mars/mhbase/MH3.cc	(revision 9518)
@@ -367,5 +367,6 @@
 MH3::~MH3()
 {
-    delete fHist;
+    if (fHist)
+        delete fHist;
 
     for (int i=0; i<4; i++)
Index: trunk/MagicSoft/Mars/mhbase/MHn.cc
===================================================================
--- trunk/MagicSoft/Mars/mhbase/MHn.cc	(revision 9517)
+++ trunk/MagicSoft/Mars/mhbase/MHn.cc	(revision 9518)
@@ -596,2 +596,16 @@
     }
 }
+
+void MHn::RecursiveRemove(TObject *obj)
+{
+    for (int i=0; i<6; i++)
+    {
+        if (!fHist[i])
+            continue;
+
+        if (obj==fHist[i])
+            fHist[i] = 0;
+        else
+            fHist[i]->RecursiveRemove(obj);
+    }
+}
Index: trunk/MagicSoft/Mars/mhbase/MHn.h
===================================================================
--- trunk/MagicSoft/Mars/mhbase/MHn.h	(revision 9517)
+++ trunk/MagicSoft/Mars/mhbase/MHn.h	(revision 9518)
@@ -75,4 +75,6 @@
     //void Paint(Option_t *opt="");
 
+    void RecursiveRemove(TObject *obj);
+
     ClassDef(MHn, 1) // Generalized histogram class for up to six histograms
 };
Index: trunk/MagicSoft/Mars/mhbase/Makefile
===================================================================
--- trunk/MagicSoft/Mars/mhbase/Makefile	(revision 9517)
+++ trunk/MagicSoft/Mars/mhbase/Makefile	(revision 9518)
@@ -6,6 +6,6 @@
 #
 ##################################################################
+include ../Makefile.conf.general
 include ../Makefile.conf.$(OSTYPE)
-include ../Makefile.conf.general
 
 #------------------------------------------------------------------------------
Index: trunk/MagicSoft/Mars/mhcalib/Makefile
===================================================================
--- trunk/MagicSoft/Mars/mhcalib/Makefile	(revision 9517)
+++ trunk/MagicSoft/Mars/mhcalib/Makefile	(revision 9518)
@@ -6,6 +6,6 @@
 #
 ##################################################################
+include ../Makefile.conf.general
 include ../Makefile.conf.$(OSTYPE)
-include ../Makefile.conf.general
 
 #------------------------------------------------------------------------------
Index: trunk/MagicSoft/Mars/mhflux/Makefile
===================================================================
--- trunk/MagicSoft/Mars/mhflux/Makefile	(revision 9517)
+++ trunk/MagicSoft/Mars/mhflux/Makefile	(revision 9518)
@@ -6,6 +6,6 @@
 #
 ##################################################################
+include ../Makefile.conf.general
 include ../Makefile.conf.$(OSTYPE)
-include ../Makefile.conf.general
 
 #------------------------------------------------------------------------------
Index: trunk/MagicSoft/Mars/mhft/Makefile
===================================================================
--- trunk/MagicSoft/Mars/mhft/Makefile	(revision 9517)
+++ trunk/MagicSoft/Mars/mhft/Makefile	(revision 9518)
@@ -6,6 +6,6 @@
 #
 ##################################################################
+include ../Makefile.conf.general
 include ../Makefile.conf.$(OSTYPE)
-include ../Makefile.conf.general
 
 #------------------------------------------------------------------------------
Index: trunk/MagicSoft/Mars/mhist/MHCamEvent.cc
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHCamEvent.cc	(revision 9517)
+++ trunk/MagicSoft/Mars/mhist/MHCamEvent.cc	(revision 9518)
@@ -407,3 +407,5 @@
     if (obj==fErr)
         fErr = 0;
-}
+    if (obj==fSum)
+        fSum = 0;
+}
Index: trunk/MagicSoft/Mars/mhvstime/Makefile
===================================================================
--- trunk/MagicSoft/Mars/mhvstime/Makefile	(revision 9517)
+++ trunk/MagicSoft/Mars/mhvstime/Makefile	(revision 9518)
@@ -6,6 +6,6 @@
 #
 ##################################################################
+include ../Makefile.conf.general
 include ../Makefile.conf.$(OSTYPE)
-include ../Makefile.conf.general
 
 #------------------------------------------------------------------------------
Index: trunk/MagicSoft/Mars/mimage/Makefile
===================================================================
--- trunk/MagicSoft/Mars/mimage/Makefile	(revision 9517)
+++ trunk/MagicSoft/Mars/mimage/Makefile	(revision 9518)
@@ -6,6 +6,6 @@
 #
 ##################################################################
+include ../Makefile.conf.general
 include ../Makefile.conf.$(OSTYPE)
-include ../Makefile.conf.general
 
 #------------------------------------------------------------------------------
Index: trunk/MagicSoft/Mars/mjobs/MJCalibration.cc
===================================================================
--- trunk/MagicSoft/Mars/mjobs/MJCalibration.cc	(revision 9517)
+++ trunk/MagicSoft/Mars/mjobs/MJCalibration.cc	(revision 9518)
@@ -1735,4 +1735,7 @@
     cont.Add(&fSequence);
 
+    TNamed cmdline("CommandLine", fCommandLine.Data());
+    cont.Add(&cmdline);
+
     return WriteContainer(cont, GetOutputFileName(), "UPDATE");
 }
Index: trunk/MagicSoft/Mars/mjobs/Makefile
===================================================================
--- trunk/MagicSoft/Mars/mjobs/Makefile	(revision 9517)
+++ trunk/MagicSoft/Mars/mjobs/Makefile	(revision 9518)
@@ -6,6 +6,6 @@
 #
 ##################################################################
+include ../Makefile.conf.general
 include ../Makefile.conf.$(OSTYPE)
-include ../Makefile.conf.general
 
 #------------------------------------------------------------------------------
Index: trunk/MagicSoft/Mars/mjoptim/Makefile
===================================================================
--- trunk/MagicSoft/Mars/mjoptim/Makefile	(revision 9517)
+++ trunk/MagicSoft/Mars/mjoptim/Makefile	(revision 9518)
@@ -6,6 +6,6 @@
 #
 ##################################################################
+include ../Makefile.conf.general
 include ../Makefile.conf.$(OSTYPE)
-include ../Makefile.conf.general
 
 #------------------------------------------------------------------------------
Index: trunk/MagicSoft/Mars/mmain/Makefile
===================================================================
--- trunk/MagicSoft/Mars/mmain/Makefile	(revision 9517)
+++ trunk/MagicSoft/Mars/mmain/Makefile	(revision 9518)
@@ -6,6 +6,6 @@
 #
 ##################################################################
+include ../Makefile.conf.general
 include ../Makefile.conf.$(OSTYPE)
-include ../Makefile.conf.general
 
 #------------------------------------------------------------------------------
Index: trunk/MagicSoft/Mars/mmontecarlo/Makefile
===================================================================
--- trunk/MagicSoft/Mars/mmontecarlo/Makefile	(revision 9517)
+++ trunk/MagicSoft/Mars/mmontecarlo/Makefile	(revision 9518)
@@ -6,6 +6,6 @@
 #
 ##################################################################
+include ../Makefile.conf.general
 include ../Makefile.conf.$(OSTYPE)
-include ../Makefile.conf.general
 
 #------------------------------------------------------------------------------
Index: trunk/MagicSoft/Mars/mmovie/Makefile
===================================================================
--- trunk/MagicSoft/Mars/mmovie/Makefile	(revision 9517)
+++ trunk/MagicSoft/Mars/mmovie/Makefile	(revision 9518)
@@ -6,6 +6,6 @@
 #
 ##################################################################
+include ../Makefile.conf.general
 include ../Makefile.conf.$(OSTYPE)
-include ../Makefile.conf.general
 
 #------------------------------------------------------------------------------
Index: trunk/MagicSoft/Mars/mmuon/Makefile
===================================================================
--- trunk/MagicSoft/Mars/mmuon/Makefile	(revision 9517)
+++ trunk/MagicSoft/Mars/mmuon/Makefile	(revision 9518)
@@ -6,6 +6,6 @@
 #
 ##################################################################
+include ../Makefile.conf.general
 include ../Makefile.conf.$(OSTYPE)
-include ../Makefile.conf.general
 
 #------------------------------------------------------------------------------
Index: trunk/MagicSoft/Mars/mpedestal/Makefile
===================================================================
--- trunk/MagicSoft/Mars/mpedestal/Makefile	(revision 9517)
+++ trunk/MagicSoft/Mars/mpedestal/Makefile	(revision 9518)
@@ -6,6 +6,6 @@
 #
 ##################################################################
+include ../Makefile.conf.general
 include ../Makefile.conf.$(OSTYPE)
-include ../Makefile.conf.general
 
 #------------------------------------------------------------------------------
Index: trunk/MagicSoft/Mars/mpointing/MPointingDevCalc.cc
===================================================================
--- trunk/MagicSoft/Mars/mpointing/MPointingDevCalc.cc	(revision 9517)
+++ trunk/MagicSoft/Mars/mpointing/MPointingDevCalc.cc	(revision 9518)
@@ -162,4 +162,7 @@
 //   19. Jun. 2008              (ca. 15:00) // From   new TPoints
 //    7. Mar. 2009              (ca. 14:00) // From   new TPoints (0808-0902)
+//   14. May  2009                // M1/M2 after upgrade (from TPoints taken in the days before)
+//   17. Aug. 2009              New pointing models for both telescopes
+//
 //
 // From 2.2.2006 beginnig of the night (21:05h, run >=81855) to 24.2.2006
@@ -240,4 +243,42 @@
 // found.
 //
+// [2009-08-05 Mail from Markus Garcz. about M1]
+// [...]
+// On the 23.07.2009 we tested the new LUTs using the star Etamin. The
+// PSF (sigma) improved from 11.0 mm to 9.5 mm and the total light content
+// in one PMT from 54% to 62%.
+// Furthermore I saw a small movement of the spot after the new focussing:
+//   dX = 3 CCD pixel = 7 mm
+//   dY = 2 CCD pixel = 4.7 mm
+// The new LUTs are now installed since the 23.07.2009 and are used as
+// default during the observation.
+// [...]
+//
+//
+// [2009-10-16 Email Adrian]
+//
+// I checked the AMC2 log files to check which LUTs had been used in which nights
+//   until    09/09/12  the old version from March had always been used
+//   09/09/13-09/09/16  LUT_090913 (test) was used (by mistake)
+//   09/09/17-09/09/20  switched back to the version from March
+//   since    09/09/21  using actual version LUT_090918
+//                      (PSF at ~10deg still rather poor, but I see strange
+//                      effects I do not yet understand and therefore cannot
+//                      correct)
+//  Especially: nothing has changed in the AMC on 09/09/09,
+//  except that around that date the SBIG camera was readjusted (but this
+//  has no direct affect on the AMC)
+//
+//
+// Others
+// ------
+//
+// The pointing of both(!) telescopes changed >2009/06/11 2:36h
+// In both cases the reason is unknown.
+//
+// The pointing has changed for M2 after    2009/09/09 noon
+// It recovered to the previous pointing at 2009/10/08 noon
+// Resons unknown (there were LUT changes but at different dates)
+//
 //
 // ToDo:
Index: trunk/MagicSoft/Mars/mpointing/Makefile
===================================================================
--- trunk/MagicSoft/Mars/mpointing/Makefile	(revision 9517)
+++ trunk/MagicSoft/Mars/mpointing/Makefile	(revision 9518)
@@ -6,6 +6,6 @@
 #
 ##################################################################
+include ../Makefile.conf.general
 include ../Makefile.conf.$(OSTYPE)
-include ../Makefile.conf.general
 
 #------------------------------------------------------------------------------
Index: trunk/MagicSoft/Mars/mranforest/Makefile
===================================================================
--- trunk/MagicSoft/Mars/mranforest/Makefile	(revision 9517)
+++ trunk/MagicSoft/Mars/mranforest/Makefile	(revision 9518)
@@ -6,6 +6,6 @@
 #
 ##################################################################
+include ../Makefile.conf.general
 include ../Makefile.conf.$(OSTYPE)
-include ../Makefile.conf.general
 
 #------------------------------------------------------------------------------
Index: trunk/MagicSoft/Mars/mraw/Makefile
===================================================================
--- trunk/MagicSoft/Mars/mraw/Makefile	(revision 9517)
+++ trunk/MagicSoft/Mars/mraw/Makefile	(revision 9518)
@@ -6,6 +6,6 @@
 #
 ##################################################################
+include ../Makefile.conf.general
 include ../Makefile.conf.$(OSTYPE)
-include ../Makefile.conf.general
 
 #------------------------------------------------------------------------------
Index: trunk/MagicSoft/Mars/mreport/Makefile
===================================================================
--- trunk/MagicSoft/Mars/mreport/Makefile	(revision 9517)
+++ trunk/MagicSoft/Mars/mreport/Makefile	(revision 9518)
@@ -6,6 +6,6 @@
 #
 ##################################################################
+include ../Makefile.conf.general
 include ../Makefile.conf.$(OSTYPE)
-include ../Makefile.conf.general
 
 #------------------------------------------------------------------------------
Index: trunk/MagicSoft/Mars/msignal/Makefile
===================================================================
--- trunk/MagicSoft/Mars/msignal/Makefile	(revision 9517)
+++ trunk/MagicSoft/Mars/msignal/Makefile	(revision 9518)
@@ -6,6 +6,6 @@
 #
 ##################################################################
+include ../Makefile.conf.general
 include ../Makefile.conf.$(OSTYPE)
-include ../Makefile.conf.general
 
 #------------------------------------------------------------------------------
Index: trunk/MagicSoft/Mars/msim/Makefile
===================================================================
--- trunk/MagicSoft/Mars/msim/Makefile	(revision 9517)
+++ trunk/MagicSoft/Mars/msim/Makefile	(revision 9518)
@@ -6,6 +6,6 @@
 #
 ##################################################################
+include ../Makefile.conf.general
 include ../Makefile.conf.$(OSTYPE)
-include ../Makefile.conf.general
 
 #------------------------------------------------------------------------------
Index: trunk/MagicSoft/Mars/msimcamera/MSimAPD.cc
===================================================================
--- trunk/MagicSoft/Mars/msimcamera/MSimAPD.cc	(revision 9517)
+++ trunk/MagicSoft/Mars/msimcamera/MSimAPD.cc	(revision 9518)
@@ -173,4 +173,11 @@
         break;
 
+    case 3:
+        ncells    = 60;
+        crosstalk = 0.15;
+        deadtime  = 3;
+        recovery  = 8.75;
+        break;
+
     default:
         *fLog << err << "ERROR - APD type " << fType << " undefined." << endl;
Index: trunk/MagicSoft/Mars/msimcamera/MSimBundlePhotons.cc
===================================================================
--- trunk/MagicSoft/Mars/msimcamera/MSimBundlePhotons.cc	(revision 9517)
+++ trunk/MagicSoft/Mars/msimcamera/MSimBundlePhotons.cc	(revision 9518)
@@ -173,5 +173,5 @@
         const Int_t &idx = row[0];
 
-        // Check if we were routed to a valid entry
+        // Check if we were routed to a valid entry ("not connected")
         // if not throw away this photon.
         if (idx<0)
Index: trunk/MagicSoft/Mars/msimcamera/MSimExcessNoise.cc
===================================================================
--- trunk/MagicSoft/Mars/msimcamera/MSimExcessNoise.cc	(revision 9517)
+++ trunk/MagicSoft/Mars/msimcamera/MSimExcessNoise.cc	(revision 9518)
@@ -59,5 +59,5 @@
 //
 MSimExcessNoise::MSimExcessNoise(const char* name, const char *title)
-: fEvt(0)
+: fEvt(0), fExcessNoise(0.2)
 {
     fName  = name  ? name  : "MSimExcessNoise";
@@ -77,4 +77,6 @@
         return kFALSE;
     }
+
+    *fLog << inf << "Excess Noise Factor in use " << fExcessNoise << "%" << endl;
 
     return kTRUE;
@@ -96,5 +98,5 @@
             continue;
 
-        const Float_t neww = gRandom->Gaus(oldw, 0.2*TMath::Sqrt(oldw));
+        const Float_t neww = gRandom->Gaus(oldw, fExcessNoise*TMath::Sqrt(oldw));
         ph.SetWeight(neww);
     }
@@ -102,2 +104,18 @@
     return kTRUE;
 }
+
+// --------------------------------------------------------------------------
+//
+// ExcessNoise: 0.2
+//
+Int_t MSimExcessNoise::ReadEnv(const TEnv &env, TString prefix, Bool_t print)
+{
+    Bool_t rc = kFALSE;
+    if (IsEnvDefined(env, prefix, "ExcessNoise", print))
+    {
+        rc = kTRUE;
+        fExcessNoise = GetEnvValue(env, prefix, "ExcessNoise", fExcessNoise);
+    }
+
+    return rc;
+}
Index: trunk/MagicSoft/Mars/msimcamera/MSimExcessNoise.h
===================================================================
--- trunk/MagicSoft/Mars/msimcamera/MSimExcessNoise.h	(revision 9517)
+++ trunk/MagicSoft/Mars/msimcamera/MSimExcessNoise.h	(revision 9518)
@@ -14,4 +14,9 @@
     MPhotonEvent *fEvt;     //! Event storing the photons
 
+    Double_t fExcessNoise;
+
+    // MParContainer
+    Int_t ReadEnv(const TEnv &env, TString prefix, Bool_t print=kFALSE);
+
     // MTask
     Int_t PreProcess(MParList *pList);
Index: trunk/MagicSoft/Mars/msimcamera/MSimTrigger.cc
===================================================================
--- trunk/MagicSoft/Mars/msimcamera/MSimTrigger.cc	(revision 9517)
+++ trunk/MagicSoft/Mars/msimcamera/MSimTrigger.cc	(revision 9518)
@@ -277,28 +277,4 @@
     }
 
-    fElectronicNoise = 0;
-    if (fShiftBaseline)
-    {
-        fElectronicNoise = (MPedestalCam*)pList->FindObject("ElectronicNoise", "MPedestalCam");
-        if (!fElectronicNoise)
-        {
-            *fLog << err << "ElectronicNoise [MPedestalCam] not found... aborting." << endl;
-            return kFALSE;
-        }
-        *fLog << inf << "Baseline will be shifted back to 0 for discriminator." << endl;
-    }
-
-    fGain = 0;
-    if (fUngainSignal)
-    {
-        fGain = (MPedestalCam*)pList->FindObject("Gain", "MPedestalCam");
-        if (!fGain)
-        {
-            *fLog << err << "Gain [MPedestalCam] not found... aborting." << endl;
-            return kFALSE;
-        }
-        *fLog << inf << "Discriminator will be multiplied by applied gain." << endl;
-    }
-
     fRunHeader = (MRawRunHeader*)pList->FindObject("MRawRunHeader");
     if (!fRunHeader)
@@ -311,4 +287,34 @@
     if (!fEvtHeader)
         return kFALSE;
+
+    if (!fSimulateElectronics)
+    {
+        *fLog << inf << "Simulation of electronics switched off... first photon will trigger." << endl;
+        return kTRUE;
+    }
+
+    fElectronicNoise = 0;
+    if (fShiftBaseline)
+    {
+        fElectronicNoise = (MPedestalCam*)pList->FindObject("ElectronicNoise", "MPedestalCam");
+        if (!fElectronicNoise)
+        {
+            *fLog << err << "ElectronicNoise [MPedestalCam] not found... aborting." << endl;
+            return kFALSE;
+        }
+        *fLog << inf << "Baseline will be shifted back to 0 for discriminator." << endl;
+    }
+
+    fGain = 0;
+    if (fUngainSignal)
+    {
+        fGain = (MPedestalCam*)pList->FindObject("Gain", "MPedestalCam");
+        if (!fGain)
+        {
+            *fLog << err << "Gain [MPedestalCam] not found... aborting." << endl;
+            return kFALSE;
+        }
+        *fLog << inf << "Discriminator will be multiplied by applied gain." << endl;
+    }
 
     fRouteAC.Delete();
Index: trunk/MagicSoft/Mars/msimcamera/Makefile
===================================================================
--- trunk/MagicSoft/Mars/msimcamera/Makefile	(revision 9517)
+++ trunk/MagicSoft/Mars/msimcamera/Makefile	(revision 9518)
@@ -6,6 +6,6 @@
 #
 ##################################################################
+include ../Makefile.conf.general
 include ../Makefile.conf.$(OSTYPE)
-include ../Makefile.conf.general
 
 #------------------------------------------------------------------------------
Index: trunk/MagicSoft/Mars/msimreflector/MReflector.cc
===================================================================
--- trunk/MagicSoft/Mars/msimreflector/MReflector.cc	(revision 9517)
+++ trunk/MagicSoft/Mars/msimreflector/MReflector.cc	(revision 9518)
@@ -373,5 +373,6 @@
 // SigmaPSF can be used to set a default for the psf of the mirrors
 // read from the file. Note, that this can be overwritten for individual
-// mirrors in the file.
+// mirrors in the file. The SigmaPSF is the sigma of a 1D-Gauss fitted
+// to the radial profile of the light distribution.
 //
 // For details on the file structure see MReflector::ReadFile
Index: trunk/MagicSoft/Mars/msql/Makefile
===================================================================
--- trunk/MagicSoft/Mars/msql/Makefile	(revision 9517)
+++ trunk/MagicSoft/Mars/msql/Makefile	(revision 9518)
@@ -6,6 +6,6 @@
 #
 ##################################################################
+include ../Makefile.conf.general
 include ../Makefile.conf.$(OSTYPE)
-include ../Makefile.conf.general
 
 ############################################################
Index: trunk/MagicSoft/Mars/mtrigger/Makefile
===================================================================
--- trunk/MagicSoft/Mars/mtrigger/Makefile	(revision 9517)
+++ trunk/MagicSoft/Mars/mtrigger/Makefile	(revision 9518)
@@ -6,6 +6,6 @@
 #
 ##################################################################
+include ../Makefile.conf.general
 include ../Makefile.conf.$(OSTYPE)
-include ../Makefile.conf.general
 
 #------------------------------------------------------------------------------
Index: trunk/MagicSoft/include-Classes/MMcFormat/Makefile
===================================================================
--- trunk/MagicSoft/include-Classes/MMcFormat/Makefile	(revision 9517)
+++ trunk/MagicSoft/include-Classes/MMcFormat/Makefile	(revision 9518)
@@ -6,6 +6,6 @@
 #
 ##################################################################
+include ../Makefile.conf.general
 include ../Makefile.conf.$(OSTYPE)
-include ../Makefile.conf.general
 
 #------------------------------------------------------------------------------
