Index: trunk/MagicSoft/Mars/Changelog
===================================================================
--- trunk/MagicSoft/Mars/Changelog	(revision 2420)
+++ trunk/MagicSoft/Mars/Changelog	(revision 2421)
@@ -1,3 +1,19 @@
                                                  -*-*- END OF LINE -*-*-
+  2003/10/22: Thomas Bretz
+  
+   * mars.cc:
+     - replaced TApplication by TGApplication
+     - removed TROOT
+     - reset Batch mode in any case
+     
+   * meventdisp/MGCamDisplay.cc:
+     - use new MHCamera::SetLevels to display cleaning levels
+     
+   * mhist/MHCamera.[h,cc]:
+     - removed FillLevels - obsolete
+     - added SetLevels instead
+
+
+
   2003/10/21: Wolfgang Wittek
 
Index: trunk/MagicSoft/Mars/manalysis/MMatrixLoop.cc
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MMatrixLoop.cc	(revision 2420)
+++ trunk/MagicSoft/Mars/manalysis/MMatrixLoop.cc	(revision 2421)
@@ -54,11 +54,10 @@
 // --------------------------------------------------------------------------
 //
+Int_t MMatrixLoop::PreProcess(MParList *plist)
+{
+    fNumRow = 0;
 
-Int_t MMatrixLoop::PreProcess(MParList *plist)
-    {
-        fNumRow = 0;
-
-        return fMatrix ? kTRUE : kFALSE;
-    }
+    return fMatrix ? kTRUE : kFALSE;
+}
 
 // --------------------------------------------------------------------------
@@ -71,12 +70,2 @@
     return fMatrix->SetNumRow(fNumRow++);
 }
-
-
-
-
-
-
-
-
-
-
Index: trunk/MagicSoft/Mars/mars.cc
===================================================================
--- trunk/MagicSoft/Mars/mars.cc	(revision 2420)
+++ trunk/MagicSoft/Mars/mars.cc	(revision 2421)
@@ -1,4 +1,4 @@
 #include <TROOT.h>
-#include <TApplication.h>
+#include <TGApplication.h>
 
 #include "MAGIC.h"
@@ -25,6 +25,20 @@
 //
 //    started by  h. kornmayer      january, 3rd  2001 
+static void StartUpMessage()
+{
+    gLog << all << endl;
 
-void Usage()
+    //                1         2         3         4         5
+    //       12345678901234567890123456789012345678901234567890
+    gLog << "==================================================" << endl;
+    gLog << "                    MARS V" << MARSVER              << endl;
+    gLog << "    Magic Analysis and Reconstruction Software"     << endl;
+    gLog << "            Compiled on <" << __DATE__ << ">"       << endl;
+    gLog << "               Using ROOT v" << ROOTVER             << endl;
+    gLog << "==================================================" << endl;
+    gLog << endl;
+}
+
+static void Usage()
 {
     gLog << "Sorry the usage is:" << endl;
@@ -34,19 +48,4 @@
     gLog << "     -v2: errors and warnings <default>"        << endl;
     gLog << "     -v3: errors, warnings and infos"           << endl;
-}
-
-void StartUpMessage()
-{
-    gLog << all << endl;
-
-    //                1         2         3         4         5
-    //       12345678901234567890123456789012345678901234567890
-    gLog << "==================================================" << endl;
-    gLog << "                    MARS V" << MARSVER << "                      " << endl;
-    gLog << "    Magic Analysis and Reconstruction Software    " << endl;
-    gLog << "            Compiled on <" << __DATE__ << ">"       << endl;
-    gLog << "               Using ROOT v" << ROOTVER             << endl;
-    gLog << "==================================================" << endl;
-    gLog << endl;
 }
 
@@ -59,4 +58,8 @@
 
     StartUpMessage();
+
+    TGApplication app("MarsApp", &argc, argv);
+    if (gROOT->IsBatch())
+        gROOT->SetBatch(kFALSE);
 
     //
@@ -105,11 +108,4 @@
     MParContainer::Class()->IgnoreTObjectStreamer();
 
-    //
-    // initialise ROOT
-    //
-    TROOT simple("mars", "MARS - Magic Analysis and Reconstruction Software");
-
-    TApplication app("MarsApp", &argc, argv);
-
 #ifdef HAVE_XPM
     logo.Popdown();
Index: trunk/MagicSoft/Mars/meventdisp/MGCamDisplay.cc
===================================================================
--- trunk/MagicSoft/Mars/meventdisp/MGCamDisplay.cc	(revision 2420)
+++ trunk/MagicSoft/Mars/meventdisp/MGCamDisplay.cc	(revision 2421)
@@ -280,8 +280,13 @@
     }
 
+    TArrayF lvl(2);
+    lvl[0] = clean->GetCleanLvl2();
+    lvl[1] = clean->GetCleanLvl1();
+
     fDisplay[0]->SetCamContent(*evt, 0);
     fDisplay[1]->SetCamContent(*ped, 1);
     fDisplay[2]->SetCamContent(val, &use);
-    fDisplay[3]->FillLevels(*evt, *clean);
+    fDisplay[3]->SetCamContent(val, &use);
+    fDisplay[3]->SetLevels(lvl);
     fDisplay[4]->SetCamContent(*ped, 0);
 
Index: trunk/MagicSoft/Mars/mhist/MHCamera.cc
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHCamera.cc	(revision 2420)
+++ trunk/MagicSoft/Mars/mhist/MHCamera.cc	(revision 2421)
@@ -818,12 +818,14 @@
 // ------------------------------------------------------------------------
 //
-// Fill the colors in respect to the cleaning levels
-//
-void MHCamera::FillLevels(const MCerPhotEvt &event, Float_t lvl1, Float_t lvl2)
+// The array must be in increasing order, eg: 2.5, 3.7, 4.9
+// The values in each bin are replaced by the interval in which the value
+// fits. In the example we have four intervals
+// (<2.5, 2.5-3.7, 3.7-4.9, >4.9). Maximum and minimum are set
+// accordingly.
+//
+void MHCamera::SetLevels(const TArrayF &arr)
 {
     if (fNcells<=1)
         return;
-
-    SetCamContent(event, 2);
 
     for (Int_t i=0; i<fNcells-2; i++)
@@ -832,21 +834,12 @@
             continue;
 
-        if (fArray[i+1]>lvl1)
-            fArray[i+1] = 0;
-        else
-            if (fArray[i+1]>lvl2)
-                fArray[i+1] = 1;
-            else
-                fArray[i+1] = 2;
-    }
-}
-
-// ------------------------------------------------------------------------
-//
-// Fill the colors in respect to the cleaning levels
-//
-void MHCamera::FillLevels(const MCerPhotEvt &event, const MImgCleanStd &clean)
-{
-    FillLevels(event, clean.GetCleanLvl1(), clean.GetCleanLvl2());
+        Int_t j = arr.GetSize();
+        while (j && fArray[i+1]<arr[j-1])
+            j--;
+
+        fArray[i+1] = j;
+    }
+    SetMaximum(arr.GetSize());
+    SetMinimum(0);
 }
 
Index: trunk/MagicSoft/Mars/mhist/MHCamera.h
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHCamera.h	(revision 2420)
+++ trunk/MagicSoft/Mars/mhist/MHCamera.h	(revision 2421)
@@ -138,6 +138,5 @@
     Double_t GetMaximum() const { return GetMaximum(0/*kTRUE*/); }
 
-    void  FillLevels(const MCerPhotEvt &event, Float_t lvl1, Float_t lvl2);
-    void  FillLevels(const MCerPhotEvt &event, const MImgCleanStd &clean);
+    void SetLevels(const TArrayF &arr);
 
     void  FillRandom(const char *fname, Int_t ntimes=5000) { TH1::FillRandom(fname, ntimes); }
@@ -152,4 +151,5 @@
     void  Reset() { Reset(""); } // *MENU*
     TH1  *DrawCopy() const/* { gPad=NULL; return TH1D::DrawCopy(); }*/; // *MENU*
+    TH1  *DrawCopy(Option_t *o) const { return TH1D::DrawCopy(o); }
 
     void  Print(Option_t *) const;
Index: trunk/MagicSoft/Mars/mhist/MHMatrix.cc
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHMatrix.cc	(revision 2420)
+++ trunk/MagicSoft/Mars/mhist/MHMatrix.cc	(revision 2421)
@@ -126,10 +126,9 @@
 //
 Bool_t MHMatrix::SetNumRow(Int_t row) 
-    {
-      if (row>=fM.GetNrows() || row<0) return kFALSE; 
-      fRow = row; 
-      return kTRUE; 
-    }
-
+{
+    if (row>=fM.GetNrows() || row<0) return kFALSE;
+    fRow = row;
+    return kTRUE;
+}
 
 // --------------------------------------------------------------------------
@@ -1191,3 +1190,2 @@
     return kTRUE;
 }
-
