Index: trunk/MagicSoft/Mars/Changelog
===================================================================
--- trunk/MagicSoft/Mars/Changelog	(revision 1966)
+++ trunk/MagicSoft/Mars/Changelog	(revision 1967)
@@ -2,4 +2,26 @@
 
  2003/04/21: Thomas Bretz
+
+   * manalysis/MBlindPixels.h:
+     - IsBlind -> const
+     
+   * mhist/HistLinkDef.h, mhist/Makefile:
+     - added MHBlindPixels
+   
+   * mhist/MH.[h,cc]:
+     - changed the two DrawClone functions to one.
+     
+   * mhist/MHHadronness.[h,cc]:
+     - changed to fit the requirements of MStatusDisplay
+     
+   * mhist/MHMatrix.cc:
+     - SetDirectory(NULL) for all histograms created
+
+   * mhist/MHSigmaTheta.cc:
+     - removed fNpix    (is already in MHHillas)
+     - removed fBlindId (--> MHBlindPixels)
+
+   * mhist/MHBlindPixels.[h,cc]:
+     - new
 
    * macros/plot.C:
@@ -8,4 +30,5 @@
    * macros/status.C:
      - added MHNewImagePar
+     - added MHHadronness
 
    * manalysis/MBlindPixelCalc.cc:
Index: trunk/MagicSoft/Mars/macros/status.C
===================================================================
--- trunk/MagicSoft/Mars/macros/status.C	(revision 1966)
+++ trunk/MagicSoft/Mars/macros/status.C	(revision 1967)
@@ -80,6 +80,6 @@
 
     // ------------- user change -----------------
+    read.AddFile("data/Pro*.root");
     read.AddFile("data/Gam*.root");
-    //read.AddFile("200*.root");
 
     MMcPedestalCopy   pcopy;
@@ -94,4 +94,5 @@
     MHillasSrcCalc    scalc; // !!Preliminary!! Will be removed later!
     MNewImageParCalc  icalc;
+    MCT1SupercutsCalc calc1;
 
     // -------------------------------------------
@@ -103,4 +104,5 @@
     MFillH hfill5("MHStarMap", "MHillas");
     MFillH hfill6("MHCerPhotEvt", "MCerPhotEvt");
+    MFillH hfill7("MHHadronness", "MHadronness");
 
     tlist.AddToList(&read);
@@ -114,4 +116,6 @@
     tlist.AddToList(&scalc);
     tlist.AddToList(&icalc);
+    tlist.AddToList(&calc1);
+    tlist.AddToList(&hfill7);
     tlist.AddToList(&hfill1);
     tlist.AddToList(&hfill2);
@@ -140,5 +144,5 @@
     {
         // Save data in a postscriptfile (status.ps)
-        d->SaveAsPS();
+       // d->SaveAsPS();
         /*
          * ----------- Write status to a root file ------------
Index: trunk/MagicSoft/Mars/manalysis/MBlindPixels.h
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MBlindPixels.h	(revision 1966)
+++ trunk/MagicSoft/Mars/manalysis/MBlindPixels.h	(revision 1967)
@@ -23,5 +23,5 @@
     void Clear(Option_t *o="")  { fPixels.Reset(); }
 
-    Bool_t IsBlind(UShort_t id) { return fPixels.GetSize() && fPixels[id]; }
+    Bool_t IsBlind(UShort_t id) const { return fPixels.GetSize() && ((TArrayC)fPixels)[id]; }
 
     ClassDef(MBlindPixels, 1) // container to store blind pixels
Index: trunk/MagicSoft/Mars/mhist/HistLinkDef.h
===================================================================
--- trunk/MagicSoft/Mars/mhist/HistLinkDef.h	(revision 1966)
+++ trunk/MagicSoft/Mars/mhist/HistLinkDef.h	(revision 1967)
@@ -19,4 +19,6 @@
 
 #pragma link C++ class MHCerPhotEvt+;
+
+#pragma link C++ class MHBlindPixels+;
 
 #pragma link C++ class MHStarMap+;
Index: trunk/MagicSoft/Mars/mhist/MH.cc
===================================================================
--- trunk/MagicSoft/Mars/mhist/MH.cc	(revision 1966)
+++ trunk/MagicSoft/Mars/mhist/MH.cc	(revision 1967)
@@ -588,6 +588,9 @@
     gPad->Update();
 
-    h1->SetMaximum(TMath::Max(hist1.GetMaximum(), hist2.GetMaximum()));
-    h1->SetMinimum(TMath::Min(hist1.GetMinimum(), hist2.GetMinimum()));
+    // FIXME: Also align max/min with set Maximum/Minimum
+     const Double_t max = TMath::Max(hist1.GetBinContent(hist1.GetMaximumBin()), hist2.GetBinContent(hist2.GetMaximumBin()));
+     const Double_t min = TMath::Min(hist1.GetBinContent(hist1.GetMinimumBin()), hist2.GetBinContent(hist2.GetMinimumBin()));
+     h1->SetMaximum(max);
+     h1->SetMinimum(min);
 
     TPaveText *t = (TPaveText*)gPad->FindObject("title");
@@ -655,6 +658,11 @@
     gPad->Update();
 
-    hist1.SetMaximum(TMath::Max(hist1.GetMaximum(), hist2.GetMaximum()));
-    hist1.SetMinimum(TMath::Min(hist1.GetMinimum(), hist2.GetMinimum()));
+    // FIXME: Also align max/min with set Maximum/Minimum
+    /*
+     const Double_t max = TMath::Max(hist1.GetBinContent(hist1.GetMaximumBin()), hist2.GetBinContent(hist2.GetMaximumBin()));
+     const Double_t min = TMath::Min(hist1.GetBinContent(hist1.GetMinimumBin()), hist2.GetBinContent(hist2.GetMinimumBin()));
+     hist1.SetMaximum(max);
+     hist1.SetMinimum(min);
+     */
 
     TPaveText *t = (TPaveText*)gPad->FindObject("title");
@@ -711,5 +719,5 @@
 //
 // If the opt string contains 'nonew' or gPad is not given NULL is returned.
-// Other wise the present gPad is cleared and returned.
+// Otherwise the present gPad is returned.
 //
 TVirtualPad *MH::GetNewPad(Option_t *opt)
@@ -720,5 +728,4 @@
         return NULL;
 
-    gPad->Clear();
     return gPad;
 }
@@ -726,9 +733,16 @@
 // --------------------------------------------------------------------------
 //
-// The object is cloned and drawn to the present pad. The kCanDelete
-// bit is set for the clone.
-//
-TObject *MH::DrawClone(Option_t *opt="") const
-{
+// If the opt string contains 'nonew' or gPad is not given a new canvas
+// with size w/h is created. Otherwise the object is cloned and drawn
+// to the present pad. The kCanDelete bit is set for the clone.
+//
+TObject *MH::DrawClone(Option_t *opt, Int_t w, Int_t h) const
+{
+    TVirtualPad *p = GetNewPad(opt);
+    if (!p)
+        p = MakeDefCanvas(this, w, h);
+    else
+        p->Clear();
+
     gROOT->SetSelectedPad(NULL);
 
@@ -737,17 +751,2 @@
     return o;
 }
-
-// --------------------------------------------------------------------------
-//
-// If the opt string contains 'nonew' or gPad is not given a new canvas
-// with size w/h is created. Otherwise the object is cloned and drawn
-// to the present pad. The kCanDelete bit is set for the clone.
-//
-TObject *MH::DrawClone(Option_t *opt, Int_t w, Int_t h) const
-{
-    TVirtualPad *p = GetNewPad(opt);
-    if (!p)
-        p = MakeDefCanvas(this, w, h);
-
-    return MH::DrawClone(opt);
-}
Index: trunk/MagicSoft/Mars/mhist/MH.h
===================================================================
--- trunk/MagicSoft/Mars/mhist/MH.h	(revision 1966)
+++ trunk/MagicSoft/Mars/mhist/MH.h	(revision 1967)
@@ -70,6 +70,5 @@
 
     void Draw(Option_t *o="") { MParContainer::Draw(o); }
-    TObject *DrawClone(Option_t *opt="") const;
-    TObject *DrawClone(Option_t *opt, Int_t w, Int_t h) const;
+    TObject *DrawClone(Option_t *opt, Int_t w=580, Int_t h=435) const;
 
     static TVirtualPad *GetNewPad(Option_t *opt);
Index: trunk/MagicSoft/Mars/mhist/MH3.h
===================================================================
--- trunk/MagicSoft/Mars/mhist/MH3.h	(revision 1966)
+++ trunk/MagicSoft/Mars/mhist/MH3.h	(revision 1967)
@@ -22,5 +22,5 @@
     TString     fDataMember[3];  // Data member which should be filled into the histogram x
     MDataChain *fData[3];        // Object from which the data is filled
-    Double_t    fScale[3];
+    Double_t    fScale[3];       // Scale for the three axis (eg unit)
 
     void StreamPrimitive(ofstream &out) const;
@@ -60,5 +60,4 @@
     void SetColors() const;
     void Draw(Option_t *opt=NULL);
-    TObject *DrawClone(Option_t *opt=NULL) const;
 
     MParContainer *New() const;
Index: trunk/MagicSoft/Mars/mhist/MHBlindPixels.cc
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHBlindPixels.cc	(revision 1967)
+++ trunk/MagicSoft/Mars/mhist/MHBlindPixels.cc	(revision 1967)
@@ -0,0 +1,89 @@
+/* ======================================================================== *\
+!
+! *
+! * 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 04/2003 <mailto:tbretz@astro.uni-wuerzburg.de>
+!
+!   Copyright: MAGIC Software Development, 2000-2003
+!
+!
+\* ======================================================================== */
+
+/////////////////////////////////////////////////////////////////////////////
+//
+//  MHBlindPixels
+//
+////////////////////////////////////////////////////////////////////////////
+#include "MHBlindPixels.h" 
+
+#include <TCanvas.h>
+
+#include "MBlindPixels.h"
+
+ClassImp(MHBlindPixels);
+
+// -------------------------------------------------------------------------
+//
+//  Default Constructor.
+//
+MHBlindPixels::MHBlindPixels(const char *name, const char *title)
+    : fHist(fName, fTitle, 577, -.5, 577-.5)
+{
+    fName  = name  ? name  : "MHBlindPixels";
+    fTitle = title ? title : "Histogram for Blind Pixels";
+
+    //  - we initialize the histogram
+    //  - we have to give diferent names for the diferent histograms because
+    //    root don't allow us to have diferent histograms with the same name
+
+    fHist.SetName(fName);
+    fHist.SetTitle(fTitle);
+
+    fHist.SetDirectory(NULL);
+
+    fHist.SetXTitle("Id");
+    fHist.SetYTitle("Counts");
+}
+
+// ------------------------------------------------------------------------
+// 
+// Drawing function. It creates its own canvas.
+//
+void MHBlindPixels::Draw(Option_t *option)
+{
+    TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(this);
+    pad->SetBorderMode(0);
+
+    fHist.Draw(option);
+
+    pad->Modified();
+    pad->Update();
+}
+
+Bool_t MHBlindPixels::Fill(const MParContainer *par)
+{
+    if (!par)
+        return kFALSE;
+
+    const MBlindPixels &bp = *(MBlindPixels*)par;
+
+    // FIXME: Slow.
+    for (int i=0; i<577; i++)
+        if (bp.IsBlind(i))
+            fHist.Fill(i);
+
+    return kTRUE;
+}
Index: trunk/MagicSoft/Mars/mhist/MHBlindPixels.h
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHBlindPixels.h	(revision 1967)
+++ trunk/MagicSoft/Mars/mhist/MHBlindPixels.h	(revision 1967)
@@ -0,0 +1,30 @@
+#ifndef MARS_MHBlindPixels
+#define MARS_MHBlindPixels
+
+#ifndef MARS_MH
+#include "MH.h"
+#endif
+#ifndef ROOT_TH1
+#include <TH1.h>
+#endif
+
+class MHBlindPixels : public MH
+{
+private:
+    TH1D fHist; //
+
+public:
+    MHBlindPixels(const char *name=NULL, const char *title=NULL);
+
+    const TH1D *GetHist()       { return &fHist; }
+    const TH1D *GetHist() const { return &fHist; }
+
+    TH1 *GetHistByName(const TString name) { return &fHist; }
+
+    void Draw(Option_t* option = "");
+    Bool_t Fill(const MParContainer *par);
+
+    ClassDef(MHBlindPixels, 1)  // Histogram of blind pixels
+};
+
+#endif
Index: trunk/MagicSoft/Mars/mhist/MHMatrix.cc
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHMatrix.cc	(revision 1966)
+++ trunk/MagicSoft/Mars/mhist/MHMatrix.cc	(revision 1967)
@@ -693,4 +693,5 @@
     //
     TH1F hta;
+    hta.SetDirectory(NULL);
     hta.SetName("hta");
     hta.SetTitle("Distribution after reduction");
@@ -793,8 +794,10 @@
     //
     TH1F hth("th", "Distribution before reduction", nbins, frombin, tobin);
+    hth.SetDirectory(NULL);
     for (Int_t j=0; j<nrows; j++)
         hth.Fill(fM(j, refcolumn));
 
     TH1F hthd("thd", "Correction factors", nbins, frombin, tobin);
+    hthd.SetDirectory(NULL);
     hthd.Divide((TH1F*)&thsh, &hth, 1, 1);
 
Index: trunk/MagicSoft/Mars/mhist/MHSigmaTheta.cc
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHSigmaTheta.cc	(revision 1966)
+++ trunk/MagicSoft/Mars/mhist/MHSigmaTheta.cc	(revision 1967)
@@ -17,6 +17,7 @@
 !
 !   Author(s): Wolfgang Wittek 1/2003 <mailto:wittek@mppmu.mpg.de>
-!
-!   Copyright: MAGIC Software Development, 2000-2002
+!   Author(s): Thomas Bretz 4/2003 <mailto:tbretz@astro.uni-wuerzburg.de>
+!
+!   Copyright: MAGIC Software Development, 2000-2003
 !
 !
@@ -27,7 +28,5 @@
 //  MHSigmaTheta (extension of Robert's MHSigmabarTheta)                    //
 //                                                                          //
-//  calculates - the 1D-histogram   ID of blind pixels
-//             - the 1D-histogram   no.of pixels in MCerPhotEvt, and        //
-//             - the 2D-histogram   sigmabar vs. Theta, and                 //
+//  calculates - the 2D-histogram   sigmabar vs. Theta, and                 //
 //             - the 3D-histogram   sigma, pixel no., Theta                 //
 //             - the 3D-histogram   (sigma^2-sigmabar^2), pixel no., Theta  //
@@ -71,35 +70,23 @@
     fTitle = title ? title : "2D histogram sigmabar vs. Theta";
 
-    fNpix.SetDirectory(NULL);
-    fNpix.SetName("1D-Npix");
-    fNpix.SetTitle("1D : no.of used pixels in MCerPhotEvt");
-    fNpix.SetXTitle("no. of used pixels in MCerPhotEvt");
-    fNpix.SetYTitle("Counts");
-
-    fBlindId.SetDirectory(NULL);
-    fBlindId.SetName("1D-BlindId");
-    fBlindId.SetTitle("1D : Id of blind pixel");
-    fBlindId.SetXTitle("Id of blind pixel");
-    fBlindId.SetYTitle("Counts");
-
     fSigmaTheta.SetDirectory(NULL);
     fSigmaTheta.SetName("2D-ThetaSigmabar");
-    fSigmaTheta.SetTitle("2D : Sigmabar, \\Theta");
+    fSigmaTheta.SetTitle("2D: \\bar{\\sigma}_{ped}, \\Theta");
     fSigmaTheta.SetXTitle("\\Theta [\\circ]");
-    fSigmaTheta.SetYTitle("Sigmabar");
+    fSigmaTheta.SetYTitle("\\bar{\\Theta}");
 
     fSigmaPixTheta.SetDirectory(NULL);
     fSigmaPixTheta.SetName("3D-ThetaPixSigma");
-    fSigmaPixTheta.SetTitle("3D : \\Theta, pixel no., Sigma");
+    fSigmaPixTheta.SetTitle("3D : \\Theta, Pixel Id, \\sigma_{ped}");
     fSigmaPixTheta.SetXTitle("\\Theta [\\circ]");
-    fSigmaPixTheta.SetYTitle("pixel number");
-    fSigmaPixTheta.SetZTitle("Sigma");
+    fSigmaPixTheta.SetYTitle("Pixel Id");
+    fSigmaPixTheta.SetZTitle("\\sigma_{ped}");
 
     fDiffPixTheta.SetDirectory(NULL);
     fDiffPixTheta.SetName("3D-ThetaPixDiff");
-    fDiffPixTheta.SetTitle("3D : \\Theta, pixel, Sigma^2-Sigmabar^2");
+    fDiffPixTheta.SetTitle("3D : \\Theta, Pixel Id, \\sigma_{ped}^{2}-\\bar{\\sigma}^{2}");
     fDiffPixTheta.SetXTitle("\\Theta [\\circ]");
-    fDiffPixTheta.SetYTitle("pixel number");
-    fDiffPixTheta.SetZTitle("Sigma^2-sigmabar^2");
+    fDiffPixTheta.SetYTitle("Pixel Id");
+    fDiffPixTheta.SetZTitle("\\sigma_{ped}^{2}-\\bar{\\sigma}^{2}");
 }
 
@@ -180,6 +167,4 @@
    binspix.SetEdges(npix+1, -0.5, 0.5+npix );
 
-   SetBinning(&fNpix,    &binspix);
-   SetBinning(&fBlindId, &binspix);
    SetBinning(&fSigmaPixTheta, binstheta, &binspix, binssigma);
    SetBinning(&fDiffPixTheta,  binstheta, &binspix, binsdiff);
@@ -194,31 +179,16 @@
 Bool_t MHSigmaTheta::Fill(const MParContainer *par)
 {
-  //*fLog << "entry Fill" << endl;
-
     Double_t theta = fMcEvt->GetTelescopeTheta()*kRad2Deg;
     Double_t mySig = fSigmabar->Calc(*fCam, *fPed, *fEvt);
 
-    //*fLog << "MHSigmaTheta::Fill; theta, mySig = " << theta << ",  "
-    //      << mySig << endl;
-
     fSigmaTheta.Fill(theta, mySig);
 
     const UInt_t npix = fEvt->GetNumPixels();
 
-    Int_t npixused=0;
     for (UInt_t i=0; i<npix; i++)
     {
-      MCerPhotPix cerpix = fEvt->operator[](i);
+      MCerPhotPix cerpix = (*fEvt)[i];
       if (!cerpix.IsPixelUsed())
-      {
-        fBlindId.Fill( cerpix.GetPixId() );        
-        continue;
-      }
-      npixused++;
-
-      /*      
-      if (cerpix.GetNumPhotons() == 0)
-        continue;
-      */       
+          continue;
 
       const Int_t id = cerpix.GetPixId();
@@ -233,10 +203,5 @@
       const Double_t diff = sigma*sigma/area - mySig*mySig;
       fDiffPixTheta.Fill(theta, (Double_t)id, diff);
-
-      //*fLog << "theta, id, sigma, diff, area  = " << theta << ",  " << id 
-      //      << ",  "
-      //      << sigma << ",  " << diff << ",  " << area << endl;
     }
-    fNpix.Fill(npixused);
 
     return kTRUE;
Index: trunk/MagicSoft/Mars/mhist/Makefile
===================================================================
--- trunk/MagicSoft/Mars/mhist/Makefile	(revision 1966)
+++ trunk/MagicSoft/Mars/mhist/Makefile	(revision 1967)
@@ -45,4 +45,5 @@
            MHAlphaEnergyTime.cc \
            MHAlphaEnergyTheta.cc \
+           MHBlindPixels.cc \
            MHEffOnTime.cc \
            MHTimeDiffTime.cc \
Index: trunk/MagicSoft/Mars/mimage/MHHillas.cc
===================================================================
--- trunk/MagicSoft/Mars/mimage/MHHillas.cc	(revision 1966)
+++ trunk/MagicSoft/Mars/mimage/MHHillas.cc	(revision 1967)
@@ -316,4 +316,5 @@
 
     pad->cd(1);
+    gPad->SetBorderMode(0);
     MH::Draw(*fWidth, *fLength, "Width'n'Length");
 
Index: trunk/MagicSoft/Mars/mmain/MStatusDisplay.cc
===================================================================
--- trunk/MagicSoft/Mars/mmain/MStatusDisplay.cc	(revision 1966)
+++ trunk/MagicSoft/Mars/mmain/MStatusDisplay.cc	(revision 1967)
@@ -431,4 +431,7 @@
     //lient->ProcessEventsFor(this);
     gSystem->ProcessEvents();
+
+    //TSeqCollection   *GetListOfCleanups() const   {return fCleanups;}
+
 }
 
@@ -440,4 +443,6 @@
 MStatusDisplay::~MStatusDisplay()
 {
+    SetLogStream(NULL);
+
     delete fList;
 
