Index: trunk/MagicSoft/Mars/Changelog
===================================================================
--- trunk/MagicSoft/Mars/Changelog	(revision 3610)
+++ trunk/MagicSoft/Mars/Changelog	(revision 3611)
@@ -18,4 +18,10 @@
 
                                                  -*-*- END OF LINE -*-*-
+
+ 2004/03/30: Markus Gaug
+ 
+   * mcalib/MHGausEvents.[h,cc]
+     - updated and enlarged documentation
+
 
  2004/03/30: Abelardo Moralejo
Index: trunk/MagicSoft/Mars/mcalib/MHGausEvents.cc
===================================================================
--- trunk/MagicSoft/Mars/mcalib/MHGausEvents.cc	(revision 3610)
+++ trunk/MagicSoft/Mars/mcalib/MHGausEvents.cc	(revision 3611)
@@ -27,6 +27,6 @@
 //  MHGausEvents
 //
-//  A base class for events which are believed follow a Gaussian distribution 
-//  with time, (e.g. calibration events, observables containing white noise, etc.)
+//  A base class for events which are believed to follow a Gaussian distribution 
+//  with time, e.g. calibration events, observables containing white noise, ...
 //
 //  MHGausEvents derives from MH, thus all features of MH can be used by a class 
@@ -36,10 +36,10 @@
 //
 //  1) The TH1F fHGausHist: 
-//     ==============================
+//     ====================
 //   
 //     It is created with a default name and title and resides in directory NULL.
 //     - Any class deriving from MHGausEvents needs to apply a binning to fHGausHist
 //       (e.g. with the function TH1F::SetBins(..) )
-//     - The histogram is filled with the functions FillHist or FillHistAndArray. 
+//     - The histogram is filled with the functions FillHist() or FillHistAndArray(). 
 //     - The histogram can be fitted with the function FitGaus(). This involves stripping 
 //       of all zeros at the lower and upper end of the histogram and re-binning to 
@@ -47,24 +47,27 @@
 //     - The fit result's probability is compared to a reference probability fProbLimit
 //       The NDF is compared to fNDFLimit and a check is made whether results are NaNs. 
-//       Accordingly the flag GausFitOK is set.
+//       Accordingly, a flag IsGausFitOK() is set.
 // 
 //  2) The TArrayF fEvents:
 //     ==========================
 // 
-//     It is created with 0 entries and not expanded unless FillArray or FillHistAndArray is called.
-//     - A first call to FillArray or FillHistAndArray initializes fEvents by default to 512 entries. 
-//     - Any later call to FillArray or FillHistAndArray fills up the array. Reaching the limit, 
-//       the array is expanded by a factor 2.
-//     - The array can be fourier-transformed into the array fPowerSpectrum. Note that any FFT accepts 
-//       only number of events which are a power of 2. Thus, fEvents is cut to the next power of 2 smaller 
-//       than its actual number of entries. You might lose information at the end of your analysis. 
-//     - Calling the function CreateFourierTransform creates the array fPowerSpectrum and its projection 
-//       fHPowerProbability which in turn is fit to an exponential. 
+//     It is created with 0 entries and not expanded unless FillArray() or FillHistAndArray()
+//     are called.
+//     - A first call to FillArray() or FillHistAndArray() initializes fEvents by default 
+//       to 512 entries. 
+//     - Any later call to FillArray() or FillHistAndArray() fills up the array. 
+//       Reaching the limit, the array is expanded by a factor 2.
+//     - The array can be fourier-transformed into the array fPowerSpectrum. 
+//       Note that any FFT accepts only number of events which are a power of 2. 
+//       Thus, fEvents is cut to the next power of 2 smaller than its actual number of entries. 
+//       Be aware that you might lose information at the end of your analysis. 
+//     - Calling the function CreateFourierSpectrum() creates the array fPowerSpectrum 
+//       and its projection fHPowerProbability which in turn is fit to an exponential. 
 //     - The fit result's probability is compared to a referenc probability fProbLimit 
-//       and accordingly the flag ExpFitOK is set.
-//     - The flag FourierSpectrumOK is set accordingly to ExpFitOK. Later, a closer check will be
-//       installed. 
-//     - You can display all arrays by calls to: CreateGraphEvents() and CreateGraphPowerSpectrum() and 
-//       successive calls to the corresponding Getters.
+//       and accordingly the flag IsExpFitOK() is set.
+//     - The flag IsFourierSpectrumOK() is set accordingly to IsExpFitOK(). 
+//       Later, a closer check will be installed. 
+//     - You can display all arrays by calls to: CreateGraphEvents() and 
+//       CreateGraphPowerSpectrum() and successive calls to the corresponding Getters.
 //
 //////////////////////////////////////////////////////////////////////////////
@@ -98,4 +101,19 @@
 //
 // Default Constructor. 
+// Sets: 
+// - the default Probability Bins for fPowerProbabilityBins (fgPowerProbabilityBins)
+// - the default Probability Limit for fProbLimit  (fgProbLimit)
+// - the default NDF Limit for fNDFLimit (fgNDFLimit)
+// - the default number of bins after stripping for fBinsAfterStipping (fgBinsAfterStipping)
+// - the default name of the fHGausHist ("HGausHist")
+// - the default title of the fHGausHist ("Histogram of Events with Gaussian Distribution")
+// - the default directory of the fHGausHist (NULL)
+//
+// Initializes:
+// - fEvents to 0 entries
+// - fHGausHist()
+// - all other pointers to NULL
+// - all variables to 0.
+// - all flags to kFALSE
 //
 MHGausEvents::MHGausEvents(const char *name, const char *title)
@@ -126,5 +144,17 @@
 
 
-
+// --------------------------------------------------------------------------
+//
+// Default Destructor. 
+//
+// Deletes (if Pointer is not NULL):
+// 
+// - fHPowerProbability
+// - fFGausFit 
+// - fFExpFit
+// - fPowerSpectrum     
+// - fGraphEvents
+// - fGraphPowerSpectrum
+// 
 MHGausEvents::~MHGausEvents()
 {
@@ -151,5 +181,14 @@
 }
       
-
+// --------------------------------------------------------------------------
+//
+// Sets:
+// - all other pointers to NULL
+// - all variables to 0., except fEventFrequency
+// - all flags to kFALSE
+// 
+// Deletes (if not NULL):
+// - all pointers
+//
 void MHGausEvents::Clear(Option_t *o)
 {
@@ -168,24 +207,50 @@
 
   if (fHPowerProbability)
-    delete fHPowerProbability;
+    {
+      delete fHPowerProbability;
+      fHPowerProbability = NULL;
+    }
   
   // delete fits
   if (fFGausFit)
-    delete fFGausFit; 
+    {
+      delete fFGausFit; 
+      fFGausFit = NULL;
+    }
+  
   if (fFExpFit)
-    delete fFExpFit;
+    {
+      delete fFExpFit;
+      fFExpFit = NULL;
+    }
   
   // delete arrays
   if (fPowerSpectrum)  
-    delete fPowerSpectrum;     
+    {
+      delete fPowerSpectrum;     
+      fPowerSpectrum = NULL;
+    }
 
   // delete graphs
   if (fGraphEvents)
-    delete fGraphEvents;
+    {
+      delete fGraphEvents;
+      fGraphEvents = NULL;
+    }
+
   if (fGraphPowerSpectrum)
-    delete fGraphPowerSpectrum;
-}
-
-
+    {
+      delete fGraphPowerSpectrum;
+      fGraphPowerSpectrum = NULL;
+    }
+}
+
+// --------------------------------------------------------------------------
+//
+// Executes:
+// - Clear()
+// - fHGausHist.Reset()
+// - fEvents.Set(0)
+//
 void MHGausEvents::Reset()
 {
@@ -197,5 +262,10 @@
 }
 
-
+// --------------------------------------------------------------------------
+//
+// Executes:
+// - FillArray()
+// - FillHist()
+//
 Bool_t MHGausEvents::FillHistAndArray(const Float_t f)
 {
@@ -205,4 +275,9 @@
 }
 
+// --------------------------------------------------------------------------
+//
+// Fills fHGausHist with f
+// Returns kFALSE, if overflow or underflow occurred
+//
 Bool_t MHGausEvents::FillHist(const Float_t f)
 {
@@ -214,4 +289,11 @@
 }
 
+// --------------------------------------------------------------------------
+//
+// Fill fEvents with f
+// If size of fEvents is 0, initializes it to 512
+// If size of fEvents is smaller than fCurrentSize, double the size
+// Increase fCurrentSize by 1
+//
 void MHGausEvents::FillArray(const Float_t f)
 {
Index: trunk/MagicSoft/Mars/mcalib/MHGausEvents.h
===================================================================
--- trunk/MagicSoft/Mars/mcalib/MHGausEvents.h	(revision 3610)
+++ trunk/MagicSoft/Mars/mcalib/MHGausEvents.h	(revision 3611)
@@ -20,12 +20,12 @@
 private:
 
-  const static Float_t  fgProbLimit;            // Default probability limit for judgement if fit is OK
-  const static Int_t    fgNDFLimit;             // Default NDF limit for judgement if fit is OK
-  const static Int_t    fgPowerProbabilityBins; // Default number of bins for the projected power spectrum 
-  const static Int_t    fgBinsAfterStripping;   // Default number of bins for the Gauss Histogram after stripping off the zeros at both end
+  const static Float_t  fgProbLimit;            // Default for fProbLimit (now 0.001)
+  const static Int_t    fgNDFLimit;             // Default for fNDFLimit  (now 2)
+  const static Int_t    fgPowerProbabilityBins; // Default for fPowerProbabilityBins (now 20)
+  const static Int_t    fgBinsAfterStripping;   // Default for fBinsAfterStripping (now 40)
 
-  Int_t    fPowerProbabilityBins;      // number of bins for the projected power spectrum
-  Int_t    fBinsAfterStripping;        // number of bins for the Gauss Histogram after stripping off the zeros at both end
-  Float_t  fEventFrequency;            // The event frequency in Hertz (to be set)
+  Int_t    fPowerProbabilityBins;      // Bins for the projected power spectrum
+  Int_t    fBinsAfterStripping;        // Bins for the Gauss Histogram after stripping off the zeros at both ends
+  Float_t  fEventFrequency;            // Event frequency in Hertz (to be set)
   
   TH1I    *fHPowerProbability;         // Fourier transform of fEvents projected on y-axis
@@ -35,9 +35,9 @@
   TGraph  *fGraphPowerSpectrum;        //! TGraph to display the power spectrum array (will not be cloned!!)
 
-  Double_t fMean;                      //   Mean of the Gauss fit
-  Double_t fSigma;                     //   Sigma of the Gauss fit
-  Double_t fMeanErr;                   //   Error of the mean of the Gauss fit
-  Double_t fSigmaErr;                  //   Error of the sigma of the Gauss fit
-  Double_t fProb;                      //   Probability of the Gauss fit (derived from Chi-Square and NDF
+  Double_t fMean;                      //  Mean of the Gauss fit
+  Double_t fSigma;                     //  Sigma of the Gauss fit
+  Double_t fMeanErr;                   //  Error of the mean of the Gauss fit
+  Double_t fSigmaErr;                  //  Error of the sigma of the Gauss fit
+  Double_t fProb;                      //  Probability of the Gauss fit (derived from Chi-Square and NDF
 
   enum { kGausFitOK, kExpFitOK, kFourierSpectrumOK }; // Bits to hold information about fit results 
