Index: /trunk/MagicSoft/Mars/Changelog
===================================================================
--- /trunk/MagicSoft/Mars/Changelog	(revision 1215)
+++ /trunk/MagicSoft/Mars/Changelog	(revision 1216)
@@ -1,3 +1,14 @@
                                                                   -*-*- END -*-*-
+
+ 2002/02/13: Thomas Bretz
+
+   * macros/MagicHillas.C, mhist/MHHillas.[h,cc], mhist/MHHillasSrc.[h,cc]:
+     - implemented variable binning (MBinning)
+     - implemented conversion to degrees (thanks to rudy)
+     
+   * mgui/MGeomCam.[h,cc], mgui/MGeomCamCT1.cc, mgui/MGeomCamMagic.cc:
+     - implemented fMm2Deg and fCamDist
+
+
 
  2002/01/23: Thomas Bretz
Index: /trunk/MagicSoft/Mars/NEWS
===================================================================
--- /trunk/MagicSoft/Mars/NEWS	(revision 1215)
+++ /trunk/MagicSoft/Mars/NEWS	(revision 1216)
@@ -14,5 +14,11 @@
      in different histograms (eg. the Energy bins should be the same in
      all histograms)
- 
+
+   - Changed Hillas histograms from mm to deg
+
+   - Added the flexible binning to the hillas histograms
+
+   - Added a filter for the alpha parameter (MFilter)
+
  
  
Index: /trunk/MagicSoft/Mars/macros/MagicHillas.C
===================================================================
--- /trunk/MagicSoft/Mars/macros/MagicHillas.C	(revision 1215)
+++ /trunk/MagicSoft/Mars/macros/MagicHillas.C	(revision 1216)
@@ -24,5 +24,5 @@
 
 
-void MagicHillas(const char *filename="~/data/Gamma*.root")
+void MagicHillas(const char *filename="~/data/gamma*.root")
 {
     //
@@ -45,4 +45,24 @@
     MGeomCamMagic geomcam;
     plist.AddToList(&geomcam);
+
+    //
+    // Setup binning for your histograms.
+    //
+    MBinning binswidth("BinningWidth");
+    binswidth.SetEdges(100, 0, 1);   // 100 bins from 0 to 1 deg
+
+    MBinning binslength("BinningLength");
+    binslength.SetEdges(100, 0, 1);  // 100 bins from 0 to 1 deg
+
+    MBinning binsalpha("BinningAlpha");
+    binsalpha.SetEdges(90, 0, 90);   // 90 bins from 0 to 90 deg
+
+    MBinning binsdist("BinningDist");
+    binsdist.SetEdges(100, 0, 2);    // 100 bins from 0 to 2 deg
+
+    plist.AddToList(&binswidth);
+    plist.AddToList(&binslength);
+    plist.AddToList(&binsalpha);
+    plist.AddToList(&binsdist);
 
     //
Index: /trunk/MagicSoft/Mars/mgui/MGeomCam.cc
===================================================================
--- /trunk/MagicSoft/Mars/mgui/MGeomCam.cc	(revision 1215)
+++ /trunk/MagicSoft/Mars/mgui/MGeomCam.cc	(revision 1216)
@@ -49,6 +49,6 @@
 // are deleted when the corresponding array is deleted.
 //
-MGeomCam::MGeomCam(UInt_t npix, const char *name, const char *title)
-    : fNumPixels(npix)
+MGeomCam::MGeomCam(UInt_t npix, Float_t dist, const char *name, const char *title)
+    : fNumPixels(npix), fCamDist(dist), fMm2Deg(kRad2Deg/(dist*1000))
 {
     fName  = name  ? name  : "MGeomCam";
Index: /trunk/MagicSoft/Mars/mgui/MGeomCam.h
===================================================================
--- /trunk/MagicSoft/Mars/mgui/MGeomCam.h	(revision 1215)
+++ /trunk/MagicSoft/Mars/mgui/MGeomCam.h	(revision 1216)
@@ -17,4 +17,7 @@
     Float_t  fMaxRadius;  // maximum radius of the camera (eg. for GUI layout)
 
+    Float_t  fCamDist;    // [m] Average distance of the camera from the mirror
+    Float_t  fMm2Deg;     // conversion factor to convert mm in the camera plain into degrees
+
     TObjArray *fPixels;   // Array of singel pixels storing the geometry
 
@@ -24,7 +27,10 @@
 public:
 
-    MGeomCam(UInt_t npix, const char *name=NULL, const char *title=NULL);
+    MGeomCam(UInt_t npix, Float_t dist, const char *name=NULL, const char *title=NULL);
 
     virtual ~MGeomCam();
+
+    Float_t GetCameraDist() const { return fCamDist; }
+    Float_t GetConvMm2Deg() const { return fMm2Deg; }
 
     UInt_t  GetNumPixels() const { return fNumPixels; }
Index: /trunk/MagicSoft/Mars/mgui/MGeomCamCT1.cc
===================================================================
--- /trunk/MagicSoft/Mars/mgui/MGeomCamCT1.cc	(revision 1215)
+++ /trunk/MagicSoft/Mars/mgui/MGeomCamCT1.cc	(revision 1216)
@@ -53,5 +53,6 @@
 //  CreateCam and CreateNN
 //
-MGeomCamCT1::MGeomCamCT1(const char *name) : MGeomCam(127, name, "Geometry information of CT1 camera")
+MGeomCamCT1::MGeomCamCT1(const char *name)
+    : MGeomCam(127, 4.88, name, "Geometry information of CT1 camera")
 {
     CreateCam();
Index: /trunk/MagicSoft/Mars/mgui/MGeomCamMagic.cc
===================================================================
--- /trunk/MagicSoft/Mars/mgui/MGeomCamMagic.cc	(revision 1215)
+++ /trunk/MagicSoft/Mars/mgui/MGeomCamMagic.cc	(revision 1216)
@@ -42,5 +42,5 @@
 #include "MGeomPix.h"
 
-ClassImp(MGeomCamMagic)
+ClassImp(MGeomCamMagic);
 
 // --------------------------------------------------------------------------
@@ -49,5 +49,6 @@
 //  CreateCam and CreateNN
 //
-MGeomCamMagic::MGeomCamMagic(const char *name) : MGeomCam(577, name, "Geometry information of Magic Camera")
+MGeomCamMagic::MGeomCamMagic(const char *name)
+    : MGeomCam(577, 17, name, "Geometry information of Magic Camera")
 {
     CreateCam();
Index: /trunk/MagicSoft/Mars/mhist/MHHillas.cc
===================================================================
--- /trunk/MagicSoft/Mars/mhist/MHHillas.cc	(revision 1215)
+++ /trunk/MagicSoft/Mars/mhist/MHHillas.cc	(revision 1216)
@@ -39,4 +39,8 @@
 #include <TCanvas.h>
 
+#include "MLog.h"
+#include "MLogManip.h"
+
+#include "MGeomCam.h"
 #include "MHillas.h"
 #include "MParList.h"
@@ -49,4 +53,5 @@
 //
 MHHillas::MHHillas(const char *name, const char *title)
+    : fMm2Deg(1), fUseMmScale(kFALSE)
 {
     //
@@ -61,6 +66,6 @@
     // connect all the histogram with the container fHist
     //
-    fWidth  = new TH1F("Width [mm]",  "Width of Hillas",  100, 0, 300);
-    fLength = new TH1F("Length [mm]", "Length of Hillas", 100, 0, 300);
+    fWidth  = new TH1F("Width",  "Width of Ellipse",  100, 0, 300);
+    fLength = new TH1F("Length", "Length of Ellipse", 100, 0, 300);
 
     fLength->SetDirectory(NULL);
@@ -89,4 +94,8 @@
 // instances of MBinning (with the names 'BinningWidth' and 'BinningLength')
 // 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 MHHillas::SetupFill(const MParList *plist)
@@ -94,10 +103,24 @@
     const MBinning* binsw = (MBinning*)plist->FindObject("BinningWidth");
     const MBinning* binsl = (MBinning*)plist->FindObject("BinningLength");
-
-    if (binsw)
-        SetBinning(fWidth, binsw);
-
-    if (binsl)
-        SetBinning(fLength, binsl);
+    if (!binsw || !binsl)
+    {
+        *fLog << err << dbginf << "At least one MBinning not found... aborting." << endl;
+        return kFALSE;
+    }
+
+    SetBinning(fWidth,  binsw);
+    SetBinning(fLength, binsl);
+
+    const MGeomCam *geom = (MGeomCam*)plist->FindObject("MGeomCam");
+    if (!geom)
+    {
+        *fLog << warn << dbginf << "No Camera Geometry available. Using mm-scale for histograms." << endl;
+        return kTRUE;
+    }
+
+    fLength->GetXaxis()->SetTitle("Length [\\circ]");
+    fWidth->GetXaxis()->SetTitle("Width [\\circ]");
+
+    fMm2Deg = geom->GetConvMm2Deg();
 
     return kTRUE;
@@ -113,6 +136,14 @@
     const MHillas &h = *(MHillas*)par;
 
-    fWidth ->Fill(h.GetWidth());
-    fLength->Fill(h.GetLength());
+    if (fUseMmScale)
+    {
+        fWidth ->Fill(h.GetWidth());
+        fLength->Fill(h.GetLength());
+    }
+    else
+    {
+        fWidth ->Fill(fMm2Deg*h.GetWidth());
+        fLength->Fill(fMm2Deg*h.GetLength());
+    }
 
     return kTRUE;
Index: /trunk/MagicSoft/Mars/mhist/MHHillas.h
===================================================================
--- /trunk/MagicSoft/Mars/mhist/MHHillas.h	(revision 1215)
+++ /trunk/MagicSoft/Mars/mhist/MHHillas.h	(revision 1216)
@@ -15,7 +15,13 @@
     TH1F *fLength;
 
+    Float_t fMm2Deg;
+
+    Bool_t fUseMmScale;
+
 public:
     MHHillas(const char *name=NULL, const char *title=NULL);
     ~MHHillas();
+
+    void SetMmScale(Bool_t mmscale=kTRUE) { fUseMmScale = mmscale; }
 
     Bool_t SetupFill(const MParList *pList);
Index: /trunk/MagicSoft/Mars/mhist/MHHillasSrc.cc
===================================================================
--- /trunk/MagicSoft/Mars/mhist/MHHillasSrc.cc	(revision 1215)
+++ /trunk/MagicSoft/Mars/mhist/MHHillasSrc.cc	(revision 1216)
@@ -38,4 +38,9 @@
 #include <TCanvas.h>
 
+#include "MLog.h"
+#include "MLogManip.h"
+
+#include "MGeomCam.h"
+
 #include "MParList.h"
 
@@ -62,6 +67,6 @@
     // connect all the histogram with the container fHist
     //
-    fAlpha = new TH1F("Alpha [deg]", "Alpha of Hillas",   90, 0,  90);
-    fDist  = new TH1F("Dist [mm]",   "Dist of Hillas",   100, 0, 600);
+    fAlpha = new TH1F("Alpha", "Alpha of Ellipse",   90, 0,  90);
+    fDist  = new TH1F("Dist",  "Dist of Ellipse",   100, 0, 600);
 
     fAlpha->SetDirectory(NULL);
@@ -90,4 +95,8 @@
 // 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 MHHillasSrc::SetupFill(const MParList *plist)
@@ -95,10 +104,23 @@
     const MBinning* binsa = (MBinning*)plist->FindObject("BinningAlpha");
     const MBinning* binsd = (MBinning*)plist->FindObject("BinningDist");
-
-    if (binsa)
-        SetBinning(fAlpha, binsa);
-
-    if (binsd)
-        SetBinning(fDist, binsd);
+    if (!binsa || !binsd)
+    {
+        *fLog << err << dbginf << "At least one MBinning not found... aborting." << endl;
+        return kFALSE;
+    }
+
+    SetBinning(fAlpha, binsa);
+    SetBinning(fDist,  binsd);
+
+    const MGeomCam *geom = (MGeomCam*)plist->FindObject("MGeomCam");
+    if (!geom)
+    {
+        *fLog << warn << dbginf << "No Camera Geometry available. Using mm-scale for histograms." << endl;
+        return kTRUE;
+    }
+
+    fDist->GetXaxis()->SetTitle("Dist [\\circ]");
+
+    fMm2Deg = geom->GetConvMm2Deg();
 
     return kTRUE;
@@ -115,5 +137,5 @@
 
     fAlpha->Fill(fabs(h.GetAlpha()));
-    fDist ->Fill(h.GetDist());
+    fDist ->Fill(fUseMmScale ? h.GetDist() : fMm2Deg*h.GetDist());
 
     return kTRUE;
Index: /trunk/MagicSoft/Mars/mhist/MHHillasSrc.h
===================================================================
--- /trunk/MagicSoft/Mars/mhist/MHHillasSrc.h	(revision 1215)
+++ /trunk/MagicSoft/Mars/mhist/MHHillasSrc.h	(revision 1216)
@@ -15,7 +15,12 @@
     TH1F *fDist;
 
+    Float_t fMm2Deg;
+    Bool_t  fUseMmScale;
+
 public:
     MHHillasSrc(const char *name=NULL, const char *title=NULL);
     ~MHHillasSrc();
+
+    void SetUseMmScale(Bool_t mmscale=kTRUE) { fUseMmScale = mmscale; }
 
     Bool_t SetupFill(const MParList *pList);
Index: /trunk/MagicSoft/Mars/mhist/Makefile
===================================================================
--- /trunk/MagicSoft/Mars/mhist/Makefile	(revision 1215)
+++ /trunk/MagicSoft/Mars/mhist/Makefile	(revision 1216)
@@ -22,5 +22,5 @@
 #  connect the include files defined in the config.mk file
 #
-INCLUDES = -I. -I../mbase -I../mraw -I../manalysis -I../mmc
+INCLUDES = -I. -I../mbase -I../mraw -I../manalysis -I../mmc -I../mgui
 
 #------------------------------------------------------------------------------
