Index: trunk/MagicSoft/Mars/Changelog
===================================================================
--- trunk/MagicSoft/Mars/Changelog	(revision 1965)
+++ trunk/MagicSoft/Mars/Changelog	(revision 1966)
@@ -1,3 +1,55 @@
                                                  -*-*- END OF LINE -*-*-
+
+ 2003/04/21: Thomas Bretz
+
+   * macros/plot.C:
+     - Added MStatusDisplay support
+     
+   * macros/status.C:
+     - added MHNewImagePar
+
+   * manalysis/MBlindPixelCalc.cc:
+     - updated class reference
+     
+   * meventdisp/MGCamDisplay.[h,cc]:
+     - fixed
+     
+   * meventdisp/MGEvtDisplay.cc:
+     - changed function adding the tab
+     
+   * mgui/MCamDisplay.cc, mhist/MHCerPhotEvt.cc:
+     - as a preliminary solution removed inner pad
+
+   * mhist/MFillH.cc:
+     - make sure canvas is updated correctly in PostProcess
+
+   * mhist/MH.cc:
+     - changed DrawCopy(TH1, TH1) and Draw(TH1, TH1) to fit the new needs
+       display the range correctly and exchanged the two stat boxes
+   
+   * mhist/MH3.cc:
+     - fixed a bug in the default constructor
+     - removed DrawClone
+     - updated Draw function
+     
+   * mhist/MHMcIntRate.[h,cc], mhist/MHRanForest.[h,cc],
+     mhist/MHRanForestGini.[h,cc], mhist/MHSigmaPixel.[h,cc],
+     mhist/MHSigmaTheta.[h,cc], mhist/MHSigmabarTheta.[h,cc],
+     mhist/MHThetabarTheta.[h,cc], mhist/MHThetabarTime.[h,cc],
+     mhist/MHTimeDiffTheta.[h,cc], mhist/MHTimeDiffTime.[h,cc],
+     mimage/MHNewImagePar.[h,cc]:
+     - removed old DrawClone
+     - updated Draw function
+     - replaced some titles by latex titles in some classes
+
+   * mimage/MHNewImagePar.[h,cc], mimage/MNewImagePar.[h,cc]:
+     - removed scaling stuff
+
+   * mmain/MStatusDisplay.cc:
+     - fixed some minor bugs
+
+
+
+ 2003/04/20: Thomas Bretz
 
    * Makefile:
Index: trunk/MagicSoft/Mars/macros/plot.C
===================================================================
--- trunk/MagicSoft/Mars/macros/plot.C	(revision 1965)
+++ trunk/MagicSoft/Mars/macros/plot.C	(revision 1966)
@@ -23,5 +23,5 @@
 !
 \* ======================================================================== */
-
+#include <MH.h>
 // -------------------------------------------------------------------------
 //
@@ -32,4 +32,7 @@
 void plot()
 {
+    MStatusDisplay *d = new MStatusDisplay;
+    d->SetLogStream(&gLog);
+
     //
     // Create a empty Parameter List and an empty Task List
@@ -48,5 +51,6 @@
     // First Task: Read file with image parameters
     // (created with the star.C macro)
-    MReadMarsFile  read("Events", "star.root");
+    MReadMarsFile  read("Events", "MC_OFF1.root");
+    read.AddFile("MC_ON1.root");
     read.DisableAutoScheme();
     tlist.AddToList(&read);
@@ -64,5 +68,5 @@
     // set the name of the variable to plot and the binning
     //
-    TString var("MHillas.fSize");
+    TString var("Hillas.fSize");
 
     MBinning bins("BinningMH3X");
@@ -99,6 +103,5 @@
     // Execute your analysis
     //
-    MProgressBar bar;
-    evtloop.SetProgressBar(&bar);
+    evtloop.SetDisplay(d);
     if (!evtloop.Eventloop())
         return;
@@ -106,7 +109,11 @@
     tlist.PrintStatistics();
 
-    // Create a default canvas called Plot and set the
+    // Create a pad, check if MStatusDisplay was not closed meanwhile
+    if (evtloop.GetDisplay())
+        d->AddTab("Size");
+    else
+        MH::MakeDefCanvas("Plot");
+
     // x-axis to logarithmic scale
-    MH::MakeDefCanvas("Plot");
     gPad->SetLogx();
 
@@ -114,7 +121,5 @@
     // and draw a copy of both
     h3h.GetHist().SetLineColor(kRed);
-    h3h.GetHist().SetFillStyle(4000);
-    h3g.GetHist().DrawCopy();
-    h3h.GetHist().DrawCopy("same");
+    MH::DrawCopy(h3h.GetHist(), h3g.GetHist(), "Size");
 
     // Now create a new histogram, fill it with the division of the
@@ -124,5 +129,4 @@
     h.Divide(&h3g.GetHist(), &h3h.GetHist());
     h.SetLineColor(kGreen);
-    h.SetFillStyle(4000);
     h.DrawCopy("same");
 }
Index: trunk/MagicSoft/Mars/macros/status.C
===================================================================
--- trunk/MagicSoft/Mars/macros/status.C	(revision 1965)
+++ trunk/MagicSoft/Mars/macros/status.C	(revision 1966)
@@ -80,6 +80,6 @@
 
     // ------------- user change -----------------
-    //read.AddFile("data/Pro*.root");
     read.AddFile("data/Gam*.root");
+    //read.AddFile("200*.root");
 
     MMcPedestalCopy   pcopy;
@@ -93,4 +93,5 @@
     MHillasCalc       hcalc;
     MHillasSrcCalc    scalc; // !!Preliminary!! Will be removed later!
+    MNewImageParCalc  icalc;
 
     // -------------------------------------------
@@ -99,4 +100,5 @@
     MFillH hfill3("MHHillasExtSrc [MHHillasExt]");
     MFillH hfill4("MHHillasSrc","MHillasSrc");
+    MFillH hfill4("MHNewImagePar","MNewImagePar");
     MFillH hfill5("MHStarMap", "MHillas");
     MFillH hfill6("MHCerPhotEvt", "MCerPhotEvt");
@@ -107,9 +109,9 @@
 
     tlist.AddToList(&ncalc);
-
     tlist.AddToList(&blind);
     tlist.AddToList(&clean);
     tlist.AddToList(&hcalc);
     tlist.AddToList(&scalc);
+    tlist.AddToList(&icalc);
     tlist.AddToList(&hfill1);
     tlist.AddToList(&hfill2);
Index: trunk/MagicSoft/Mars/manalysis/MBlindPixelCalc.cc
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MBlindPixelCalc.cc	(revision 1965)
+++ trunk/MagicSoft/Mars/manalysis/MBlindPixelCalc.cc	(revision 1966)
@@ -19,5 +19,5 @@
 !   Author(s): Thomas Bretz    08/2002 <mailto:tbretz@astro.uni.wuerzburg.de>
 !
-!   Copyright: MAGIC Software Development, 2000-2002
+!   Copyright: MAGIC Software Development, 2000-2003
 !
 !
@@ -25,29 +25,43 @@
 
 /////////////////////////////////////////////////////////////////////////////
-//                                                                         //
-//  MBlindPixelCalc                                                        //
-//                                                                         //
-//  This is the specific image cleaning for a list of pixels. This task    //
-//  sets the pixels listed in fPixelsID to unused so they should not be    //
-//  used for analysis (eg calculation of hillas parameters).               //
-//                                                                         //
-//  If you specify an array of pixel IDs this pixels are disabled.         //
-//  In all other cases the task tries to determin the starfield from the   //
-//  MMcRunHeader and disables pixels correspoding to the starfield.        //
-//                                                                         //
-//  Implemented star fields:                                               //
-//   - Crab: 400, 401, 402, 437, 438, 439                                  //
-//                                                                         //
-//  You can use MBlindPixelCalc::SetUseInterpolation to replaced the       //
-//  blind pixels by the average of its neighbors instead of unmapping      //
-//  them. If you want to include the central pixel use                     //
-//  MBlindPixelCalc::SetUseCentralPixel                                    //
-//                                                                         //
-//  Input Containers:                                                      //
-//   MCerPhotEvt                                                           //
-//                                                                         //
-//  Output Containers:                                                     //
-//   MBlindPixels                                                          //
-//                                                                         //
+//
+//  MBlindPixelCalc
+//
+//  This is the specific image cleaning for a list of pixels. This task
+//  sets the pixels listed in fPixelsID to unused so they should not be
+//  used for analysis (eg calculation of hillas parameters).
+//
+//  You can use MBlindPixelCalc::SetUseInterpolation to replaced the
+//  blind pixels by the average of its neighbors instead of unmapping
+//  them. If you want to include the central pixel use
+//  MBlindPixelCalc::SetUseCentralPixel.
+//
+//  You have three options:
+//   1) Call SetUseBlindPixels():
+//      This will take an existing MBlindPixels container filled from
+//      elsewhere (eg. MCT1ReadPreProc) and use this pixels as blind
+//      pixels.
+//   2) Call SetPixels():
+//      This will setup an array with pixel numbers. These pixels are used
+//      as blind pixels.
+//   3) Neither 1) nor 2)
+//      This options tries to identify the starfield from the
+//      MMcRunHeader container and tries to identifies it. If it is known
+//      (eg. Crab) the fixed build in pixel numbers are used as blind
+//      pixels.
+//
+//  If neither an array of pixels is given (or its size is 0) and
+//  MMcRunHeader couldn't be found the task removes itself from the
+//  tasklist.
+//
+//  Implemented star fields:
+//   - Crab: 400, 401, 402, 437, 438, 439
+//
+//  Input Containers:
+//   MCerPhotEvt[, MBlindPixels]
+//
+//  Output Containers:
+//   MCerPhotEvt, MBlindPixels
+//
 /////////////////////////////////////////////////////////////////////////////
 #include "MBlindPixelCalc.h"
@@ -140,5 +154,6 @@
 //
 //  Replaces each pixel by the average of its surrounding pixels.
-//  If TESTBIT(fFlags, kUseCentralPixel) is set the central pixel is also included.
+//  If TESTBIT(fFlags, kUseCentralPixel) is set the central pixel is also
+//  included.
 //
 void MBlindPixelCalc::Interpolate() const
Index: trunk/MagicSoft/Mars/meventdisp/MGCamDisplay.cc
===================================================================
--- trunk/MagicSoft/Mars/meventdisp/MGCamDisplay.cc	(revision 1965)
+++ trunk/MagicSoft/Mars/meventdisp/MGCamDisplay.cc	(revision 1966)
@@ -150,5 +150,5 @@
                            const TGWindow *p, /*const TGWindow *main,*/
                            UInt_t w, UInt_t h)
-: MGEvtDisplay(filename, "Events", p, /*main,*/ w, h), fDisplay(NULL)
+: MGEvtDisplay(filename, "Events", p, /*main,*/ w, h)
 {
     //
@@ -162,35 +162,21 @@
     AddSetupElements();
 
-    fCanvas2 = AddTab("Errors");
-    fCanvas3 = AddTab("Phot/Err");
-    fCanvas4 = AddTab("Levels");
-    fCanvas5 = AddTab("Pedestals");
+    fCanvas2[0] = fCanvas;
+    fCanvas2[1] = AddTab("Errors");
+    fCanvas2[2] = AddTab("Phot/Err");
+    fCanvas2[3] = AddTab("Levels");
+    fCanvas2[4] = AddTab("Pedestals");
 
     //
     // Show camera display for the actual geometry
     //
-    fDisplay  = new MCamDisplay(geom);
-    fDisplay2 = new MCamDisplay(geom);
-    fDisplay3 = new MCamDisplay(geom);
-    fDisplay4 = new MCamDisplay(geom);
-    fDisplay5 = new MCamDisplay(geom);
-
-    fList->Add(fDisplay);
-    fList->Add(fDisplay2);
-    fList->Add(fDisplay3);
-    fList->Add(fDisplay4);
-    fList->Add(fDisplay5);
-
-    fCanvas->cd();
-    fDisplay->Draw();
-    fCanvas2->cd();
-    fDisplay2->Draw();
-    fCanvas3->cd();
-    fDisplay3->Draw();
-    fCanvas4->cd();
-    fDisplay4->Draw();
-    fCanvas5->cd();
-    fDisplay5->Draw();
-
+    for (int i=0; i<5; i++)
+    {
+        fCanvas2[i]->cd();
+        fDisplay[i]  = new MCamDisplay(geom);
+        fDisplay[i]->Draw();
+        fCanvas2[i]->Update();
+        fList->Add(fDisplay[i]);
+    }
 
     ReadFirstEvent();
@@ -203,6 +189,6 @@
     Layout();
 
-    SetWindowName("Hillas Event Display");
-    SetIconName("Hillas");
+    SetWindowName("Image Event Display");
+    SetIconName("Image");
 
     MapWindow();
@@ -242,7 +228,5 @@
     if (fDisplayRaw)
     {
-        //
         // Get a clone of MCerPhotEvt which is made before the image cleaning
-        //
         const MClone *clone = (MClone*)GetTaskList()->FindObject("MClone");
         evt = (MCerPhotEvt*)clone->GetClone();
@@ -250,7 +234,5 @@
     else
     {
-        //
         // Get MCerPhotEvt which containes the cleaned data
-        //
         evt = (MCerPhotEvt*)plist->FindObject("MCerPhotEvt");
     }
@@ -259,19 +241,15 @@
     const MPedestalCam *ped   = (MPedestalCam*)plist->FindObject("MPedestalCam");
 
-    fDisplay->FillPhotNum(*evt);
-    fCanvas->Modified();
-    fCanvas->Update();
-    fDisplay2->FillErrorPhot(*evt);
-    fCanvas2->Modified();
-    fCanvas2->Update();
-    fDisplay3->FillRatio(*evt);
-    fCanvas3->Modified();
-    fCanvas3->Update();
-    fDisplay4->FillLevels(*evt, *clean);
-    fCanvas4->Modified();
-    fCanvas4->Update();
-    fDisplay5->FillPedestals(*ped);
-    fCanvas5->Modified();
-    fCanvas5->Update();
+    fDisplay[0]->FillPhotNum(*evt);
+    fDisplay[1]->FillErrorPhot(*evt);
+    fDisplay[2]->FillRatio(*evt);
+    fDisplay[3]->FillLevels(*evt, *clean);
+    fDisplay[4]->FillPedestals(*ped);
+
+    for (int i=0; i<5; i++)
+    {
+        fCanvas2[i]->Modified();
+        fCanvas2[i]->Update();
+    }
 }
 
Index: trunk/MagicSoft/Mars/meventdisp/MGCamDisplay.h
===================================================================
--- trunk/MagicSoft/Mars/meventdisp/MGCamDisplay.h	(revision 1965)
+++ trunk/MagicSoft/Mars/meventdisp/MGCamDisplay.h	(revision 1966)
@@ -19,14 +19,6 @@
     TGListBox   *fPixelList;
 
-    MCamDisplay *fDisplay;
-    MCamDisplay *fDisplay2;
-    MCamDisplay *fDisplay3;
-    MCamDisplay *fDisplay4;
-    MCamDisplay *fDisplay5;
-
-    TCanvas *fCanvas2;
-    TCanvas *fCanvas3;
-    TCanvas *fCanvas4;
-    TCanvas *fCanvas5;
+    MCamDisplay *fDisplay[5];
+    TCanvas     *fCanvas2[5];
 
     void AddSetupElements();
Index: trunk/MagicSoft/Mars/meventdisp/MGEvtDisplay.cc
===================================================================
--- trunk/MagicSoft/Mars/meventdisp/MGEvtDisplay.cc	(revision 1965)
+++ trunk/MagicSoft/Mars/meventdisp/MGEvtDisplay.cc	(revision 1966)
@@ -216,9 +216,30 @@
     fList->Add(laycanvas);
 
-    TGCompositeFrame *frame = fEvtDisplay->AddTab(name);
-    TRootEmbeddedCanvas *canvas = new TRootEmbeddedCanvas(name+"Display", frame, 400, 400);
-    frame->AddFrame(canvas, laycanvas);
-    fList->Add(canvas);
-    return canvas->GetCanvas();
+    // Add new tab
+    TGCompositeFrame *f = fEvtDisplay->AddTab(name);
+
+    // create root embedded canvas and add it to the tab
+    TRootEmbeddedCanvas *ec = new TRootEmbeddedCanvas(name+"Display", f, f->GetWidth(), f->GetHeight());
+    f->AddFrame(ec, laycanvas);
+    fList->Add(ec);
+
+    // set background and border mode of the canvas
+    TCanvas &c = *ec->GetCanvas();
+    c.SetBorderMode(0);
+
+    // layout and map new tab
+#if ROOT_VERSION_CODE < ROOT_VERSION(3,03,00)
+    MapSubwindows();
+    Layout();
+#else
+    Layout();
+    MapSubwindows();
+#endif
+
+    // display new tab in the main frame
+    gClient->ProcessEventsFor(fEvtDisplay);
+
+    // return pointer to new canvas
+    return &c;
 }
 
Index: trunk/MagicSoft/Mars/mgui/MCamDisplay.cc
===================================================================
--- trunk/MagicSoft/Mars/mgui/MCamDisplay.cc	(revision 1965)
+++ trunk/MagicSoft/Mars/mgui/MCamDisplay.cc	(revision 1966)
@@ -278,23 +278,5 @@
     pad->SetFillColor(16);
 
-    //
-    // All this is necessary to get the background in the correct color
-    //
-    pad->Divide(1,1);
-    pad->cd(1);
-
-    gPad->SetBorderMode(0);
-    gPad->SetFillColor(16);
-
-    //
-    // set the color palette for the TBox elements
-    //
     AppendPad("");
-
-    //
-    // Necessary to visualize the background color (FIXME?)
-    //
-    gPad->Modified();
-    gPad->Update();
 }
 
@@ -309,4 +291,6 @@
     const float w = gPad->GetWw();
     const float h = gPad->GetWh()*ratio;
+
+    gPad->Range(-fRange, -fRange, (2*ratio-1)*fRange, fRange);
 
     if (h<w)
@@ -314,6 +298,4 @@
     else
         gPad->SetPad(0, (1.-w/h)/2, 1, (w/h+1)/2);
-
-    gPad->Range(-fRange, -fRange, (2*ratio-1)*fRange, fRange);
 }
 
@@ -741,5 +723,5 @@
 
         TText &txt = *GetText(i);
-        txt.SetText(txt.GetX(), txt.GetY(), Form("%5.1f", val));
+        txt.SetText(txt.GetX(), txt.GetY(), Form(val<1e6?"%5.1f":"%5.1e", val));
     }
 }
Index: trunk/MagicSoft/Mars/mhist/MFillH.cc
===================================================================
--- trunk/MagicSoft/Mars/mhist/MFillH.cc	(revision 1965)
+++ trunk/MagicSoft/Mars/mhist/MFillH.cc	(revision 1966)
@@ -469,4 +469,6 @@
         fCanvas->cd();
         fH->DrawClone("nonew");
+        fCanvas->Modified();
+        fCanvas->Update();
     }
 
Index: trunk/MagicSoft/Mars/mhist/MH.cc
===================================================================
--- trunk/MagicSoft/Mars/mhist/MH.cc	(revision 1965)
+++ trunk/MagicSoft/Mars/mhist/MH.cc	(revision 1966)
@@ -584,7 +584,10 @@
     // Draw first histogram
     //
-    TH1 *h1 = (TH1*)((TH1&)hist1).DrawCopy();
+    TH1 *h1 = ((TH1&)hist1).DrawCopy();
     gPad->SetBorderMode(0);
     gPad->Update();
+
+    h1->SetMaximum(TMath::Max(hist1.GetMaximum(), hist2.GetMaximum()));
+    h1->SetMinimum(TMath::Min(hist1.GetMinimum(), hist2.GetMinimum()));
 
     TPaveText *t = (TPaveText*)gPad->FindObject("title");
@@ -609,35 +612,30 @@
     //
     TPaveStats &s1 = *(TPaveStats*)gPad->FindObject("stats");
-    s1.SetX1NDC(s1.GetX1NDC()-0.01);
-    s1.SetName("MHStat");
+    const Double_t x1 = s1.GetX1NDC()-0.01;
+    s1.SetName((TString)"Stat"+hist1.GetTitle());
+    s1.SetX1NDC(x1-(s1.GetX2NDC()-s1.GetX1NDC()));
+    s1.SetX2NDC(x1);
 
     //
     // Draw second histogram
     //
-    TH1 *h2 = (TH1*)((TH1&)hist2).DrawCopy("sames");
+    ((TH1&)hist2).DrawCopy("sames");
     gPad->Update();
 
     //
-    // Set new position of second statistics box
+    // Draw Legend
     //
     TPaveStats &s2 = *(TPaveStats*)gPad->FindObject("stats");
-    s2.SetX1NDC(s1.GetX1NDC()-(s2.GetX2NDC()-s2.GetX1NDC())-0.01);
-    s2.SetX2NDC(s1.GetX1NDC()-0.01);
-
-    //
-    // Draw Legend
-    //
-    const Int_t    n = s1.GetListOfLines()->GetSize();
-    const Double_t h = s1.GetY2NDC()-s1.GetY1NDC();
-    TLegend &l = *new TLegend(s1.GetX1NDC(), s1.GetY1NDC()-0.015-h*2/n,
-                              s1.GetX2NDC(), s1.GetY1NDC()-0.01
-                            );
-    l.AddEntry(h1, h1->GetTitle());
-    l.AddEntry(h2, h2->GetTitle());
+    TLegend &l = *new TLegend(s2.GetX1NDC(),
+                              s2.GetY1NDC()-0.015-(s2.GetY2NDC()-s2.GetY1NDC())/2,
+                              s2.GetX2NDC(),
+                              s2.GetY1NDC()-0.01
+                             );
+    l.AddEntry((TH1*)&hist1, hist1.GetTitle());
+    l.AddEntry((TH1*)&hist2, hist2.GetTitle());
     l.SetTextSize(s2.GetTextSize());
     l.SetTextFont(s2.GetTextFont());
     l.SetBorderSize(s2.GetBorderSize());
     l.SetBit(kCanDelete);
-
     l.Draw();
 }
@@ -656,4 +654,7 @@
     gPad->SetBorderMode(0);
     gPad->Update();
+
+    hist1.SetMaximum(TMath::Max(hist1.GetMaximum(), hist2.GetMaximum()));
+    hist1.SetMinimum(TMath::Min(hist1.GetMinimum(), hist2.GetMinimum()));
 
     TPaveText *t = (TPaveText*)gPad->FindObject("title");
@@ -678,6 +679,8 @@
     //
     TPaveStats &s1 = *(TPaveStats*)gPad->FindObject("stats");
-    s1.SetX1NDC(s1.GetX1NDC()-0.01);
+    const Double_t x1 = s1.GetX1NDC()-0.01;
     s1.SetName((TString)"Stat"+hist1.GetTitle());
+    s1.SetX1NDC(x1-(s1.GetX2NDC()-s1.GetX1NDC()));
+    s1.SetX2NDC(x1);
 
     //
@@ -685,21 +688,14 @@
     //
     hist2.Draw("sames");
-
     gPad->Update();
 
     //
-    // Set new position of second statistics box
+    // Draw Legend
     //
     TPaveStats &s2 = *(TPaveStats*)gPad->FindObject("stats");
-    s2.SetX1NDC(s1.GetX1NDC()-(s2.GetX2NDC()-s2.GetX1NDC())-0.01);
-    s2.SetX2NDC(s1.GetX1NDC()-0.01);
-
-    //
-    // Draw Legend
-    //
-    TLegend &l = *new TLegend(s1.GetX1NDC(),
-                              s1.GetY1NDC()-0.015-(s1.GetY2NDC()-s1.GetY1NDC())/2,
-                              s1.GetX2NDC(),
-                              s1.GetY1NDC()-0.01
+    TLegend &l = *new TLegend(s2.GetX1NDC(),
+                              s2.GetY1NDC()-0.015-(s2.GetY2NDC()-s2.GetY1NDC())/2,
+                              s2.GetX2NDC(),
+                              s2.GetY1NDC()-0.01
                              );
     l.AddEntry(&hist1, hist1.GetTitle());
Index: trunk/MagicSoft/Mars/mhist/MH3.cc
===================================================================
--- trunk/MagicSoft/Mars/mhist/MH3.cc	(revision 1965)
+++ trunk/MagicSoft/Mars/mhist/MH3.cc	(revision 1966)
@@ -112,5 +112,6 @@
     fTitle = Form(gsDefTitle.Data(), 1);
 
-    fHist->SetDirectory(NULL);
+    if (fHist)
+        fHist->SetDirectory(NULL);
 
     fScale[0] = 1;
@@ -451,4 +452,5 @@
 // pointer to it from this function
 //
+/*
 TObject *MH3::DrawClone(Option_t *opt) const
 {
@@ -499,4 +501,5 @@
     return c;
 }
+*/
 
 // --------------------------------------------------------------------------
@@ -517,11 +520,16 @@
 void MH3::Draw(Option_t *opt)
 {
-    if (!gPad)
-        MH::MakeDefCanvas(fHist);
+    TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(fHist);
+    pad->SetBorderMode(0);
+
+    AppendPad("");
 
     TString str(opt);
 
+    // FIXME: Do it in Paint()
     if (str.Contains("COL", TString::kIgnoreCase))
         SetColors();
+
+    fHist->SetFillStyle(4000);
 
     Bool_t only = str.Contains("ONLY", TString::kIgnoreCase) && fDimension==2;
@@ -546,10 +554,10 @@
     }
 
-    if (fHist->TestBit(kIsLogx)) gPad->SetLogx();
-    if (fHist->TestBit(kIsLogy)) gPad->SetLogy();
-    if (fHist->TestBit(kIsLogz)) gPad->SetLogz();
-
-    gPad->Modified();
-    gPad->Update();
+    if (fHist->TestBit(kIsLogx)) pad->SetLogx();
+    if (fHist->TestBit(kIsLogy)) pad->SetLogy();
+    if (fHist->TestBit(kIsLogz)) pad->SetLogz();
+
+    pad->Modified();
+    pad->Update();
 }
 
Index: trunk/MagicSoft/Mars/mhist/MHCerPhotEvt.cc
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHCerPhotEvt.cc	(revision 1965)
+++ trunk/MagicSoft/Mars/mhist/MHCerPhotEvt.cc	(revision 1966)
@@ -165,23 +165,5 @@
     pad->SetBorderMode(0);
 
-    //
-    // All this is necessary to get the background in the correct color
-    //
-    pad->Divide(1,1);
-    pad->cd(1);
-
-    gPad->SetBorderMode(0);
-    gPad->SetFillColor(gPad->GetFillColor());
-
-    //
-    // set the color palette for the TBox elements
-    //
     AppendPad("");
-
-    //
-    // Necessary to visualize the background color (FIXME?)
-    //
-    gPad->Modified();
-    gPad->Update();
 }
 
Index: trunk/MagicSoft/Mars/mhist/MHMcIntRate.cc
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHMcIntRate.cc	(revision 1965)
+++ trunk/MagicSoft/Mars/mhist/MHMcIntRate.cc	(revision 1966)
@@ -81,12 +81,4 @@
 }
 
-//-------------------------------------------------------------------------
-//
-//  Defualt Destructor
-//
-MHMcIntRate::~MHMcIntRate()
-{
-}
-
 // ------------------------------------------------------------------------
 // 
@@ -95,32 +87,15 @@
 void MHMcIntRate::Draw(Option_t *option)
 {
-    if (!gPad)
-        MH::MakeDefCanvas(&fHist);
+    TVirtualPad *pad = gPad ? gPad : MH::MakeDefCanvas(this);
+    pad->SetBorderMode(0);
 
-    gPad->SetLogx();
+    AppendPad("");
+
+    pad->SetLogx();
 
     fHist.Draw(option);
 
-    gPad->Modified();
-    gPad->Update();
-}
-
-TObject *MHMcIntRate::DrawClone(Option_t *option) const
-{
-    TCanvas *c = MH::MakeDefCanvas(&fHist);
-
-    c->SetLogx();
-
-    //
-    // This is necessary to get the expected bahviour of DrawClone
-    //
-    gROOT->SetSelectedPad(NULL);
-
-    ((TH1D&)fHist).DrawCopy(option);
-
-    c->Modified();
-    c->Update();
-
-    return c;
+    pad->Modified();
+    pad->Update();
 }
 
Index: trunk/MagicSoft/Mars/mhist/MHMcIntRate.h
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHMcIntRate.h	(revision 1965)
+++ trunk/MagicSoft/Mars/mhist/MHMcIntRate.h	(revision 1966)
@@ -21,5 +21,4 @@
 public:
     MHMcIntRate(const char *name=NULL, const char *title=NULL);
-    ~MHMcIntRate();
 
     void SetName(const char *name);
@@ -32,5 +31,4 @@
 
     void Draw(Option_t* option = "");
-    TObject *DrawClone(Option_t* option = "") const;
 
     void Calc(const MHMcDifRate &rate);
Index: trunk/MagicSoft/Mars/mhist/MHRanForest.cc
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHRanForest.cc	(revision 1965)
+++ trunk/MagicSoft/Mars/mhist/MHRanForest.cc	(revision 1966)
@@ -67,4 +67,5 @@
     fGraphSigma->SetTitle("Evolution of Standard deviation of estimated hadronness in tree combination");
     fGraphSigma->SetMaximum(1);
+    fGraphSigma->SetMarkerStyle(kFullDotSmall);
 }
 
@@ -157,36 +158,4 @@
 // --------------------------------------------------------------------------
 //
-// Draw clone of histogram
-//
-TObject *MHRanForest::DrawClone(Option_t *opt) const
-{
-    if (fGraphSigma->GetN()==0)
-        return NULL;
-
-    TCanvas &c = *MakeDefCanvas("RanForest", fTitle);
-    gROOT->SetSelectedPad(NULL);
-
-    //gStyle->SetOptStat(10);
-    TGraph &g = (TGraph&)*fGraphSigma->DrawClone("AL");
-    g.SetBit(kCanDelete);
-    gPad->Modified();
-    gPad->Update();
-    if (g.GetHistogram())
-    {
-        g.GetXaxis()->SetRangeUser(0, fNumEvent);
-        g.GetXaxis()->SetTitle("Number of Trees");
-        g.GetYaxis()->SetTitle("Standard deviation of estimated hadronness");
-        g.SetMarkerStyle(kFullDotMedium);
-        gPad->Modified();
-        gPad->Update();
-        //g.Draw("P");
-    }
-    gPad->SetGrid();
-
-    return &c;
-}
-
-// --------------------------------------------------------------------------
-//
 // Draw histogram. (For the Meaning see class description)
 //
@@ -196,21 +165,22 @@
         return;
 
-   if (!gPad)
-        MakeDefCanvas("RanForest", fTitle);
+    TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(this);
+    pad->SetBorderMode(0);
 
-    //gStyle->SetOptStat(10);
+    AppendPad("");
+
     fGraphSigma->Draw("ALP");
-    gPad->Modified();
-    gPad->Update();
-    if (fGraphSigma->GetHistogram())
-    {
-        fGraphSigma->GetXaxis()->SetRangeUser(0, 1);
-        fGraphSigma->GetXaxis()->SetTitle("Number of Trees");
-        fGraphSigma->GetYaxis()->SetTitle("Standard deviation of estimated hadronness");
+    pad->Modified();
+    pad->Update();
 
-        fGraphSigma->SetMarkerStyle(kFullDotSmall);
-        //fGraphSigma->Draw("P");
-        gPad->Modified();
-        gPad->Update();
-    }    
+    TH1 *h=fGraphSigma->GetHistogram();
+    if (!h)
+        return;
+
+    h->GetXaxis()->SetRangeUser(0, 1);
+    h->SetXTitle("No.of Trees");
+    h->SetYTitle("\\sigma of est.hadronness");
+
+    pad->Modified();
+    pad->Update();
 }
Index: trunk/MagicSoft/Mars/mhist/MHRanForest.h
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHRanForest.h	(revision 1965)
+++ trunk/MagicSoft/Mars/mhist/MHRanForest.h	(revision 1966)
@@ -37,5 +37,4 @@
 
     void Draw(Option_t *opt="");
-    TObject *DrawClone(Option_t *opt="") const;
 
     ClassDef(MHRanForest, 1) // Histogram showing variance of estimated Hadronness
Index: trunk/MagicSoft/Mars/mhist/MHRanForestGini.cc
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHRanForestGini.cc	(revision 1965)
+++ trunk/MagicSoft/Mars/mhist/MHRanForestGini.cc	(revision 1966)
@@ -65,4 +65,5 @@
     fGraphGini->SetTitle("Importance of RF-input parameters measured by mean Gini decrease");
     fGraphGini->SetMaximum(1);
+    fGraphGini->SetMarkerStyle(kFullDotSmall);
 }
 
@@ -140,60 +141,29 @@
 // --------------------------------------------------------------------------
 //
-// Draw clone of histogram (For the Meaning see class description)
-//
-TObject *MHRanForestGini::DrawClone(Option_t *opt) const
-{
-    if (fGraphGini->GetN()==0)
-        return NULL;
-
-    TCanvas &c = *MakeDefCanvas("RanForestGini", fTitle);
-    gROOT->SetSelectedPad(NULL);
-
-    //gStyle->SetOptStat(10);
-    TGraph &g = (TGraph&)*fGraphGini->DrawClone("AL");
-    g.SetBit(kCanDelete);
-    gPad->Modified();
-    gPad->Update();
-    if (g.GetHistogram())
-    {
-        g.GetXaxis()->SetRangeUser(0, fRanForest->GetNumTrees());
-        g.GetXaxis()->SetTitle("No. of RF-input parameter");
-        g.GetYaxis()->SetTitle("Mean decrease in Gini-index [a.u.]");
-        g.SetMarkerStyle(kFullDotMedium);
-        //g.Draw("P");
-        gPad->Modified();
-        gPad->Update();
-    }
-    gPad->SetGrid();
-
-    return &c;
-}
-
-// --------------------------------------------------------------------------
-//
 // Draw histogram. (For the Meaning see class description)
 //
 void MHRanForestGini::Draw(Option_t *)
 {
-   if (fGraphGini->GetN()==0)
+    if (fGraphGini->GetN()==0)
         return;
 
-   if (!gPad)
-        MakeDefCanvas("RanForest", fTitle);
+    TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(this);
+    pad->SetBorderMode(0);
 
-    //gStyle->SetOptStat(10);
+    AppendPad("");
+
     fGraphGini->Draw("ALP");
-    gPad->Modified();
-    gPad->Update();
-    if (fGraphGini->GetHistogram())
-    {
-        fGraphGini->GetXaxis()->SetRangeUser(0, 1);
-        fGraphGini->GetXaxis()->SetTitle("No. of RF-input parameter");
-        fGraphGini->GetYaxis()->SetTitle("Mean decrease in Gini-index [a.u.]");
+    pad->Modified();
+    pad->Update();
 
-        fGraphGini->SetMarkerStyle(kFullDotSmall);
-        //fGraphGini->Draw("P");
-        gPad->Modified();
-        gPad->Update();
-    }
+    TH1 *h = fGraphGini->GetHistogram();
+    if (!h)
+        return;
+
+    h->GetXaxis()->SetRangeUser(0, 1);
+    h->SetXTitle("No.of RF-input parameter");
+    h->SetYTitle("Mean decrease in Gini-index [a.u.]");
+
+    pad->Modified();
+    pad->Update();
 }
Index: trunk/MagicSoft/Mars/mhist/MHRanForestGini.h
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHRanForestGini.h	(revision 1965)
+++ trunk/MagicSoft/Mars/mhist/MHRanForestGini.h	(revision 1966)
@@ -35,5 +35,4 @@
 
     void Draw(Option_t *opt="");
-    TObject *DrawClone(Option_t *opt="") const;
 
     ClassDef(MHRanForestGini, 1)
Index: trunk/MagicSoft/Mars/mhist/MHSigmaPixel.cc
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHSigmaPixel.cc	(revision 1965)
+++ trunk/MagicSoft/Mars/mhist/MHSigmaPixel.cc	(revision 1966)
@@ -124,29 +124,13 @@
 void MHSigmaPixel::Draw(Option_t *opt)
 {
-  //gStyle->SetOptStat(1000);
-  if (!gPad)
-    MakeDefCanvas("SigmaPixel", fTitle);
-  
-  fHist.Draw(opt);
-  
-  gPad->Modified();
-  gPad->Update();
+    TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(this);
+    pad->SetBorderMode(0);
+
+    AppendPad("");
+
+    fHist.Draw(opt);
+
+    gPad->Modified();
+    gPad->Update();
 }
 
-// --------------------------------------------------------------------------
-//
-// Draw copies of the histogram
-// 
-TObject *MHSigmaPixel::DrawClone(Option_t *opt) const
-{
-  //gStyle->SetOptStat(1000);
-  TCanvas &c = *MakeDefCanvas("SigmaPixel", fTitle);
-  
-  ((TH2&)fHist).DrawCopy(opt);
-  
-  c.Modified();
-  c.Update();
-  
-  return &c;
-}
-
Index: trunk/MagicSoft/Mars/mhist/MHSigmaPixel.h
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHSigmaPixel.h	(revision 1965)
+++ trunk/MagicSoft/Mars/mhist/MHSigmaPixel.h	(revision 1966)
@@ -35,5 +35,4 @@
 
     void Draw(Option_t *option="");
-    TObject *DrawClone(Option_t *option="") const;
 
     ClassDef(MHSigmaPixel, 1) //2D-histogram in Sigma and Pixel number
Index: trunk/MagicSoft/Mars/mhist/MHSigmaTheta.cc
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHSigmaTheta.cc	(revision 1965)
+++ trunk/MagicSoft/Mars/mhist/MHSigmaTheta.cc	(revision 1966)
@@ -249,149 +249,84 @@
 TObject *MHSigmaTheta::DrawClone(Option_t *opt) 
 {
-    TCanvas &c = *MakeDefCanvas("SigmaThetaPlot", "Sigmabar vs. Theta",
-                                 900, 900);
-    c.Divide(3, 3);
-
-    gROOT->SetSelectedPad(NULL);
-
-    //--------------------------------------------------------------------
+    return MH::DrawClone(opt, 900, 900);
+}
+
+// --------------------------------------------------------------------------
+//
+// Draw the histogram
+//
+void MHSigmaTheta::Draw(Option_t *opt)
+{
+    TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(this, 900, 900);
+    pad->SetBorderMode(0);
+
+    AppendPad("");
+
+    pad->Divide(3, 3);
+
     // draw the 2D histogram Sigmabar versus Theta
-    TH1D *h;
-
-    c.cd(1);
-    h = ((TH2*)&fSigmaTheta)->ProjectionX("ProjX-Theta", -1, 9999, "E");
+    TH1 *h;
+
+    pad->cd(1);
+    gPad->SetLogy();
+    h = fSigmaTheta.ProjectionX("ProjX-Theta", -1, 9999, "E");
     h->SetDirectory(NULL);
     h->SetTitle("Distribution of \\Theta");
     h->SetXTitle("\\Theta [\\circ]");
     h->SetYTitle("No.of events");
-
-    h->DrawCopy(opt);
-    h->SetBit(kCanDelete);;
-    gPad->SetLogy();
-
-    c.cd(4);
-    h = ((TH2*)&fSigmaTheta)->ProjectionY("ProjY-sigma", -1, 9999, "E");
-    h->SetDirectory(NULL);
-    h->SetTitle("Distribution of Sigmabar");
-    h->SetXTitle("Sigmabar");
+    h->Draw("box");
+    h->SetBit(kCanDelete);
+
+    pad->cd(2);
+    h = fDiffPixTheta.Project3D("zx");
+    h->SetDirectory(NULL);
+    h->SetTitle("\\sigma_{ped}^{2}-\\bar{\\sigma}_{ped}^{2} vs. \\Theta (all pixels)");
+    h->SetXTitle("\\Theta [\\circ]");
+    h->SetYTitle("\\sigma_{ped}^2-\\bar{\\sigma}_{ped}^{2}");
+    h->SetBit(kCanDelete);
+
+    pad->cd(3);
+    h = fSigmaPixTheta.Project3D("zx");
+    h->SetDirectory(NULL);
+    h->SetTitle("\\sigma_{ped} vs. \\Theta (all pixels)");
+    h->SetXTitle("\\Theta [\\circ]");
+    h->SetYTitle("\\sigma_{ped}");
+    h->Draw("box");
+    h->SetBit(kCanDelete);
+
+    pad->cd(4);
+    h = fSigmaTheta.ProjectionY("ProjY-sigma", -1, 9999, "E");
+    h->SetDirectory(NULL);
+    h->SetTitle("Distribution of \\bar{\\sigma}_{ped}");
+    h->SetXTitle("\\bar{\\sigma}_{ped}");
     h->SetYTitle("No.of events");
-
-    h->DrawCopy(opt);
-    h->SetBit(kCanDelete);;
-
-    c.cd(7);
-    ((TH2*)&fSigmaTheta)->DrawCopy(opt);
-
-    //--------------------------------------------------------------------
-    // draw the 3D histogram : Theta, pixel, Sigma^2-Sigmabar^2
-
-    TH2D *l;
-
-    c.cd(2);
-    l = (TH2D*) ((TH3*)&fDiffPixTheta)->Project3D("zx");
-    l->SetDirectory(NULL);
-    l->SetTitle("Sigma^2-Sigmabar^2 vs. \\Theta (all pixels)");
-    l->SetXTitle("\\Theta [\\circ]");
-    l->SetYTitle("Sigma^2-Sigmabar^2");
-
-    l->DrawCopy("box");
-    l->SetBit(kCanDelete);;
-
-    c.cd(5);
-    l = (TH2D*) ((TH3*)&fDiffPixTheta)->Project3D("zy");
-    l->SetDirectory(NULL);
-    l->SetTitle("Sigma^2-Sigmabar^2 vs. pixel number (all \\Theta)");
-    l->SetXTitle("pixel");
-    l->SetYTitle("Sigma^2-Sigmabar^2");
-
-    l->DrawCopy("box");
-    l->SetBit(kCanDelete);;
-
-    //c.cd(8);
-    //((TH2*)&fDiffPixTheta)->DrawCopy(opt);
-
-    c.cd(8);
-    ((TH1*)&fBlindId)->DrawCopy(opt);
-
-
-    //--------------------------------------------------------------------
-    // draw the 3D histogram : Theta, pixel, Sigma
-
-    TH2D *k;
-
-    c.cd(3);
-    k = (TH2D*) ((TH3*)&fSigmaPixTheta)->Project3D("zx");
-    k->SetDirectory(NULL);
-    k->SetTitle("Sigma vs. \\Theta (all pixels)");
-    k->SetXTitle("\\Theta [\\circ]");
-    k->SetYTitle("Sigma");
-
-    k->DrawCopy("box");
-    k->SetBit(kCanDelete);;
-
-    c.cd(6);
-    k = (TH2D*) ((TH3*)&fSigmaPixTheta)->Project3D("zy");
-    k->SetDirectory(NULL);
-    k->SetTitle("Sigma vs. pixel number (all \\Theta)");
-    k->SetXTitle("pixel");
-    k->SetYTitle("Sigma");
-
-    k->DrawCopy("box");
-    k->SetBit(kCanDelete);;
-
-    //c.cd(9);
-    //((TH2*)&fSigmaPixTheta)->DrawCopy(opt);
-
-    c.cd(9);
-    ((TH1*)&fNpix)->DrawCopy(opt);
-
-    //--------------------------------------------------------------------
-    c.Modified();
-    c.Update();
-
-    return &c;
-}
-
-// --------------------------------------------------------------------------
-//
-// Draw the histogram
-//
-void MHSigmaTheta::Draw(Option_t *opt)
-{
-    if (!gPad)
-        MakeDefCanvas("SigmaTheta", "Sigmabar vs. Theta", 600, 600);
-
-    TH1D *h;
-
-    gPad->Divide(2,2);
-
-    gPad->cd(1);
-    h = ((TH2*)&fSigmaTheta)->ProjectionX("ProjX-Theta", -1, 9999, "E");
-    h->SetTitle("Distribution of \\Theta");
-    h->SetXTitle("\\Theta [\\circ]");
-    h->SetYTitle("No.of events");
-
     h->Draw(opt);
-    h->SetBit(kCanDelete);;
-    gPad->SetLogy();
-
-    gPad->cd(2);
-    h = ((TH2*)&fSigmaTheta)->ProjectionY("ProjY-sigma", -1, 9999, "E");
-    h->SetTitle("Distribution of Sigmabar");
-    h->SetXTitle("Sigmabar");
-    h->SetYTitle("No.of events");
-
-    h->Draw(opt);
-    h->SetBit(kCanDelete);;
-
-    gPad->cd(3);
-    fSigmaTheta.DrawCopy(opt);
-
-    gPad->Modified();
-    gPad->Update();
-}
-// --------------------------------------------------------------------------
-
-
-
-
+    h->SetBit(kCanDelete);
+
+    pad->cd(5);
+    h = fDiffPixTheta.Project3D("zy");
+    h->SetDirectory(NULL);
+    h->SetTitle("\\sigma_{ped}^{2}-\\bar{\\sigma}_{ped}^{2} vs. pixel Id (all \\Theta)");
+    h->SetXTitle("Id");
+    h->SetYTitle("\\sigma_{ped}^{2}-\\bar{\\sigma}_{ped}^{2}");
+    h->Draw("box");
+    h->SetBit(kCanDelete);
+
+    pad->cd(6);
+    h = fSigmaPixTheta.Project3D("zy");
+    h->SetDirectory(NULL);
+    h->SetTitle("\\sigma_{ped} vs. pixel Id (all \\Theta)");
+    h->SetXTitle("Id");
+    h->SetYTitle("\\sigma_{ped}");
+    h->Draw("box");
+    h->SetBit(kCanDelete);
+
+    pad->cd(7);
+    fSigmaTheta.Draw(opt);
+
+    pad->cd(8);
+    fDiffPixTheta.Draw(opt);
+
+    pad->cd(9);
+    fSigmaPixTheta.Draw(opt);
+}
Index: trunk/MagicSoft/Mars/mhist/MHSigmabarTheta.cc
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHSigmabarTheta.cc	(revision 1965)
+++ trunk/MagicSoft/Mars/mhist/MHSigmabarTheta.cc	(revision 1966)
@@ -63,5 +63,5 @@
     fHist.SetTitle("3D-plot of sigmabar and theta");
     fHist.SetXTitle("\\theta [\\circ]");
-    fHist.SetYTitle("\\overline{\\sigma}");
+    fHist.SetYTitle("\\bar{\\sigma}");
     fHist.SetZTitle("N");
 }
@@ -123,27 +123,13 @@
 void MHSigmabarTheta::Draw(Option_t *opt)
 {
-    if (!gPad)
-        MakeDefCanvas("SigmabarTheta", fTitle);
-   
+    TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(this);
+    pad->SetBorderMode(0);
+
+    AppendPad("");
+
     fHist.Draw(opt);
     
-    gPad->Modified();
-    gPad->Update();
+    pad->Modified();
+    pad->Update();
 }
 
-// --------------------------------------------------------------------------
-//
-// Draw copies of the histogram
-// 
-TObject *MHSigmabarTheta::DrawClone(Option_t *opt) const
-{
-    TCanvas &c = *MakeDefCanvas("SigmabarTheta", fTitle);
-    
-    ((TH2&)fHist).DrawCopy(opt);
-
-    c.Modified();
-    c.Update();
-
-    return &c;
-}
-
Index: trunk/MagicSoft/Mars/mhist/MHSigmabarTheta.h
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHSigmabarTheta.h	(revision 1965)
+++ trunk/MagicSoft/Mars/mhist/MHSigmabarTheta.h	(revision 1966)
@@ -36,5 +36,4 @@
 
     void Draw(Option_t *option="");
-    TObject *DrawClone(Option_t *option="") const;
 
     ClassDef(MHSigmabarTheta, 1) //3D-histogram in alpha, Energy and theta
Index: trunk/MagicSoft/Mars/mhist/MHThetabarTheta.cc
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHThetabarTheta.cc	(revision 1965)
+++ trunk/MagicSoft/Mars/mhist/MHThetabarTheta.cc	(revision 1966)
@@ -61,5 +61,5 @@
 
     fHist.SetXTitle("\\Theta [\\circ]");
-    fHist.SetYTitle("Theta-bar [ \\circ]");
+    fHist.SetYTitle("\\bar{\\Theta} [ \\circ]");
 }
 
@@ -91,33 +91,17 @@
 // --------------------------------------------------------------------------
 //
-// Draw a copy of the histogram
-//
-TObject *MHThetabarTheta::DrawClone(Option_t *opt) const
-{
-    TCanvas &c = *MakeDefCanvas("ThetabarTheta", "Thetabar vs. Theta");
-
-    gROOT->SetSelectedPad(NULL);
-
-    ((TProfile)fHist).DrawCopy(opt);
-
-    c.Modified();
-    c.Update();
-
-    return &c;
-}
-
-// --------------------------------------------------------------------------
-//
 // Draw the histogram
 //
 void MHThetabarTheta::Draw(Option_t *opt)
 {
-    if (!gPad)
-        MakeDefCanvas("ThetabarTheta", "Thetabar vs. Theta");
+    TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(this);
+    pad->SetBorderMode(0);
 
-    fHist.DrawCopy(opt);
+    AppendPad("");
 
-    gPad->Modified();
-    gPad->Update();
+    fHist.Draw(opt);
+
+    pad->Modified();
+    pad->Update();
 }
 
Index: trunk/MagicSoft/Mars/mhist/MHThetabarTheta.h
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHThetabarTheta.h	(revision 1965)
+++ trunk/MagicSoft/Mars/mhist/MHThetabarTheta.h	(revision 1966)
@@ -34,5 +34,4 @@
 
     void Draw(Option_t *option="");
-    TObject *DrawClone(Option_t *option="") const;
 
     ClassDef(MHThetabarTheta, 0) //Profile histogram Thetabar vs. time
Index: trunk/MagicSoft/Mars/mhist/MHThetabarTime.cc
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHThetabarTime.cc	(revision 1965)
+++ trunk/MagicSoft/Mars/mhist/MHThetabarTime.cc	(revision 1966)
@@ -63,5 +63,5 @@
 
     fHist.SetXTitle("time [s]");
-    fHist.SetYTitle("Theta-bar [ \\circ]");
+    fHist.SetYTitle("\\bar{\\Theta} [ \\circ]");
 }
 
@@ -100,33 +100,17 @@
 // --------------------------------------------------------------------------
 //
-// Draw a copy of the histogram
-//
-TObject *MHThetabarTime::DrawClone(Option_t *opt) const
-{
-    TCanvas &c = *MakeDefCanvas("ThetabarTime", "Thetabar vs. time");
-
-    gROOT->SetSelectedPad(NULL);
-
-    ((TProfile*)&fHist)->DrawCopy(opt);
-
-    c.Modified();
-    c.Update();
-
-    return &c;
-}
-
-// --------------------------------------------------------------------------
-//
 // Draw the histogram
 //
 void MHThetabarTime::Draw(Option_t *opt)
 {
-    if (!gPad)
-        MakeDefCanvas("ThetabarTime", "Thetabar vs. time");
+    TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(this);
+    pad->SetBorderMode(0);
 
-    fHist.DrawCopy(opt);
+    AppendPad("");
 
-    gPad->Modified();
-    gPad->Update();
+    fHist.Draw(opt);
+
+    pad->Modified();
+    pad->Update();
 }
 
Index: trunk/MagicSoft/Mars/mhist/MHThetabarTime.h
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHThetabarTime.h	(revision 1965)
+++ trunk/MagicSoft/Mars/mhist/MHThetabarTime.h	(revision 1966)
@@ -37,5 +37,4 @@
 
     void Draw(Option_t *option="");
-    TObject *DrawClone(Option_t *option="") const;
 
     ClassDef(MHThetabarTime, 0) //Profile histogram Thetabar vs. time
Index: trunk/MagicSoft/Mars/mhist/MHTimeDiffTheta.cc
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHTimeDiffTheta.cc	(revision 1965)
+++ trunk/MagicSoft/Mars/mhist/MHTimeDiffTheta.cc	(revision 1966)
@@ -102,89 +102,39 @@
 // --------------------------------------------------------------------------
 //
-// Draw a copy of the histogram
-//
-TObject *MHTimeDiffTheta::DrawClone(Option_t *opt) const
-{
-    TCanvas &c = *MakeDefCanvas("DiffTimeTheta", "Distrib of \\Delta t, Theta");
-
-    c.Divide(2, 2);
-
-    gROOT->SetSelectedPad(NULL);
-
-    //
-    // FIXME: ProjectionX,Y is not const within root
-    //
-
-    TH1D *h;
-
-    c.cd(1);
-    h = ((TH2*)&fHist)->ProjectionX("ProjX-Theta", -1, 9999, "E");
-
-    h->SetTitle("Distribution of \\Delta t [s]");
-    h->SetXTitle("\\Delta t [s]");
-    h->SetYTitle("Counts");
-
-    h->Draw(opt);
-    h->SetBit(kCanDelete);;
-    gPad->SetLogy();
-
-    c.cd(2);
-    h = ((TH2*)&fHist)->ProjectionY("ProjY-timediff", -1, 9999, "E");
-
-    h->SetTitle("Distribution of \\Theta [\\circ]");
-    h->SetXTitle("\\Theta [\\circ]");
-    h->SetYTitle("Counts");
-
-    h->Draw(opt);
-    h->SetBit(kCanDelete);;
-
-    c.cd(3);
-    ((TH2*)&fHist)->DrawCopy(opt);
-
-    c.Modified();
-    c.Update();
-
-    return &c;
-}
-
-// --------------------------------------------------------------------------
-//
 // Draw the histogram
 //
 void MHTimeDiffTheta::Draw(Option_t *opt)
 {
-    if (!gPad)
-        MakeDefCanvas("DiffTimeTheta", "Distrib of Delta t, Theta");
+    TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(this);
+    pad->SetBorderMode(0);
 
-    TH1D *h;
+    AppendPad("");
 
-    gPad->Divide(2,2);
+    TH1 *h;
 
-    gPad->cd(1);
+    pad->Divide(2,2);
+
+    pad->cd(1);
+    gPad->SetLogy();
     h = fHist.ProjectionX("ProjX_Theta", -1, 9999, "E");
-
     h->SetTitle("Distribution of \\Delta t [s]");
     h->SetXTitle("\\Delta t [s]");
     h->SetYTitle("Counts");
-
     h->Draw(opt);
     h->SetBit(kCanDelete);;
-    gPad->SetLogy();
 
-    gPad->cd(2);
+    pad->cd(2);
     h = fHist.ProjectionY("ProjY_timediff", -1, 9999, "E");
-
     h->SetTitle("Distribution of \\Theta [\\circ]");
     h->SetXTitle("\\Theta [\\circ]");
     h->SetYTitle("Counts");
-
     h->Draw(opt);
     h->SetBit(kCanDelete);;
 
-    gPad->cd(3);
-    fHist.DrawCopy(opt);
+    pad->cd(3);
+    fHist.Draw(opt);
 
-    gPad->Modified();
-    gPad->Update();
+    pad->Modified();
+    pad->Update();
 }
 
Index: trunk/MagicSoft/Mars/mhist/MHTimeDiffTheta.h
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHTimeDiffTheta.h	(revision 1965)
+++ trunk/MagicSoft/Mars/mhist/MHTimeDiffTheta.h	(revision 1966)
@@ -35,5 +35,4 @@
 
     void Draw(Option_t *option="");
-    TObject *DrawClone(Option_t *option="") const;
 
     ClassDef(MHTimeDiffTheta, 0) //2D-histogram  time-diff vs. Theta
Index: trunk/MagicSoft/Mars/mhist/MHTimeDiffTime.cc
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHTimeDiffTime.cc	(revision 1965)
+++ trunk/MagicSoft/Mars/mhist/MHTimeDiffTime.cc	(revision 1966)
@@ -95,87 +95,39 @@
 // --------------------------------------------------------------------------
 //
-// Draw a copy of the histogram
-//
-TObject *MHTimeDiffTime::DrawClone(Option_t *opt) const
-{
-
-    TCanvas &c = *MakeDefCanvas("DiffTimeTime", "Distrib of dt and t");
-
-    c.Divide(2, 2);
-
-    gROOT->SetSelectedPad(NULL);
-
-    TH1D *h;
-
-    c.cd(1);
-    h = ((TH2*)&fHist)->ProjectionX("ProjX-sumtime", -1, 9999, "E");
-
-    h->SetTitle("Distribution of \\Delta t [s]");
-    h->SetXTitle("\\Delta t [s]");
-    h->SetYTitle("Counts");
-
-    h->Draw(opt);
-    h->SetBit(kCanDelete);
-    gPad->SetLogy();
-
-    c.cd(2);
-    h = ((TH2*)&fHist)->ProjectionY("ProjY-sumtimediff", -1, 9999, "E");
-
-    h->SetTitle("Distribution of time [s]");
-    h->SetXTitle("time [s]");
-    h->SetYTitle("Counts");
-
-    h->Draw(opt);
-    h->SetBit(kCanDelete);
-
-    c.cd(3);
-    ((TH2*)&fHist)->DrawCopy(opt);
-
-    c.Modified();
-    c.Update();
-
-    return &c;
-}
-
-// --------------------------------------------------------------------------
-//
 // Draw the histogram
 //
 void MHTimeDiffTime::Draw(Option_t *opt)
 {
-    if (!gPad)
-        MakeDefCanvas("DiffTimeTime", "Distrib of \\Delta t, time");
+    TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(this);
+    pad->SetBorderMode(0);
 
-    gPad->Divide(2,2);
+    AppendPad("");
+
+    pad->Divide(2,2);
 
     TH1D *h;
 
-    gPad->cd(1);
+    pad->cd(1);
+    gPad->SetLogy();
     h = fHist.ProjectionX("ProjX_sumtime", -1, 9999, "E");
-
     h->SetTitle("Distribution of \\Delta t [s]");
     h->SetXTitle("\\Delta t [s]");
     h->SetYTitle("Counts");
-
     h->Draw(opt);
     h->SetBit(kCanDelete);
-    gPad->SetLogy();
 
-    gPad->cd(2);
+    pad->cd(2);
     h = fHist.ProjectionY("ProjY_sumtimediff", -1, 9999, "E");
-
     h->SetTitle("Distribution of time [s]");
     h->SetXTitle("time [s]");
     h->SetYTitle("Counts");
-
     h->Draw(opt);
     h->SetBit(kCanDelete);
 
-    gPad->cd(3);
+    pad->cd(3);
     fHist.DrawCopy(opt);
 
-    gPad->Modified();
-    gPad->Update();
-
+    pad->Modified();
+    pad->Update();
 }
 
Index: trunk/MagicSoft/Mars/mhist/MHTimeDiffTime.h
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHTimeDiffTime.h	(revision 1965)
+++ trunk/MagicSoft/Mars/mhist/MHTimeDiffTime.h	(revision 1966)
@@ -33,5 +33,4 @@
 
     void Draw(Option_t *option="");
-    TObject *DrawClone(Option_t *option="") const;
 
     ClassDef(MHTimeDiffTime, 0) //2D-histogram  time-diff vs. time
Index: trunk/MagicSoft/Mars/mimage/MHNewImagePar.cc
===================================================================
--- trunk/MagicSoft/Mars/mimage/MHNewImagePar.cc	(revision 1965)
+++ trunk/MagicSoft/Mars/mimage/MHNewImagePar.cc	(revision 1966)
@@ -55,18 +55,18 @@
 //
 MHNewImagePar::MHNewImagePar(const char *name, const char *title)
-    : fUseMmScale(kTRUE)
 {
     fName  = name  ? name  : "MHNewImagePar";
-    fTitle = title ? title : "Container for histograms of new image parameters";
+    fTitle = title ? title : "Histograms of new image parameters";
 
-    fLeakage1 = new TH1F("Leakage1", "Leakage1", 100, 0.0, 1.0);
+    fLeakage1 = new TH1F("Leakage1", "Leakage_{1}", 100, 0.0, 1.0);
     fLeakage1->SetDirectory(NULL);
-    fLeakage1->SetXTitle("Leakage1");
+    fLeakage1->SetXTitle("Leakage");
     fLeakage1->SetYTitle("Counts");
 
-    fLeakage2 = new TH1F("Leakage2", "Leakage2", 100, 0.0, 1.0);
+    fLeakage2 = new TH1F("Leakage2", "Leakage_{2}", 100, 0.0, 1.0);
     fLeakage2->SetDirectory(NULL);
-    fLeakage2->SetXTitle("Leakage2");
+    fLeakage2->SetXTitle("Leakage");
     fLeakage2->SetYTitle("Counts");
+    fLeakage2->SetLineColor(kBlue);
 }
 
@@ -79,32 +79,4 @@
     delete fLeakage1;
     delete fLeakage2;
-}
-
-// --------------------------------------------------------------------------
-//
-// Setup the Binning for the histograms automatically if the correct
-// instances of MBinning (with the names 'BinningAlpha' and 'BinningDist')
-// are found in the parameter list
-// Use this function if you want to set the conversion factor which
-// is used to convert the mm-scale in the camera plain into the deg-scale
-// used for histogram presentations. The conversion factor is part of
-// the camera geometry. Please create a corresponding MGeomCam container.
-//
-Bool_t MHNewImagePar::SetupFill(const MParList *plist)
-{
-    const MGeomCam *geom = (MGeomCam*)plist->FindObject("MGeomCam");
-    if (!geom)
-        *fLog << warn << dbginf << "No Camera Geometry available. Using mm-scale for histograms." << endl;
-    else
-    {
-        fMm2Deg = geom->GetConvMm2Deg();
-        SetMmScale(kFALSE);
-    }
-
-    //ApplyBinning(*plist, "Alpha",    fAlpha);
-    //ApplyBinning(*plist, "Dist",     fDist);
-    //ApplyBinning(*plist, "HeadTail", fHeadTail);
-
-    return kTRUE;
 }
 
@@ -125,72 +97,4 @@
 // --------------------------------------------------------------------------
 //
-// Use this function to setup your own conversion factor between degrees
-// and millimeters. The conversion factor should be the one calculated in
-// MGeomCam. Use this function with Caution: You could create wrong values
-// by setting up your own scale factor.
-//
-void MHNewImagePar::SetMm2Deg(Float_t mmdeg)
-{
-    if (mmdeg<=0)
-    {
-        *fLog << warn << dbginf << "Warning - Conversion factor <= 0 - nonsense. Ignored." << endl;
-        return;
-    }
-
-    if (fMm2Deg>0)
-        *fLog << warn << dbginf << "Warning - Conversion factor already set. Overwriting" << endl;
-
-    fMm2Deg = mmdeg;
-}
-
-// --------------------------------------------------------------------------
-//
-// With this function you can convert the histogram ('on the fly') between
-// degrees and millimeters.
-//
-void MHNewImagePar::SetMmScale(Bool_t mmscale)
-{
-    if (fUseMmScale == mmscale)
-        return;
-
-    if (fMm2Deg<0)
-    {
-        *fLog << warn << GetDescriptor() << ": Warning - Sorry, no conversion factor for conversion available." << endl;
-        return;
-    }
-
-    //const Double_t scale = mmscale ? 1./fMm2Deg : fMm2Deg;
-    //MH::ScaleAxis(fDist,     scale);
-    //MH::ScaleAxis(fHeadTail, scale);
-
-    if (mmscale)
-    {
-      //    fDist->SetXTitle("Dist [mm]");
-      //    fHeadTail->SetXTitle("Head-Tail [mm]");
-    }
-    else
-    {
-      //    fDist->SetXTitle("Dist [\\circ]");
-      //    fHeadTail->SetXTitle("Head-Tail [\\circ]");
-    }
-
-    fUseMmScale = mmscale;
-}
-
-// --------------------------------------------------------------------------
-//
-// Draw clones of all two histograms. So that the object can be deleted
-// and the histograms are still visible in the canvas.
-// The cloned object are deleted together with the canvas if the canvas is
-// destroyed. If you want to handle dostroying the canvas you can get a
-// pointer to it from this function
-//
-TObject *MHNewImagePar::DrawClone(Option_t *opt) const
-{
-    return MH::DrawClone(opt, 300, 600);
-}
-
-// --------------------------------------------------------------------------
-//
 // Creates a new canvas and draws the two histograms into it.
 // Be careful: The histograms belongs to this object and won't get deleted
@@ -199,18 +103,10 @@
 void MHNewImagePar::Draw(Option_t *)
 {
-    TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(this, 300, 600);
+    TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(this);
     pad->SetBorderMode(0);
 
     AppendPad("");
 
-    pad->Divide(1, 2);
-
-    pad->cd(1);
-    pad->SetBorderMode(0);
-    fLeakage1->Draw();
-
-    pad->cd(2);
-    pad->SetBorderMode(0);
-    fLeakage2->Draw();
+    MH::Draw(*fLeakage1, *fLeakage2, "Leakage1 and Leakage2");
 
     pad->Modified();
@@ -228,19 +124,2 @@
     return NULL;
 }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Index: trunk/MagicSoft/Mars/mimage/MHNewImagePar.h
===================================================================
--- trunk/MagicSoft/Mars/mimage/MHNewImagePar.h	(revision 1965)
+++ trunk/MagicSoft/Mars/mimage/MHNewImagePar.h	(revision 1966)
@@ -15,15 +15,8 @@
     TH1F *fLeakage2;     //->
 
-    Float_t fMm2Deg;
-    Bool_t  fUseMmScale;
-
 public:
     MHNewImagePar(const char *name=NULL, const char *title=NULL);
     ~MHNewImagePar();
 
-    void SetMmScale(Bool_t mmscale=kTRUE);
-    void SetMm2Deg(Float_t mmdeg);
-
-    Bool_t SetupFill(const MParList *pList);
     Bool_t Fill(const MParContainer *par);
 
@@ -34,7 +27,6 @@
 
     void Draw(Option_t *opt=NULL);
-    TObject *DrawClone(Option_t *opt=NULL) const;
 
-    ClassDef(MHNewImagePar, 1) // Container which holds histograms for the new image parameters
+    ClassDef(MHNewImagePar, 1) // Histograms of new image parameters
 };
 
Index: trunk/MagicSoft/Mars/mimage/MNewImagePar.cc
===================================================================
--- trunk/MagicSoft/Mars/mimage/MNewImagePar.cc	(revision 1965)
+++ trunk/MagicSoft/Mars/mimage/MNewImagePar.cc	(revision 1966)
@@ -72,10 +72,8 @@
                           const MHillas *hillas)
 {
-    //fHillas = (MHillas*)hillas;
-
     const UInt_t npixevt = evt.GetNumPixels();
 
-    Double_t edgepix1 = 0.0;
-    Double_t edgepix2 = 0.0;
+    Double_t edgepix1 = 0;
+    Double_t edgepix2 = 0;
 
     for (UInt_t i=0; i<npixevt; i++)
@@ -87,5 +85,5 @@
         const MGeomPix &gpix = geom[pix.GetPixId()];
 
-        Double_t nphot = pix.GetNumPhotons();                        
+        const Double_t nphot = pix.GetNumPhotons();
 
         // count photons in outer rings of camera
Index: trunk/MagicSoft/Mars/mmain/MStatusDisplay.cc
===================================================================
--- trunk/MagicSoft/Mars/mmain/MStatusDisplay.cc	(revision 1965)
+++ trunk/MagicSoft/Mars/mmain/MStatusDisplay.cc	(revision 1966)
@@ -372,6 +372,4 @@
     txt += cont.GetTitle();
 
-    cout << txt << endl;
-
     SetStatusLine2(txt);
 }
@@ -552,6 +550,11 @@
 
     // layout and map new tab
+#if ROOT_VERSION_CODE < ROOT_VERSION(3,03,00)
+    MapSubwindows();
+    Layout();
+#else
     Layout();
     MapSubwindows();
+#endif
 
     // display new tab in the main frame
@@ -804,13 +807,12 @@
         return kTRUE;
 
-    if (timer==&fTimer)
-    {
-        TGCompositeFrame *f=fTab->GetCurrentContainer();
-        if (f!=fLogBox)
-            return kTRUE;
-
-        UpdateTab(f);
-        return kTRUE;
-    }
+    // Update a canvas tab (if visible)
+    if (timer==&fTimer && c!=fLogIdx)
+    {
+        UpdateTab(fTab->GetCurrentContainer());
+        return kTRUE;
+    }
+
+    // update the logbook tab (if visible)
     if (timer==&fLogTimer && c==fLogIdx)
     {
