Index: trunk/MagicSoft/Mars/msignal/MExtractSlidingWindow.cc
===================================================================
--- trunk/MagicSoft/Mars/msignal/MExtractSlidingWindow.cc	(revision 3884)
+++ trunk/MagicSoft/Mars/msignal/MExtractSlidingWindow.cc	(revision 3885)
@@ -33,4 +33,22 @@
 //  contents. 
 //
+//  Call: SetRange(higainfirst, higainlast, logainfirst, logainlast) 
+//  to modify the ranges in which the window is allowed to move. 
+//  Defaults are: 
+// 
+//   fHiGainFirst =  fgHiGainFirst =  0 
+//   fHiGainLast  =  fgHiGainLast  =  14
+//   fLoGainFirst =  fgLoGainFirst =  3 
+//   fLoGainLast  =  fgLoGainLast  =  14
+//
+//  Call: SetWindowSize(windowhigain, windowlogain) 
+//  to modify the sliding window widths. Windows have to be an even number. 
+//  In case of odd numbers, the window will be modified.
+//
+//  Defaults are:
+//
+//   fHiGainWindowSize = fgHiGainWindowSize = 6
+//   fLoGainWindowSize = fgLoGainWindowSize = 6
+//
 //////////////////////////////////////////////////////////////////////////////
 #include "MExtractSlidingWindow.h"
@@ -45,5 +63,5 @@
 using namespace std;
 
-const Byte_t MExtractSlidingWindow::fgHiGainFirst      = 3;
+const Byte_t MExtractSlidingWindow::fgHiGainFirst      = 0;
 const Byte_t MExtractSlidingWindow::fgHiGainLast       = 14;
 const Byte_t MExtractSlidingWindow::fgLoGainFirst      = 3;
@@ -55,4 +73,11 @@
 // Default constructor. 
 //
+// Sets:
+// - fWindowSizeHiGain to fgWindowSizeHiGain
+// - fWindowSizeLoGain to fgWindowSizeLoGain
+//
+// Calls: 
+// - SetRange(fgHiGainFirst, fgHiGainLast, fgLoGainFirst, fgLoGainLast)
+//
 MExtractSlidingWindow::MExtractSlidingWindow(const char *name, const char *title)
     : fWindowSizeHiGain(fgHiGainWindowSize), 
@@ -66,4 +91,12 @@
 }
 
+// --------------------------------------------------------------------------
+//
+// SetRange: 
+//
+// Calls:
+// - MExtractor::SetRange(hifirst,hilast,lofirst,lolast);
+// - SetWindowSize(fWindowSizeHiGain,fWindowSizeLoGain);
+//
 void MExtractSlidingWindow::SetRange(Byte_t hifirst, Byte_t hilast, Byte_t lofirst, Byte_t lolast)
 {
@@ -79,4 +112,17 @@
 }
 
+// --------------------------------------------------------------------------
+//
+// Checks:
+// - if a window is odd, subtract one
+// - if a window is bigger than the one defined by the ranges, set it to the available range
+// - if a window is smaller than 2, set it to 2
+// 
+// Sets:
+// - fNumHiGainSamples to: (Float_t)fWindowSizeHiGain
+// - fNumLoGainSamples to: (Float_t)fWindowSizeLoGain
+// - fSqrtHiGainSamples to: TMath::Sqrt(fNumHiGainSamples)
+// - fSqrtLoGainSamples to: TMath::Sqrt(fNumLoGainSamples)  
+//  
 void MExtractSlidingWindow::SetWindowSize(Byte_t windowh, Byte_t windowl)
 {
@@ -137,4 +183,15 @@
 
 
+// --------------------------------------------------------------------------
+//
+// FindSignalHiGain:
+//
+// - Loop from ptr to (ptr+fWindowSizeHiGain)
+// - Sum up contents of *ptr
+// - If *ptr is greater than fSaturationLimit, raise sat by 1
+// - Loop from (ptr+fWindowSizeHiGain) to (ptr+fHiGainLast-fHiGainFirst)
+// - Sum the content of *(ptr+fWindowSizeHiGain) and subtract *ptr
+// - Check if the sum has become bigger and store it in case yes.
+// 
 void MExtractSlidingWindow::FindSignalHiGain(Byte_t *ptr, Int_t &max, Byte_t &sat) const
 {
@@ -177,4 +234,15 @@
 
 
+// --------------------------------------------------------------------------
+//
+// FindSignalLoGain:
+//
+// - Loop from ptr to (ptr+fWindowSizeLoGain)
+// - Sum up contents of *ptr
+// - If *ptr is greater than fSaturationLimit, raise sat by 1
+// - Loop from (ptr+fWindowSizeLoGain) to (ptr+fLoGainLast-fLoGainFirst)
+// - Sum the content of *(ptr+fWindowSizeLoGain) and subtract *ptr
+// - Check if the sum has become bigger and store it in case yes.
+// 
 void MExtractSlidingWindow::FindSignalLoGain(Byte_t *ptr, Int_t &max, Byte_t &sat) const
 {
