Index: /trunk/MagicSoft/Mars/Changelog
===================================================================
--- /trunk/MagicSoft/Mars/Changelog	(revision 8157)
+++ /trunk/MagicSoft/Mars/Changelog	(revision 8158)
@@ -29,4 +29,5 @@
    * mextralgo/MExtralgoSpline.[h,cc]:
      - removed the random iterator, use a random number instead
+     - removed obsolete variable fResolution
 
    * mjobs/MJCalibrateSignal.cc, mjobs/MJCalibration.cc,
@@ -46,4 +47,5 @@
      - removed memcpy stuff, instead use the output of MExtractPedestal
      - get the window size automatically from a possible extractor
+     - simplified InitBlindPixel
 
    * mpedestal/Makefile, mpedestal/PedestalLinkDef.h:
@@ -87,4 +89,5 @@
      - changed rise-time from 0.5 to 0.7 and fall time from 0.5 to 1.0
      - removed obsolete data members
+     - removed fRandomIter
 
    * msignal/MExtractedSignalPix.h:
@@ -117,4 +120,10 @@
    * msignal/SignalIncl.h:
      - removed obsolete includes
+
+   * msignal/MExtractBlindPixel.[h,cc]:
+     - changed according to the other changes
+     - removed a lot of obsolete variables
+     - changed interface to set blind pixel indices
+     - now directly use the spline extractor class
 
 
Index: /trunk/MagicSoft/Mars/mextralgo/MExtralgoSpline.cc
===================================================================
--- /trunk/MagicSoft/Mars/mextralgo/MExtralgoSpline.cc	(revision 8157)
+++ /trunk/MagicSoft/Mars/mextralgo/MExtralgoSpline.cc	(revision 8158)
@@ -50,4 +50,6 @@
 #include "MExtralgoSpline.h"
 
+#include <TRandom.h>
+
 #include "../mbase/MMath.h"
 
@@ -207,7 +209,8 @@
 }
 
-#include <TRandom.h>
-Float_t MExtralgoSpline::ExtractNoise(Int_t iter)
-{
+Float_t MExtralgoSpline::ExtractNoise(/*Int_t iter*/)
+{
+    // FIXME: Shell we keep the extraction inside one slice
+    // or randomize it along the extraction window?
     const Float_t nsx = gRandom->Uniform(); //iter * fResolution;
 
@@ -378,5 +381,5 @@
     {
         fTime      = maxpos;
-        fTimeDev   = fResolution;
+        fTimeDev   = 0;
         fSignal    = maxval;
         fSignalDev = 0;  // means: is valid
@@ -389,5 +392,5 @@
 
     fTime      = x1;
-    fTimeDev   = fResolution;
+    fTimeDev   = 0;
     fSignal    = CalcIntegral(maxpos);
     fSignalDev = 0;  // means: is valid
Index: /trunk/MagicSoft/Mars/mextralgo/MExtralgoSpline.h
===================================================================
--- /trunk/MagicSoft/Mars/mextralgo/MExtralgoSpline.h	(revision 8157)
+++ /trunk/MagicSoft/Mars/mextralgo/MExtralgoSpline.h	(revision 8158)
@@ -30,5 +30,5 @@
     Float_t fFallTime;
 
-    Float_t fResolution;
+//    Float_t fResolution;
 
     // Result
@@ -446,6 +446,6 @@
 
     void SetRiseFallTime(Float_t rise, Float_t fall) { fRiseTime=rise; fFallTime=fall; }
-    void SetExtrationType(ExtractionType_t typ)      { fExtractionType = typ; }
-    void SetResolution(Float_t res)                  { fResolution=res; }
+    void SetExtractionType(ExtractionType_t typ)     { fExtractionType = typ; }
+//    void SetResolution(Float_t res)                  { fResolution=res; }
 
     Float_t GetTime() const      { return fTime; }
@@ -458,5 +458,5 @@
     void GetTime(Float_t &sig, Float_t &dsig) const   { sig=fTime; dsig=fTimeDev; }
 
-    Float_t ExtractNoise(Int_t iter);
+    Float_t ExtractNoise(/*Int_t iter*/);
     void Extract(Byte_t sat, Int_t maxpos);
 };
Index: /trunk/MagicSoft/Mars/mjobs/MJCalibration.cc
===================================================================
--- /trunk/MagicSoft/Mars/mjobs/MJCalibration.cc	(revision 8157)
+++ /trunk/MagicSoft/Mars/mjobs/MJCalibration.cc	(revision 8158)
@@ -114,4 +114,5 @@
 
 #include "MPedestalCam.h"
+#include "MPedestalSubtract.h"
 #include "MCalibColorSteer.h"
 
@@ -1594,70 +1595,43 @@
                                    MHCalibrationChargeBlindCam &blindcam)
 {
-
-  Int_t run = fSequence.GetLastRun();
-  
-  //
-  // Initialize the blind pixel. Unfortunately, there is a hardware difference
-  // in the first blind pixel until run "gkSecondBlindPixelInstallation" and the
-  // later setup. The first needs to use a filter because of the length of
-  // spurious NSB photon signals. The latter get better along extracting the amplitude
-  // from a small window.
-  //
-  if (run < gkSecondBlindPixelInstallation)
-    {
-      MCalibrationBlindCamOneOldStyle blindresults;
-      if (IsIntensity())
+    const Int_t run = fSequence.GetLastRun();
+
+    //
+    // Initialize the blind pixel. Unfortunately, there is a hardware
+    // difference in the first blind pixel until run
+    // gkSecondBlindPixelInstallation and the later setup. The first
+    // needs to use a filter because of the length of spurious NSB photon
+    // signals. The latter get better along extracting the amplitude
+    // from a small window.
+    //
+    const MCalibrationBlindCamOneOldStyle   one;
+    const MCalibrationBlindCamTwoNewStyle   two;
+    const MCalibrationBlindCamThreeNewStyle three;
+
+    const MCalibrationBlindCam &blindresults =
+        run<gkSecondBlindPixelInstallation ? static_cast<MCalibrationBlindCam>(one) :
+        (run<gkThirdBlindPixelInstallation ? static_cast<MCalibrationBlindCam>(two) : static_cast<MCalibrationBlindCam>(three));
+
+    if (IsIntensity())
         blindresults.Copy(*fIntensBlindCam.GetCam());
-      else
+    else
         blindresults.Copy(fCalibrationBlindCam);
 
-      blindext.SetExtractionType(MExtractBlindPixel::kIntegral);
-      blindext.SetExtractionType(MExtractBlindPixel::kFilter);
-      blindext.SetRange(10,19,0,6);
-      blindext.SetNSBFilterLimit(70);
-    }
-  else if (run < gkThirdBlindPixelInstallation)
-    {
-
-      MCalibrationBlindCamTwoNewStyle blindresults;
-
-      if (IsIntensity())
-        blindresults.Copy(*fIntensBlindCam.GetCam());
-      else
-        blindresults.Copy(fCalibrationBlindCam);
-
-      blindext.SetNumBlindPixels(blindresults.GetSize());
-      for (Int_t i=0;i<blindresults.GetSize();i++)
-        blindext.SetBlindPixelIdx(blindresults[i].GetPixId(),i);
-
-      blindext.SetExtractionType(MExtractBlindPixel::kAmplitude);
-      blindext.SetExtractionType(MExtractBlindPixel::kFilter);
-      blindext.SetRange(5,8,0,2);
-      blindext.SetNSBFilterLimit(38);
-      
-    }
-  else
-    {
-
-      MCalibrationBlindCamThreeNewStyle blindresults;
-
-      if (IsIntensity())
-        blindresults.Copy(*fIntensBlindCam.GetCam());
-      else
-        blindresults.Copy(fCalibrationBlindCam);
-
-      blindext.SetNumBlindPixels(blindresults.GetSize());
-
-      for (Int_t i=0;i<blindresults.GetSize();i++)
-        blindext.SetBlindPixelIdx(blindresults[i].GetPixId(),i);
-
-      blindext.SetExtractionType(MExtractBlindPixel::kAmplitude);
-      blindext.SetExtractionType(MExtractBlindPixel::kFilter);
-      blindext.SetDataType(MExtractBlindPixel::kRawEvt2);
-      blindext.SetRange(5,8,0,2);
-      blindext.SetNSBFilterLimit(38);
-      
-    }
-  
+    blindext.SetExtractionType(MExtractBlindPixel::kIntegral);
+    blindext.SetExtractionType(MExtractBlindPixel::kFilter);
+
+    if (run<gkSecondBlindPixelInstallation)
+    {
+        blindext.SetRange(10,19,0,6);
+        blindext.SetNSBFilterLimit(70);
+    }
+    else
+    {
+        blindext.SetRange(5,8,0,2);
+        blindext.SetNSBFilterLimit(38);
+    }
+
+    if (run>=gkThirdBlindPixelInstallation)
+        blindext.SetDataType(MExtractBlindPixel::kRawEvt2);
 }
 
Index: /trunk/MagicSoft/Mars/mpedestal/MPedestalSubtract.cc
===================================================================
--- /trunk/MagicSoft/Mars/mpedestal/MPedestalSubtract.cc	(revision 8157)
+++ /trunk/MagicSoft/Mars/mpedestal/MPedestalSubtract.cc	(revision 8158)
@@ -1,4 +1,4 @@
 /* ======================================================================== *\
-! $Name: not supported by cvs2svn $:$Id: MPedestalSubtract.cc,v 1.2 2006-10-24 08:18:07 tbretz Exp $
+! $Name: not supported by cvs2svn $:$Id: MPedestalSubtract.cc,v 1.3 2006-10-24 12:39:00 tbretz Exp $
 ! --------------------------------------------------------------------------
 !
@@ -144,7 +144,19 @@
         memcpy(sample+numh, pixel.GetLoGainSamples(), numl);
 
-        // if no pedestals are given we are finished
+        // start of destination array, end of hi-gain destination array
+        // and start of hi-gain samples
+        Float_t *beg = fSignal->GetSamples(pixidx);
+        Float_t *end = beg + fSignal->GetNumSamples();
+
+        const Byte_t *src = sample;
+
+        // if no pedestals are given just convert the data into
+        // floats and we are finished
         if (!fPedestals)
+        {
+            while (beg<end)
+                *beg++ = *src++;
             continue;
+        }
 
         // get pedestal information for this pixel
@@ -155,15 +167,8 @@
         const Float_t ped = pedpix.GetPedestal();
 
-        // start of destination array, end of hi-gain destination array
-        // and start of hi-gain samples
-        Float_t *beg = fSignal->GetSamples(pixidx);
-        Float_t *end = beg + fSignal->GetNumSamples();
-
         // determine with which pedestal (+/- AB offset) to start
         const Bool_t  swap    = (ab&1)==1;
         const Float_t offh    = swap ? -pedpix.GetPedestalABoffset() : pedpix.GetPedestalABoffset();
         const Float_t mean[2] = { ped + offh, ped - offh };
-
-        const Byte_t *src = sample;
 
         // Copy hi-gains into array and substract pedestal
Index: /trunk/MagicSoft/Mars/mpedestal/MPedestalSubtractedEvt.h
===================================================================
--- /trunk/MagicSoft/Mars/mpedestal/MPedestalSubtractedEvt.h	(revision 8157)
+++ /trunk/MagicSoft/Mars/mpedestal/MPedestalSubtractedEvt.h	(revision 8158)
@@ -56,4 +56,17 @@
     }
 
+    Int_t GetIntegralRaw(Int_t idx, Int_t first, Int_t last) const
+    {
+        Byte_t *ptr = GetSamplesRaw(idx);
+
+        const Byte_t *end = ptr + last - first + 1;
+
+        Int_t sum = 0;
+        while (ptr<end)
+            sum += *ptr++;
+
+        return sum;
+    }
+
     Bool_t GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type=0) const { return kTRUE; }
     void   DrawPixelContent(Int_t num) const { }
Index: /trunk/MagicSoft/Mars/msignal/MExtractBlindPixel.cc
===================================================================
--- /trunk/MagicSoft/Mars/msignal/MExtractBlindPixel.cc	(revision 8157)
+++ /trunk/MagicSoft/Mars/msignal/MExtractBlindPixel.cc	(revision 8158)
@@ -61,8 +61,14 @@
 #include "MRawEvtPixelIter.h"
 
+#include "MPedestalSubtractedEvt.h"
 #include "MExtractedSignalBlindPixel.h"
 
 #include "MPedestalCam.h"
 #include "MPedestalPix.h"
+
+#include "MCalibrationBlindCam.h"
+#include "MCalibrationBlindPix.h"
+
+#include "MExtralgoSpline.h"
 
 ClassImp(MExtractBlindPixel);
@@ -78,4 +84,5 @@
 const Float_t MExtractBlindPixel::fgResolution       = 0.003;
 const Float_t MExtractBlindPixel::gkOverflow         = 300.;
+
 // --------------------------------------------------------------------------
 //
@@ -92,5 +99,5 @@
 //
 MExtractBlindPixel::MExtractBlindPixel(const char *name, const char *title)
-    : fBlindPixel(0), fHiLoLast(0), fDataType(0)
+    : fBlindPixel(0), /*fHiLoLast(0),*/ fDataType(0)
 {
   
@@ -102,5 +109,7 @@
   SetRange(fgHiGainFirst, fgHiGainLast, fgLoGainFirst, fgLoGainLast);
   
-  SetNumBlindPixels();
+//  SetNumBlindPixels();
+  fBlindPixelIdx.Set(1);
+  fBlindPixelIdx[0] = fgBlindPixelIdx;
 
   Clear();
@@ -128,6 +137,15 @@
     fExtractionType = 0;
 
-    fBlindPixelIdx.Set(0);
-    SetBlindPixelIdx();
+    fBlindPixelIdx.Set(1);
+    fBlindPixelIdx[0] = fgBlindPixelIdx;
+}
+
+void MExtractBlindPixel::SetBlindPixels(const MCalibrationBlindCam &cam)
+{
+    const Int_t n = cam.GetSize();
+
+    fBlindPixelIdx.Set(n);
+    for (Int_t i=0; i<n; i++)
+        fBlindPixelIdx[i] = cam[i].GetPixId();
 }
 
@@ -138,7 +156,7 @@
 
   fNumHiGainSamples = (Float_t)(fHiGainLast-fHiGainFirst+1);
-  if (lolast)
-    fNumLoGainSamples = (Float_t)(fLoGainLast-fLoGainFirst+1);
-  else
+//  if (lolast)
+//    fNumLoGainSamples = (Float_t)(fLoGainLast-fLoGainFirst+1);
+//  else
     fNumLoGainSamples = 0.;
 
@@ -146,6 +164,6 @@
   fSqrtLoGainSamples = TMath::Sqrt(fNumLoGainSamples);  
   
-  fHiLoFirst = 0;
-  fHiLoLast  = 0;
+  //fHiLoFirst = 0;
+  //fHiLoLast  = 0;
 }
 
@@ -170,16 +188,21 @@
     return kFALSE;
 
-  if (IsDataType(kRawEvt2))
-    fRawEvt = (MRawEvtData*)pList->FindObject(AddSerialNumber("MRawEvtData2"));
-  else
-    fRawEvt = (MRawEvtData*)pList->FindObject(AddSerialNumber("MRawEvtData"));
-
+  const TString raw = IsDataType(kRawEvt2) ? "MRawEvtData2" : "MRawEvtData";
+  const TString sig = IsDataType(kRawEvt2) ? "MPedestalSubtractedEvt2" : "MPedestalSubtractedEvt";
+
+  fRawEvt = (MRawEvtData*)pList->FindObject(AddSerialNumber(raw), "MRawEvtData");
   if (!fRawEvt)
     {
-      *fLog << err << GetDescriptor() 
-            << Form("%s%s",IsDataType(kRawEvt2) ? "MRawEvtData2" : "MRawEvtData",
-                    " not found... aborting.") << endl;
+      *fLog << err << raw << " [MRawEvtData] not found... aborting." << endl;
       return kFALSE;
     }
+
+  fSignal = (MPedestalSubtractedEvt*)pList->FindObject(AddSerialNumber(sig), "MPedestalSubtractedEvt");
+  if (!fSignal)
+    {
+      *fLog << err << sig << " [MPedestalSubtractedEvt] not found... aborting." << endl;
+      return kFALSE;
+    }
+
   return kTRUE;
 }
@@ -204,6 +227,6 @@
 {
   
-  for (Int_t i=0;i<fNumBlindPixels;i++)
-    fBlindPixel->SetBlindPixelIdx(fBlindPixelIdx.At(i),i);
+  for (UInt_t i=0;i<fBlindPixelIdx.GetSize();i++)
+      fBlindPixel->SetBlindPixelIdx(fBlindPixelIdx[i], i);
 
   fBlindPixel->SetExtractionType(fExtractionType);
@@ -223,5 +246,5 @@
       }
   }
-
+/*
   const Int_t higainsamples = fRunHeader->GetNumSamplesHiGain();
   const Int_t logainsamples = fRunHeader->GetNumSamplesLoGain();
@@ -265,9 +288,9 @@
       fHiLoLast   = logainsamples ? diff : 0;
     }
-
-  const Int_t range = fHiLoFirst ? fHiLoLast - fHiLoFirst + 1 : fHiGainLast - fHiGainFirst + fHiLoLast + 1;
-
-  fHiGainSignal.Set(range);
-  fHiGainSignal.Reset();
+ */
+  const Int_t range = fHiGainLast-fHiGainFirst+1; //fHiLoFirst ? fHiLoLast - fHiLoFirst + 1 : fHiGainLast - fHiGainFirst + fHiLoLast + 1;
+
+//  fHiGainSignal.Set(range);
+//  fHiGainSignal.Reset();
 
   fHiGainFirstDeriv.Set(range);
@@ -280,17 +303,12 @@
   *fLog << inf << "Extracting "
       << (IsExtractionType(kAmplitude) ? "Amplitude" : " Integral")
-      << " using " << range << " FADC samples from "
-      << (fHiLoFirst ? "Low Gain slice" : " High Gain slice")
-      << (fHiLoFirst ? (Int_t)fHiLoFirst : (Int_t)fHiGainFirst)
-      << " to (including) "
-      << (fHiLoLast ? "Low Gain slice" : "High Gain slice")
-      << (fHiLoLast ?  (Int_t)fHiLoLast-1 : (Int_t)fHiGainLast)
-      << endl;
+      << " using " << range << " FADC samples from slice "
+      << (Int_t)fHiGainFirst << " to " << (Int_t)fHiGainLast << " (incl)" << endl;
 
   if (IsExtractionType(kFilter))
     *fLog << inf << "Will use Filter using "
 	  << (Int_t)(fLoGainLast-fLoGainFirst+1) << " FADC slices"
-	  << " from High Gain slice " << (Int_t)fLoGainFirst
-	  << " to High Gain slice " << (Int_t)fLoGainLast << endl;
+	  << " from slice " << (Int_t)fLoGainFirst
+	  << " to " << (Int_t)fLoGainLast << endl;
 
   fBlindPixel->SetUsedFADCSlices(fHiGainFirst, range);
@@ -303,4 +321,32 @@
 //
 // FindSignalHiGain:
+//
+// - Loop from ptr to (ptr+fHiGainLast-fHiGainFirst)
+// - Sum up contents of *ptr
+// - If *ptr is greater than fSaturationLimit, raise sat by 1
+// - If fHiLoLast is set, loop from logain to (logain+fHiLoLast)
+// - Add contents of *logain to sum
+//
+/*
+void MExtractBlindPixel::FindIntegral(Byte_t *ptr, Byte_t *logain, Float_t &sum, Byte_t &sat)
+{
+    const Byte_t *end = ptr + fHiGainLast - fHiGainFirst + 1;
+
+    Int_t summ = 0;
+    while (p<end)
+    {
+        summ += *ptr;
+
+        if (*ptr++ >= fSaturationLimit)
+            sat++;
+    }
+
+    sum = (Float_t)summ;
+}
+*/
+
+// --------------------------------------------------------------------------
+//
+// FindSignalPhe:
 //
 // - Loop from ptr to (ptr+fHiGainLast-fHiGainFirst)
@@ -310,50 +356,26 @@
 // - Add contents of *logain to sum
 // 
-void MExtractBlindPixel::FindIntegral(Byte_t *ptr, Byte_t *logain, Float_t &sum, Byte_t &sat)
-{
-
-  Int_t summ = 0;
-  Byte_t *p   = ptr;
-  Byte_t *end = ptr + fHiGainLast - fHiGainFirst + 1;
-
-  if (fHiLoFirst == 0)
-    {
-
-      while (p<end)
-        {
-          summ += *ptr;
-          
-          if (*p++ >= fSaturationLimit)
-            sat++;
-        }
-      
-    }
-  
-  p   = logain + fHiLoFirst;  
-  end = logain + fHiLoLast;
-  while (p<end)
-    {
-      summ += *p;
-
-      if (*p++ >= fSaturationLimit)
-            sat++;
-    }
-
-  sum = (Float_t)summ;
-}
-
-// --------------------------------------------------------------------------
-//
-// FindSignalPhe:
-//
-// - Loop from ptr to (ptr+fHiGainLast-fHiGainFirst)
-// - Sum up contents of *ptr
-// - If *ptr is greater than fSaturationLimit, raise sat by 1
-// - If fHiLoLast is set, loop from logain to (logain+fHiLoLast)
-// - Add contents of *logain to sum
-// 
-void MExtractBlindPixel::FindAmplitude(Byte_t *ptr, Byte_t *logain, Float_t &sum, Byte_t &sat) 
-{
-
+//void MExtractBlindPixel::FindAmplitude(Float_t *ptr, Byte_t *logain, Float_t &sum, Byte_t &sat)
+Float_t MExtractBlindPixel::FindAmplitude(Int_t idx, Int_t numsat) const
+{
+    Int_t sat0 = fHiGainFirst; // First slice to extract and first saturating slice
+    Int_t sat1 = fHiGainLast;  // Last  slice to extract and last saturating slice
+
+    Int_t maxcont;
+    Int_t maxpos = fSignal->GetMax(idx, sat0, sat1, maxcont);
+
+//    numsat = fSignal->GetSaturation(idx, fSaturationLimit, sat0, sat1);
+
+    const Float_t *ptr = fSignal->GetSamples(idx);
+    const Int_t    num = fHiGainLast-fHiGainFirst+1;
+
+    MExtralgoSpline s(ptr, num, fHiGainFirstDeriv.GetArray(), fHiGainSecondDeriv.GetArray());
+
+    s.SetExtractionType(MExtralgoSpline::kAmplitude);
+
+    s.Extract(numsat, maxpos);
+
+    return s.GetSignal();
+/*
   Int_t range   = 0;
   Int_t count   = 0;
@@ -586,5 +608,5 @@
         }
     }
-
+  */
 }
 
@@ -596,9 +618,10 @@
 // - Sum up contents of *ptr
 // - If *ptr is greater than fSaturationLimit, raise sat by 1
-// 
-void MExtractBlindPixel::FindSignalFilter(Byte_t *ptr, Int_t &sum, Byte_t &sat) const
-{
-
-  Byte_t *end = ptr + fLoGainLast - fLoGainFirst + 1;
+//
+/*
+void MExtractBlindPixel::FindSignalFilter(Byte_t *ptr, Int_t range, Int_t &sum, Byte_t &sat) const
+{
+
+  Byte_t *end = ptr + range;
   
   while (ptr<end)
@@ -610,4 +633,5 @@
     }
 }
+*/
 
 // --------------------------------------------------------------------------
@@ -624,16 +648,17 @@
   
   for (UInt_t id=0;id<fBlindPixelIdx.GetSize();id++)
-    {
-  
-      pixel.Jump(fBlindPixelIdx[id]);
-      
-      Int_t sum   = 0;
-      Byte_t sat  = 0;
-
+  {
+      // Be carefull: GetSaturation changed sat0 and sat1
+      Int_t sat0 = fHiGainFirst; // First slice to extract and first saturating slice
+      Int_t sat1 = fHiGainLast;  // Last  slice to extract and last saturating slice
+
+      const Int_t sat = fSignal->GetSaturation(fBlindPixelIdx[id], fSaturationLimit, sat0, sat1);
+      
       if (IsExtractionType(kFilter))
       {
-
-	  FindSignalFilter(pixel.GetHiGainSamples()+fLoGainFirst, sum, sat);
-	  
+          // FIXME: fLoGain* is used to determine the FILTER/CHECK range
+          const Int_t numh = pixel.GetNumHiGainSamples();
+
+          const Int_t sum = fSignal->GetIntegralRaw(fBlindPixelIdx[id], fLoGainFirst+numh, fLoGainLast+numh);
 	  if (sum > fNSBFilterLimit)
 	  {
@@ -644,9 +669,9 @@
 	  }
 
+          /*
           sum = 0;
           if (pixel.HasLoGain())
-            FindSignalFilter(pixel.GetLoGainSamples(), sum, sat);          
-
-          /*
+            FindSignalFilter(sl+pixel.GetNumLoGainSamples()+fLoGainFirst, fLoGainLast - fLoGainFirst + 1, sum, sat);
+
           if (fModified)
             {
@@ -661,18 +686,16 @@
           */
       }
-      
+
+
       Float_t newsum = 0.;
-      sat = 0;
-      
       if (IsExtractionType(kAmplitude))
-	FindAmplitude   (pixel.GetHiGainSamples()+fHiGainFirst, pixel.GetLoGainSamples(), newsum, sat);
+          newsum = FindAmplitude(fBlindPixelIdx[id], sat);
       else
-	FindIntegral    (pixel.GetHiGainSamples()+fHiGainFirst, pixel.GetLoGainSamples(), newsum, sat);
-  
-
-      fBlindPixel->SetExtractedSignal(newsum,id);
-      fBlindPixel->SetNumSaturated(sat,id);
-    }
-  
+          newsum = fSignal->GetIntegralRaw(fBlindPixelIdx[id], fHiGainFirst, fHiGainLast);
+  
+      fBlindPixel->SetExtractedSignal(newsum, id);
+      fBlindPixel->SetNumSaturated(sat, id);
+  }
+
   fBlindPixel->SetReadyToSave();
   return kTRUE;
@@ -686,7 +709,5 @@
 Bool_t MExtractBlindPixel::IsDataType( const DataType_t typ )
 {
-  
   return TESTBIT( fDataType, typ );
-
 }
 
@@ -698,7 +719,5 @@
 Bool_t MExtractBlindPixel::IsExtractionType( const ExtractionType_t typ )
 {
-  
   return TESTBIT( fExtractionType, typ );
-
 }
 
Index: /trunk/MagicSoft/Mars/msignal/MExtractBlindPixel.h
===================================================================
--- /trunk/MagicSoft/Mars/msignal/MExtractBlindPixel.h	(revision 8157)
+++ /trunk/MagicSoft/Mars/msignal/MExtractBlindPixel.h	(revision 8158)
@@ -13,4 +13,5 @@
 #endif
 
+class MCalibrationBlindCam;
 class MExtractedSignalBlindPixel;
 
@@ -30,8 +31,8 @@
   MExtractedSignalBlindPixel *fBlindPixel; // Extracted signal of the Blind Pixel
 
-  Byte_t   fHiLoFirst;                     // If not zero, start extraction from fHiLoFirst slice of Low-Gain
-  Byte_t   fHiLoLast;
+//  Byte_t   fHiLoFirst;                     // If not zero, start extraction from fHiLoFirst slice of Low-Gain
+//  Byte_t   fHiLoLast;
 
-  MArrayF  fHiGainSignal;                  //! Need fast access to the signals in a float way
+//  MArrayF  fHiGainSignal;                  //! Need fast access to the signals in a float way
   MArrayF  fHiGainFirstDeriv;              //! First derivative at intersection
   MArrayF  fHiGainSecondDeriv;             //! Second derivative at intersection
@@ -43,5 +44,5 @@
   Byte_t  fExtractionType;                 // What extraction type has been chosen?
   Byte_t  fDataType;                       // What data container type is needed?  
-  Int_t   fNumBlindPixels;                 // Current number of blind pixels
+//  Int_t   fNumBlindPixels;                 // Current number of blind pixels
 
 public:
@@ -50,7 +51,7 @@
 
 private:
-  void FindAmplitude   (Byte_t *firstused, Byte_t *lowgain, Float_t &sum, Byte_t &sat);
-  void FindIntegral    (Byte_t *firstused, Byte_t *lowgain, Float_t &sum, Byte_t &sat);
-  void FindSignalFilter(Byte_t *ptr,                          Int_t &sum, Byte_t &sat) const;
+  Float_t FindAmplitude(Int_t idx, Int_t numsat) const;
+//  void FindIntegral    (Byte_t *firstused, Byte_t *lowgain, Float_t &sum, Byte_t &sat);
+//  void FindSignalFilter(Byte_t *ptr, Int_t range,             Int_t &sum, Byte_t &sat) const;
   
   Int_t  PreProcess(MParList *pList);
@@ -69,4 +70,5 @@
 
   // Setters
+  /*
   void SetBlindPixelIdx(  const Int_t  idx=fgBlindPixelIdx, const UInt_t nr=0 )
   {
@@ -74,10 +76,14 @@
           fBlindPixelIdx.Set(nr+1);
       fBlindPixelIdx[nr] = idx;
-  }
+      }
+      */
+
+  void SetBlindPixels(const MCalibrationBlindCam &cam);
+
   void SetExtractionType( const ExtractionType_t typ=kAmplitude );
   void SetDataType    ( const DataType_t       typ=kRawEvt    );  
   void SetNSBFilterLimit( const Int_t   lim=fgNSBFilterLimit )  { fNSBFilterLimit = lim;   }     
   
-  void SetNumBlindPixels( const Int_t   num=1 )  { fNumBlindPixels = num;   }
+//  void SetNumBlindPixels( const Int_t   num=1 )  { fNumBlindPixels = num;   }
   
   void SetRange         ( const Byte_t  hifirst=0, const Byte_t hilast=0, 
Index: /trunk/MagicSoft/Mars/msignal/MExtractTimeAndChargeSpline.cc
===================================================================
--- /trunk/MagicSoft/Mars/msignal/MExtractTimeAndChargeSpline.cc	(revision 8157)
+++ /trunk/MagicSoft/Mars/msignal/MExtractTimeAndChargeSpline.cc	(revision 8158)
@@ -1,4 +1,4 @@
 /* ======================================================================== *\
-! $Name: not supported by cvs2svn $:$Id: MExtractTimeAndChargeSpline.cc,v 1.61 2006-10-24 08:24:52 tbretz Exp $
+! $Name: not supported by cvs2svn $:$Id: MExtractTimeAndChargeSpline.cc,v 1.62 2006-10-24 12:39:00 tbretz Exp $
 ! --------------------------------------------------------------------------
 !
@@ -182,5 +182,5 @@
 //
 MExtractTimeAndChargeSpline::MExtractTimeAndChargeSpline(const char *name, const char *title) 
-    : fRandomIter(0), fExtractionType(kIntegral)
+    : /*fRandomIter(0),*/ fExtractionType(kIntegral)
 {
 
@@ -377,13 +377,13 @@
 
     s.SetRiseFallTime(fRiseTimeHiGain, fFallTimeHiGain);
-    s.SetResolution(fResolution);
+//    s.SetResolution(fResolution);
 
     if (IsNoiseCalculation())
     {
-        if (fRandomIter == int(1./fResolution))
-            fRandomIter = 0;
-
-        sum = s.ExtractNoise(fRandomIter);
-        fRandomIter++;
+//        if (fRandomIter == int(1./fResolution))
+//            fRandomIter = 0;
+
+        sum = s.ExtractNoise(/*fRandomIter*/);
+//        fRandomIter++;
         return;
     }
@@ -402,12 +402,12 @@
 
     s.SetRiseFallTime(fRiseTimeLoGain, fFallTimeLoGain);
-    s.SetResolution(fResolution);
+//    s.SetResolution(fResolution);
 
     if (IsNoiseCalculation())
     {
-        if (fRandomIter == int(1./fResolution))
-            fRandomIter = 0;
-
-        sum = s.ExtractNoise(fRandomIter);
+//        if (fRandomIter == int(1./fResolution))
+//            fRandomIter = 0;
+
+        sum = s.ExtractNoise(/*fRandomIter*/);
         return;
     }
