Index: trunk/MagicSoft/Mars/mpedestal/MExtractPedestal.cc
===================================================================
--- trunk/MagicSoft/Mars/mpedestal/MExtractPedestal.cc	(revision 8274)
+++ trunk/MagicSoft/Mars/mpedestal/MExtractPedestal.cc	(revision 8296)
@@ -1,4 +1,4 @@
 /* ======================================================================== *\
-! $Name: not supported by cvs2svn $:$Id: MExtractPedestal.cc,v 1.24 2007-01-26 21:10:14 tbretz Exp $
+! $Name: not supported by cvs2svn $:$Id: MExtractPedestal.cc,v 1.25 2007-02-03 20:03:35 tbretz Exp $
 ! --------------------------------------------------------------------------
 !
@@ -268,32 +268,19 @@
 Bool_t MExtractPedestal::SetExtractWindow(UShort_t windowf, UShort_t windows)
 {
-
-  Bool_t rc = kTRUE;
-
-  const Int_t odd  = TMath::Odd(windows);
-  
-  if (odd && !fExtractor)
-  {
-      *fLog << warn << GetDescriptor();
-      *fLog << " - WARNING: Window size in SetExtractWindow has to be even... ";
-      *fLog << " lowering from " << windows << " to ";
-      windows -= 1;
-      *fLog << windows << "!" << endl;
-      rc = kFALSE;
-  }
-
-  if (windows==0)
-  {
-      *fLog << warn << GetDescriptor();
-      *fLog << " - WARNING: Window size in SetExtractWindow has to be > 0... adjusting to 2!" << endl;
-      windows = 2;
-      rc = kFALSE;
-  }
-
-  fExtractWinSize  = windows;
-  fExtractWinFirst = windowf;
-  fExtractWinLast  = fExtractWinFirst+fExtractWinSize-1;
-
-  return rc;
+    Bool_t rc = kTRUE;
+
+    if (windows==0)
+    {
+        *fLog << warn << GetDescriptor();
+        *fLog << " - WARNING: Window size in SetExtractWindow has to be > 0... adjusting to 2!" << endl;
+        windows = 2;
+        rc = kFALSE;
+    }
+
+    fExtractWinSize  = windows;
+    fExtractWinFirst = windowf;
+    fExtractWinLast  = fExtractWinFirst+fExtractWinSize-1;
+
+    return rc;
 }
 
@@ -329,5 +316,5 @@
 // Check (and if neccesary: correct) the extraction and check ranges.
 //
-void MExtractPedestal::CheckExtractionWindow()
+void MExtractPedestal::CheckExtractionWindow(UInt_t offset)
 {
     // fSignal->GetNumSamples() not yet initialized!!!
@@ -336,20 +323,20 @@
     if (fCheckWinLast >= num)
     {
-        *fLog << warn << endl;
-        *fLog << "Selected CheckWindow [" << fCheckWinFirst << "," << fCheckWinLast;
-        *fLog << "] ranges out of range [0," << num-1 << "]." << endl;
-        *fLog << "Resetting upper edge." << endl;
-
-        fCheckWinLast = num;
-    }
-
-    if (fExtractWinLast >= num)
-    {
-        *fLog << warn << endl;
-        *fLog << "Selected ExtractWindow [" << fExtractWinFirst << "," << fExtractWinLast;
-        *fLog << "] ranges out of range [0," << num-1 << "]." << endl;
-        *fLog << "Resetting upper edge." << endl;
-
-        fExtractWinLast = num;
+        *fLog << inf;
+        *fLog << "CheckWindow [" << fCheckWinFirst+offset << "," << fCheckWinLast+offset;
+        *fLog << "] out of range [0," << num-1 << "]... ";
+        *fLog << "reset upper edge." << endl;
+
+        fCheckWinLast = num-1;
+    }
+
+    if (offset+fExtractWinLast >= num)
+    {
+        *fLog << inf;
+        *fLog << "ExtractWindow [" << fExtractWinFirst+offset << "," << fExtractWinLast+offset;
+        *fLog << "] out of range [0," << num-1 << "]... ";
+        *fLog << "reset upper edge." << endl;
+
+        fExtractWinLast = num-offset-1;
     }
 
@@ -359,9 +346,9 @@
         return;
 
-    fExtractWinLast += fExtractWinLast==num-1 ? -1 : +1;
-
-    *fLog << warn << endl;
-    *fLog << "ExtractionWindow odd...";
-    *fLog << "New extraction window [" << fExtractWinFirst << "," << fExtractWinLast << "]" << endl;
+    fExtractWinLast += offset+fExtractWinLast==num-1 ? -1 : +1;
+
+    *fLog << inf;
+    *fLog << "ExtractionWindow odd... set to [";
+    *fLog << fExtractWinFirst+offset << "," << fExtractWinLast+offset << "]" << endl;
 
     fExtractWinSize = fExtractWinLast-fExtractWinFirst+1;
@@ -582,5 +569,5 @@
     }
 
-    CheckExtractionWindow();
+    //CheckExtractionWindow();
 
     return kTRUE;
Index: trunk/MagicSoft/Mars/mpedestal/MExtractPedestal.h
===================================================================
--- trunk/MagicSoft/Mars/mpedestal/MExtractPedestal.h	(revision 8274)
+++ trunk/MagicSoft/Mars/mpedestal/MExtractPedestal.h	(revision 8296)
@@ -101,5 +101,5 @@
   Bool_t  CheckVariation(UInt_t idx) const;
 
-  void CheckExtractionWindow();
+  void CheckExtractionWindow(UInt_t offset=0);
 
 public:
Index: trunk/MagicSoft/Mars/mpedestal/MPedCalcFromLoGain.cc
===================================================================
--- trunk/MagicSoft/Mars/mpedestal/MPedCalcFromLoGain.cc	(revision 8274)
+++ trunk/MagicSoft/Mars/mpedestal/MPedCalcFromLoGain.cc	(revision 8296)
@@ -1,4 +1,4 @@
 /* ======================================================================== *\
-! $Name: not supported by cvs2svn $:$Id: MPedCalcFromLoGain.cc,v 1.34 2006-10-24 07:58:13 tbretz Exp $
+! $Name: not supported by cvs2svn $:$Id: MPedCalcFromLoGain.cc,v 1.35 2007-02-03 20:03:35 tbretz Exp $
 ! --------------------------------------------------------------------------
 !
@@ -158,6 +158,6 @@
 using namespace std;
 
-const UShort_t MPedCalcFromLoGain::fgExtractWinFirst = 17;
-const UShort_t MPedCalcFromLoGain::fgExtractWinSize  =  6;
+const UShort_t MPedCalcFromLoGain::fgExtractWinFirst =  17;
+const UShort_t MPedCalcFromLoGain::fgExtractWinSize  =   6;
 const UInt_t   MPedCalcFromLoGain::fgNumDump         = 500;
 
@@ -213,4 +213,6 @@
     if (!MExtractPedestal::ReInit(pList))
         return kFALSE;
+
+    CheckExtractionWindow(fRunHeader->GetNumSamplesHiGain());
 
     return kTRUE;
Index: trunk/MagicSoft/Mars/mpedestal/MPedCalcPedRun.cc
===================================================================
--- trunk/MagicSoft/Mars/mpedestal/MPedCalcPedRun.cc	(revision 8274)
+++ trunk/MagicSoft/Mars/mpedestal/MPedCalcPedRun.cc	(revision 8296)
@@ -1,4 +1,4 @@
 /* ======================================================================== *\
-! $Name: not supported by cvs2svn $:$Id: MPedCalcPedRun.cc,v 1.49 2006-10-24 07:58:13 tbretz Exp $
+! $Name: not supported by cvs2svn $:$Id: MPedCalcPedRun.cc,v 1.50 2007-02-03 20:03:35 tbretz Exp $
 ! --------------------------------------------------------------------------
 !
@@ -205,4 +205,6 @@
         return kFALSE;
 
+    CheckExtractionWindow();
+
     //
     // If this is the first ped run, the next run (call to ReInit)
