Index: trunk/MagicSoft/Mars/msignal/MExtractFixedWindowPeakSearch.cc
===================================================================
--- trunk/MagicSoft/Mars/msignal/MExtractFixedWindowPeakSearch.cc	(revision 4716)
+++ trunk/MagicSoft/Mars/msignal/MExtractFixedWindowPeakSearch.cc	(revision 4722)
@@ -1,25 +1,26 @@
 /* ======================================================================== *\
-   !
-   ! *
-   ! * This file is part of MARS, the MAGIC Analysis and Reconstruction
-   ! * Software. It is distributed to you in the hope that it can be a useful
-   ! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
-   ! * It is distributed WITHOUT ANY WARRANTY.
-   ! *
-   ! * Permission to use, copy, modify and distribute this software and its
-   ! * documentation for any purpose is hereby granted without fee,
-   ! * provided that the above copyright notice appear in all copies and
-   ! * that both that copyright notice and this permission notice appear
-   ! * in supporting documentation. It is provided "as is" without express
-   ! * or implied warranty.
-   ! *
-   !
-   !
-   !   Author(s): Abelardo Moralejo,04/2004 <mailto:moralejo@pd.infn.it>
-   !              Markus Gaug      ,04/2004 <mailto:markus@ifae.es>
-   !   Copyright: MAGIC Software Development, 2000-2004
-   !
-   !
-   \* ======================================================================== */
+!
+! *
+! * This file is part of MARS, the MAGIC Analysis and Reconstruction
+! * Software. It is distributed to you in the hope that it can be a useful
+! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
+! * It is distributed WITHOUT ANY WARRANTY.
+! *
+! * Permission to use, copy, modify and distribute this software and its
+! * documentation for any purpose is hereby granted without fee,
+! * provided that the above copyright notice appear in all copies and
+! * that both that copyright notice and this permission notice appear
+! * in supporting documentation. It is provided "as is" without express
+! * or implied warranty.
+! *
+!
+!
+!   Author(s): Abelardo Moralejo, 04/2004 <mailto:moralejo@pd.infn.it>
+!   Author(s): Markus Gaug, 04/2004 <mailto:markus@ifae.es>
+!
+!   Copyright: MAGIC Software Development, 2000-2004
+!
+!
+\* ======================================================================== */
 
 //////////////////////////////////////////////////////////////////////////////
@@ -55,5 +56,5 @@
 //   fLoGainWindowSize     = fgLoGainWindowSize     = 6
 //   fPeakSearchWindowSize = fgPeakSearchWindowSize = 4
-//   fLowGainPeakShift     = fgLowGainPeakShift     = 0
+//   fLoGainPeakShift      = fgLoGainPeakShift      = 0
 //
 //////////////////////////////////////////////////////////////////////////////
@@ -84,5 +85,5 @@
 const Byte_t MExtractFixedWindowPeakSearch::fgPeakSearchWindowSize = 4;
 const Byte_t MExtractFixedWindowPeakSearch::fgOffsetFromWindow     = 1;
-const Byte_t MExtractFixedWindowPeakSearch::fgLowGainPeakShift     = 0;
+const Byte_t MExtractFixedWindowPeakSearch::fgLoGainPeakShift      = 0;
 // --------------------------------------------------------------------------
 //
@@ -90,8 +91,8 @@
 //
 // Sets:
-// - fWindowSizeHiGain to fgWindowSizeHiGain
-// - fWindowSizeLoGain to fgWindowSizeLoGain
+// - fHiGainWindowSize to fgHiGainWindowSize
+// - fLoGainWindowSize to fgLoGainWindowSize
 // - fPeakSearchWindowSize to fgPeakSearchWindowSize
-// - fLowGainPeakShift to fgLowGainPeakShift
+// - fLoGainPeakShift to fgLoGainPeakShift
 //
 // Calls: 
@@ -100,8 +101,8 @@
 //
 MExtractFixedWindowPeakSearch::MExtractFixedWindowPeakSearch(const char *name, const char *title)
-    : fWindowSizeHiGain(fgHiGainWindowSize), 
-      fWindowSizeLoGain(fgLoGainWindowSize),
+    : fHiGainWindowSize(fgHiGainWindowSize), 
+      fLoGainWindowSize(fgLoGainWindowSize),
       fPeakSearchWindowSize(fgPeakSearchWindowSize),
-      fLowGainPeakShift(fgLowGainPeakShift)
+      fLoGainPeakShift(fgLoGainPeakShift)
 {
 
@@ -119,5 +120,5 @@
 // Calls:
 // - MExtractor::SetRange(hifirst,hilast,lofirst,lolast);
-// - SetWindows(fWindowSizeHiGain,fWindowSizeLoGain,fPeakSearchWindowSize);
+// - SetWindows(fHiGainWindowSize,fLoGainWindowSize,fPeakSearchWindowSize);
 //
 void MExtractFixedWindowPeakSearch::SetRange(Byte_t hifirst, Byte_t hilast, Byte_t lofirst, Byte_t lolast)
@@ -129,5 +130,5 @@
   // Redo the checks if the window is still inside the ranges
   //
-  SetWindows(fWindowSizeHiGain,fWindowSizeLoGain,fPeakSearchWindowSize);
+  SetWindows(fHiGainWindowSize,fLoGainWindowSize,fPeakSearchWindowSize);
   
 }
@@ -141,6 +142,6 @@
 // 
 // Sets:
-// - fNumHiGainSamples to: (Float_t)fWindowSizeHiGain
-// - fNumLoGainSamples to: (Float_t)fWindowSizeLoGain
+// - fNumHiGainSamples to: (Float_t)fHiGainWindowSize
+// - fNumLoGainSamples to: (Float_t)fLoGainWindowSize
 // - fSqrtHiGainSamples to: TMath::Sqrt(fNumHiGainSamples)
 // - fSqrtLoGainSamples to: TMath::Sqrt(fNumLoGainSamples)  
@@ -149,15 +150,15 @@
 {
 
-  fWindowSizeHiGain     = windowh & ~1;
-  fWindowSizeLoGain     = windowl & ~1;
+  fHiGainWindowSize     = windowh & ~1;
+  fLoGainWindowSize     = windowl & ~1;
   fPeakSearchWindowSize = peaksearchwindow & ~1;
 
-  if (fWindowSizeHiGain != windowh)
+  if (fHiGainWindowSize != windowh)
     *fLog << warn << GetDescriptor() << ": Hi Gain window size has to be even, set to: " 
-          << int(fWindowSizeHiGain) << " samples " << endl;
-  
-  if (fWindowSizeLoGain != windowl)
+          << int(fHiGainWindowSize) << " samples " << endl;
+  
+  if (fLoGainWindowSize != windowl)
     *fLog << warn << GetDescriptor() << ": Lo Gain window size has to be even, set to: " 
-          << int(fWindowSizeLoGain) << " samples " << endl;
+          << int(fLoGainWindowSize) << " samples " << endl;
     
   if (fPeakSearchWindowSize != peaksearchwindow)
@@ -168,34 +169,34 @@
   const Byte_t availlorange = (fLoGainLast-fLoGainFirst+1) & ~1;
 
-  if (fWindowSizeHiGain > availhirange)
+  if (fHiGainWindowSize > availhirange)
     {
       *fLog << warn << GetDescriptor() 
-            << Form("%s%2i%s%2i%s%2i%s",": Hi Gain window size: ",(int)fWindowSizeHiGain,
+            << Form("%s%2i%s%2i%s%2i%s",": Hi Gain window size: ",(int)fHiGainWindowSize,
                     " is bigger than available range: [",(int)fHiGainFirst,",",(int)fHiGainLast,"]") << endl;
       *fLog << warn << GetDescriptor() 
             << ": Will set window size to: " << (int)availhirange << endl;
-      fWindowSizeHiGain = availhirange;
-    }
-  
-  
-  if (fWindowSizeLoGain > availlorange)
+      fHiGainWindowSize = availhirange;
+    }
+  
+  
+  if (fLoGainWindowSize > availlorange)
     {
       *fLog << warn << GetDescriptor() 
-            << Form("%s%2i%s%2i%s%2i%s",": Lo Gain window size: ",(int)fWindowSizeLoGain,
+            << Form("%s%2i%s%2i%s%2i%s",": Lo Gain window size: ",(int)fLoGainWindowSize,
                     " is bigger than available range: [",(int)fLoGainFirst,",",(int)fLoGainLast,"]") << endl;
       *fLog << warn << GetDescriptor() 
             << ": Will set window size to: " << (int)availlorange << endl;
-      fWindowSizeLoGain = availlorange;
-    }
-  
-  if (fWindowSizeHiGain<2) 
-    {
-      fWindowSizeHiGain = 2;
+      fLoGainWindowSize = availlorange;
+    }
+  
+  if (fHiGainWindowSize<2) 
+    {
+      fHiGainWindowSize = 2;
       *fLog << warn << GetDescriptor() << ": Hi Gain window size set to two samples" << endl;
     }
   
-  if (fWindowSizeLoGain<2) 
-    {
-      fWindowSizeLoGain = 2;
+  if (fLoGainWindowSize<2) 
+    {
+      fLoGainWindowSize = 2;
       *fLog << warn << GetDescriptor() << ": Lo Gain window size set to two samples" << endl;
     }
@@ -208,6 +209,6 @@
     }
 
-  fNumHiGainSamples = (Float_t)fWindowSizeHiGain;
-  fNumLoGainSamples = (Float_t)fWindowSizeLoGain;
+  fNumHiGainSamples = (Float_t)fHiGainWindowSize;
+  fNumLoGainSamples = (Float_t)fLoGainWindowSize;
 
   fSqrtHiGainSamples = TMath::Sqrt(fNumHiGainSamples);
@@ -295,5 +296,5 @@
 // FindSignalHiGain:
 //
-// - Loop from ptr to (ptr+fWindowSizeHiGain)
+// - Loop from ptr to (ptr+fHiGainWindowSize)
 // - Sum up contents of *ptr
 // - If *ptr is greater than fSaturationLimit, raise sat by 1
@@ -302,5 +303,5 @@
 {
 
-  Byte_t *end = ptr + fWindowSizeHiGain-fHiLoLast;
+  Byte_t *end = ptr + fHiGainWindowSize-fHiLoLast;
 
   Int_t summ = 0;
@@ -316,5 +317,5 @@
 
   //
-  // If part of the "low-Gain" slices are used, 
+  // If part of the "lo-Gain" slices are used,
   // repeat steps one and two for the logain part until fHiLoLast
   //
@@ -337,5 +338,5 @@
 // FindSignalLoGain:
 //
-// - Loop from ptr to (ptr+fWindowSizeLoGain)
+// - Loop from ptr to (ptr+fLoGainWindowSize)
 // - Sum up contents of *ptr
 // - If *ptr is greater than fSaturationLimit, raise sat by 1
@@ -349,5 +350,5 @@
   Int_t summ = 0;
 
-  while (p<ptr+fWindowSizeLoGain)
+  while (p<ptr+fLoGainWindowSize)
     {
       summ += *p;
@@ -400,15 +401,15 @@
 
 
-  loGainFirst = ( hiGainFirst+fLowGainPeakShift > fLoGainFirst ) ? 
-      hiGainFirst+fLowGainPeakShift : fLoGainFirst;
+  loGainFirst = ( hiGainFirst+fLoGainPeakShift > fLoGainFirst ) ?
+      hiGainFirst+fLoGainPeakShift : fLoGainFirst;
 
   // Make sure we will not integrate beyond the hi gain limit:
-  if (hiGainFirst+fWindowSizeHiGain > pixel.GetNumHiGainSamples())
-    fHiLoLast = hiGainFirst+fWindowSizeHiGain - pixel.GetNumHiGainSamples();
-  //    hiGainFirst = pixel.GetNumHiGainSamples()-fWindowSizeHiGain;
+  if (hiGainFirst+fHiGainWindowSize > pixel.GetNumHiGainSamples())
+    fHiLoLast = hiGainFirst+fHiGainWindowSize - pixel.GetNumHiGainSamples();
+  //    hiGainFirst = pixel.GetNumHiGainSamples()-fHiGainWindowSize;
 
   // Make sure we will not integrate beyond the lo gain limit:
-  if (loGainFirst+fWindowSizeLoGain > pixel.GetNumLoGainSamples())
-    loGainFirst = pixel.GetNumLoGainSamples()-fWindowSizeLoGain;
+  if (loGainFirst+fLoGainWindowSize > pixel.GetNumLoGainSamples())
+    loGainFirst = pixel.GetNumLoGainSamples()-fLoGainWindowSize;
 
   pixel.Reset();
@@ -465,2 +466,56 @@
   return kTRUE;
 }
+
+// --------------------------------------------------------------------------
+//
+// In addition to the resources of the base-class MExtractor:
+//   MJPedestal.MExtractor.WindowSizeHiGain: 6
+//   MJPedestal.MExtractor.WindowSizeLoGain: 6
+//   MJPedestal.MExtractor.PeakSearchWindow: 4
+//   MJPedestal.MExtractor.OffsetFromWindow: 1
+//   MJPedestal.MExtractor.LoGainPeakShift:  0
+//
+Int_t MExtractFixedWindowPeakSearch::ReadEnv(const TEnv &env, TString prefix, Bool_t print)
+{
+    Byte_t hw = fHiGainWindowSize;
+    Byte_t lw = fLoGainWindowSize;
+    Byte_t pw = fPeakSearchWindowSize;
+
+    Bool_t rc = kFALSE;
+
+    if (IsEnvDefined(env, prefix, "PeakSearchWindow", print))
+    {
+        pw = GetEnvValue(env, prefix, "PeakSearchWindow", pw);
+        rc = kTRUE;
+    }
+    if (IsEnvDefined(env, prefix, "HiGainWindowSize", print))
+    {
+        hw = GetEnvValue(env, prefix, "HiGainWindowSize", hw);
+        rc = kTRUE;
+    }
+    if (IsEnvDefined(env, prefix, "LoGainWindowSize", print))
+    {
+        lw = GetEnvValue(env, prefix, "LoGainWindowSize", lw);
+        rc = kTRUE;
+    }
+
+    if (rc)
+        SetWindows(hw, lw, pw);
+
+
+    if (IsEnvDefined(env, prefix, "OffsetFromWindow", print))
+    {
+        SetOffsetFromWindow(GetEnvValue(env, prefix, "OffsetFromWindow", fOffsetFromWindow));
+        rc = kTRUE;
+    }
+
+    if (IsEnvDefined(env, prefix, "LoGainPeakShift", print))
+    {
+        SetLoGainPeakShift(GetEnvValue(env, prefix, "LoGainPeakShift", fLoGainPeakShift));
+        rc = kTRUE;
+    }
+
+    rc = MExtractor::ReadEnv(env, prefix, print) ? kTRUE : rc;
+
+    return rc;
+}
Index: trunk/MagicSoft/Mars/msignal/MExtractFixedWindowPeakSearch.h
===================================================================
--- trunk/MagicSoft/Mars/msignal/MExtractFixedWindowPeakSearch.h	(revision 4716)
+++ trunk/MagicSoft/Mars/msignal/MExtractFixedWindowPeakSearch.h	(revision 4722)
@@ -18,11 +18,11 @@
   static const Byte_t fgPeakSearchWindowSize; // Default for fPeakSearchWindowSize (now set to: 4)
   static const Byte_t fgOffsetFromWindow;     // Default for fOffsetFromWindow (now set to: 1)
-  static const Byte_t fgLowGainPeakShift;     // Default for fLowGainPeakShift (now set to: 0)
+  static const Byte_t fgLoGainPeakShift;      // Default for fLowGainPeakShift (now set to: 0)
 
-  Byte_t  fWindowSizeHiGain;     // Number of Hi Gain slices in window
-  Byte_t  fWindowSizeLoGain;     // Number of Lo Gain slices in window
+  Byte_t  fHiGainWindowSize;     // Number of Hi Gain slices in window
+  Byte_t  fLoGainWindowSize;     // Number of Lo Gain slices in window
   Byte_t  fPeakSearchWindowSize; // Size of FADC window in the search for the highest peak of all pixels.
   Byte_t  fOffsetFromWindow;     // Number of slices to start extraction before search window
-  Byte_t  fLowGainPeakShift;     // Shift of the low gain pulse with respect to the high gain pulse, in slices: it is 0 if the low gain is delayed with respect to HG by 15 slices.
+  Byte_t  fLoGainPeakShift;      // Shift of the low gain pulse with respect to the high gain pulse, in slices: it is 0 if the low gain is delayed with respect to HG by 15 slices.
 
   void   FindSignalHiGain(Byte_t *ptr, Byte_t *logain, Float_t &sum, Byte_t &sat) const;
@@ -31,6 +31,7 @@
   void   FindPeak(Byte_t *ptr, Byte_t window, Byte_t &startslice, Int_t &signal, Int_t &sat) const;
 
-  Bool_t  ReInit(MParList *pList);
+  Bool_t ReInit(MParList *pList);
   Int_t  Process();
+  Int_t  ReadEnv(const TEnv &env, TString prefix, Bool_t print);
   
 public:
@@ -43,5 +44,5 @@
     void SetOffsetFromWindow(Byte_t offset=fgOffsetFromWindow)  {  fOffsetFromWindow = offset; }
 
-    void SetLowGainPeakShift(Byte_t shift=fgLowGainPeakShift) { fLowGainPeakShift = shift; }
+    void SetLoGainPeakShift(Byte_t shift=fgLoGainPeakShift) { fLoGainPeakShift = shift; }
     
     ClassDef(MExtractFixedWindowPeakSearch, 0) // Signal Extractor for fixed size trigger-corrected extraction window 
Index: trunk/MagicSoft/Mars/msignal/MExtractTimeHighestIntegral.cc
===================================================================
--- trunk/MagicSoft/Mars/msignal/MExtractTimeHighestIntegral.cc	(revision 4716)
+++ trunk/MagicSoft/Mars/msignal/MExtractTimeHighestIntegral.cc	(revision 4722)
@@ -17,5 +17,5 @@
 !
 !   Author(s): Thomas Bretz, 02/2004 <mailto:tbretz@astro.uni-wuerzburg.de>
-!              Hendrik Bartko, 02/2004 <mailto:hbartko@mppmu.mpg.de>
+!   Author(s): Hendrik Bartko, 02/2004 <mailto:hbartko@mppmu.mpg.de>
 !
 !   Copyright: MAGIC Software Development, 2000-2004
@@ -297,2 +297,33 @@
 }
 
+// --------------------------------------------------------------------------
+//
+// In addition to the resources of the base-class MExtractor:
+//   MJPedestal.MExtractor.WindowSizeHiGain: 6
+//   MJPedestal.MExtractor.WindowSizeLoGain: 6
+//
+Int_t MExtractTimeHighestIntegral::ReadEnv(const TEnv &env, TString prefix, Bool_t print)
+{
+    Byte_t hw = fHiGainWindowSize;
+    Byte_t lw = fLoGainWindowSize;
+
+    Bool_t rc = kFALSE;
+
+    if (IsEnvDefined(env, prefix, "HiGainWindowSize", print))
+    {
+        hw = GetEnvValue(env, prefix, "HiGainWindowSize", hw);
+        rc = kTRUE;
+    }
+    if (IsEnvDefined(env, prefix, "LoGainWindowSize", print))
+    {
+        lw = GetEnvValue(env, prefix, "LoGainWindowSize", lw);
+        rc = kTRUE;
+    }
+
+    if (rc)
+        SetWindowSize(hw, lw);
+
+    rc = MExtractor::ReadEnv(env, prefix, print) ? kTRUE : rc;
+
+    return rc;
+}
Index: trunk/MagicSoft/Mars/msignal/MExtractTimeHighestIntegral.h
===================================================================
--- trunk/MagicSoft/Mars/msignal/MExtractTimeHighestIntegral.h	(revision 4716)
+++ trunk/MagicSoft/Mars/msignal/MExtractTimeHighestIntegral.h	(revision 4722)
@@ -24,4 +24,6 @@
   void FindTimeHiGain(Byte_t *first, Float_t &time, Float_t &dtime, Byte_t &sat, const MPedestalPix &ped) const;
   void FindTimeLoGain(Byte_t *first, Float_t &time, Float_t &dtime, Byte_t &sat, const MPedestalPix &ped) const;
+
+  Int_t ReadEnv(const TEnv &env, TString prefix, Bool_t print);
   
 public:
