Index: trunk/MagicSoft/Mars/mhist/MHCamEvent.cc
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHCamEvent.cc	(revision 2225)
+++ trunk/MagicSoft/Mars/mhist/MHCamEvent.cc	(revision 2229)
@@ -16,5 +16,5 @@
 !
 !
-!   Author(s): Thomas Bretz  12/2002 <mailto:tbretz@astro.uni-wuerzburg.de>
+!   Author(s): Thomas Bretz, 12/2002 <mailto:tbretz@astro.uni-wuerzburg.de>
 !
 !   Copyright: MAGIC Software Development, 2000-2003
@@ -26,4 +26,7 @@
 //
 // MHCamEvent
+//
+// A histogram to store the sum of camera events. This can be photons,
+// currents or enything else derived from MCamEvent
 //
 /////////////////////////////////////////////////////////////////////////////
@@ -131,4 +134,8 @@
 }
 
+// --------------------------------------------------------------------------
+//
+// Return fSum.
+//
 TH1 *MHCamEvent::GetHistByName(const TString name)
 {
Index: trunk/MagicSoft/Mars/mhist/MHCamEvent.h
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHCamEvent.h	(revision 2225)
+++ trunk/MagicSoft/Mars/mhist/MHCamEvent.h	(revision 2229)
@@ -12,6 +12,6 @@
 {
 private:
-    MHCamera *fSum;      // storing the sum
-    MCamEvent   *fEvt;      //! the current event
+    MHCamera  *fSum; // storing the sum
+    MCamEvent *fEvt; //! the current event
 
     TString fNameEvt;
Index: trunk/MagicSoft/Mars/mhist/MHCamera.cc
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHCamera.cc	(revision 2225)
+++ trunk/MagicSoft/Mars/mhist/MHCamera.cc	(revision 2229)
@@ -28,9 +28,8 @@
 // MHCamera
 //
-// Camera Display. The Pixels are displayed in
-// contents/area [somthing/mm^2]
-//
-// To change the scale to a logarithmic scale SetLogz() of the Pad.
-//
+// Camera Display, based on a TH1D. Pleas be carefull using the
+// underlaying TH1D.
+//
+// To change the scale to a logarithmic scale SetLogy() of the Pad.
 //
 ////////////////////////////////////////////////////////////////////////////
@@ -44,5 +43,4 @@
 #include <TLatex.h>
 #include <TStyle.h>
-#include <TMarker.h>
 #include <TCanvas.h>
 #include <TArrayF.h>
@@ -57,7 +55,4 @@
 #include "MGeomCam.h"
 
-#include "MRflEvtData.h"
-#include "MRflSinglePhoton.h"
-
 #include "MCerPhotPix.h"
 #include "MCerPhotEvt.h"
@@ -85,5 +80,4 @@
     SetDirectory(NULL);
 
-    fPhotons   = NULL;
     fNotify  = NULL;
 
@@ -97,5 +91,7 @@
 // ------------------------------------------------------------------------
 //
-//  Constructor. Makes a clone of MGeomCam.
+//  Constructor. Makes a clone of MGeomCam. Removed the TH1D from the
+// current directory. Calls Sumw2(). Set the histogram line color
+// (for error bars) to Green and the marker style to kFullDotMedium.
 //
 MHCamera::MHCamera(const MGeomCam &geom, const char *name, const char *title)
@@ -121,6 +117,4 @@
     //    register BIT(8) as kNoContextMenu. If an object has this bit set it will
     //    not get an automatic context menu when clicked with the right mouse button.
-
-    fPhotons = new TClonesArray("TMarker", 0);
 
     //
@@ -139,13 +133,8 @@
 // ------------------------------------------------------------------------
 //
-// Destructor. Deletes TClonesArrays for hexagons and legend elements.
+// Destructor. Deletes the cloned fGeomCam and the notification list.
 //
 MHCamera::~MHCamera()
 {
-    if (fPhotons)
-    {
-        fPhotons->Delete();
-        delete fPhotons;
-    }
     if (fGeomCam)
         delete fGeomCam;
@@ -154,6 +143,9 @@
 }
 
-Int_t MHCamera::Fill(Axis_t x)
-{
+// ------------------------------------------------------------------------
+//
+// Taken from TH1D::Fill(). Uses the argument directly as bin index.
+// Doesn't increment the number of entries.
+//
 //   -*-*-*-*-*-*-*-*Increment bin with abscissa X by 1*-*-*-*-*-*-*-*-*-*-*
 //                   ==================================
@@ -167,4 +159,6 @@
 //
 //   -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
+Int_t MHCamera::Fill(Axis_t x)
+{
 
 #if ROOT_VERSION_CODE > ROOT_VERSION(3,05,00)
@@ -186,7 +180,9 @@
 }
 
-//______________________________________________________________________________
-Int_t MHCamera::Fill(Axis_t x, Stat_t w)
-{
+// ------------------------------------------------------------------------
+//
+// Taken from TH1D::Fill(). Uses the argument directly as bin index.
+// Doesn't increment the number of entries.
+//
 //   -*-*-*-*-*-*Increment bin with abscissa X with a weight w*-*-*-*-*-*-*-*
 //               =============================================
@@ -200,5 +196,6 @@
 //
 //   -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
-
+Int_t MHCamera::Fill(Axis_t x, Stat_t w)
+{
 #if ROOT_VERSION_CODE > ROOT_VERSION(3,05,00)
    if (fBuffer) return BufferFill(x,w);
@@ -310,5 +307,9 @@
 }
 
-
+// ------------------------------------------------------------------------
+//
+// Resizes the current pad so that the camera is displayed in its
+// correct aspect ratio
+//
 void MHCamera::SetRange()
 {
@@ -349,4 +350,8 @@
 }
 
+// ------------------------------------------------------------------------
+//
+// Updates the pixel colors and paints the pixels
+//
 void MHCamera::Update(Bool_t islog, Bool_t isbox, Bool_t iscol)
 {
@@ -383,4 +388,8 @@
 }
 
+// ------------------------------------------------------------------------
+//
+// Print minimum and maximum
+//
 void MHCamera::Print(Option_t *) const
 {
@@ -395,4 +404,8 @@
 }
 
+// ------------------------------------------------------------------------
+//
+// Paint the y-axis title
+//
 void MHCamera::PaintAxisTitle()
 {
@@ -412,4 +425,8 @@
 }
 
+// ------------------------------------------------------------------------
+//
+// Paint the histogram title
+//
 void MHCamera::PaintTitle()
 {
@@ -485,7 +502,5 @@
 // ------------------------------------------------------------------------
 //
-// This is called at any time the canvas should get repainted.
-// Here we maintain an aspect ratio of 1.15. This makes sure,
-// that the camera image doesn't get distorted by resizing the canvas.
+// Paints the camera.
 //
 void MHCamera::Paint(Option_t *o)
@@ -517,6 +532,4 @@
 
     // Paint primitives (pixels, color legend, photons, ...)
-    { fPhotons->ForEach(TObject, Paint)(); }
-
     PaintTitle();
     PaintAxisTitle();
@@ -525,5 +538,5 @@
 // ------------------------------------------------------------------------
 //
-//  With this function you can change the color palette. For more
+// With this function you can change the color palette. For more
 // information see TStyle::SetPalette. Only palettes with 50 colors
 // are allowed.
@@ -580,5 +593,5 @@
 }
 
-void MHCamera::DrawPixelNumbers()
+void MHCamera::DrawPixelIndices()
 {
     for (int i=0; i<kItemsLegend; i++)
@@ -605,5 +618,6 @@
 // ------------------------------------------------------------------------
 //
-// Call this function to fill the currents
+// Call this function to add a MCamEvent on top of the present contents.
+// Only 'used' pixels are added.
 //
 void MHCamera::AddCamContent(const MCamEvent &event, Int_t type)
@@ -617,5 +631,4 @@
 
         Fill(idx, val); // FIXME: Slow!
-        //fArray[idx+1]+=val;
     }
     fEntries++;
@@ -624,5 +637,10 @@
 // ------------------------------------------------------------------------
 //
-// Call this function to fill the currents
+// Call this function to add a MHCamera on top of the present contents.
+// Only 'used' pixels are added.
+// Type:
+//  0) bin content
+//  1) errors
+//  2) rel. errors
 //
 void MHCamera::AddCamContent(const MHCamera &d, Int_t type)
@@ -657,12 +675,15 @@
 // ------------------------------------------------------------------------
 //
-// Call this function to fill the currents
+// Call this function to add a TArrayD on top of the present contents.
+// Only 'used' pixels are added.
 //
 void MHCamera::AddCamContent(const TArrayD &event, Bool_t ispos)
 {
+    if (event.GetSize()!=fNcells-2)
+        return;
+
     for (Int_t idx=0; idx<fNcells-2; idx++)
     {
         Fill(idx, const_cast<TArrayD&>(event)[idx]); // FIXME: Slow!
-        //fArray[idx+1]+=val;
 
         if (!ispos || fArray[idx+1]>0)
@@ -674,5 +695,6 @@
 // ------------------------------------------------------------------------
 //
-// Call this function to fill the currents
+// Call this function to add a MCamEvent on top of the present contents.
+// 1 is added to each pixel if the contents of MCamEvent>threshold
 //
 void MHCamera::CntCamContent(const MCamEvent &event, Double_t threshold, Int_t type)
@@ -693,8 +715,12 @@
 // ------------------------------------------------------------------------
 //
-// Call this function to fill the currents
+// Call this function to add a TArrayD on top of the present contents.
+// 1 is added to each pixel if the contents of MCamEvent>threshold
 //
 void MHCamera::CntCamContent(const TArrayD &event, Double_t threshold, Bool_t ispos)
 {
+    if (event.GetSize()!=fNcells-2)
+        return;
+
     for (Int_t idx=0; idx<fNcells-2; idx++)
     {
@@ -708,4 +734,8 @@
 }
 
+// ------------------------------------------------------------------------
+//
+// Fill the pixels with random contents.
+//
 void MHCamera::FillRandom()
 {
@@ -752,28 +782,4 @@
 {
     FillLevels(event, clean.GetCleanLvl1(), clean.GetCleanLvl2());
-}
-
-// ------------------------------------------------------------------------
-//
-// Show a reflector event. EMarkerStyle is defined in root/include/Gtypes.h
-// To remove the photons from the display call FillRflEvent(NULL)
-//
-void MHCamera::ShowRflEvent(const MRflEvtData *event, EMarkerStyle ms)
-{
-    const Int_t num = event ? event->GetNumPhotons() : 0;
-
-    fPhotons->ExpandCreate(num);
-    if (num < 1)
-        return;
-
-    Int_t i=num-1;
-    do
-    {
-        const MRflSinglePhoton &ph = event->GetPhoton(i);
-        TMarker &m = *static_cast<TMarker*>(fPhotons->UncheckedAt(i));
-        m.SetX(ph.GetX());
-        m.SetY(ph.GetY());
-        m.SetMarkerStyle(ms);
-    } while (i--);
 }
 
@@ -917,5 +923,5 @@
 // with the graphical primitive with the mouse!!!
 //
-// All calcutations are running in pixel coordinates
+// All calcutations are done in pixel coordinates
 //
 Int_t MHCamera::DistancetoPrimitive(Int_t px, Int_t py)
@@ -939,16 +945,4 @@
 // ------------------------------------------------------------------------
 //
-// Execute a mouse event on the camera
-//
-/*
- void MHCamera::ExecuteEvent(Int_t event, Int_t px, Int_t py)
- {
- cout << "Execute Event Camera " << event << " @ " << px << " " << py << endl;
- }
- */
-
-
-// ------------------------------------------------------------------------
-//
 // Function introduced  (31-01-03)  WILL BE REMOVED IN THE FUTURE! DON'T
 // USE IT!
@@ -960,4 +954,9 @@
 }
 
+// ------------------------------------------------------------------------
+//
+// Function introduced  (31-01-03)  WILL BE REMOVED IN THE FUTURE! DON'T
+// USE IT!
+//
 Int_t MHCamera::GetPixelIndex(Int_t px, Int_t py) const
 {
@@ -1019,5 +1018,5 @@
     cout << "Contents:             " << fArray[idx+1] << "  <";
     cout << (IsUsed(idx)?"on":"off");
-    cout << ">" << endl << endl;
+    cout << ">" << endl;
 
     if (fNotify && fNotify->GetSize()>0)
Index: trunk/MagicSoft/Mars/mhist/MHCamera.h
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHCamera.h	(revision 2225)
+++ trunk/MagicSoft/Mars/mhist/MHCamera.h	(revision 2229)
@@ -5,7 +5,4 @@
 #include "MAGIC.h"
 #endif
-#ifndef ROOT_Gtypes
-#include <Gtypes.h>
-#endif
 #ifndef ROOT_TArrayC
 #include <TArrayC.h>
@@ -21,30 +18,15 @@
 #endif
 
-#include "MGeomCam.h"
-#include "MGeomPix.h"
-class TBox;
-class TText;
-class TArrow;
-class TGStatusBar;
-
 class MGeomCam;
-class MHexagon;
-class MCurrents;
 class MCamEvent;
 class MRflEvtData;
 class MCerPhotEvt;
-class MCerPhotPix;
 class MImgCleanStd;
-class MPedestalPix;
-class MPedestalCam;
 
 class MHCamera : public TH1D
 {
 private:
-    MGeomCam      *fGeomCam;     // pointer to camera geometry
-
-    TArrayC        fUsed;
-
-    TClonesArray  *fPhotons;     // array of reflector photons
+    MGeomCam      *fGeomCam;     // pointer to camera geometry (y-axis)
+    TArrayC        fUsed;        // array containing flags
 
     TArrayI        fColors;      //! Color conversion table
@@ -121,5 +103,4 @@
     Double_t GetMaximum() const { return GetMaximum(0/*kTRUE*/); }
 
-    void  ShowRflEvent(const MRflEvtData *event=NULL, EMarkerStyle m=kFullDotMedium);
     void  FillLevels(const MCerPhotEvt &event, Float_t lvl1, Float_t lvl2);
     void  FillLevels(const MCerPhotEvt &event, const MImgCleanStd &clean);
@@ -129,5 +110,5 @@
     void  FillRandom();
 
-    void  DrawPixelNumbers();
+    void  DrawPixelIndices();
 
     void  PrintInfo() const { Print(""); } // *MENU*
Index: trunk/MagicSoft/Mars/mhist/MHTriggerLvl0.cc
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHTriggerLvl0.cc	(revision 2225)
+++ trunk/MagicSoft/Mars/mhist/MHTriggerLvl0.cc	(revision 2229)
@@ -28,16 +28,10 @@
 // MHTriggerLvl0
 //
-// This is intended to be a sort of "level 0 trigger display". What it really
-// does is to store the number of events of a data file in which each pixel 
-// has gone above a given threshold (fPixelThreshold) which is chosen when
-// calling the constructor. Displaying a camera view with these values can
-// help identify noisy pixels. See the macro pixfixrate.C to see an example
-// of its use. Many things are to be fixed. Only inner pixels are shown now
-// (which are anyhow those involved in the trigger), and the camera geometry
-// (number of pixels, and how many inner ones) is not yet read from the input 
-// file. 
-// The "pedestal" we are using is just the signal in the first ADC slice 
-// (seems reasonable from the inspection of the available test data files).
-//
+// This is intended to be a sort of "level 0 trigger display". What it
+// really does is to store the number of events of a data file in which
+// each pixel has gone above a given threshold (fPixelThreshold) which
+// is chosen when calling the constructor. Displaying a camera view with
+// these values can help identify noisy pixels. See the macro pixfixrate.C
+// to see an example of its use.
 //
 /////////////////////////////////////////////////////////////////////////////
@@ -118,5 +112,5 @@
 // --------------------------------------------------------------------------
 //
-// Fill the histograms with data from a MCerPhotEvt-Container.
+// Fill the histograms with data from a MCamEvent-Container.
 //
 Bool_t MHTriggerLvl0::Fill(const MParContainer *par, const Stat_t w)
@@ -136,5 +130,5 @@
 // --------------------------------------------------------------------------
 //
-// Set to Unused outer pixels.
+// Scale by the number of events
 //
 Bool_t MHTriggerLvl0::Finalize()
Index: trunk/MagicSoft/Mars/mhist/MHTriggerLvl0.h
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHTriggerLvl0.h	(revision 2225)
+++ trunk/MagicSoft/Mars/mhist/MHTriggerLvl0.h	(revision 2229)
@@ -12,6 +12,6 @@
 {
 private:
-    MHCamera *fSum;      // storing the sum
-    MCamEvent   *fEvt;      //! the current event
+    MHCamera  *fSum;  // storing the sum
+    MCamEvent *fEvt;  //! the current event
 
     TString fNameEvt;
@@ -36,5 +36,5 @@
     void Draw(Option_t * ="");
 
-    ClassDef(MHTriggerLvl0, 1) // Histogram to sum level 0 triggers in all pixels
+    ClassDef(MHTriggerLvl0, 1) // Histogram to count how often a pixel is above threshold
 };
 
