Index: /trunk/MagicSoft/Mars/Changelog
===================================================================
--- /trunk/MagicSoft/Mars/Changelog	(revision 4003)
+++ /trunk/MagicSoft/Mars/Changelog	(revision 4004)
@@ -25,4 +25,5 @@
        rounding errors of the floats introduced significant errors in the 
        RMS! 
+     - introduced one condition about possible window sizes of 0.
 
 
Index: /trunk/MagicSoft/Mars/mpedestal/MPedCalcPedRun.cc
===================================================================
--- /trunk/MagicSoft/Mars/mpedestal/MPedCalcPedRun.cc	(revision 4003)
+++ /trunk/MagicSoft/Mars/mpedestal/MPedCalcPedRun.cc	(revision 4004)
@@ -346,5 +346,5 @@
 {
   
-  Int_t lastdesired   = (Int_t)(fLoGainLast);
+  Int_t lastdesired   = (Int_t)fLoGainLast;
   Int_t lastavailable = (Int_t)fRunHeader->GetNumSamplesLoGain()-1;
   
@@ -469,11 +469,14 @@
       UInt_t sqr = 0;
 
-      do
+      if (fWindowSizeHiGain != 0)
         {
-          sum += *ptr;
-          sqr += *ptr * *ptr;
+          do
+            {
+              sum += *ptr;
+              sqr += *ptr * *ptr;
+            }
+          while (++ptr != end);
         }
-      while (++ptr != end);
-
+      
       if (fWindowSizeLoGain != 0)
         {
