Index: trunk/MagicSoft/Mars/mhist/MHMcEnergies.cc
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHMcEnergies.cc	(revision 859)
+++ trunk/MagicSoft/Mars/mhist/MHMcEnergies.cc	(revision 861)
@@ -23,4 +23,13 @@
 \* ======================================================================== */
 
+/////////////////////////////////////////////////////////////////////////////
+//
+//  MHMcEnergies
+//
+// This class holds and array of MHMcEnergy objects in order to be able
+// to compute the threshold for each of the different trigger conditions
+// in a root file.
+//
+////////////////////////////////////////////////////////////////////////////
 #include "MHMcEnergies.h" 
 
@@ -30,10 +39,11 @@
 ClassImp(MHMcEnergies);
 
+// --------------------------------------------------------------------------
+//
+// Default Constructor.
+//
 MHMcEnergies::MHMcEnergies(const UInt_t count, const char *name, const char *title)
     : fNum(count)
 { 
-    //
-    //   default constructor
-    //
     char aux[25]="MHMcEnergies";
     sprintf(aux+12, "[%i]", fNum);
@@ -48,9 +58,16 @@
 }
 
+// --------------------------------------------------------------------------
+//
+// Default Destructor.
+//
 MHMcEnergies::~MHMcEnergies()
 {
     delete fHists;
 }
-
+// --------------------------------------------------------------------------
+//
+// Add to the parameter list all the MHMcEnergy objects contained in the array.
+//
 void MHMcEnergies::AddEntriesToList(MParList *plist)
 {
Index: trunk/MagicSoft/Mars/mhist/MHMcEnergies.h
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHMcEnergies.h	(revision 859)
+++ trunk/MagicSoft/Mars/mhist/MHMcEnergies.h	(revision 861)
@@ -20,6 +20,6 @@
 {
 private:
-    UInt_t        fNum;
-    TClonesArray *fHists; // histograms
+    UInt_t        fNum;   // Num of histograms
+    TClonesArray *fHists; // Array with the energy histograms
 
 public:
@@ -36,2 +36,3 @@
 
 #endif
+
Index: trunk/MagicSoft/Mars/mhist/MHMcEnergy.cc
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHMcEnergy.cc	(revision 859)
+++ trunk/MagicSoft/Mars/mhist/MHMcEnergy.cc	(revision 861)
@@ -23,4 +23,12 @@
 \* ======================================================================== */
 
+/////////////////////////////////////////////////////////////////////////////
+//
+//  MHMcEnergy
+//
+// This class holds the information ( histogram and fit function )  
+// about the energy threshold for a particular trigger condition.
+//
+////////////////////////////////////////////////////////////////////////////
 #include "MHMcEnergy.h" 
 
@@ -34,9 +42,10 @@
 ClassImp(MHMcEnergy);
 
+// -------------------------------------------------------------------------
+//
+//  Default Constructor.
+//
 MHMcEnergy::MHMcEnergy(const UInt_t idx, const char *name, const char *title)
 { 
-    //
-    //   default constructor
-    //
     char aux[15]="MHMcEnergy";
 
@@ -58,10 +67,13 @@
     if (idx>0)
         sprintf(aux+10, ";%i", idx);
-    hLogEner = new TH1F(aux, "", 100, 0.5, 4.5);
+    hLogEner = new TH1F(aux, "", 40, 0.5, 4.5);
     hLogEner->SetXTitle("log(E) [GeV]");
     hLogEner->SetYTitle("dN/dE");
-    //hLogEner->SetBins(60);
 }
 
+//-------------------------------------------------------------------------
+//
+//  Defualt Destructor
+//
 MHMcEnergy::~MHMcEnergy()
 {
@@ -70,4 +82,8 @@
 }
 
+//--------------------------------------------------------------------------
+//
+//  Fill the histogram with the log10 of the energy for triggered events.
+//
 void MHMcEnergy::Fill(Float_t log10E, Float_t w)
 {
@@ -75,17 +91,21 @@
 }
 
+// -------------------------------------------------------------------------
+//
+// Fitting function
+//
 void MHMcEnergy::Fit(Axis_t xxmin, Axis_t xxmax)
 {
     //
     // 0: don't draw the function (it is drawn together with the histogram)
-    // +: add these function to the list of fits. Don't delete the last fit.
+    // Q: quiet mode
     //
-    // FIXME: R means: use the range specified in the function (xxmin, xxmax are ignored!)
-    //        Q means: quiet (why?)
-    //
-    //
-    hLogEner->Fit(fLogEner->GetName(), "Q0+", "", xxmin, xxmax);
+    hLogEner->Fit(fLogEner->GetName(), "Q0", "", xxmin, xxmax);
 }
 
+// ------------------------------------------------------------------------
+// 
+// Drawing function. It creates its own canvas.
+//
 void MHMcEnergy::Draw(Option_t *option)
 {
@@ -111,4 +131,16 @@
 }
 
+// --------------------------------------------------------------------------
+//
+// Set the number of bins in the histogran.
+//
+void MHMcEnergy::SetBins(Int_t nbins)
+{
+  hLogEner->SetBins(nbins,0.5,4.5);
+}
+// --------------------------------------------------------------------------
+//
+// Write the threshold and its error in the standard output
+//
 void MHMcEnergy::Print(Option_t*)
 {
@@ -116,4 +148,8 @@
 }
 
+// -------------------------------------------------------------------------
+//
+//  Return the threshold
+//
 Float_t MHMcEnergy::GetThreshold() const
 {
@@ -123,4 +159,8 @@
 }
 
+// -------------------------------------------------------------------------
+//
+// Return the error of the threshold.
+//
 Float_t MHMcEnergy::GetThresholdErr() const
 {
@@ -129,7 +169,12 @@
     const Float_t p1err = fLogEner->GetParError(1);
 
+    // The error has into accuont the error in the fit
     return pow(10, p1) * p1err * lg10;
 }
 
+// -------------------------------------------------------------------------
+//
+// Return the peak of the fitted gaussan function.
+//
 Float_t MHMcEnergy::GetGaussPeak() const
 {
@@ -137,4 +182,8 @@
 }
 
+// -------------------------------------------------------------------------
+//
+// Return the sigma of the fitted gaussan function.
+//
 Float_t MHMcEnergy::GetGaussSigma() const
 {
@@ -142,2 +191,5 @@
 }
 
+
+
+
Index: trunk/MagicSoft/Mars/mhist/MHMcEnergy.h
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHMcEnergy.h	(revision 859)
+++ trunk/MagicSoft/Mars/mhist/MHMcEnergy.h	(revision 861)
@@ -32,9 +32,10 @@
     void Fill(Float_t log10E, Float_t w);
     void Fit(Axis_t xxmin, Axis_t xxmax);
+    void SetBins(Int_t nbins = 100);
 
     void Draw(Option_t* option = "");
     void Print(Option_t* option = NULL);
 
-    ClassDef(MHMcEnergy, 1)  // Histogram container for montecarlo energy
+    ClassDef(MHMcEnergy, 1)  // Histogram container for montecarlo energy threshold
 };
 
