Index: trunk/MagicSoft/Mars/Changelog
===================================================================
--- trunk/MagicSoft/Mars/Changelog	(revision 8303)
+++ trunk/MagicSoft/Mars/Changelog	(revision 8304)
@@ -39,4 +39,36 @@
      - replaced GetMediandev by GetDev
 
+   * callisto.rc, callisto_Dec04Jan05.rc:
+     - changed ExtractWinLeft/Right according to new scheme
+
+   * mhcalib/MHCalibrationChargeCam.[h,cc]:
+     - removed obsolete data members fFirstHiGain, etc and
+       replaced by storage of fSignal
+     - made sure that the average extracted signal position
+       is at least one slice away from the edges of the
+       extraction window
+
+   * mjobs/MJPedestal.cc:
+     - reworked the pulse position check. It now better takes
+       the properties of the extractors into account.
+       Still to be done: relation between pulse position and
+       extraction window!
+
+   * msignal/MExtractBlindPixel.[h,cc],
+     msignal/MExtractPINDiode.[h,cc]:
+     - fixed arguments type of SetRange
+
+   * msignal/MExtractTime.cc:
+     - removed old obsolete code already in comments
+
+   * msignal/MExtractTimeAndCharge.h:
+     - added getter for LoGainStartShift
+
+   * msignal/MExtractTimeAndChargeDigitalFilter.[h,cc],
+     msignal/MExtractTimeAndChargeSpline.[h,cc],
+     msignal/MExtractedSignalCam.[h,cc], msignal/MExtractor.[h,cc]:
+     - changed the type of LoGainFirst from byte to int
+     - if necessary increased class version
+
 
 
Index: trunk/MagicSoft/Mars/NEWS
===================================================================
--- trunk/MagicSoft/Mars/NEWS	(revision 8303)
+++ trunk/MagicSoft/Mars/NEWS	(revision 8304)
@@ -17,4 +17,11 @@
 
    - general: fixed a memory leak when reading many MStatusDisplays
+
+   - callisto: We have a new pulse position check which takes the properties
+     of the extractor automatically into account. So no need to set 
+     ExtractWinLeft/Right anymore. Again a check for pulses too much to the
+     left is done. If possible the lo-gain extraction start and hi-gain
+     extraction end is changed accordingly. If no proper extraction range
+     can be set (hi-gain too much to the left) an error is raised.
 
    - callisto: Redone the signal extraction this includes:
Index: trunk/MagicSoft/Mars/callisto.rc
===================================================================
--- trunk/MagicSoft/Mars/callisto.rc	(revision 8303)
+++ trunk/MagicSoft/Mars/callisto.rc	(revision 8304)
@@ -295,9 +295,19 @@
 
 # -------------------------------------------------------------------------
-# Use Pulse Position check to define the extraction ranges for the data?
+# When the starting pedestal is extracted from the first events of
+# the data run also the average pulse position of these events
+# is determined. If the pulse position check is switched on (default)
+# the extraction window of the hi- and lo-gain extractor for the
+# determined average pulse position is not allowed to exceed the
+# extractors search region. In this scenario we assume that the
+# start of the extraction window is at least similar to the
+# rising edge of the pulse.
+# To make sure that the search region and the extraction window
+# does not touch increase the values.
 # -------------------------------------------------------------------------
 #MJPedestalY2.PulsePosCheck: yes
-MJPedestalY2.ExtractWinLeft:  4.0
-MJPedestalY2.ExtractWinRight: 4.5
+#MJPedestalY2.ExtractWinLeft:  0.0
+#MJPedestalY2.ExtractWinRight: 0.0
+
 
 # -------------------------------------------------------------------------
Index: trunk/MagicSoft/Mars/callisto_Dec04Jan05.rc
===================================================================
--- trunk/MagicSoft/Mars/callisto_Dec04Jan05.rc	(revision 8303)
+++ trunk/MagicSoft/Mars/callisto_Dec04Jan05.rc	(revision 8304)
@@ -322,10 +322,19 @@
 
 # -------------------------------------------------------------------------
-# Use Pulse Position check to define the extraction ranges for the data?
+# When the starting pedestal is extracted from the first events of
+# the data run also the average pulse position of these events
+# is determined. If the pulse position check is switched on (default)
+# the extraction window of the hi- and lo-gain extractor for the
+# determined average pulse position is not allowed to exceed the
+# extractors search region. In this scenario we assume that the
+# start of the extraction window is at least similar to the
+# rising edge of the pulse.
+# To make sure that the search region and the extraction window
+# does not touch increase the values.
 # -------------------------------------------------------------------------
 #MJPedestalY2.PulsePosCheck: yes
-MJPedestalY2.ExtractWinLeft:  3.5
-MJPedestalY2.ExtractWinRight: 2.5
-#MJCalibrateSignal.ModifiedExtractWin: yes
+#MJPedestalY2.ExtractWinLeft:  0.0
+#MJPedestalY2.ExtractWinRight: 0.0
+
 # -------------------------------------------------------------------------
 # Define the Pulse Position check parameters:
Index: trunk/MagicSoft/Mars/mhcalib/MHCalibrationChargeCam.cc
===================================================================
--- trunk/MagicSoft/Mars/mhcalib/MHCalibrationChargeCam.cc	(revision 8303)
+++ trunk/MagicSoft/Mars/mhcalib/MHCalibrationChargeCam.cc	(revision 8304)
@@ -1,4 +1,4 @@
 /* ======================================================================== *\
-! $Name: not supported by cvs2svn $:$Id: MHCalibrationChargeCam.cc,v 1.49 2007-01-30 14:16:45 tbretz Exp $
+! $Name: not supported by cvs2svn $:$Id: MHCalibrationChargeCam.cc,v 1.50 2007-02-04 15:29:09 tbretz Exp $
 ! --------------------------------------------------------------------------
 !
@@ -114,4 +114,10 @@
 //  + Float_t fNumLoGainBlackoutLimit; // Rel. amount blackout logain events until pixel is declared unsuitable
 //
+// Class Version 3:
+//  - Byte_t  fFirstHiGain;                              // First used slice High Gain
+//  - Byte_t  fLastHiGain;                               // Last used slice High Gain
+//  - Byte_t  fFirstLoGain;                              // First used slice Low Gain
+//  - Byte_t  fLastLoGain;                               // Last used slice Low Gain
+//
 /////////////////////////////////////////////////////////////////////////////
 #include "MHCalibrationChargeCam.h"
@@ -219,5 +225,5 @@
 //
 MHCalibrationChargeCam::MHCalibrationChargeCam(const char *name, const char *title)
-    : fRawEvt(NULL)
+    : fRawEvt(NULL), fSignal(NULL)
 {
 
@@ -367,7 +373,6 @@
 {
 
-  MExtractedSignalCam *signal = 
-    (MExtractedSignalCam*)pList->FindObject(AddSerialNumber("MExtractedSignalCam"));
-  if (!signal)
+  fSignal = (MExtractedSignalCam*)pList->FindObject(AddSerialNumber("MExtractedSignalCam"));
+  if (!fSignal)
   {
       *fLog << err << "MExtractedSignalCam not found... abort." << endl;
@@ -377,9 +382,4 @@
   if (!InitCams(pList,"Charge"))
     return kFALSE;
-
-  fFirstHiGain = signal->GetFirstUsedSliceHiGain();
-  fLastHiGain  = signal->GetLastUsedSliceHiGain();
-  fFirstLoGain = signal->GetFirstUsedSliceLoGain();
-  fLastLoGain  = signal->GetLastUsedSliceLoGain();
 
   const Int_t npixels  = fGeom->GetNumPixels();
@@ -900,4 +900,9 @@
   MBadPixelsCam   *badcam    = fIntensBad ? fIntensBad->GetCam() : fBadPixels;
 
+  const Int_t hifirst = fSignal->GetFirstUsedSliceHiGain();
+  const Int_t hilast  = fSignal->GetLastUsedSliceHiGain();
+  const Int_t lofirst = fSignal->GetFirstUsedSliceLoGain();
+  const Int_t lolast  = fSignal->GetLastUsedSliceLoGain();
+
 
   for (Int_t i=0; i<fHiGainArray->GetSize(); i++)
@@ -944,6 +949,6 @@
           bad.SetUncalibrated( MBadPixelsPix::kHiGainOverFlow ); 
         }
-      
-      FinalizeAbsTimes(histhi, pix, bad, fFirstHiGain, fLastHiGain);
+
+      FinalizeAbsTimes(histhi, pix, bad, hifirst, hilast);
     }
 
@@ -991,5 +996,5 @@
           }
         
-        FinalizeAbsTimes(histlo, pix, bad, fFirstLoGain, fLastLoGain);
+        FinalizeAbsTimes(histlo, pix, bad, lofirst, lolast);
       }
 
@@ -1009,5 +1014,5 @@
 
       MBadPixelsPix &bad = chargecam->GetAverageBadArea(j);
-      FinalizeAbsTimes(histhi, pix, bad, fFirstHiGain, fLastHiGain);
+      FinalizeAbsTimes(histhi, pix, bad, hifirst, hilast);
    }
 
@@ -1031,5 +1036,5 @@
           {
             MBadPixelsPix &bad = chargecam->GetAverageBadArea(j);
-            FinalizeAbsTimes(histlo, pix, bad, fFirstLoGain, fLastLoGain);
+            FinalizeAbsTimes(histlo, pix, bad, lofirst, lolast);
           }
         
@@ -1051,5 +1056,5 @@
 
       MBadPixelsPix &bad = chargecam->GetAverageBadSector(j);
-      FinalizeAbsTimes(histhi, pix, bad, fFirstHiGain, fLastHiGain);
+      FinalizeAbsTimes(histhi, pix, bad, hifirst, hilast);
     }
   
@@ -1073,5 +1078,5 @@
 
         if (pix.IsHiGainSaturation())
-          FinalizeAbsTimes(histlo, pix, bad, fFirstLoGain, fLastLoGain);
+          FinalizeAbsTimes(histlo, pix, bad, lofirst, lolast);
       }
   
@@ -1131,5 +1136,5 @@
 //
 void MHCalibrationChargeCam::FinalizeAbsTimes(MHCalibrationChargePix &hist, MCalibrationChargePix &pix, MBadPixelsPix &bad, 
-                                              Byte_t first, Byte_t last)
+                                              Int_t first, Int_t last)
 {
     const Float_t mean = hist.GetAbsTimeMean();
@@ -1139,6 +1144,6 @@
     pix.SetAbsTimeRms(rms);
 
-    const Float_t lowerlimit = (Float_t)first;// + fTimeLowerLimit;
-    const Float_t upperlimit = (Float_t)last ;// - fTimeUpperLimit;
+    const Float_t lowerlimit = (Float_t)first+1;// + fTimeLowerLimit;
+    const Float_t upperlimit = (Float_t)last -1;// - fTimeUpperLimit;
 
     // FIXME: instead of checking whether the maximum is in the first or
Index: trunk/MagicSoft/Mars/mhcalib/MHCalibrationChargeCam.h
===================================================================
--- trunk/MagicSoft/Mars/mhcalib/MHCalibrationChargeCam.h	(revision 8303)
+++ trunk/MagicSoft/Mars/mhcalib/MHCalibrationChargeCam.h	(revision 8304)
@@ -86,10 +86,7 @@
   Float_t fTimeLowerLimit;                           // Limit dist. to first signal slice (in units of FADC slices) 
   Float_t fTimeUpperLimit;                           // Limit dist. to last signal slice  (in units of FADC slices) 
-  Byte_t  fFirstHiGain;                              // First used slice High Gain 
-  Byte_t  fLastHiGain;                               // Last used slice High Gain
-  Byte_t  fFirstLoGain;                              // First used slice Low Gain
-  Byte_t  fLastLoGain;                               // Last used slice Low Gain
   
   MRawEvtData         *fRawEvt;                      //!  Raw event data 
+  MExtractedSignalCam *fSignal;                      //!
 
   Bool_t SetupHists(const MParList *pList);
@@ -101,5 +98,5 @@
 
   void   FinalizeAbsTimes (MHCalibrationChargePix &hist, MCalibrationChargePix &pix, MBadPixelsPix &bad,
-                           Byte_t first, Byte_t last);  
+                           Int_t first, Int_t last);
   Bool_t FinalizeHists();
   void   FinalizeBadPixels();
@@ -141,5 +138,5 @@
   void   DrawPixelContent( Int_t num )  const;    
 
-  ClassDef(MHCalibrationChargeCam, 2)	// Histogram class for Charge Camera Calibration
+  ClassDef(MHCalibrationChargeCam, 3)	// Histogram class for Charge Camera Calibration
 };
 
Index: trunk/MagicSoft/Mars/mjobs/MJPedestal.cc
===================================================================
--- trunk/MagicSoft/Mars/mjobs/MJPedestal.cc	(revision 8303)
+++ trunk/MagicSoft/Mars/mjobs/MJPedestal.cc	(revision 8304)
@@ -102,6 +102,6 @@
 const TString  MJPedestal::fgReferenceFile   = "mjobs/pedestalref.rc";
 const TString  MJPedestal::fgBadPixelsFile   = "mjobs/badpixels_0_559.rc";
-const Float_t  MJPedestal::fgExtractWinLeft  = 2.5;
-const Float_t  MJPedestal::fgExtractWinRight = 4.5;
+const Float_t  MJPedestal::fgExtractWinLeft  = 0;
+const Float_t  MJPedestal::fgExtractWinRight = 0;
 
 // --------------------------------------------------------------------------
@@ -859,28 +859,15 @@
         return kTRUE;
 
-    Int_t numhigainsamples = 0;
-    Int_t numlogainsamples = 0;
-
-    Float_t meanpulsetime  = 0.;
-    Float_t rmspulsetime   = 0.;
-
-    if (IsUseMC())
-    {
-        //
-        // FIXME:
-        // The MC cannot run over the first 2000 pedestal events since almost all
-        // events are empty, therefore a pulse pos. check is not possible, either.
-        // For the moment, have to fix the problem hardcoded...
-        //
-        //            MMcEvt *evt = (MMcEvt*)plist.FindObject("MMcEvt");
-        //            const Float_t meanpulsetime = evt->GetFadcTimeJitter();
-        meanpulsetime = 4.5;
-        rmspulsetime  = 1.0;
-
-        numhigainsamples = 15;
-        numlogainsamples = 15;
-
-    }
-    else
+    // FIXME:
+    // The MC cannot run over the first 2000 pedestal events since almost all
+    // events are empty, therefore a pulse pos. check is not possible, either.
+    // For the moment, have to fix the problem hardcoded...
+    //
+    //            MMcEvt *evt = (MMcEvt*)plist.FindObject("MMcEvt");
+    //            const Float_t meanpulsetime = evt->GetFadcTimeJitter();
+    Float_t meanpulsetime  = 4.5;
+    Float_t rmspulsetime   = 1.0;
+
+    if (!IsUseMC())
     {
         if (fIsPixelCheck)
@@ -909,14 +896,4 @@
         meanpulsetime = cam->GetAverageArea(0).GetHiGainMean();
         rmspulsetime  = cam->GetAverageArea(0).GetHiGainRms();
-
-        MRawEvtData *data = (MRawEvtData*)plist.FindObject("MRawEvtData");
-        if (!data)
-        {
-            *fLog << err << "MRawEvtData not found... abort." << endl;
-            return kFALSE;
-        }
-
-        numhigainsamples = data->GetNumHiGainSamples();
-        numlogainsamples = data->GetNumLoGainSamples();
     }
 
@@ -924,66 +901,93 @@
     *fLog << meanpulsetime << "+-" << rmspulsetime << endl;
 
-    const MExtractTimeAndCharge *ext = dynamic_cast<MExtractTimeAndCharge*>(fExtractor);
-
-    //
-    // Get the ranges for the new extractor setting
-    //
-    const Int_t newfirst = TMath::Nint(meanpulsetime-fExtractWinLeft);
-
-    Int_t wshigain = ext ? ext->GetWindowSizeHiGain() : 6;
-    if (wshigain > 6)
-        wshigain = 6;
-
-    Int_t wslogain = ext ? ext->GetWindowSizeLoGain() : 4;
-    if (wslogain > 4)
-        wslogain = 4;
-
-    const Int_t newlast  = TMath::Nint(meanpulsetime+fExtractWinRight);
-
-    *fLog << underline;
-    *fLog << "Try to set new range limits: (" << newfirst << "," << newlast;
-    *fLog << "+" << wshigain << "," << newfirst-1 << "," << newlast << "+";
-    *fLog << wslogain << ")" << endl;
-
-    //
-    // Check the ranges for the new extractor setting
-    //
-    if (newfirst < 0)
-    {
-        //*fLog << err << "Pulse is too much to the left, cannot go below 0!" << endl;
-        //return -1;
-    }
-    if (newlast+wshigain > numhigainsamples+numlogainsamples-1)
-    {
-        *fLog << err << "Pulse is too much to the right, cannot go beyond limits: ";
-        *fLog << numhigainsamples << "+" << numlogainsamples << "-1" << endl;
-        *fLog << " Cannot extract at all!" << endl;
-        return -3;
-    }
-    if (newlast+wslogain > numlogainsamples)
-    {
-        *fLog << err << "Pulse is too much to the right, cannot go beyond logain limits!" << endl;
-        *fLog << endl;
-        *fLog << "Try to use a different extractor (e.g. with a window size of only 4 sl.) or:" << endl;
-        *fLog << "Set the limit to a lower value (callisto.rc):" << endl;
-        *fLog << "    MJPedestalY2:ExtractWinRight: 4.5" << endl;
-        *fLog << "(ATTENTION, you will lose late cosmics pulses!)" << endl;
+    MExtractTimeAndCharge *ext = dynamic_cast<MExtractTimeAndCharge*>(fExtractor);
+    if (!ext)
+    {
+        *fLog << warn << "WARNING - no extractor found inheriting from MExtractTimeAndCharge... no pulse position check." << endl;
+        return kTRUE;
+    }
+
+    const Int_t hi0 = ext->GetHiGainFirst();
+    const Int_t lo1 = ext->GetLoGainLast();
+    Int_t hi1 = ext->GetHiGainLast();
+    Int_t lo0 = ext->GetLoGainFirst();
+
+    //
+    // Get the ranges for the new extractor setting. The window
+    // size is always rounded to the next higher integer.
+    //
+    const Int_t wshigain = ext->GetWindowSizeHiGain();
+    const Int_t wslogain = ext->GetWindowSizeLoGain();
+
+    //
+    // Here we calculate the end of the lo-gain range
+    // as it is done in MExtractTimeAndCharge
+    //
+    const Double_t poshi  = meanpulsetime;
+    const Double_t poslo  = poshi + ext->GetOffsetLoGain();
+    const Double_t poslo2 = poslo + ext->GetLoGainStartShift();
+
+    //
+    // Do the right side checks range checks
+    //
+    if (poshi+wshigain+fExtractWinRight > hi1-0.5)
+    {
+        *fLog << err;
+        *fLog << "ERROR - Pulse is too much to the right, out of hi-gain range [";
+        *fLog << hi0 << "," << hi1 << "]" << endl;
         *fLog << endl;
         return -2;
     }
 
+    if (poslo+wslogain+fExtractWinRight > lo1-0.5)
+    {
+        *fLog << err;
+        *fLog << "ERROR - Pulse is too much to the right, out of lo-gain range [";
+        *fLog << lo0 << "," << lo1 << "]" << endl;
+        return -2;
+    }
+
+    //
+    // Do the left side checks range checks
+    //
+    if (poshi-fExtractWinLeft < hi0+0.5)
+    {
+        *fLog << err;
+        *fLog << "ERROR - Pulse is too much to the left, out of hi-gain range [";
+        *fLog << hi0 << "," << hi1 << "]" << endl;
+        return -3;
+    }
+
+    if (poslo2-fExtractWinLeft < lo0+0.5)
+    {
+        *fLog << warn;
+        *fLog << "WARNING - Pulse is too much to the left, out of lo-gain range [";
+        *fLog << lo0 << "," << lo1 << "]" << endl;
+        *fLog << "Trying to match extraction window and pulse position..." << endl;
+
+        //
+        // Set and store the new ranges
+        //
+        Int_t shift = 0;
+        while (poslo2-fExtractWinLeft < lo0+0.5)
+        {
+            hi1--;
+            lo0--;
+
+            if (poshi+wshigain+fExtractWinRight > hi1-0.5)
+            {
+                *fLog << err << "ERROR - No proper extraction window found.... abort." << endl;
+                return -3;
+            }
+        }
+
+        *fLog << "Changed extraction window by " << shift;
+        *fLog << "slices to hi-gain [" << hi0 << "," << hi1;
+        *fLog << "] and lo-gain [" << lo0 << "," << lo1 << "]" << endl;
+
+        ext->SetRange(hi0, hi1, lo0, lo1);
+    }
+
     return kTRUE;
-/*
-    //
-    // Set and store the new ranges
-    //
-    const Int_t hi0 = newfirst;
-    const Int_t hi1 = newlast+wshigain;
-
-    const Int_t lo0 = newfirst>0 ? newfirst-1 : newfirst;
-    const Int_t lo1 = numlogainsamples-1;
-
-    fExtractor->SetRange(hi0, hi1, lo0, lo1);
-    return kTRUE;*/
 }
 
Index: trunk/MagicSoft/Mars/msignal/MExtractBlindPixel.cc
===================================================================
--- trunk/MagicSoft/Mars/msignal/MExtractBlindPixel.cc	(revision 8303)
+++ trunk/MagicSoft/Mars/msignal/MExtractBlindPixel.cc	(revision 8304)
@@ -150,5 +150,5 @@
 }
 
-void MExtractBlindPixel::SetRange(Byte_t hifirst, Byte_t hilast, Byte_t lofirst, Byte_t lolast)
+void MExtractBlindPixel::SetRange(Byte_t hifirst, Byte_t hilast, Int_t lofirst, Byte_t lolast)
 {
 
Index: trunk/MagicSoft/Mars/msignal/MExtractBlindPixel.h
===================================================================
--- trunk/MagicSoft/Mars/msignal/MExtractBlindPixel.h	(revision 8303)
+++ trunk/MagicSoft/Mars/msignal/MExtractBlindPixel.h	(revision 8304)
@@ -88,5 +88,5 @@
   
   void SetRange         ( const Byte_t  hifirst=0, const Byte_t hilast=0, 
-   		          const Byte_t  lofirst=0, const Byte_t lolast=0 );
+   		          const Int_t   lofirst=0, const Byte_t lolast=0 );
   void SetResolution    ( const Float_t f=fgResolution       )  { fResolution     = f;     }
   
Index: trunk/MagicSoft/Mars/msignal/MExtractPINDiode.cc
===================================================================
--- trunk/MagicSoft/Mars/msignal/MExtractPINDiode.cc	(revision 8303)
+++ trunk/MagicSoft/Mars/msignal/MExtractPINDiode.cc	(revision 8304)
@@ -145,5 +145,5 @@
 // - fSqrtLoGainSamples to: 0.
 //  
-void MExtractPINDiode::SetRange(Byte_t hifirst, Byte_t hilast, Byte_t lofirst, Byte_t lolast)
+void MExtractPINDiode::SetRange(Byte_t hifirst, Byte_t hilast, Int_t lofirst, Byte_t lolast)
 {
 
Index: trunk/MagicSoft/Mars/msignal/MExtractPINDiode.h
===================================================================
--- trunk/MagicSoft/Mars/msignal/MExtractPINDiode.h	(revision 8303)
+++ trunk/MagicSoft/Mars/msignal/MExtractPINDiode.h	(revision 8304)
@@ -56,5 +56,5 @@
 
   // Setters
-  void SetRange(Byte_t hifirst=0, Byte_t hilast=0, Byte_t lofirst=0, Byte_t lolast=0);
+  void SetRange(Byte_t hifirst=0, Byte_t hilast=0, Int_t lofirst=0, Byte_t lolast=0);
   void SetPINDiodeIdx  ( const UInt_t idx=fgPINDiodeIdx    ) { fPINDiodeIdx   = idx; }
   void SetLowerFitLimit( const Byte_t lim=fgLowerFitLimit  ) { fLowerFitLimit = lim; }
Index: trunk/MagicSoft/Mars/msignal/MExtractTime.cc
===================================================================
--- trunk/MagicSoft/Mars/msignal/MExtractTime.cc	(revision 8303)
+++ trunk/MagicSoft/Mars/msignal/MExtractTime.cc	(revision 8304)
@@ -1,4 +1,4 @@
 /* ======================================================================== *\
-! $Name: not supported by cvs2svn $:$Id: MExtractTime.cc,v 1.22 2006-10-24 08:24:52 tbretz Exp $
+! $Name: not supported by cvs2svn $:$Id: MExtractTime.cc,v 1.23 2007-02-04 15:30:16 tbretz Exp $
 ! --------------------------------------------------------------------------
 !
@@ -86,4 +86,5 @@
 
 const TString MExtractTime::fgNameTimeCam   = "MArrivalTimeCam";
+
 // --------------------------------------------------------------------------
 //
@@ -109,6 +110,4 @@
 }
 
-
-
 // --------------------------------------------------------------------------
 //
@@ -132,69 +131,7 @@
 }
 
-// --------------------------------------------------------------------------
-//
-// The ReInit calls:
-// -  MExtractor::ReInit()
-//
-// Call: 
-// - MArrivalTimeCam::SetUsedFADCSlices(fHiGainFirst, fHiGainLast, fNumHiGainSamples,
-//                                      fLoGainFirst, fLoGainLast, fNumLoGainSamples);
-/*
-Bool_t MExtractTime::ReInit(MParList *pList)
-{
-    if (!MExtractor::ReInit(pList))
-        return kFALSE;
-
-//    if (fArrTime)
-//      fArrTime->SetUsedFADCSlices(fHiGainFirst, fHiGainLast+fHiLoLast, fLoGainFirst, fLoGainLast);
-
-    return kTRUE;
-}
-*/
-// --------------------------------------------------------------------------
-//
-// Calculate the integral of the FADC time slices and store them as a new
-// pixel in the MArrivalTimeCam container.
-/*
-Int_t MExtractTime::Process()
-{
-
-
-  MRawEvtPixelIter pixel(fRawEvt);
-
-  while (pixel.Next())
-    {
-      //
-      // Find signal in hi- and lo-gain
-      //
-      Float_t timehi=0., deltatimehi=0.;
-      Byte_t sathi=0;
-
-      const Int_t pixid = pixel.GetPixelId();
-      const MPedestalPix  &ped = (*fPedestals)[pixid];
-      MArrivalTimePix &pix = (*fArrTime)[pixid];
-
-      FindTimeHiGain(pixel.GetHiGainSamples()+fHiGainFirst, timehi, deltatimehi, sathi, ped);
-
-      Float_t timelo=0., deltatimelo=0.;
-      Byte_t satlo=0;
-
-      if ((sathi)&&pixel.HasLoGain())
-	  FindTimeLoGain(pixel.GetLoGainSamples()+fLoGainFirst, timelo, deltatimelo, satlo, ped);
-
-      pix.SetArrivalTime(timehi, deltatimehi, timelo-fOffsetLoGain, deltatimelo);
-      pix.SetGainSaturation(sathi, satlo);
- 
-    }
-
-    fArrTime->SetReadyToSave();
-
-    return kTRUE;
-}*/
 
 void MExtractTime::Print(Option_t *o) const
 {
-//    if (IsA()==MExtractTime::Class())
-//        *fLog << GetDescriptor() << ":" << endl;
     MExtractor::Print(o);
     *fLog << " Offset Lo-Gain:     " << fOffsetLoGain << endl;
Index: trunk/MagicSoft/Mars/msignal/MExtractTimeAndCharge.h
===================================================================
--- trunk/MagicSoft/Mars/msignal/MExtractTimeAndCharge.h	(revision 8303)
+++ trunk/MagicSoft/Mars/msignal/MExtractTimeAndCharge.h	(revision 8304)
@@ -30,7 +30,8 @@
   MExtractTimeAndCharge(const char *name=NULL, const char *title=NULL);
   
-  Int_t  GetWindowSizeHiGain  () const { return fWindowSizeHiGain; }
-  Int_t  GetWindowSizeLoGain  () const { return fWindowSizeLoGain; }
-  Byte_t GetLoGainSwitch      () const { return fLoGainSwitch;     }
+  Int_t   GetWindowSizeHiGain  () const { return fWindowSizeHiGain; }
+  Int_t   GetWindowSizeLoGain  () const { return fWindowSizeLoGain; }
+  Float_t GetLoGainStartShift  () const { return fLoGainStartShift; }
+  Byte_t  GetLoGainSwitch      () const { return fLoGainSwitch;     }
 
   void SetLoGainStartShift( const Float_t f=fgLoGainStartShift ) { fLoGainStartShift = f + fOffsetLoGain;  }
Index: trunk/MagicSoft/Mars/msignal/MExtractTimeAndChargeDigitalFilter.cc
===================================================================
--- trunk/MagicSoft/Mars/msignal/MExtractTimeAndChargeDigitalFilter.cc	(revision 8303)
+++ trunk/MagicSoft/Mars/msignal/MExtractTimeAndChargeDigitalFilter.cc	(revision 8304)
@@ -1,4 +1,4 @@
 /* ======================================================================== *\
-! $Name: not supported by cvs2svn $:$Id: MExtractTimeAndChargeDigitalFilter.cc,v 1.76 2007-01-16 14:14:37 tbretz Exp $
+! $Name: not supported by cvs2svn $:$Id: MExtractTimeAndChargeDigitalFilter.cc,v 1.77 2007-02-04 15:30:16 tbretz Exp $
 ! --------------------------------------------------------------------------
 !
@@ -86,5 +86,5 @@
 const Byte_t  MExtractTimeAndChargeDigitalFilter::fgHiGainFirst             =  0;
 const Byte_t  MExtractTimeAndChargeDigitalFilter::fgHiGainLast              = 16;
-const Byte_t  MExtractTimeAndChargeDigitalFilter::fgLoGainFirst             =  1;
+const Int_t   MExtractTimeAndChargeDigitalFilter::fgLoGainFirst             =  1;
 const Byte_t  MExtractTimeAndChargeDigitalFilter::fgLoGainLast              = 14;
 const Int_t   MExtractTimeAndChargeDigitalFilter::fgBinningResolutionHiGain = 10;
@@ -137,5 +137,5 @@
     }
 
-    if (windowl > fLoGainLast-fLoGainFirst+1)
+    if (windowl > (int)fLoGainLast-fLoGainFirst+1)
     {
         *fLog << err << "ERROR - The new hi-gain window size exceeds the extraction range." << endl;
Index: trunk/MagicSoft/Mars/msignal/MExtractTimeAndChargeDigitalFilter.h
===================================================================
--- trunk/MagicSoft/Mars/msignal/MExtractTimeAndChargeDigitalFilter.h	(revision 8303)
+++ trunk/MagicSoft/Mars/msignal/MExtractTimeAndChargeDigitalFilter.h	(revision 8304)
@@ -17,5 +17,5 @@
     static const Byte_t  fgHiGainFirst;             //! Default for fHiGainFirst       (now set to: 0)
     static const Byte_t  fgHiGainLast;              //! Default for fHiGainLast        (now set to:14)
-    static const Byte_t  fgLoGainFirst;             //! Default for fLoGainFirst       (now set to: 3)
+    static const Int_t   fgLoGainFirst;             //! Default for fLoGainFirst       (now set to: 3)
     static const Byte_t  fgLoGainLast;              //! Default for fLoGainLast        (now set to:14)
     static const Int_t   fgBinningResolutionHiGain; //! Default for fBinningResolutionHiGain (now set to: 10)
Index: trunk/MagicSoft/Mars/msignal/MExtractTimeAndChargeSpline.cc
===================================================================
--- trunk/MagicSoft/Mars/msignal/MExtractTimeAndChargeSpline.cc	(revision 8303)
+++ trunk/MagicSoft/Mars/msignal/MExtractTimeAndChargeSpline.cc	(revision 8304)
@@ -1,4 +1,4 @@
 /* ======================================================================== *\
-! $Name: not supported by cvs2svn $:$Id: MExtractTimeAndChargeSpline.cc,v 1.65 2007-02-03 20:07:52 tbretz Exp $
+! $Name: not supported by cvs2svn $:$Id: MExtractTimeAndChargeSpline.cc,v 1.66 2007-02-04 15:30:16 tbretz Exp $
 ! --------------------------------------------------------------------------
 !
@@ -158,5 +158,5 @@
 const Byte_t  MExtractTimeAndChargeSpline::fgHiGainFirst      = 0;
 const Byte_t  MExtractTimeAndChargeSpline::fgHiGainLast       = 14;
-const Byte_t  MExtractTimeAndChargeSpline::fgLoGainFirst      = 1;
+const Int_t   MExtractTimeAndChargeSpline::fgLoGainFirst      = 1;
 const Byte_t  MExtractTimeAndChargeSpline::fgLoGainLast       = 14;
 const Float_t MExtractTimeAndChargeSpline::fgResolution       = 0.05;
@@ -205,7 +205,6 @@
 // explicit call to SetChargeType().
 //
-void MExtractTimeAndChargeSpline::SetRange(Byte_t hifirst, Byte_t hilast, Byte_t lofirst, Byte_t lolast)
-{
-
+void MExtractTimeAndChargeSpline::SetRange(Byte_t hifirst, Byte_t hilast, Int_t lofirst, Byte_t lolast)
+{
   MExtractor::SetRange(hifirst, hilast, lofirst, lolast);
 
Index: trunk/MagicSoft/Mars/msignal/MExtractTimeAndChargeSpline.h
===================================================================
--- trunk/MagicSoft/Mars/msignal/MExtractTimeAndChargeSpline.h	(revision 8303)
+++ trunk/MagicSoft/Mars/msignal/MExtractTimeAndChargeSpline.h	(revision 8304)
@@ -17,5 +17,5 @@
     static const Byte_t  fgHiGainFirst;      //! Default for fHiGainFirst  (now set to: 2)
     static const Byte_t  fgHiGainLast;       //! Default for fHiGainLast   (now set to: 14)
-    static const Byte_t  fgLoGainFirst;      //! Default for fLoGainFirst  (now set to: 2)
+    static const Int_t   fgLoGainFirst;      //! Default for fLoGainFirst  (now set to: 2)
     static const Byte_t  fgLoGainLast;       //! Default for fLoGainLast   (now set to: 14)
     static const Float_t fgResolution;       //! Default for fResolution   (now set to: 0.003)
@@ -60,5 +60,5 @@
     Float_t GetFallTimeHiGain() const { return fFallTimeHiGain; }
 
-    void SetRange(Byte_t hifirst=0, Byte_t hilast=0, Byte_t lofirst=0, Byte_t lolast=0 );
+    void SetRange(Byte_t hifirst=0, Byte_t hilast=0, Int_t lofirst=0, Byte_t lolast=0 );
 
     void SetResolution(const Float_t f=fgResolution)  { fResolution  = f;  }
Index: trunk/MagicSoft/Mars/msignal/MExtractedSignalCam.cc
===================================================================
--- trunk/MagicSoft/Mars/msignal/MExtractedSignalCam.cc	(revision 8303)
+++ trunk/MagicSoft/Mars/msignal/MExtractedSignalCam.cc	(revision 8304)
@@ -34,4 +34,9 @@
 //  - fNdf
 //
+// Class Version 4:
+// ----------------
+//  - Byte_t fFirstUsedSliceLoGain;         // First Low Gain FADC used for extraction (incl.)
+//  + Int_t  fFirstUsedSliceLoGain;         // First Low Gain FADC used for extraction (incl.)
+//
 /////////////////////////////////////////////////////////////////////////////
 #include "MExtractedSignalCam.h"
Index: trunk/MagicSoft/Mars/msignal/MExtractedSignalCam.h
===================================================================
--- trunk/MagicSoft/Mars/msignal/MExtractedSignalCam.h	(revision 8303)
+++ trunk/MagicSoft/Mars/msignal/MExtractedSignalCam.h	(revision 8304)
@@ -20,5 +20,5 @@
 
   Byte_t fFirstUsedSliceHiGain;        // First High Gain FADC used for extraction (incl.)
-  Byte_t fFirstUsedSliceLoGain;        // First Low Gain FADC used for extraction (incl.)
+  Int_t  fFirstUsedSliceLoGain;        // First Low Gain FADC used for extraction (incl.)
   
   Byte_t fLastUsedSliceHiGain;         // Last High Gain FADC used for extraction (incl.)
@@ -40,6 +40,5 @@
 
     Byte_t  GetFirstUsedSliceHiGain()    const { return fFirstUsedSliceHiGain; }
-    Byte_t  GetFirstUsedSliceLoGain()    const { return fFirstUsedSliceLoGain; }
-
+    Int_t   GetFirstUsedSliceLoGain()    const { return fFirstUsedSliceLoGain; }
     Byte_t  GetLastUsedSliceHiGain()     const { return fLastUsedSliceHiGain;  }
     Byte_t  GetLastUsedSliceLoGain()     const { return fLastUsedSliceLoGain;  }
@@ -50,5 +49,5 @@
     void    SetLogStream     ( MLog *lg  );
     void    SetUsedFADCSlices(Byte_t firsth, Byte_t lasth, Float_t winh,
-                              Byte_t firstl, Byte_t lastl, Float_t winl)
+                              Int_t  firstl, Byte_t lastl, Float_t winl)
     {
       fFirstUsedSliceHiGain    = firsth;
@@ -66,5 +65,5 @@
     void DrawPixelContent(Int_t num) const;
 
-    ClassDef(MExtractedSignalCam, 3)	// Storage Container for extracted signals in the camera
+    ClassDef(MExtractedSignalCam, 4)	// Storage Container for extracted signals in the camera
 };
 
Index: trunk/MagicSoft/Mars/msignal/MExtractor.cc
===================================================================
--- trunk/MagicSoft/Mars/msignal/MExtractor.cc	(revision 8303)
+++ trunk/MagicSoft/Mars/msignal/MExtractor.cc	(revision 8304)
@@ -141,5 +141,5 @@
 }
 
-void MExtractor::SetRange(Byte_t hifirst, Byte_t hilast, Byte_t lofirst, Byte_t lolast)
+void MExtractor::SetRange(Byte_t hifirst, Byte_t hilast, Int_t lofirst, Byte_t lolast)
 {
     fHiGainFirst = hifirst;
@@ -397,5 +397,5 @@
 {
     Byte_t hf = fHiGainFirst;
-    Byte_t lf = fLoGainFirst;
+    Int_t  lf = fLoGainFirst;
     Byte_t hl = fHiGainLast;
     Byte_t ll = fLoGainLast;
Index: trunk/MagicSoft/Mars/msignal/MExtractor.h
===================================================================
--- trunk/MagicSoft/Mars/msignal/MExtractor.h	(revision 8303)
+++ trunk/MagicSoft/Mars/msignal/MExtractor.h	(revision 8304)
@@ -48,5 +48,5 @@
   Byte_t   fHiGainFirst;                   // First FADC slice nr. to extract the High Gain signal
   Byte_t   fHiGainLast;                    // Last FADC slice nr. to extract the High Gain signal
-  Byte_t   fLoGainFirst;                   // First FADC slice nr. to extract the Low Gain signal
+  Int_t    fLoGainFirst;                   // First FADC slice nr. to extract the Low Gain signal
   Byte_t   fLoGainLast;                    // Last FADC slice nr. to extract the Low Gain signal
                                            
@@ -87,5 +87,5 @@
   Byte_t  GetHiGainFirst()      const { return fHiGainFirst;      }
   Byte_t  GetHiGainLast ()      const { return fHiGainLast ;      }
-  Byte_t  GetLoGainFirst()      const { return fLoGainFirst;      }
+  Int_t   GetLoGainFirst()      const { return fLoGainFirst;      }
   Byte_t  GetLoGainLast ()      const { return fLoGainLast ;      }
   Float_t GetNumHiGainSamples() const { return fNumHiGainSamples; }
@@ -102,5 +102,5 @@
   Float_t SetResolutionPerPheLoGain() const { return fResolutionPerPheLoGain; }
 
-  virtual void SetRange(Byte_t hifirst=0, Byte_t hilast=0, Byte_t lofirst=0, Byte_t lolast=0);
+  virtual void SetRange(Byte_t hifirst=0, Byte_t hilast=0, Int_t lofirst=0, Byte_t lolast=0);
 
   void SetOffsetLoGain    ( const Float_t  f=fgOffsetLoGain          ) { fOffsetLoGain     = f;    }
