Index: trunk/MagicSoft/Mars/mhist/MH.cc
===================================================================
--- trunk/MagicSoft/Mars/mhist/MH.cc	(revision 1439)
+++ trunk/MagicSoft/Mars/mhist/MH.cc	(revision 1441)
@@ -317,2 +317,20 @@
     }
 }
+
+void MH::ScaleAxis(TArrayD &bins, Double_t f)
+{
+    for (int i=0; i<bins.GetSize(); i++)
+        bins[i] *= f;
+}
+
+void MH::ScaleAxis(TH1 *h, Double_t fx=1, Double_t fy=1, Double_t fz=1)
+{
+    if (h->InheritsFrom(TH3::Class()))
+        ScaleAxis(*((TH3*)h)->GetZaxis()->GetXbins(), fz);
+
+    if (h->InheritsFrom(TH2::Class()))
+        ScaleAxis(*((TH2*)h)->GetYaxis()->GetXbins(), fy);
+
+    if (h->InheritsFrom(TH1::Class()))
+        ScaleAxis(*h->GetXaxis()->GetXbins(), fx);
+}
Index: trunk/MagicSoft/Mars/mhist/MH.h
===================================================================
--- trunk/MagicSoft/Mars/mhist/MH.h	(revision 1439)
+++ trunk/MagicSoft/Mars/mhist/MH.h	(revision 1441)
@@ -44,4 +44,7 @@
     static void SetBinning(TH1 *h, TH1 *x);
 
+    static void ScaleAxis(TArrayD &bins, Double_t f);
+    static void ScaleAxis(TH1 *bins, Double_t fx=1, Double_t fy=1, Double_t fz=1);
+
     ClassDef(MH, 1) //A histogram base class for Mars histograms
 };
Index: trunk/MagicSoft/Mars/mhist/MHHillas.cc
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHHillas.cc	(revision 1439)
+++ trunk/MagicSoft/Mars/mhist/MHHillas.cc	(revision 1441)
@@ -17,4 +17,5 @@
 !
 !   Author(s): Thomas Bretz  2001 <mailto:tbretz@uni-sw.gwdg.de>
+!              Wolfgang Wittek  2002 <mailto:wittek@mppmu.mpg.de>
 !
 !   Copyright: MAGIC Software Development, 2000-2002
@@ -27,5 +28,5 @@
 // MHHillas
 //
-// This class contains histograms for every Hillas parameter
+// This class contains histograms for the source independent image parameters
 //
 /////////////////////////////////////////////////////////////////////////////
@@ -36,5 +37,7 @@
 
 #include <TH1.h>
+#include <TH2.h>
 #include <TPad.h>
+#include <TStyle.h>
 #include <TCanvas.h>
 
@@ -42,7 +45,10 @@
 #include "MLogManip.h"
 
+#include "MParList.h"
+
+#include "MHillas.h"
 #include "MGeomCam.h"
-#include "MHillas.h"
-#include "MParList.h"
+#include "MBinning.h"
+
 
 ClassImp(MHHillas);
@@ -53,5 +59,5 @@
 //
 MHHillas::MHHillas(const char *name, const char *title)
-    : fMm2Deg(-1), fUseMmScale(kTRUE)
+    : fMm2Deg(1), fUseMmScale(kFALSE)
 {
     //
@@ -59,32 +65,61 @@
     //
     fName  = name  ? name  : "MHHillas";
-    fTitle = title ? title : "Container for Hillas histograms";
-
-    //
-    // loop over all Pixels and create two histograms
-    // one for the Low and one for the High gain
-    // connect all the histogram with the container fHist
-    //
+    fTitle = title ? title : "Source independent image parameters";
+
+    fLength = new TH1F("Length", "Length of Ellipse", 100, 0, 300);
+    fLength->SetDirectory(NULL);
+    fLength->SetXTitle("Length [mm]");
+    fLength->SetYTitle("Counts");
+
     fWidth  = new TH1F("Width",  "Width of Ellipse",  100, 0, 300);
-    fLength = new TH1F("Length", "Length of Ellipse", 100, 0, 300);
-
-    fLength->SetDirectory(NULL);
     fWidth->SetDirectory(NULL);
-
-    fLength->SetXTitle("Length [mm]");
     fWidth->SetXTitle("Width [mm]");
-
-    fLength->SetYTitle("Counts");
     fWidth->SetYTitle("Counts");
-}
-
-// --------------------------------------------------------------------------
-//
-// Delete the four histograms
+
+    fDistC  = new TH1F("DistC",  "Distance from center of camera",  100, 0, 600);
+    fDistC->SetDirectory(NULL);
+    fDistC->SetXTitle("Distance [mm]");
+    fDistC->SetYTitle("Counts");
+
+    fDelta  = new TH1F("Delta",  "Angle (Main axis - x-axis)", 100, -90, 90);
+    fDelta->SetDirectory(NULL);
+    fDelta->SetXTitle("Delta [\\circ]");
+    fDelta->SetYTitle("Counts");
+
+    MBinning bins;
+    bins.SetEdgesLog(50, 1, 1e7);
+
+    fSize  = new TH1F;
+    fSize->SetName("Size");
+    fSize->SetTitle("Number of Photons");
+    fSize->SetDirectory(NULL);
+    fSize->SetXTitle("Size");
+    fSize->SetYTitle("Counts");
+    fSize->GetXaxis()->SetTitleOffset(1.2);
+    fSize->GetXaxis()->SetLabelOffset(-0.015);
+
+    MH::SetBinning(fSize, &bins);
+
+    fCenter = new TH2F("Center", "Center of Ellipse", 60, -600, 600, 60, -600, 600);
+    fCenter->SetDirectory(NULL);
+    fCenter->SetXTitle("x [mm]");
+    fCenter->SetYTitle("y [mm]");
+    fCenter->SetZTitle("Counts");
+}
+
+// --------------------------------------------------------------------------
+//
+// Delete the histograms
 //
 MHHillas::~MHHillas()
 {
+    delete fLength;
     delete fWidth;
-    delete fLength;
+
+    delete fDistC;
+    delete fDelta;
+
+    delete fSize;
+    delete fCenter;
 }
 
@@ -101,7 +136,10 @@
 Bool_t MHHillas::SetupFill(const MParList *plist)
 {
-    const MBinning* binsw = (MBinning*)plist->FindObject("BinningWidth");
-    const MBinning* binsl = (MBinning*)plist->FindObject("BinningLength");
-    if (!binsw || !binsl)
+    const MBinning *binsw = (MBinning*)plist->FindObject("BinningWidth");
+    const MBinning *binsl = (MBinning*)plist->FindObject("BinningLength");
+    const MBinning *binsd = (MBinning*)plist->FindObject("BinningDist");
+    const MBinning *binsc = (MBinning*)plist->FindObject("BinningCamera");
+
+    if (!binsw || !binsl || !binsd || !binsc)
     {
         *fLog << err << dbginf << "At least one MBinning not found... aborting." << endl;
@@ -111,4 +149,6 @@
     SetBinning(fWidth,  binsw);
     SetBinning(fLength, binsl);
+    SetBinning(fDistC,  binsd);
+    SetBinning(fCenter, binsc, binsc);
 
     const MGeomCam *geom = (MGeomCam*)plist->FindObject("MGeomCam");
@@ -119,32 +159,12 @@
     }
 
+    fMm2Deg     = geom->GetConvMm2Deg();
+    fUseMmScale = kFALSE;
+
     fLength->SetXTitle("Length [\\circ]");
     fWidth->SetXTitle("Width [\\circ]");
-
-    fMm2Deg     = geom->GetConvMm2Deg();
-    fUseMmScale = kFALSE;
-
-    return kTRUE;
-}
-
-// --------------------------------------------------------------------------
-//
-// Fill the four histograms with data from a MHillas-Container.
-// Be careful: Only call this with an object of type MHillas
-//
-Bool_t MHHillas::Fill(const MParContainer *par)
-{
-    const MHillas &h = *(MHillas*)par;
-
-    if (fUseMmScale)
-    {
-        fWidth ->Fill(h.GetWidth());
-        fLength->Fill(h.GetLength());
-    }
-    else
-    {
-        fWidth ->Fill(fMm2Deg*h.GetWidth());
-        fLength->Fill(fMm2Deg*h.GetLength());
-    }
+    fDistC->SetXTitle("Distance [\\circ]");
+    fCenter->SetXTitle("x [\\circ]");
+    fCenter->SetYTitle("y [\\circ]");
 
     return kTRUE;
@@ -190,17 +210,26 @@
     if (fUseMmScale)
     {
+        MH::ScaleAxis(fLength, 1./fMm2Deg);
+        MH::ScaleAxis(fWidth,  1./fMm2Deg);
+        MH::ScaleAxis(fDistC,  1./fMm2Deg);
+        MH::ScaleAxis(fCenter, 1./fMm2Deg, 1./fMm2Deg);
+
         fLength->SetXTitle("Length [mm]");
         fWidth->SetXTitle("Width [mm]");
-
-        fLength->Scale(1./fMm2Deg);
-        fWidth->Scale(1./fMm2Deg);
+        fCenter->SetXTitle("x [mm]");
+        fCenter->SetYTitle("y [mm]");
     }
     else
     {
+        MH::ScaleAxis(fLength, fMm2Deg);
+        MH::ScaleAxis(fWidth,  fMm2Deg);
+        MH::ScaleAxis(fDistC,  fMm2Deg);
+        MH::ScaleAxis(fCenter, fMm2Deg, fMm2Deg);
+
         fLength->SetXTitle("Length [\\circ]");
         fWidth->SetXTitle("Width [\\circ]");
-
-        fLength->Scale(fMm2Deg);
-        fWidth->Scale(fMm2Deg);
+        fDistC->SetXTitle("Distance [\\circ]");
+        fCenter->SetXTitle("x [\\circ]");
+        fCenter->SetYTitle("y [\\circ]");
     }
 
@@ -210,5 +239,50 @@
 // --------------------------------------------------------------------------
 //
-// Draw clones of all four histograms. So that the object can be deleted
+// Fill the histograms with data from a MHillas-Container.
+// Be careful: Only call this with an object of type MHillas
+//
+Bool_t MHHillas::Fill(const MParContainer *par)
+{
+    const MHillas &h = *(MHillas*)par;
+
+    const Double_t d = sqrt(h.GetMeanX()*h.GetMeanX() + h.GetMeanY()*h.GetMeanY());
+
+    if (fUseMmScale)
+    {
+        fLength->Fill(h.GetLength());
+        fWidth ->Fill(h.GetWidth());
+        fDistC ->Fill(d);
+        fCenter->Fill(h.GetMeanX(), h.GetMeanY());
+    }
+    else
+    {
+        fLength->Fill(fMm2Deg*h.GetLength());
+        fWidth ->Fill(fMm2Deg*h.GetWidth());
+        fDistC ->Fill(fMm2Deg*d);
+        fCenter->Fill(fMm2Deg*h.GetMeanX(), fMm2Deg*h.GetMeanY());
+    }
+
+    fDelta->Fill(kRad2Deg*h.GetDelta());
+    fSize->Fill(h.GetSize());
+
+    return kTRUE;
+}
+
+// --------------------------------------------------------------------------
+//
+// Setup a inversed deep blue sea palette for the fCenter histogram.
+//
+void MHHillas::SetColors() const
+{
+    gStyle->SetPalette(51, NULL);
+    Int_t c[50];
+    for (int i=0; i<50; i++)
+        c[49-i] = gStyle->GetColorPalette(i);
+    gStyle->SetPalette(50, c);
+}
+
+// --------------------------------------------------------------------------
+//
+// Draw clones of four 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
@@ -218,13 +292,9 @@
 TObject *MHHillas::DrawClone(Option_t *opt) const
 {
-    TCanvas *c = MakeDefCanvas("Hillas", "Histograms of Hillas Parameters",
-                               350, 500);
-    c->Divide(1, 2);
+    TCanvas *c = MakeDefCanvas("Hillas", fTitle, 700, 750);
+    c->Divide(2,3);
 
     gROOT->SetSelectedPad(NULL);
 
-    //
-    // This is necessary to get the expected bahviour of DrawClone
-    //
     c->cd(1);
     fLength->DrawCopy();
@@ -232,4 +302,18 @@
     c->cd(2);
     fWidth->DrawCopy();
+
+    c->cd(3);
+    gPad->SetLogx();
+    fSize->DrawCopy();
+
+    c->cd(4);
+    fDelta->DrawCopy();
+
+    c->cd(5);
+    fDistC->DrawCopy();
+
+    c->cd(6);
+    SetColors();
+    fCenter->DrawCopy("colz");
 
     c->Modified();
@@ -248,7 +332,7 @@
 {
     if (!gPad)
-        MakeDefCanvas("Hillas", "Histograms of Hillas Parameters", 350, 500);
-
-    gPad->Divide(1, 2);
+        MakeDefCanvas("Hillas", fTitle, 700, 750);
+
+    gPad->Divide(2,3);
 
     gPad->cd(1);
@@ -258,4 +342,18 @@
     fWidth->Draw();
 
+    gPad->cd(3);
+    gPad->SetLogx();
+    fSize->Draw();
+
+    gPad->cd(4);
+    fDelta->Draw();
+
+    gPad->cd(5);
+    fDistC->Draw();
+
+    gPad->cd(6);
+    SetColors();
+    fCenter->Draw("colz");
+
     gPad->Modified();
     gPad->Update();
Index: trunk/MagicSoft/Mars/mhist/MHHillas.h
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHHillas.h	(revision 1439)
+++ trunk/MagicSoft/Mars/mhist/MHHillas.h	(revision 1441)
@@ -7,10 +7,21 @@
 
 class TH1F;
+class TH2F;
+class MHillas;
 
 class MHHillas : public MH
 {
 private:
+
+    TH1F *fLength;
     TH1F *fWidth;
-    TH1F *fLength;
+
+    TH1F *fDistC;
+    TH1F *fDelta;
+
+    TH1F *fSize;
+    TH2F *fCenter;
+
+    void SetColors() const;
 
 protected:
@@ -29,11 +40,17 @@
     Bool_t Fill(const MParContainer *par);
 
+    TH1F *GetHistLength() { return fLength; }
     TH1F *GetHistWidth()  { return fWidth; }
-    TH1F *GetHistLength() { return fLength; }
+
+    TH1F *GetHistDistC()  { return fDistC; }
+    TH1F *GetHistDelta()  { return fDelta; }
+
+    TH1F *GetHistSize()   { return fSize; }
+    TH2F *GetHistCenter() { return fCenter; }
 
     void Draw(Option_t *opt=NULL);
     TObject *DrawClone(Option_t *opt=NULL) const;
 
-    ClassDef(MHHillas, 1) // Container which holds histograms for length and width
+    ClassDef(MHHillas, 1) // Container which holds histograms for the source independent image parameters
 };
 
