Index: trunk/MagicSoft/Mars/mcalib/MHCalibrationChargeBlindPix.cc
===================================================================
--- trunk/MagicSoft/Mars/mcalib/MHCalibrationChargeBlindPix.cc	(revision 3638)
+++ trunk/MagicSoft/Mars/mcalib/MHCalibrationChargeBlindPix.cc	(revision 3639)
@@ -27,11 +27,12 @@
 //  MHCalibrationChargeBlindPix
 //
-//  Histogram container for the calibration Blind Pixel information
-//  Extracts the signal stored in MExtractedSignalBlindPixel , histograms and fits it.
-//  Performs the Single Photo-electron fit to extract the Poisson mean and its errors
-//
-//  Different fits can be chosen with the function ChangeFitFunc()
-//
-//  The fit result is accepted under condition that:
+//  Histogram class for the charge calibration of the Blind Pixel.
+//  Stores and fits the charges and stores the averaged assumed pedestal and 
+//  single-phe FADC slice entries. Charges are taken from MExtractedSignalBlindPix.
+//  Performs the Single Photo-electron fit to extract the Poisson mean and its errors.
+//
+//  Different fits can be chosen with the function ChangeFitFunc().
+//
+//  The fit result is accepted under the condition that:
 //  1) the Probability is greater than fProbLimit (default 0.001 == 99.7%)
 //  2) at least fNumSinglePheLimit events are found in the single Photo-electron peak
@@ -105,9 +106,10 @@
 //
 // Sets: 
-// - the default number for MHGausEvents::fNbins  (fgChargeNbins)
-// - the default number for MHGausEvents::fFirst  (fgChargeFirst)
-// - the default number for MHGausEvents::fLast   (fgChargeLast)
+// - the default number for fNbins        (fgChargeNbins)
+// - the default number for fFirst        (fgChargeFirst)
+// - the default number for fLast         (fgChargeLast)
 // - the default number for fSinglePheCut (fgSingePheCut)
 // - the default number for fNumSinglePheLimit (fgNumSinglePheLimit)
+// - the default number of bins after stripping (30)
 //
 // - the default name of the  fHGausHist ("HCalibrationChargeBlindPix")
@@ -118,7 +120,7 @@
 // Initializes:
 // - all pointers to NULL
-// - all variables to 0., except the fit result variables to -999.
-// - all flags to kFALSE
-// - the default Fit function to kEPoisson5
+//
+// Calls:
+// - Clear()
 //
 MHCalibrationChargeBlindPix::MHCalibrationChargeBlindPix(const char *name, const char *title)
@@ -130,5 +132,5 @@
 
     fName  = name  ? name  : "MHCalibrationChargeBlindPix";
-    fTitle = title ? title : "Fill the accumulated charges and times of all Blind Pixel events and perform fits";
+    fTitle = title ? title : "Statistics of the FADC sums of Blind Pixel calibration events";
 
     SetNbins( fgChargeNbins );
@@ -183,9 +185,11 @@
 // - all flags to kFALSE
 // - all pointers to NULL
+// - the default fit function (kEPoisson5)
 //
 // Deletes: 
 // - all pointers unequal NULL
 //
-// Executes MHCalibrationChargePix::Clear()
+// Calls:
+// - MHCalibrationChargePix::Clear()
 //
 void MHCalibrationChargeBlindPix::Clear(Option_t *o)
@@ -248,4 +252,8 @@
 }
 
+// --------------------------------------------------------------------------
+//
+// Set bit kSinglePheFitOK from outside
+//
 void MHCalibrationChargeBlindPix::SetSinglePheFitOK (const Bool_t b) 
 {
@@ -253,4 +261,8 @@
 }
 
+// --------------------------------------------------------------------------
+//
+// Set bit kPedestalFitOK from outside
+//
 void MHCalibrationChargeBlindPix::SetPedestalFitOK(const Bool_t b)
 {
@@ -258,4 +270,8 @@
 }
 
+// --------------------------------------------------------------------------
+//
+// Ask for status of bit kSinglePheFitOK 
+//
 const Bool_t  MHCalibrationChargeBlindPix::IsSinglePheFitOK()     const 
 {
@@ -263,4 +279,8 @@
 }
 
+// --------------------------------------------------------------------------
+//
+// Ask for status of bit kPedestalFitOK 
+//
 const Bool_t  MHCalibrationChargeBlindPix::IsPedestalFitOK()  const
 {
@@ -278,5 +298,6 @@
 // - fAPedestalFADCSlices(0);
 //
-// Sets Binning of the fHGausHist
+// Calls:
+// - MHGausHist::InitBins()
 //
 Bool_t MHCalibrationChargeBlindPix::SetupFill(const MParList *pList) 
@@ -384,5 +405,5 @@
 // Returns kFALSE, if empty
 //
-// - Creates the fourier spectrum and sets bit IsFourierSpectrumOK()
+// - Creates the fourier spectrum and sets bit MHGausEvents::IsFourierSpectrumOK()
 // - Retrieves the pedestals from MExtractedSignalBlindPixel
 // - Normalizes fASinglePheFADCSlices and fAPedestalFADCSlices
Index: trunk/MagicSoft/Mars/mcalib/MHCalibrationChargeBlindPix.h
===================================================================
--- trunk/MagicSoft/Mars/mcalib/MHCalibrationChargeBlindPix.h	(revision 3638)
+++ trunk/MagicSoft/Mars/mcalib/MHCalibrationChargeBlindPix.h	(revision 3639)
@@ -27,7 +27,7 @@
 private:
 
-  static const Int_t    fgChargeNbins;       //! Default for MHGausEvents::fNBins  (now set to: 5300   )
-  static const Axis_t   fgChargeFirst;       //! Default for MHGausEvents::fFirst  (now set to: -100.5 )
-  static const Axis_t   fgChargeLast;        //! Default for MHGausEvents::fLast   (now set to: 5199.5 )
+  static const Int_t    fgChargeNbins;       //! Default for fNBins        (now set to: 5300   )
+  static const Axis_t   fgChargeFirst;       //! Default for fFirst        (now set to: -100.5 )
+  static const Axis_t   fgChargeLast;        //! Default for fLast         (now set to: 5199.5 )
   static const Float_t  fgSinglePheCut;      //! Default for fSinglePheCut (now set to: 200   )
   static const Float_t  fgNumSinglePheLimit; //! Default for fNumSinglePheLimit (now set to: 50  )
@@ -502,5 +502,5 @@
 
   
-  ClassDef(MHCalibrationChargeBlindPix, 1)  // Histogram class for the Calibration Blind Pixel
+  ClassDef(MHCalibrationChargeBlindPix, 1)  // Histogram class for Charge Blind Pixel Calibration
 };
 
Index: trunk/MagicSoft/Mars/mcalib/MHCalibrationChargeCam.cc
===================================================================
--- trunk/MagicSoft/Mars/mcalib/MHCalibrationChargeCam.cc	(revision 3638)
+++ trunk/MagicSoft/Mars/mcalib/MHCalibrationChargeCam.cc	(revision 3639)
@@ -29,18 +29,19 @@
 // MHCalibrationChargeHiGainPix and MHCalibrationChargeLoGainPix for every:
 //
-// - pixel, stored in the TObjArray's MHCalibrationCam::fHiGainArray and 
+// - Pixel, stored in the TObjArray's MHCalibrationCam::fHiGainArray and 
 //   MHCalibrationCam::fLoGainArray
 //
-// - average pixel per area index (e.g. inner and outer for the MAGIC camera), 
+// - Average pixel per AREA index (e.g. inner and outer for the MAGIC camera), 
 //   stored in the TObjArray's MHCalibrationCam::fAverageHiGainAreas and 
 //   MHCalibrationCam::fAverageLoGainAreas
 //
-// - average pixel per camera sector (e.g. sectors 1-6 for the MAGIC camera), 
+// - Average pixel per camera SECTOR (e.g. sectors 1-6 for the MAGIC camera), 
 //   stored in the TObjArray's MHCalibrationCam::fAverageHiGainSectors and 
 //   MHCalibrationCam::fAverageLoGainSectors
 // 
-// Every signal is filled into a Charge histogram and an array, in order to perform 
-// a Fourier analysis (see MHGausEvents). The signals are moreover averaged on an 
-// event-by-event basis and written into the corresponding average pixels
+// Every signal is taken from MExtractedSignalCam and filled into a histogram and 
+// an array, in order to perform a Fourier analysis (see MHGausEvents). 
+// The signals are moreover averaged on an event-by-event basis and written into 
+// the corresponding average pixels.
 //
 // Additionally, the (FADC slice) position of the maximum is stored in an Absolute 
@@ -50,14 +51,16 @@
 // The Charge histograms are fitted to a Gaussian, mean and sigma with its errors 
 // and the fit probability are extracted. If none of these values are NaN's and 
-// if the probability is bigger than fProbLimit (default: 0.5%), the fit is valid.
-// Otherwise, the fit is repeated within ranges of the previous mean +- 5 sigma. 
+// if the probability is bigger than MHGausEvents::fProbLimit (default: 0.5%), 
+// the fit is declared valid.
+// Otherwise, the fit is repeated within ranges of the previous mean 
+// +- MHGausEvents::fPickupLimit (default: 5) sigma (see MHGausEvents::RepeatFit())
 // In case this does not make the fit valid, the histogram means and RMS's are 
-// taken directly and the following flags are set:
+// taken directly (see MHGausEvents::BypassFit()) and the following flags are set:
 // - MBadPixelsPix::SetUncalibrated( MBadPixelsPix::kHiGainNotFitted ) or  
 // - MBadPixelsPix::SetUncalibrated( MBadPixelsPix::kLoGainNotFitted ) and 
 // - MBadPixelsPix::SetUnsuitable(   MBadPixelsPix::kUnreliableRun   ) 
 // 
-// Outliers of more than MHCalibrationChargePix::fPickupLimit (default: 5) sigmas 
-// from the mean are counted as PickUp events (stored in MHCalibrationChargePix::fPickup) 
+// Outliers of more than MHGausEvents::fPickupLimit (default: 5) sigmas 
+// from the mean are counted as Pickup events (stored in MHGausEvents::fPickup) 
 //
 // Unless more than fNumHiGainSaturationLimit (default: 1%) of the overall FADC 
@@ -74,5 +77,5 @@
 // spectrum and investigates if the projected fourier components follow an exponential 
 // distribution. In case that the probability of the exponential fit is less than 
-// fProbLimit (default: 0.5%), the following flags are set:
+// MHGausEvents::fProbLimit (default: 0.5%), the following flags are set:
 // - MBadPixelsPix::SetUncalibrated( MBadPixelsPix::kHiGainOscillating ) or
 // - MBadPixelsPix::SetUncalibrated( MBadPixelsPix::kLoGainOscillating ) and
@@ -83,24 +86,21 @@
 // The following results are written into MCalibrationChargeCam:
 //
-// - MCalibrationChargePix::SetHiGainSaturation(Bool_t b) 
-// - MCalibrationChargePix::SetHiGainMeanCharge()
-// - MCalibrationChargePix::SetHiGainMeanChargeErr()
-// - MCalibrationChargePix::SetHiGainSigmaCharge()
-// - MCalibrationChargePix::SetHiGainSigmaChargeErr()
-// - MCalibrationChargePix::SetHiGainChargeProb()
-// - MCalibrationChargePix::SetHiGainNumPickup()
-//
-// - MCalibrationChargePix::SetLoGainMeanCharge()
-// - MCalibrationChargePix::SetLoGainMeanChargeErr()
-// - MCalibrationChargePix::SetLoGainSigmaCharge()
-// - MCalibrationChargePix::SetLoGainSigmaChargeErr()
-// - MCalibrationChargePix::SetLoGainChargeProb()
-// - MCalibrationChargePix::SetLoGainNumPickup()
+// - MCalibrationPix::SetHiGainSaturation() 
+// - MCalibrationPix::SetHiGainMean()
+// - MCalibrationPix::SetHiGainMeanErr()
+// - MCalibrationPix::SetHiGainSigma()
+// - MCalibrationPix::SetHiGainSigmaErr()
+// - MCalibrationPix::SetHiGainProb()
+// - MCalibrationPix::SetHiGainNumPickup()
+//
+// - MCalibrationPix::SetLoGainMean()
+// - MCalibrationPix::SetLoGainMeanErr()
+// - MCalibrationPix::SetLoGainSigma()
+// - MCalibrationPix::SetLoGainSigmaErr()
+// - MCalibrationPix::SetLoGainProb()
+// - MCalibrationPix::SetLoGainNumPickup()
 //
 // - MCalibrationChargePix::SetAbsTimeMean()
 // - MCalibrationChargePix::SetAbsTimeRms()
-//
-// The last two items are filled with the Hi-Gain or Lo-Gain result, depending on 
-// the saturation status. 
 //
 // For all averaged areas, the fitted sigma is multiplied with the square root of 
@@ -191,10 +191,22 @@
 // - MExtractedSignalCam
 //
-// Calls InitializeHists() for every entry in:
+// Initializes, if empty to MGeomCam::GetNumPixels():
+// - MHCalibrationCam::fHiGainArray, MHCalibrationCam::fLoGainArray
+//
+// Initializes, if empty to MGeomCam::GetNumAreas() for:
+// - MHCalibrationCam::fAverageHiGainAreas, MHCalibrationCam::fAverageLoGainAreas
+//
+// Initializes, if empty to MGeomCam::GetNumSectors() for:
+// - MHCalibrationCam::fAverageHiGainSectors, MHCalibrationCam::fAverageLoGainSectors
+//
+// Calls MHCalibrationCam::InitHists() for every entry in:
 // - MHCalibrationCam::fHiGainArray, MHCalibrationCam::fLoGainArray
 // - MHCalibrationCam::fAverageHiGainAreas, MHCalibrationCam::fAverageLoGainAreas
 // - MHCalibrationCam::fAverageHiGainSectors, MHCalibrationCam::fAverageLoGainSectors
 //
-// Sets Titles and Names for the Charge Histograms and 
+// Sets Titles and Names for the Charge Histograms:
+// - MHCalibrationCam::fAverageHiGainAreas
+// - MHCalibrationCam::fAverageHiGainSectors
+// 
 // Sets number of bins to MHCalibrationCam::fAverageNbins for:
 // - MHCalibrationCam::fAverageHiGainAreas, MHCalibrationCam::fAverageLoGainAreas
@@ -502,10 +514,9 @@
 //    otherwise the Hi-Gain ones.
 // 4) Calls to MHCalibrationCam::FitHiGainArrays() and MCalibrationCam::FitLoGainArrays() 
-//    and sets the flags (if  occurring):
+//    with the flags:
 //    - MBadPixelsPix::SetUncalibrated( MBadPixelsPix::kHiGainNotFitted )
 //    - MBadPixelsPix::SetUncalibrated( MBadPixelsPix::kLoGainNotFitted )
 //    - MBadPixelsPix::SetUncalibrated( MBadPixelsPix::kHiGainOscillating )
 //    - MBadPixelsPix::SetUncalibrated( MBadPixelsPix::kLoGainOscillating )
-// 5) Retrieves the results and store them in MCalibrationChargePix
 //
 Bool_t MHCalibrationChargeCam::FinalizeHists()
@@ -652,16 +663,12 @@
 // --------------------------------------------------------------------------
 //
-// Takes the decisions under which conditions a pixel is declared:
-// MBadPixelsPix::kUnsuitableRun  or MBadPixelsPix::kUnreliableRun, namely:
-// * if MBadPixelsPix::kHiGainNotFitted   and !MCalibrationPix::IsHiGainSaturation()
-//   sets MBadPixelsPix::kUnreliableRun 
-// * if MBadPixelsPix::kHiGainOscillating and !MCalibrationPix::IsHiGainSaturation()
-//   sets MBadPixelsPix::kUnreliableRun 
-// * if MBadPixelsPix::kLoGainNotFitted   and  MCalibrationPix::IsLoGainSaturation()
-//   sets MBadPixelsPix::kUnreliableRun 
-// * if MBadPixelsPix::kLoGainOscillating and  MCalibrationPix::IsLoGainSaturation()
-//   sets MBadPixelsPix::kUnreliableRun 
-// * if MBadPixelsPix::kLoGainSaturation
-//   sets MBadPixelsPix::kUnsuitableRun 
+// Sets all pixels to MBadPixelsPix::kUnsuitableRun, if following flags are set:
+// - MBadPixelsPix::kLoGainSaturation
+//
+// Sets all pixels to MBadPixelsPix::kUnreliableRun, if following flags are set:
+// - if MBadPixelsPix::kHiGainNotFitted   and !MCalibrationPix::IsHiGainSaturation()
+// - if MBadPixelsPix::kHiGainOscillating and !MCalibrationPix::IsHiGainSaturation()
+// - if MBadPixelsPix::kLoGainNotFitted   and  MCalibrationPix::IsLoGainSaturation()
+// - if MBadPixelsPix::kLoGainOscillating and  MCalibrationPix::IsLoGainSaturation()
 //
 void MHCalibrationChargeCam::FinalizeBadPixels()
@@ -705,5 +712,5 @@
 // --------------------------------------------------------------------------
 //
-// What MHCamera needs in order to draw an individual pixel in the camera
+// Calls MHGausEvents::DrawClone() for pixel idx
 //
 void MHCalibrationChargeCam::DrawPixelContent(Int_t idx) const
Index: trunk/MagicSoft/Mars/mcalib/MHCalibrationChargeCam.h
===================================================================
--- trunk/MagicSoft/Mars/mcalib/MHCalibrationChargeCam.h	(revision 3638)
+++ trunk/MagicSoft/Mars/mcalib/MHCalibrationChargeCam.h	(revision 3639)
@@ -46,5 +46,5 @@
   void   DrawPixelContent( Int_t num )  const;    
 
-  ClassDef(MHCalibrationChargeCam, 1)	// Histogram class for camera charge calibration 
+  ClassDef(MHCalibrationChargeCam, 1)	// Histogram class for Charge Camera Calibration 
 };
 
Index: trunk/MagicSoft/Mars/mcalib/MHCalibrationChargeHiGainPix.cc
===================================================================
--- trunk/MagicSoft/Mars/mcalib/MHCalibrationChargeHiGainPix.cc	(revision 3638)
+++ trunk/MagicSoft/Mars/mcalib/MHCalibrationChargeHiGainPix.cc	(revision 3639)
@@ -27,5 +27,7 @@
 //  MHCalibrationChargeHiGainPix
 //
-//  Store the histogrammed Hi Gain summed FADC slices and the arrival times
+//  Histogram class for the charge High Gain FADC calibration. 
+//  Stores and fits the charges and stores the location of the maximum FADC 
+//  slice. Charges are taken from MExtractedSignalPix.
 //
 //////////////////////////////////////////////////////////////////////////////
@@ -33,15 +35,4 @@
 
 #include <TH1.h>
-#include <TPad.h>
-#include <TVirtualPad.h>
-#include <TCanvas.h>
-
-#include "MLog.h"
-#include "MLogManip.h"
-
-#include "MParList.h"
-
-#include "MExtractedSignalCam.h"
-
 
 ClassImp(MHCalibrationChargeHiGainPix);
Index: trunk/MagicSoft/Mars/mcalib/MHCalibrationChargeHiGainPix.h
===================================================================
--- trunk/MagicSoft/Mars/mcalib/MHCalibrationChargeHiGainPix.h	(revision 3638)
+++ trunk/MagicSoft/Mars/mcalib/MHCalibrationChargeHiGainPix.h	(revision 3639)
@@ -12,10 +12,10 @@
 private:
 
-  static const Int_t   fgChargeNbins;     // Default for MHGausEvents::fNbins (now set to: 2000  )
-  static const Axis_t  fgChargeFirst;     // Default for MHGausEvents::fFirst (now set to: -0.5  )
-  static const Axis_t  fgChargeLast;      // Default for MHGausEvents::fLast  (now set to: 1999.5)
-  static const Int_t   fgAbsTimeNbins;    // Default for fAbsTimeNbins        (now set to: 20    )
-  static const Axis_t  fgAbsTimeFirst;    // Default for fAbsTimeFirst        (now set to: -0.5  )
-  static const Axis_t  fgAbsTimeLast;     // Default for fAbsTimeLast         (now set to: 19.5  )
+  static const Int_t   fgChargeNbins;     // Default for fNbins        (now set to: 2000  )
+  static const Axis_t  fgChargeFirst;     // Default for fFirst        (now set to: -0.5  )
+  static const Axis_t  fgChargeLast;      // Default for fLast         (now set to: 1999.5)
+  static const Int_t   fgAbsTimeNbins;    // Default for fAbsTimeNbins (now set to: 20    )
+  static const Axis_t  fgAbsTimeFirst;    // Default for fAbsTimeFirst (now set to: -0.5  )
+  static const Axis_t  fgAbsTimeLast;     // Default for fAbsTimeLast  (now set to: 19.5  )
 
 public:
@@ -29,5 +29,5 @@
   void SetAbsTimeLast (const Axis_t last =fgAbsTimeLast)         { fAbsTimeLast  = last;    }
 
-  ClassDef(MHCalibrationChargeHiGainPix, 1)  // Histogram class for High Gain part of Calibration Pixel 
+  ClassDef(MHCalibrationChargeHiGainPix, 1)  // Histogram class for Charge High Gain Pixel Calibration 
 };
 
Index: trunk/MagicSoft/Mars/mcalib/MHCalibrationChargeLoGainPix.cc
===================================================================
--- trunk/MagicSoft/Mars/mcalib/MHCalibrationChargeLoGainPix.cc	(revision 3638)
+++ trunk/MagicSoft/Mars/mcalib/MHCalibrationChargeLoGainPix.cc	(revision 3639)
@@ -27,5 +27,7 @@
 //  MHCalibrationChargeLoGainPix
 //
-//  Store the histogrammed Hi Gain summed FADC slices and the arrival times
+//  Histogram class for the charge Low Gain FADC calibration. 
+//  Stores and fits the charges and stores the location of the maximum FADC 
+//  slice. Charges are taken from MExtractedSignalPix.
 //
 //////////////////////////////////////////////////////////////////////////////
@@ -33,15 +35,4 @@
 
 #include <TH1.h>
-#include <TPad.h>
-#include <TVirtualPad.h>
-#include <TCanvas.h>
-
-#include "MLog.h"
-#include "MLogManip.h"
-
-#include "MParList.h"
-
-#include "MExtractedSignalCam.h"
-
 
 ClassImp(MHCalibrationChargeLoGainPix);
@@ -99,13 +90,2 @@
 
 
-
-
-
-
-
-
-
-
-
-
-
Index: trunk/MagicSoft/Mars/mcalib/MHCalibrationChargeLoGainPix.h
===================================================================
--- trunk/MagicSoft/Mars/mcalib/MHCalibrationChargeLoGainPix.h	(revision 3638)
+++ trunk/MagicSoft/Mars/mcalib/MHCalibrationChargeLoGainPix.h	(revision 3639)
@@ -11,10 +11,10 @@
 private:
 
-  static const Int_t   fgChargeNbins;      // Default for MHGausEvents::fNbins (now set to: 200   )
-  static const Axis_t  fgChargeFirst;      // Default for MHGausEvents::fFirst (now set to: -0.5  )
-  static const Axis_t  fgChargeLast;       // Default for MHGausEvents::fLast  (now set to: 199.5 )
-  static const Int_t   fgAbsTimeNbins;     // Default for fAbsTimeNbins        (now set to: 15    )
-  static const Axis_t  fgAbsTimeFirst;     // Default for fAbsTimeFirst        (now set to: -0.5  )
-  static const Axis_t  fgAbsTimeLast;      // Default for fAbsTimeLast         (now set to: 14.5  )
+  static const Int_t   fgChargeNbins;      // Default for fNbins        (now set to: 200   )
+  static const Axis_t  fgChargeFirst;      // Default for fFirst        (now set to: -0.5  )
+  static const Axis_t  fgChargeLast;       // Default for fLast         (now set to: 199.5 )
+  static const Int_t   fgAbsTimeNbins;     // Default for fAbsTimeNbins (now set to: 15    )
+  static const Axis_t  fgAbsTimeFirst;     // Default for fAbsTimeFirst (now set to: -0.5  )
+  static const Axis_t  fgAbsTimeLast;      // Default for fAbsTimeLast  (now set to: 14.5  )
 
 public:
@@ -28,5 +28,5 @@
   void SetAbsTimeLast (const Axis_t last =fgAbsTimeLast)         { fAbsTimeLast  = last;    }
 
-  ClassDef(MHCalibrationChargeLoGainPix, 1)  // Histogram class for Low Gain Part of Calibration Pixel
+  ClassDef(MHCalibrationChargeLoGainPix, 1)  // Histogram class for Charge Low Gain Pixel Calibration
 };
 
Index: trunk/MagicSoft/Mars/mcalib/MHCalibrationChargePINDiode.cc
===================================================================
--- trunk/MagicSoft/Mars/mcalib/MHCalibrationChargePINDiode.cc	(revision 3638)
+++ trunk/MagicSoft/Mars/mcalib/MHCalibrationChargePINDiode.cc	(revision 3639)
@@ -27,6 +27,7 @@
 //  MHCalibrationChargePINDiode
 //
-//  Histogram container for the calibration PIN Diode information
-//  Extracts the signal stored in MExtractedSignalPINDiode, histograms and fits it.
+//  Histogram class for the charge calibration of the PIN Diode. 
+//  Stores and fits the charges, the RMS of the charges  and stores the 
+//  location of the maximum FADC slice. Charges are taken from MExtractedSignalPINDiode.
 //
 //////////////////////////////////////////////////////////////////////////////
@@ -88,10 +89,12 @@
 // - the default y-axis title for fHRmsCharge ("Nr. of events")
 // - the default directory of the fHRmsCharge (NULL)
+// - the current style for fHRmsCharge (NULL)
 //
 // Initializes:
 // - fHRmsCharge()
 // - all pointers to NULL
-// - all variables to 0.
-// - all flags to kFALSE
+//
+// Calls:
+// - Clear()
 //
 MHCalibrationChargePINDiode::MHCalibrationChargePINDiode(const char *name, const char *title)
@@ -174,8 +177,8 @@
 //
 // Retrieves from MExtractedSignalPINDiode:
-// - Number of used FADC samples
-// - Extracted signal 
-// - Signal Rms
-// - Arrival Time
+// - Number of used FADC samples via MExtractedSignalPINDiode::GetNumFADCSamples()
+// - Extracted signal via            MExtractedSignalPINDiode::GetExtractedSignal()
+// - Signal Rms                      MExtractedSignalPINDiode::GetExtractedRms()
+// - Arrival Time                    MExtractedSignalPINDiode::GetExtractedTime()
 //
 // Fills the following histograms:
@@ -217,5 +220,5 @@
 // --------------------------------------------------------------------------
 //
-// Returns kFALSE, if empty
+// Returns kTRUE, if empty
 //
 // Performs the following fits:
@@ -223,8 +226,10 @@
 // - FitRmsCharge()
 //
-// Creates the fourier spectrum and sets bit IsFourierSpectrumOK()
+// Creates the fourier spectrum (MHGausEvents::CreateFourierSpectrum() 
+// and sets bit MCalibrationChargePINDiode::SetOscillating( MHGausEvents::IsFourierSpectrumOK() )
 // Retrieves the results of the following fits and stores them in MCalibrationChargePINDiode:
 // - Mean Charge and Error 
 // - Sigma Charge and Error
+// - Fit Probability
 // - Abs Time Mean
 // - Abs Time Rms
@@ -244,8 +249,9 @@
   fPINDiode->SetOscillating  ( !IsFourierSpectrumOK() );
 
-  fPINDiode->SetMeanCharge(     GetMean()     );
-  fPINDiode->SetMeanChargeErr(  GetMeanErr()  );
-  fPINDiode->SetSigmaCharge(    GetSigma()    );
-  fPINDiode->SetSigmaChargeErr( GetSigmaErr() );
+  fPINDiode->SetMean     (  GetMean()     );
+  fPINDiode->SetMeanErr  (  GetMeanErr()  );
+  fPINDiode->SetSigma    (  GetSigma()    );
+  fPINDiode->SetSigmaErr (  GetSigmaErr() );
+  fPINDiode->SetProb     (  GetProb()     );
 
   fPINDiode->SetAbsTimeMean(    GetAbsTimeMean() );
Index: trunk/MagicSoft/Mars/mcalib/MHCalibrationChargePINDiode.h
===================================================================
--- trunk/MagicSoft/Mars/mcalib/MHCalibrationChargePINDiode.h	(revision 3638)
+++ trunk/MagicSoft/Mars/mcalib/MHCalibrationChargePINDiode.h	(revision 3639)
@@ -13,13 +13,13 @@
 private:
 
-  static const Int_t   fgChargeNbins;     //! Default for MHGausEvents::fNBins  (now set to: 200   )
-  static const Axis_t  fgChargeFirst;     //! Default for MHGausEvents::fFirst  (now set to: -0.5  )
-  static const Axis_t  fgChargeLast;      //! Default for MHGausEvents::fLast   (now set to: 199.5 )
-  static const Int_t   fgRmsChargeNbins;  //! Default for fRmsChargeNBins       (now set to: 100   )
-  static const Axis_t  fgRmsChargeFirst;  //! Default for fRmsChargeFirst       (now set to: 0.    )
-  static const Axis_t  fgRmsChargeLast;   //! Default for fRmsChargeLast        (now set to: 100.  )
-  static const Int_t   fgAbsTimeNbins;    //! Default for fAbsTimeNBins         (now set to: 30    )
-  static const Axis_t  fgAbsTimeFirst;    //! Default for fAbsTimeFirst         (now set to: -0.5  )
-  static const Axis_t  fgAbsTimeLast;     //! Default for fAbsTimeLast          (now set to: 29.5  )
+  static const Int_t   fgChargeNbins;     //! Default for fNBins           (now set to: 200   )
+  static const Axis_t  fgChargeFirst;     //! Default for fFirst           (now set to: -0.5  )
+  static const Axis_t  fgChargeLast;      //! Default for fLast            (now set to: 199.5 )
+  static const Int_t   fgRmsChargeNbins;  //! Default for fRmsChargeNBins  (now set to: 100   )
+  static const Axis_t  fgRmsChargeFirst;  //! Default for fRmsChargeFirst  (now set to: 0.    )
+  static const Axis_t  fgRmsChargeLast;   //! Default for fRmsChargeLast   (now set to: 100.  )
+  static const Int_t   fgAbsTimeNbins;    //! Default for fAbsTimeNBins    (now set to: 30    )
+  static const Axis_t  fgAbsTimeFirst;    //! Default for fAbsTimeFirst    (now set to: -0.5  )
+  static const Axis_t  fgAbsTimeLast;     //! Default for fAbsTimeLast     (now set to: 29.5  )
 
   MCalibrationChargePINDiode *fPINDiode; //! Storage container of the results
@@ -73,5 +73,5 @@
   void Draw(Option_t *opt="");
   
-  ClassDef(MHCalibrationChargePINDiode, 1)  // Histogram class for the Calibration PIN Diode
+  ClassDef(MHCalibrationChargePINDiode, 1)  // Histogram class for Charge PIN Diode Calibration 
 };
 
Index: trunk/MagicSoft/Mars/mcalib/MHCalibrationChargePix.cc
===================================================================
--- trunk/MagicSoft/Mars/mcalib/MHCalibrationChargePix.cc	(revision 3638)
+++ trunk/MagicSoft/Mars/mcalib/MHCalibrationChargePix.cc	(revision 3639)
@@ -26,7 +26,7 @@
 //  MHCalibrationChargePix
 //
-//  Histogram class for charge calibration analysis. Holds the histogrammed
-//  summed FADC slices and some rough absolute timing. Calculates the mean 
-//  sum of FADC slices and its sigma and perform a Fourier analysis.
+//  Histogram class for the charge calibration. 
+//  Stores and fits the charges and stores the location of the maximum FADC 
+//  slice. Charges are taken from MExtractedSignalPix.
 //
 //////////////////////////////////////////////////////////////////////////////
@@ -64,5 +64,5 @@
 // - the default number for fFirst        (fgChargeFirst)
 // - the default number for fLast         (fgChargeLast)
-// - the default number for fAbsTimeNbins (fgAbstTimeNbins)
+// - the default number for fAbsTimeNbins (fgAbsTimeNbins)
 // - the default number for fAbsTimeFirst (fgAbsTimeFirst)
 // - the default number for fAbsTimeLast  (fgAbsTimeLast)
@@ -78,10 +78,11 @@
 // - the default y-axis title for fHAbsTime ("Nr. of events"); 
 // - the default directory of the fHAbsTime (NULL)
+// - the current style for fHAbsTime
 //
 // Initializes:
 // - fHAbsTime()
-// - fPixId to -1
-// - all variables to 0.
-// - all flags to kFALSE
+//
+// Calls:
+// - Clear();
 //
 MHCalibrationChargePix::MHCalibrationChargePix(const char *name, const char *title)
@@ -132,5 +133,5 @@
 //
 // Sets:
-// - all variables to 0.
+// - fSaturated to 0.
 // 
 // Executes:
Index: trunk/MagicSoft/Mars/mcalib/MHCalibrationChargePix.h
===================================================================
--- trunk/MagicSoft/Mars/mcalib/MHCalibrationChargePix.h	(revision 3638)
+++ trunk/MagicSoft/Mars/mcalib/MHCalibrationChargePix.h	(revision 3639)
@@ -12,10 +12,10 @@
 private:
 
-  static const Int_t   fgChargeNbins;        // Default for MHGausEvents::fNBins (now set to: 2000  )
-  static const Axis_t  fgChargeFirst;        // Default for MHGausEvents::fFirst (now set to: -0.5  )
-  static const Axis_t  fgChargeLast;         // Default for MHGausEvents::fLast  (now set to: 1999.5)
-  static const Int_t   fgAbsTimeNbins;       // Default for fAbsTimeNbins        (now set to: 15    )
-  static const Axis_t  fgAbsTimeFirst;       // Default for fAbsTimeFirst        (now set to: -0.5  )
-  static const Axis_t  fgAbsTimeLast;        // Default for fAbsTimeLast         (now set to: 14.5  )
+  static const Int_t   fgChargeNbins;        // Default for fNBins          (now set to: 2000  )
+  static const Axis_t  fgChargeFirst;        // Default for fFirst          (now set to: -0.5  )
+  static const Axis_t  fgChargeLast;         // Default for fLast           (now set to: 1999.5)
+  static const Int_t   fgAbsTimeNbins;       // Default for fAbsTimeNbins   (now set to: 15    )
+  static const Axis_t  fgAbsTimeFirst;       // Default for fAbsTimeFirst   (now set to: -0.5  )
+  static const Axis_t  fgAbsTimeLast;        // Default for fAbsTimeLast    (now set to: 14.5  )
 
 protected:
@@ -63,5 +63,5 @@
   void ChangeHistId(Int_t id);
   
-  ClassDef(MHCalibrationChargePix, 1)     // Base Histogram class for a Charge Calibration Pixel
+  ClassDef(MHCalibrationChargePix, 1)     // Base Histogram class for Charge Pixel Calibration
 };
 
Index: trunk/MagicSoft/Mars/mcalib/MHCalibrationRelTimeCam.cc
===================================================================
--- trunk/MagicSoft/Mars/mcalib/MHCalibrationRelTimeCam.cc	(revision 3638)
+++ trunk/MagicSoft/Mars/mcalib/MHCalibrationRelTimeCam.cc	(revision 3639)
@@ -23,19 +23,25 @@
 \* ======================================================================== */
 /////////////////////////////////////////////////////////////////////////////
-//                                                                         //
-// MHCalibrationRelTimeCam                                                 //
-//                                                                         //
+//                                                                        
+// MHCalibrationRelTimeCam                                                
+//                                                                        
 // Fills the extracted relative arrival times of MArrivalTimeCam into 
 // the MHGausEvents-classes MHCalibrationRelTimePix for every:
 //
-// - pixel, stored in the TObjArray's MHCalibrationCam::fHiGainArray 
-//
-// - average pixel per area index (e.g. inner and outer for the MAGIC camera), 
-//   stored in the TObjArray's MHCalibrationCam::fAverageHiGainAreas
-//
-// - average pixel per camera sector (e.g. sectors 1-6 for the MAGIC camera), 
+// - Pixel, stored in the TObjArray's MHCalibrationCam::fHiGainArray  
+//   or MHCalibrationCam::fHiGainArray, respectively, depending if 
+//   MArrivalTimePix::IsLoGainUsed() is set.
+//
+// - Average pixel per AREA index (e.g. inner and outer for the MAGIC camera), 
+//   stored in the TObjArray's MHCalibrationCam::fAverageHiGainAreas and 
+//   MHCalibrationCam::fAverageHiGainAreas
+//
+// - Average pixel per camera SECTOR (e.g. sectors 1-6 for the MAGIC camera), 
 //   stored in the TObjArray's MHCalibrationCam::fAverageHiGainSectors 
-// 
-// Every time is filled into a histogram and an array, in order to perform 
+//   and MHCalibrationCam::fAverageHiGainSectors 
+//
+// Every relative time is calculated as the difference between the individual 
+// pixel arrival time and the one of pixel 1 (hardware number: 2). 
+// The relative times are filled into a histogram and an array, in order to perform 
 // a Fourier analysis (see MHGausEvents). The signals are moreover averaged on an 
 // event-by-event basis and written into the corresponding average pixels.
@@ -43,18 +49,21 @@
 // The histograms are fitted to a Gaussian, mean and sigma with its errors 
 // and the fit probability are extracted. If none of these values are NaN's and 
-// if the probability is bigger than fProbLimit (default: 0.5%), the fit is valid.
-// Otherwise, the fit is repeated within ranges of the previous mean +- 5 sigma. 
+// if the probability is bigger than MHGausEvents::fProbLimit (default: 0.5%), 
+// the fit is declared valid.
+// Otherwise, the fit is repeated within ranges of the previous mean 
+// +- MHGausEvents::fPickupLimit (default: 5) sigma (see MHGausEvents::RepeatFit())
 // In case this does not make the fit valid, the histogram means and RMS's are 
-// taken directly and the following flags are set:
+// taken directly (see MHGausEvents::BypassFit()) and the following flags are set:
 // - MBadPixelsPix::SetUncalibrated( MBadPixelsPix::kRelTimeNotFitted ) and
 // - MBadPixelsPix::SetUnsuitable(   MBadPixelsPix::kUnreliableRun    ) 
 // 
-// Outliers of more than MHCalibrationChargePix::fPickupLimit (default: 5) sigmas 
-// from the mean are counted as PickUp events (stored in MHCalibrationRelTimePix::fPickup) 
+// Outliers of more than MHGausEvents::fPickupLimit (default: 5) sigmas 
+// from the mean are counted as Pickup events (stored in MHGausEvents::fPickup) 
 //
 // The class also fills arrays with the signal vs. event number, creates a fourier 
-// spectrum and investigates if the projected fourier components follow an exponential 
-// distribution. In case that the probability of the exponential fit is less than 
-// fProbLimit (default: 0.5%), the following flags are set:
+// spectrum (see MHGausEvents::CreateFourierSpectrum()) and investigates if the 
+// projected fourier components follow an exponential distribution. 
+// In case that the probability of the exponential fit is less than 
+// MHGausEvents::fProbLimit (default: 0.5%), the following flags are set:
 // - MBadPixelsPix::SetUncalibrated( MBadPixelsPix::kRelTimeOscillating ) and
 // - MBadPixelsPix::SetUnsuitable(   MBadPixelsPix::kUnreliableRun      )
@@ -119,5 +128,5 @@
 // - MArrivalTimeCam
 //
-// Initializes, if empty to MArrivalTimeCam::GetSize() for:
+// Initializes, if empty to MGeomCam::GetNumPixels():
 // - MHCalibrationCam::fHiGainArray, MHCalibrationCam::fLoGainArray
 //
@@ -128,8 +137,8 @@
 // - MHCalibrationCam::fAverageHiGainSectors, MHCalibrationCam::fAverageLoGainSectors
 // 
-// Calls InitializeHists() for every entry in:
-// - MHCalibrationCam::fHiGainArray
-// - MHCalibrationCam::fAverageHiGainAreas
-// - MHCalibrationCam::fAverageHiGainSectors
+// Calls MHCalibrationCam::InitHists() for every entry in:
+// - MHCalibrationCam::fHiGainArray, MHCalibrationCam::fLoGainArray
+// - MHCalibrationCam::fAverageHiGainAreas, MHCalibrationCam::fAverageLoGainAreas
+// - MHCalibrationCam::fAverageHiGainSectors, MHCalibrationCam::fAverageLoGainSectors
 //
 // Sets Titles and Names for the Histograms 
@@ -249,5 +258,5 @@
 
 
-//--------------------------------------------------------------------------------
+// -------------------------------------------------------------------------------
 //
 // Retrieves pointer to MArrivalTimeCam:
@@ -258,7 +267,8 @@
 // - number of sectors
 //
-// Fill RelTimes histograms (MHGausEvents::FillHistAndArray()) with:
+// Fills HiGain or LoGain histograms (MHGausEvents::FillHistAndArray()), respectively
+// depending on MArrivalTimePix::IsLoGainUsed(), with:
 // - MArrivalTimePix::GetArrivalTime(pixid) - MArrivalTimePix::GetArrivalTime(1);
-//   (i.e. the time difference between pixel i and pixel 1 (hardware number: 2)
+//   (i.e. the time difference between pixel i and pixel 1 (hardware number: 2) )
 //
 Bool_t MHCalibrationRelTimeCam::FillHists(const MParContainer *par, const Stat_t w)
@@ -405,8 +415,8 @@
 // ============== 
 //
-// 0: Fitted Mean Relative Arrival Time
-// 1: Error of fitted Mean Relative Arrival Time
-// 2: Sigma of fitted Relative Arrival Time
-// 3: Error of Sigma of fitted Relative Arrival Time
+// 0: Fitted Mean Relative Arrival Time              (calls: MHGausEvents::GetMean())
+// 1: Error of fitted Mean Relative Arrival Time     (calls: MHGausEvents::GetMeanErr())
+// 2: Sigma of fitted Relative Arrival Time          (calls: MHGausEvents::GetSigma())
+// 3: Error of Sigma of fitted Relative Arrival Time (calls: MHGausEvents::GetSigmaErr())
 //
 //
@@ -414,11 +424,11 @@
 // =============================================
 //
-// 4: Returned probability of Gauss fit to RelTime distribution
+// 4: Returned probability of Gauss fit              (calls: MHGausEvents::GetProb())
 //
 // Localized defects:
 // ==================
 //
-// 5: Gaus fit not OK
-// 6: Fourier spectrum not OK
+// 5: Gaus fit not OK                               (calls: MHGausEvents::IsGausFitOK())
+// 6: Fourier spectrum not OK                       (calls: MHGausEvents::IsFourierSpectrumOK())
 //
 Bool_t MHCalibrationRelTimeCam::GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type) const
@@ -428,29 +438,27 @@
     return kFALSE;
 
-  MHCalibrationRelTimePix &hist = (MHCalibrationRelTimePix&)(*this)[idx];      
-
   switch (type)
     {
     case 0:
-      val = hist.GetMean();
+      val = (*this)[idx].GetMean();
       break;
     case 1:
-      val = hist.GetMeanErr();
+      val = (*this)[idx].GetMeanErr();
       break;
     case 2:
-      val = hist.GetSigma();
+      val = (*this)[idx].GetSigma();
       break;
     case 3:
-      val = hist.GetSigmaErr();
+      val = (*this)[idx].GetSigmaErr();
       break;
     case 4:
-      val = hist.GetProb();
+      val = (*this)[idx].GetProb();
       break;
     case 5:
-      if (!hist.IsGausFitOK())
+      if (!(*this)[idx].IsGausFitOK())
         val = 1.;
       break;
     case 6:
-      if (!hist.IsFourierSpectrumOK())
+      if (!(*this)[idx].IsFourierSpectrumOK())
         val = 1.;
       break;
@@ -461,7 +469,10 @@
 }
 
+// --------------------------------------------------------------------------
+//
+// Calls MHGausEvents::DrawClone() for pixel idx
+//
 void MHCalibrationRelTimeCam::DrawPixelContent(Int_t idx) const
 {
-  const MHCalibrationRelTimePix &hist = (MHCalibrationRelTimePix&)(*this)[idx];      
-  hist.DrawClone();
-}
+ (*this)[idx].DrawClone();
+}
Index: trunk/MagicSoft/Mars/mcalib/MHCalibrationRelTimeCam.h
===================================================================
--- trunk/MagicSoft/Mars/mcalib/MHCalibrationRelTimeCam.h	(revision 3638)
+++ trunk/MagicSoft/Mars/mcalib/MHCalibrationRelTimeCam.h	(revision 3639)
@@ -15,5 +15,5 @@
   Bool_t FillHists(const MParContainer *par, const Stat_t w=1);
   Bool_t FinalizeHists();
-  void   FinalizeBadPixels();
+  void    FinalizeBadPixels();
   
 public:
@@ -25,5 +25,5 @@
   void DrawPixelContent(Int_t idx) const;
   
-  ClassDef(MHCalibrationRelTimeCam, 1)	// Histogram class for camera relative time calibration
+  ClassDef(MHCalibrationRelTimeCam, 1)	// Histogram class for Relative Time Camera Calibration
 };
 
Index: trunk/MagicSoft/Mars/mcalib/MHCalibrationRelTimePix.cc
===================================================================
--- trunk/MagicSoft/Mars/mcalib/MHCalibrationRelTimePix.cc	(revision 3638)
+++ trunk/MagicSoft/Mars/mcalib/MHCalibrationRelTimePix.cc	(revision 3639)
@@ -27,7 +27,7 @@
 //  MHCalibrationRelTimePix
 //
-//  Histogram class for the relative arrival time calibration.
-//  Holds the histogrammed arrival times,
-//  derives from MHGausEvents, perform Fourier analysis
+//  Histogram class for the relative arrival time calibration. 
+//  Stores and fits the relative arrival times between pixel fPixId and 
+//  pixel number 1 (hardware index: 2). Times are taken from MArrivalTimePix
 //
 //////////////////////////////////////////////////////////////////////////////
@@ -57,7 +57,4 @@
 // - the default y-axis title for fHGausHist ("Nr. of events")
 //
-// Initializes:
-// - fPixId to -1
-//
 // Executes:
 // - MHGausEvents::Clear()
@@ -83,21 +80,4 @@
 }
 
-// --------------------------------------------------------------------------
-//
-// Sets:
-// - fPixId to -1
-// 
-// Executes:
-// - MHGausEvents::Clear()
-//
-void MHCalibrationRelTimePix::Clear(Option_t *o)
-{
-
-  fPixId = -1;
-
-  MHGausEvents::Clear();
-  return;
-}
-
 
 // --------------------------------------------------------------------------
Index: trunk/MagicSoft/Mars/mcalib/MHCalibrationRelTimePix.h
===================================================================
--- trunk/MagicSoft/Mars/mcalib/MHCalibrationRelTimePix.h	(revision 3638)
+++ trunk/MagicSoft/Mars/mcalib/MHCalibrationRelTimePix.h	(revision 3639)
@@ -11,7 +11,7 @@
 private:
 
-  static const Int_t   fgRelTimeNbins;      //! Default for MHGausEvents::fNBins  (now set to: 900   )
-  static const Axis_t  fgRelTimeFirst;      //! Default for MHGausEvents::fFirst  (now set to: -13.5 )
-  static const Axis_t  fgRelTimeLast;       //! Default for MHGausEvents::fLast   (now set to:  13.5 )
+  static const Int_t   fgRelTimeNbins;      //! Default for fNbins  (now set to: 900   )
+  static const Axis_t  fgRelTimeFirst;      //! Default for fFirst  (now set to: -13.5 )
+  static const Axis_t  fgRelTimeLast;       //! Default for fLast   (now set to:  13.5 )
 
 public:
@@ -19,9 +19,8 @@
   MHCalibrationRelTimePix(const char *name=NULL, const char *title=NULL);
   ~MHCalibrationRelTimePix() {}
-  
-  void Clear(Option_t *o="");
+
   void Reset();
   
-  ClassDef(MHCalibrationRelTimePix, 1)     // Histogram class for Relative Time Calibration pixel
+  ClassDef(MHCalibrationRelTimePix, 1)     // Histogram class for Relative Time Pixel Calibration
 };
 
Index: trunk/MagicSoft/Mars/mcalib/MHGausEvents.h
===================================================================
--- trunk/MagicSoft/Mars/mcalib/MHGausEvents.h	(revision 3638)
+++ trunk/MagicSoft/Mars/mcalib/MHGausEvents.h	(revision 3639)
@@ -51,8 +51,8 @@
 protected:
 
-  Int_t   fNbins;                      // Number histogram bins for fHGausHist (used by Init())
-  Axis_t  fFirst;                      // Lower histogram edge  for fHGausHist (used by Init()) 
-  Axis_t  fLast;                       // Upper histogram edge  for fHGausHist (used by Init()) 
-  Int_t   fPixId;                      //  Pixel ID 
+  Int_t   fNbins;                      // Number histogram bins for fHGausHist (used by InitBins())
+  Axis_t  fFirst;                      // Lower histogram edge  for fHGausHist (used by InitBins()) 
+  Axis_t  fLast;                       // Upper histogram edge  for fHGausHist (used by InitBins()) 
+  Int_t   fPixId;                      // Pixel ID 
   
   TH1F    fHGausHist;                  // Histogram which should hold the Gaussian distribution
