Index: trunk/MagicSoft/Mars/Changelog
===================================================================
--- trunk/MagicSoft/Mars/Changelog	(revision 8584)
+++ trunk/MagicSoft/Mars/Changelog	(revision 8585)
@@ -72,4 +72,12 @@
      - changed the GetScale from a calculation to a switch 
        (faster and easier to understand)
+
+   * callisto_mux.rc:
+     - replaced saturation and lower signal limit in
+       MJPedestalY2.MHCalibrationPulseTimeCam by the defaults
+
+   * mbase/MMath.[h,cc]:
+     - added a function to do a InterpolParab assuming that the
+       x-coordinates are -1, 0, 1
 
 
Index: trunk/MagicSoft/Mars/callisto_mux.rc
===================================================================
--- trunk/MagicSoft/Mars/callisto_mux.rc	(revision 8584)
+++ trunk/MagicSoft/Mars/callisto_mux.rc	(revision 8585)
@@ -335,7 +335,7 @@
 # Define the Pulse Position check parameters:
 # -------------------------------------------------------------------------
-MJPedestalY2.MHCalibrationPulseTimeCam.SaturationLimit:  252
-MJPedestalY2.MHCalibrationPulseTimeCam.LowerSignalLimit: 35
-#MJPedestalY2.MHCalibrationPulseTimeCam.NumPixelsRequired: 2
+#MJPedestalY2.MHCalibrationPulseTimeCam.SaturationLimit:  245
+#MJPedestalY2.MHCalibrationPulseTimeCam.LowerSignalLimit:  85
+#MJPedestalY2.MHCalibrationPulseTimeCam.NumPixelsRequired:  2
 #MJPedestalY2.PixelCheck: no
 
Index: trunk/MagicSoft/Mars/mbase/MMath.cc
===================================================================
--- trunk/MagicSoft/Mars/mbase/MMath.cc	(revision 8584)
+++ trunk/MagicSoft/Mars/mbase/MMath.cc	(revision 8585)
@@ -1,4 +1,4 @@
 /* ======================================================================== *\
-! $Name: not supported by cvs2svn $:$Id: MMath.cc,v 1.35 2007-06-18 14:42:32 tbretz Exp $
+! $Name: not supported by cvs2svn $:$Id: MMath.cc,v 1.36 2007-06-19 11:14:33 tbretz Exp $
 ! --------------------------------------------------------------------------
 !
@@ -308,11 +308,11 @@
 TVector3 MMath::GetParab(const TVector3 &x, const TVector3 &y)
 {
-    Double_t x1 = x(0);
-    Double_t x2 = x(1);
-    Double_t x3 = x(2);
-
-    Double_t y1 = y(0);
-    Double_t y2 = y(1);
-    Double_t y3 = y(2);
+    const Double_t x1 = x(0);
+    const Double_t x2 = x(1);
+    const Double_t x3 = x(2);
+
+    const Double_t y1 = y(0);
+    const Double_t y2 = y(1);
+    const Double_t y3 = y(2);
 
     const double det =
@@ -343,7 +343,24 @@
 }
 
+// --------------------------------------------------------------------------
+//
+//  Interpolate the points with x-coordinates vx and y-coordinates vy
+// by a parabola (second order polynomial) and return the value at x.
+//
 Double_t MMath::InterpolParabLin(const TVector3 &vx, const TVector3 &vy, Double_t x)
 {
     const TVector3 c = GetParab(vx, vy);
+    return c(0) + c(1)*x + c(2)*x*x;
+}
+
+// --------------------------------------------------------------------------
+//
+//  Interpolate the points with x-coordinates vx=(-1,0,1) and
+// y-coordinates vy by a parabola (second order polynomial) and return
+// the value at x.
+//
+Double_t MMath::InterpolParabLin(const TVector3 &vy, Double_t x)
+{
+    const TVector3 c(vy(1), (vy(2)-vy(0))/2, vy(0)/2 - vy(1) + vy(2)/2);
     return c(0) + c(1)*x + c(2)*x*x;
 }
Index: trunk/MagicSoft/Mars/mbase/MMath.h
===================================================================
--- trunk/MagicSoft/Mars/mbase/MMath.h	(revision 8584)
+++ trunk/MagicSoft/Mars/mbase/MMath.h	(revision 8585)
@@ -39,4 +39,5 @@
     TVector3 GetParab(const TVector3 &x, const TVector3 &y);
     Double_t InterpolParabLin(const TVector3 &vx, const TVector3 &vy, Double_t x);
+    Double_t InterpolParabLin(const TVector3 &vy, Double_t x);
     Double_t InterpolParabLog(const TVector3 &vx, const TVector3 &vy, Double_t x);
     Double_t InterpolParabCos(const TVector3 &vx, const TVector3 &vy, Double_t x);
Index: trunk/MagicSoft/Mars/mjobs/MJStar.cc
===================================================================
--- trunk/MagicSoft/Mars/mjobs/MJStar.cc	(revision 8584)
+++ trunk/MagicSoft/Mars/mjobs/MJStar.cc	(revision 8585)
@@ -110,5 +110,5 @@
 
     const TString oname = Form("%s/star%08d.root", (const char*)fPathOut, fSequence.GetSequence());
-    return WriteContainer(cont, oname, "UPDATE");
+    return WriteContainer(cont, oname, "RECREATE");
 }
 
Index: trunk/MagicSoft/Mars/msignal/MExtractor.cc
===================================================================
--- trunk/MagicSoft/Mars/msignal/MExtractor.cc	(revision 8584)
+++ trunk/MagicSoft/Mars/msignal/MExtractor.cc	(revision 8585)
@@ -136,5 +136,5 @@
     : fResolutionPerPheHiGain(0), fResolutionPerPheLoGain(0),
     fSignals(NULL), fRawEvt(NULL), fRunHeader(NULL), fSignal(NULL),
-      /*fHiLoLast(0),*/ fNumHiGainSamples(0), fNumLoGainSamples(0)
+    fNumHiGainSamples(0), fNumLoGainSamples(0)
 {
     fName  = name  ? name  : "MExtractor";
@@ -251,71 +251,7 @@
         fLoGainFirst=0;
         fLoGainLast =0;
-        if (fSaturationLimit>fRunHeader->GetMax())
-        {
-            *fLog << " and saturation limit to " << fRunHeader->GetMax();
-            fSaturationLimit=fRunHeader->GetMax();
-        }
         *fLog << "." << endl;
     }
 
-/*
-  const Int_t logainsamples = fRunHeader->GetNumSamplesLoGain();
-
-  Int_t lastdesired;
-  Int_t lastavailable;
-
-  if (logainsamples)
-    {
-
-      lastdesired   = (Int_t)(fLoGainLast);
-      lastavailable = logainsamples-1;
-      
-      if (lastavailable < 0)
-        *fLog << warn << GetDescriptor() << " - WARNING: Number of available Low-Gain Slices is smaller than or equal zero!" << endl;
-      
-    if (lastdesired > lastavailable)
-      {
-        const Int_t diff = lastdesired - lastavailable;
-        
-        *fLog << endl;
-        *fLog << warn << GetDescriptor() << ": Selected Lo Gain FADC Window [";
-        *fLog << Form("%2i,%2i", (int)fLoGainFirst, lastdesired);
-        *fLog << "] ranges out of the available limits: [0," << Form("%2i", lastavailable) << "]" << endl;
-        *fLog << GetDescriptor() << ": Will reduce the upper edge to " << (int)(fLoGainLast - diff) << endl;
-        SetRange(fHiGainFirst, fHiGainLast, fLoGainFirst, fLoGainLast-diff);
-      }
-    }
-  else
-    SetRange(fHiGainFirst, fHiGainLast, 0,0);      
-  
-  const Int_t higainsamples = fRunHeader->GetNumSamplesHiGain();
-
-  if (higainsamples <= 0)
-    {
-      *fLog << err << GetDescriptor();
-      *fLog << " - ERROR: Number of available High-Gain Slices is smaller than or equal zero!" << endl;
-      return kFALSE;
-    }
-
-  lastdesired   = (Int_t)fHiGainLast;
-  lastavailable = higainsamples-1;
-  
-  if (lastdesired > lastavailable)
-    {
-      const Int_t diff = lastdesired - lastavailable;
-      
-      *fLog << endl;
-      *fLog << inf << GetDescriptor() << ": Selected Hi Gain FADC Window [";
-      *fLog << Form("%2i,%2i", (int)fHiGainFirst,lastdesired);
-      *fLog << "] ranges out of the available limits: [0," << Form("%2i", lastavailable) << "]" << endl;
-      *fLog << inf << GetDescriptor() << ": Will use ";
-      *fLog << Form("%2i", diff) << " samples from the Low-Gain for the High-Gain extraction";
-      *fLog << endl;
-      
-      fHiGainLast -= diff;
-      fHiLoLast    = diff;
-    }
-  
-  */
     return kTRUE;
 }
@@ -329,39 +265,4 @@
 {
     return kERROR;
-/*
-  MRawEvtPixelIter pixel(fRawEvt);
-
-  while (pixel.Next())
-    {
-      Float_t sumhi = 0.;
-      Byte_t sathi = 0;
-
-      FindSignalHiGain(pixel.GetHiGainSamples()+fHiGainFirst, pixel.GetLoGainSamples(), sumhi, sathi);
-
-      Float_t sumlo  = 0.;
-      Byte_t  satlo  = 0;
-
-      if (pixel.HasLoGain())
-	FindSignalLoGain(pixel.GetLoGainSamples()+fLoGainFirst, sumlo, satlo);
-
-      const Int_t pixid = pixel.GetPixelId();
-      
-      const MPedestalPix  &ped = (*fPedestals)[pixid]; 
-      MExtractedSignalPix &pix = (*fSignals)[pixid];
-      
-      const Float_t pedes  = ped.GetPedestal();
-      const Float_t pedrms = ped.GetPedestalRms();
-
-      pix.SetExtractedSignal(sumhi - pedes*fNumHiGainSamples, pedrms*fSqrtHiGainSamples,
-                             sumlo - pedes*fNumLoGainSamples, pedrms*fSqrtLoGainSamples);
-      
-      pix.SetGainSaturation(sathi, satlo);
-      
-    }
-
-    fSignals->SetReadyToSave();
-
-    return kTRUE;
-    */
 }
 
@@ -461,8 +362,8 @@
 
     *fLog << " Hi Gain Range:      " << Form("%2d %2d", fHiGainFirst, fHiGainLast) << endl;
+    *fLog << " Saturation Lim:     " << Form("%3d", fSaturationLimit) << endl;
     if (HasLoGain())
     {
         *fLog << " Lo Gain Range:      " << Form("%2d %2d", fLoGainFirst, fLoGainLast) << endl;
-        *fLog << " Saturation Lim:     " << Form("%3d", fSaturationLimit) << endl;
         *fLog << " Num Samples Hi/Lo:  " << Form("%2.1f %2.1f", fNumHiGainSamples, fNumLoGainSamples) << endl;
     }
