Index: /trunk/MagicSoft/Mars/Changelog
===================================================================
--- /trunk/MagicSoft/Mars/Changelog	(revision 8010)
+++ /trunk/MagicSoft/Mars/Changelog	(revision 8011)
@@ -18,4 +18,40 @@
 
                                                  -*-*- END OF LINE -*-*-
+
+ 2006/10/07 Thomas Bretz
+
+   * Makefile.conf.general:
+     - removed ROOTVER definition ROOT_RELEASE can be used instead
+
+   * callisto.cc:
+     - exchanged some checks to get a more reasonable output
+
+   * callisto.rc, callisto_Dec04Jan05.rc:
+     - removed some obsolete resources for simplicity
+
+   * callisto.cc, ganymed.cc, mars.cc, merpp.cc, readdaq.cc, readreaw.cc,
+     showlog.cc, showplot.cc, sinope.cc, star.cc
+     - added the new root version check
+     - replaced ROOTVER by ROOT_RELEASE
+
+   * sinope.cc:
+     - adapted Usage() to fit the other executables
+
+   * mbase/MAGIC.h:
+     - added new namespace MARS with a new function CheckRootVer
+
+   * mbase/MAGIC.cc:
+     - added 
+
+   * mbase/MEvtLoop.cc, mbase/MStatusDisplay.cc:
+     - replaced ROOTVER by ROOT_RELEASE
+
+   * mbase/Makefile:
+     - added new MAGIC.cc
+
+   * mbase/BaseLinkDef.h:
+     - added namespace MAGIC.cc
+
+
 
  2006/10/07 Daniela Dorner, Thomas Bretz
Index: /trunk/MagicSoft/Mars/Makefile.conf.general
===================================================================
--- /trunk/MagicSoft/Mars/Makefile.conf.general	(revision 8010)
+++ /trunk/MagicSoft/Mars/Makefile.conf.general	(revision 8011)
@@ -3,5 +3,4 @@
 #
 
-ROOTVER    =  `root-config --version`
 ROOTLIBS   =  `root-config --libs` -lASImage -lMinuit -lHistPainter -lThread
 ROOTGLIBS  =  `root-config --glibs` -lASImage -lMinuit -lHistPainter -lThread
@@ -18,5 +17,5 @@
 #   export MARSLIBS="-lX11 -lXpm -L/usr/X11R6/lib"
 #
-DEFINES	 = -DMARSVER=\"\<cvs\>\" -D__MARS__ -DROOTVER=\"$(ROOTVER)\" $(ARCHDEF) $(MARSDEFINES)
+DEFINES	 = -DMARSVER=\"\<cvs\>\" -D__MARS__ $(ARCHDEF) $(MARSDEFINES)
 
 CXXFLAGS = $(ROOTCFLAGS) $(INCLUDES) $(OPTIM) $(DEBUG) $(DEFINES)
Index: /trunk/MagicSoft/Mars/NEWS
===================================================================
--- /trunk/MagicSoft/Mars/NEWS	(revision 8010)
+++ /trunk/MagicSoft/Mars/NEWS	(revision 8011)
@@ -3,5 +3,6 @@
  *** Version  <cvs>
 
-   - callisto: New swapped pixels have been found and corrected
+   - general: all executables now check consistency of the root version
+     installed with the root version used for compilation
 
    - general: The algorithm to build seqeunces has been redesigned
@@ -43,4 +44,7 @@
 
    - merpp: didn't recognize files with the extension .raw.gz - fixed.
+
+   - callisto: New swapped pixels have been found and corrected. For
+     details see MRawRunHeader::FixAssignment()
 
    - callisto: Callisto now raises an error if one of the input files could
Index: /trunk/MagicSoft/Mars/callisto.cc
===================================================================
--- /trunk/MagicSoft/Mars/callisto.cc	(revision 8010)
+++ /trunk/MagicSoft/Mars/callisto.cc	(revision 8011)
@@ -33,5 +33,5 @@
     gLog << "                 Callisto - MARS V" << MARSVER            << endl;
     gLog << "    MARS -- CALibrate LIght Signals and Time Offsets"     << endl;
-    gLog << "      Compiled with ROOT v" << ROOTVER << " on <" << __DATE__ << ">" << endl;
+    gLog << "      Compiled with ROOT v" << ROOT_RELEASE << " on <" << __DATE__ << ">" << endl;
     gLog << "========================================================" << endl;
     gLog << endl;
@@ -142,4 +142,7 @@
 int main(int argc, char **argv)
 {
+    if (!MARS::CheckRootVer())
+        return 0xff;
+
     //
     // Evaluate arguments
@@ -198,7 +201,26 @@
         kModeC = kTRUE;
 
+    //
+    // check for the right usage of the program
+    //
+    if (arg.GetNumArguments()!=1)
+    {
+        Usage();
+        return 2;
+    }
+
+    if (arg.GetNumOptions()>0)
+    {
+        gLog << warn << "WARNING - Unknown commandline options..." << endl;
+        arg.Print("options");
+        gLog << endl;
+        return 2;
+    }
+
     if (!kModeC && !kModeY /*&& !kUseTest*/)
     {
-        gLog << err << "Neither calibration (-c) nor signal extraction (-y) or test-mode (--use-test) specified!" << endl;
+        gLog << err << "Neither calibration (-c), signal extraction (-y) or test-mode (--use-test)" << endl;
+        gLog <<        "specified! You can also give the operation mode by the options defining the" << endl;
+        gLog <<        "output path --outc, --outy or --out." << endl;
         Usage();
         return 2;
@@ -228,21 +250,4 @@
     if (kModeC && kModeY)
         kInpathY = kOutpathC;
-
-    if (arg.GetNumOptions()>0)
-    {
-        gLog << warn << "WARNING - Unknown commandline options..." << endl;
-        arg.Print("options");
-        gLog << endl;
-        return 2;
-    }
-
-    //
-    // check for the right usage of the program
-    //
-    if (arg.GetNumArguments()!=1)
-    {
-        Usage();
-        return 2;
-    }
 
     //
Index: /trunk/MagicSoft/Mars/callisto.rc
===================================================================
--- /trunk/MagicSoft/Mars/callisto.rc	(revision 8010)
+++ /trunk/MagicSoft/Mars/callisto.rc	(revision 8011)
@@ -82,17 +82,4 @@
 #MJPedestalC1.ExtractSignal.ExtractionType: Integral <default>
 #MJPedestalC1.ExtractSignal.ExtractionType: Amplitude
-# -------------------------------------------------------------------------
-# Define here parameters valid for the sliding window:
-# -------------------------------------------------------------------------
-#MJPedestalC1.ExtractSignal.HiGainWindowSize:     6
-#MJPedestalC1.ExtractSignal.LoGainWindowSize:     6
-# -------------------------------------------------------------------------
-# Define here parameters valid for the digital filter with peak search:
-# -------------------------------------------------------------------------
-#MJPedestalC1.ExtractSignal.OffsetLeftFromPeak:   3
-#MJPedestalC1.ExtractSignal.OffsetRightFromPeak:  3
-#MJPedestalC1.ExtractSignal.PeakSearchWindowSize: 2
-#MJPedestalC1.ExtractSignal.HiGainFailureLimit:  10
-#MJPedestalC1.ExtractSignal.LoGainFailureLimit:  25
 
 # -------------------------------------------------------------------------
Index: /trunk/MagicSoft/Mars/callisto_Dec04Jan05.rc
===================================================================
--- /trunk/MagicSoft/Mars/callisto_Dec04Jan05.rc	(revision 8010)
+++ /trunk/MagicSoft/Mars/callisto_Dec04Jan05.rc	(revision 8011)
@@ -92,17 +92,4 @@
 #MJPedestalC1.ExtractSignal.ExtractionType: Integral <default>
 #MJPedestalC1.ExtractSignal.ExtractionType: Amplitude
-# -------------------------------------------------------------------------
-# Define here parameters valid for the sliding window:
-# -------------------------------------------------------------------------
-#MJPedestalC1.ExtractSignal.HiGainWindowSize:     6
-#MJPedestalC1.ExtractSignal.LoGainWindowSize:     6
-# -------------------------------------------------------------------------
-# Define here parameters valid for the digital filter with peak search:
-# -------------------------------------------------------------------------
-#MJPedestalC1.ExtractSignal.OffsetLeftFromPeak:   3
-#MJPedestalC1.ExtractSignal.OffsetRightFromPeak:  3
-#MJPedestalC1.ExtractSignal.PeakSearchWindowSize: 2
-#MJPedestalC1.ExtractSignal.HiGainFailureLimit:  10
-#MJPedestalC1.ExtractSignal.LoGainFailureLimit:  25
 
 # -------------------------------------------------------------------------
Index: /trunk/MagicSoft/Mars/ganymed.cc
===================================================================
--- /trunk/MagicSoft/Mars/ganymed.cc	(revision 8010)
+++ /trunk/MagicSoft/Mars/ganymed.cc	(revision 8011)
@@ -30,5 +30,5 @@
     gLog << "                  Ganymed - MARS V" << MARSVER            << endl;
     gLog << "   MARS -- Gammas Are Now Your Most Exciting Discovery"   << endl;
-    gLog << "   Compiled with ROOT v" << ROOTVER << " on <" << __DATE__ << ">" << endl;
+    gLog << "   Compiled with ROOT v" << ROOT_RELEASE << " on <" << __DATE__ << ">" << endl;
     gLog << "========================================================" << endl;
     gLog << endl;
@@ -91,4 +91,7 @@
 int main(int argc, char **argv)
 {
+    if (!MARS::CheckRootVer())
+        return 0xff;
+
     //
     // Evaluate arguments
Index: /trunk/MagicSoft/Mars/mars.cc
===================================================================
--- /trunk/MagicSoft/Mars/mars.cc	(revision 8010)
+++ /trunk/MagicSoft/Mars/mars.cc	(revision 8011)
@@ -36,5 +36,5 @@
     gLog << "                    MARS V" << MARSVER              << endl;
     gLog << "    Magic Analysis and Reconstruction Software"     << endl;
-    gLog << "   Compiled with ROOT v" << ROOTVER << " on <" << __DATE__ << ">" << endl;
+    gLog << "   Compiled with ROOT v" << ROOT_RELEASE << " on <" << __DATE__ << ">" << endl;
     gLog << "==================================================" << endl;
     gLog << endl;
@@ -53,4 +53,7 @@
 int main(int argc, char **argv)
 {
+    if (!MARS::CheckRootVer())
+        return 0xff;
+
     //
     // Evaluate arguments
Index: /trunk/MagicSoft/Mars/mbase/BaseLinkDef.h
===================================================================
--- /trunk/MagicSoft/Mars/mbase/BaseLinkDef.h	(revision 8010)
+++ /trunk/MagicSoft/Mars/mbase/BaseLinkDef.h	(revision 8011)
@@ -18,4 +18,5 @@
 // I/O
 #pragma link C++ class MZlib+;
+//#pragma link C++ class MBzlib2+;
 
 // Basic Network Tools
@@ -23,4 +24,5 @@
 
 // Basic Tools
+#pragma link C++ namespace MARS;
 #pragma link C++ namespace MMath;
 #pragma link C++ class MString+;
Index: /trunk/MagicSoft/Mars/mbase/MAGIC.cc
===================================================================
--- /trunk/MagicSoft/Mars/mbase/MAGIC.cc	(revision 8011)
+++ /trunk/MagicSoft/Mars/mbase/MAGIC.cc	(revision 8011)
@@ -0,0 +1,59 @@
+/* ======================================================================== *\
+!
+! *
+! * This file is part of MARS, the MAGIC Analysis and Reconstruction
+! * Software. It is distributed to you in the hope that it can be a useful
+! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
+! * It is distributed WITHOUT ANY WARRANTY.
+! *
+! * Permission to use, copy, modify and distribute this software and its
+! * documentation for any purpose is hereby granted without fee,
+! * provided that the above copyright notice appear in all copies and
+! * that both that copyright notice and this permission notice appear
+! * in supporting documentation. It is provided "as is" without express
+! * or implied warranty.
+! *
+!
+!
+!   Author(s): Thomas Bretz  10/2006 <mailto:tbretz@astro.uni-wuerzburg.de>
+!
+!   Copyright: MAGIC Software Development, 2000-2006
+!
+!
+\* ======================================================================== */
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// MARS
+//
+/////////////////////////////////////////////////////////////////////////////
+#include "MAGIC.h"
+
+#include <iostream>
+
+using namespace std;
+
+bool MARS::CheckRootVer()
+{
+    if (!strcmp(gROOT->GetVersion(), ROOT_RELEASE))
+        return true;
+
+    cout << "FATAL ERROR - ROOT version mismatch." << endl;
+    cout << "  Your mars has been compiled using root v" << ROOT_RELEASE << endl;
+    cout << "  The libraries you are using are from root v" << gROOT->GetVersion() << endl;
+    cout << "  Your environment contains:" << endl;
+    cout << "    ROOTSYS         = " << getenv("ROOTSYS") << endl;
+    cout << "    PATH            = " << getenv("PATH") << endl;
+    cout << "    LD_LIBRARY_PATH = " << getenv("LD_LIBRARY_PATH") << endl << endl;
+    cout << "  If this is the right root-version please do" << endl;
+    cout << "    make mrproper && make" << endl;
+    cout << "  for a complete recompilation." << endl << endl;
+    cout << "  If this is the wrong root-version make sure that the file ~/.bashrc contains:" << endl;
+    cout << "    export ROOTSYS=/PathTo/Your/RootVersion" << endl;
+    cout << "    export PATH=$ROOTSYS/bin:$PATH" << endl;
+    cout << "    export LD_LIBRARY_PATH=$ROOTSYS/lib:$LD_LIBRARY_PATH" << endl;
+    cout << "  and start a new shell. Check it by typing \"export\"" << endl;
+    cout << endl;
+
+    return false;
+}
Index: /trunk/MagicSoft/Mars/mbase/MAGIC.h
===================================================================
--- /trunk/MagicSoft/Mars/mbase/MAGIC.h	(revision 8010)
+++ /trunk/MagicSoft/Mars/mbase/MAGIC.h	(revision 8011)
@@ -35,3 +35,8 @@
 const Double_t kRad2Deg = 180.0/3.1415926535897932384626433832795028841971693993751;
 
+namespace MARS
+{
+    bool CheckRootVer();
+}
+
 #endif
Index: /trunk/MagicSoft/Mars/mbase/MEvtLoop.cc
===================================================================
--- /trunk/MagicSoft/Mars/mbase/MEvtLoop.cc	(revision 8010)
+++ /trunk/MagicSoft/Mars/mbase/MEvtLoop.cc	(revision 8011)
@@ -109,5 +109,5 @@
     SetBit(kMustCleanup);
 
-    *fLog << inf << underline << "Instantiated MEvtLoop (" << name << "), using ROOT v" << ROOTVER << endl;
+    *fLog << inf << underline << "Instantiated MEvtLoop (" << name << "), using ROOT v" << ROOT_RELEASE << endl;
 }
 
Index: /trunk/MagicSoft/Mars/mbase/MStatusDisplay.cc
===================================================================
--- /trunk/MagicSoft/Mars/mbase/MStatusDisplay.cc	(revision 8010)
+++ /trunk/MagicSoft/Mars/mbase/MStatusDisplay.cc	(revision 8011)
@@ -451,5 +451,5 @@
 
     // Add root version
-    l = new TGLabel(f, MString::Format("Using ROOT v%s", ROOTVER));
+    l = new TGLabel(f, MString::Format("Using ROOT v%s", ROOT_RELEASE));
     fList->Add(l);
 
Index: /trunk/MagicSoft/Mars/mbase/Makefile
===================================================================
--- /trunk/MagicSoft/Mars/mbase/Makefile	(revision 8010)
+++ /trunk/MagicSoft/Mars/mbase/Makefile	(revision 8011)
@@ -18,5 +18,6 @@
 CINT = Base
 
-SRCFILES = MLogo.cc \
+SRCFILES = MAGIC.cc \
+	   MLogo.cc \
            MArgs.cc \
            MString.cc \
Index: /trunk/MagicSoft/Mars/merpp.cc
===================================================================
--- /trunk/MagicSoft/Mars/merpp.cc	(revision 8010)
+++ /trunk/MagicSoft/Mars/merpp.cc	(revision 8011)
@@ -53,5 +53,5 @@
     gLog << "                MERPP - MARS V" << MARSVER          << endl;
     gLog << "     MARS - Merging and Preprocessing Program"      << endl;
-    gLog << "   Compiled with ROOT v" << ROOTVER << " on <" << __DATE__ << ">" << endl;
+    gLog << "   Compiled with ROOT v" << ROOT_RELEASE << " on <" << __DATE__ << ">" << endl;
     gLog << "==================================================" << endl;
     gLog << endl;
@@ -147,4 +147,7 @@
 int main(const int argc, char **argv)
 {
+    if (!MARS::CheckRootVer())
+        return 0xff;
+
     //
     // Evaluate arguments
Index: /trunk/MagicSoft/Mars/readdaq.cc
===================================================================
--- /trunk/MagicSoft/Mars/readdaq.cc	(revision 8010)
+++ /trunk/MagicSoft/Mars/readdaq.cc	(revision 8011)
@@ -39,5 +39,5 @@
     gLog << "              ReadDaq - MARS V" << MARSVER          << endl;
     gLog << "       MARS - Read and print daq data files"        << endl;
-    gLog << "   Compiled with ROOT v" << ROOTVER << " on <" << __DATE__ << ">" << endl;
+    gLog << "   Compiled with ROOT v" << ROOT_RELEASE << " on <" << __DATE__ << ">" << endl;
     gLog << "==================================================" << endl;
     gLog << endl;
@@ -59,4 +59,7 @@
 int main(int argc, char **argv)
 {
+    if (!MARS::CheckRootVer())
+        return 0xff;
+
     //
     // Evaluate arguments
Index: /trunk/MagicSoft/Mars/readraw.cc
===================================================================
--- /trunk/MagicSoft/Mars/readraw.cc	(revision 8010)
+++ /trunk/MagicSoft/Mars/readraw.cc	(revision 8011)
@@ -42,5 +42,5 @@
     gLog << "              ReadRaw - MARS V" << MARSVER          << endl;
     gLog << "       MARS - Read and print raw data files"        << endl;
-    gLog << "   Compiled with ROOT v" << ROOTVER << " on <" << __DATE__ << ">" << endl;
+    gLog << "   Compiled with ROOT v" << ROOT_RELEASE << " on <" << __DATE__ << ">" << endl;
     gLog << "==================================================" << endl;
     gLog << endl;
@@ -70,4 +70,7 @@
 int main(int argc, char **argv)
 {
+    if (!MARS::CheckRootVer())
+        return 0xff;
+
     // Evaluate arguments
     MArgs arg(argc, argv);
Index: /trunk/MagicSoft/Mars/showlog.cc
===================================================================
--- /trunk/MagicSoft/Mars/showlog.cc	(revision 8010)
+++ /trunk/MagicSoft/Mars/showlog.cc	(revision 8011)
@@ -3,4 +3,6 @@
 
 #include <TRegexp.h>
+
+#include "MAGIC.h"
 
 #include "MArgs.h"
@@ -16,5 +18,5 @@
     //       12345678901234567890123456789012345678901234567890
     gLog << endl;
-    gLog << "showlog --- Mars V" << MARSVER << " compiled on <" << __DATE__ << "> using ROOT v" << ROOTVER << endl;
+    gLog << "showlog --- Mars V" << MARSVER << " compiled on <" << __DATE__ << "> using ROOT v" << ROOT_RELEASE << endl;
     gLog << endl;
 }
@@ -62,4 +64,7 @@
 int main(int argc, char **argv)
 {
+    if (!MARS::CheckRootVer())
+        return 0xff;
+
     MArgs arg(argc, argv);
 
Index: /trunk/MagicSoft/Mars/showplot.cc
===================================================================
--- /trunk/MagicSoft/Mars/showplot.cc	(revision 8010)
+++ /trunk/MagicSoft/Mars/showplot.cc	(revision 8011)
@@ -18,5 +18,5 @@
     //       12345678901234567890123456789012345678901234567890
     gLog << endl;
-    gLog << "showplot --- Mars V" << MARSVER << " compiled on <" << __DATE__ << "> using ROOT v" << ROOTVER << endl;
+    gLog << "showplot --- Mars V" << MARSVER << " compiled on <" << __DATE__ << "> using ROOT v" << ROOT_RELEASE << endl;
     gLog << endl;
 }
@@ -90,4 +90,7 @@
 int main(int argc, char **argv)
 {
+    if (!MARS::CheckRootVer())
+        return 0xff;
+
     //
     // Evaluate arguments
Index: /trunk/MagicSoft/Mars/sinope.cc
===================================================================
--- /trunk/MagicSoft/Mars/sinope.cc	(revision 8010)
+++ /trunk/MagicSoft/Mars/sinope.cc	(revision 8011)
@@ -196,10 +196,9 @@
     //                1         2         3         4         5
     //       12345678901234567890123456789012345678901234567890
-    gLog << "========================================================" << endl;
-    gLog << "                  Sinope - MARS V" << MARSVER            << endl;
-    gLog << "        MARS -- SImple Non Online Pulse Evaluation"       << endl;
-    gLog << "               Compiled on <" << __DATE__ << ">"          << endl;
-    gLog << "                  Using ROOT v" << ROOTVER                << endl;
-    gLog << "========================================================" << endl;
+    gLog << "==================================================" << endl;
+    gLog << "            Sinope - MARS V" << MARSVER          << endl;
+    gLog << "    MARS -- SImple Non Online Pulse Evaluation"       << endl;
+    gLog << "   Compiled with ROOT v" << ROOT_RELEASE << " on <" << __DATE__ << ">" << endl;
+    gLog << "==================================================" << endl;
     gLog << endl;
 }
@@ -267,4 +266,7 @@
 int main(int argc, char **argv)
 {
+    if (!MARS::CheckRootVer())
+        return 0xff;
+
     //
     // Evaluate arguments
Index: /trunk/MagicSoft/Mars/star.cc
===================================================================
--- /trunk/MagicSoft/Mars/star.cc	(revision 8010)
+++ /trunk/MagicSoft/Mars/star.cc	(revision 8011)
@@ -30,5 +30,5 @@
     gLog << "                   Star - MARS V" << MARSVER              << endl;
     gLog << "      MARS -- STandard Analysis and Reconstruction"       << endl;
-    gLog << "     Compiled with ROOT v" << ROOTVER << " on <" << __DATE__ << ">" << endl;
+    gLog << "     Compiled with ROOT v" << ROOT_RELEASE << " on <" << __DATE__ << ">" << endl;
     gLog << "========================================================" << endl;
     gLog << endl;
@@ -91,4 +91,7 @@
 int main(int argc, char **argv)
 {
+    if (!MARS::CheckRootVer())
+        return 0xff;
+
     //
     // Evaluate arguments
