Index: /trunk/MagicSoft/Mars/mhcalib/MHCalibrationPulseTimeCam.cc
===================================================================
--- /trunk/MagicSoft/Mars/mhcalib/MHCalibrationPulseTimeCam.cc	(revision 8360)
+++ /trunk/MagicSoft/Mars/mhcalib/MHCalibrationPulseTimeCam.cc	(revision 8361)
@@ -1,4 +1,4 @@
 /* ======================================================================== *\
-! $Name: not supported by cvs2svn $:$Id: MHCalibrationPulseTimeCam.cc,v 1.33 2007-03-03 22:01:13 tbretz Exp $
+! $Name: not supported by cvs2svn $:$Id: MHCalibrationPulseTimeCam.cc,v 1.34 2007-03-04 11:55:55 tbretz Exp $
 ! --------------------------------------------------------------------------
 !
@@ -540,5 +540,4 @@
             << endl;
     }
-  return;
 }
 
Index: /trunk/MagicSoft/Mars/mjobs/MJPedestal.cc
===================================================================
--- /trunk/MagicSoft/Mars/mjobs/MJPedestal.cc	(revision 8360)
+++ /trunk/MagicSoft/Mars/mjobs/MJPedestal.cc	(revision 8361)
@@ -95,4 +95,5 @@
 #include "MPedestalCam.h"
 #include "MPedestalPix.h"
+#include "MPedestalSubtract.h"
 
 ClassImp(MJPedestal);
@@ -211,5 +212,5 @@
     TString title = fDisplay->GetTitle();
     title += "--  Pedestal ";
-    title += fSequence.GetName();
+    title += fSequence.GetFileName();
     title += "  --";
     fDisplay->SetTitle(title);
@@ -914,4 +915,9 @@
 
     //
+    // This is for data without lo-gains
+    //
+    const Bool_t haslo = ext->HasLoGain();
+
+    //
     // Get the ranges for the new extractor setting. The window
     // size is always rounded to the next higher integer.
@@ -940,5 +946,5 @@
     }
 
-    if (poslo+wslogain+fExtractWinRight > lo1-0.5)
+    if (haslo && poslo+wslogain+fExtractWinRight > lo1-0.5)
     {
         *fLog << err;
@@ -959,5 +965,5 @@
     }
 
-    if (poslo2-fExtractWinLeft < lo0+0.5)
+    if (haslo && poslo2-fExtractWinLeft < lo0+0.5)
     {
         *fLog << warn;
@@ -1064,5 +1070,8 @@
         hpedcam.SetRenorm(kTRUE);
 
-    MFillH fillpul("MHCalibrationPulseTimeCam", "MPedestalSubtractedEvt", "FillPulseTime");
+    // To have it in the parlist!
+    MHCalibrationPulseTimeCam pulcam;
+    plist.AddToList(&pulcam);
+    MFillH fillpul(&pulcam, "MPedestalSubtractedEvt", "FillPulseTime");
     fillpul.SetBit(MFillH::kDoNotDisplay);
 
@@ -1103,6 +1112,6 @@
     MFTriggerPattern fcalib("CalibFilter");
     fcalib.SetDefault(kFALSE);
-    fcalib.RequireCalibration();
-    fcalib.SetInverted();
+    fcalib.DenyCalibration();
+    fcalib.DenyPedestal();
 
     tlist.AddToList(&decode);
@@ -1127,4 +1136,18 @@
     // ----------------------------------------------------------------------
     MTaskEnv taskenv("ExtractPedestal");
+
+    //------------------------------
+    MFTriggerPattern ftp2("PedestalFilter");
+    ftp2.SetDefault(kTRUE);
+    ftp2.DenyCalibration();
+//    ftp2.RequirePedestal();
+
+    if (!IsUseMC())
+    {
+        taskenv.SetFilter(&ftp2);
+        tlist.AddToList(&ftp2);
+    }
+    //------------------------------
+
     switch (fExtractType)
     {
@@ -1166,5 +1189,5 @@
     pedlogain.SetPedestalsOut(&fPedestalCamOut);
 
-     // kFundamental
+    // kFundamental
     if (fExtractor)
     {
@@ -1181,15 +1204,6 @@
         else
         {
-            // The window size of the extractor is not yet initialized,
-            // so we have to stick to the extraction range
-            const Int_t f = fExtractor->GetHiGainFirst();
-            const Int_t l = fExtractor->GetHiGainLast();
-            const Int_t w = (l-f+1)&~1;
-
-            // Setup to use the hi-gain extraction window in the lo-gain
-            // range (the start of the lo-gain range is added automatically
-            // by MPedCalcFromLoGain)
-            pedcalc.SetExtractWindow(f, w);
-            pedlogain.SetExtractWindow(f, w);
+            pedcalc.SetRangeFromExtractor(*fExtractor);
+            pedlogain.SetRangeFromExtractor(*fExtractor);
         }
 
Index: /trunk/MagicSoft/Mars/mpedestal/MPedCalcFromLoGain.cc
===================================================================
--- /trunk/MagicSoft/Mars/mpedestal/MPedCalcFromLoGain.cc	(revision 8360)
+++ /trunk/MagicSoft/Mars/mpedestal/MPedCalcFromLoGain.cc	(revision 8361)
@@ -1,4 +1,4 @@
 /* ======================================================================== *\
-! $Name: not supported by cvs2svn $:$Id: MPedCalcFromLoGain.cc,v 1.36 2007-03-01 21:20:41 tbretz Exp $
+! $Name: not supported by cvs2svn $:$Id: MPedCalcFromLoGain.cc,v 1.37 2007-03-04 12:00:30 tbretz Exp $
 ! --------------------------------------------------------------------------
 !
@@ -214,5 +214,7 @@
         return kFALSE;
 
-    CheckExtractionWindow(fRunHeader->GetNumSamplesHiGain());
+    const Int_t nhi = fRunHeader->GetNumSamplesHiGain();
+    const Int_t nlo = fRunHeader->GetNumSamplesLoGain();
+    CheckExtractionWindow(nlo>0?nhi:0);
 
     return kTRUE;
@@ -227,7 +229,9 @@
 Int_t MPedCalcFromLoGain::Calc()
 {
+    const Int_t nhi = fRunHeader->GetNumSamplesHiGain();
+    const Int_t nlo = fRunHeader->GetNumSamplesLoGain();
+
     // Real Process
     MRawEvtPixelIter pixel(fRawEvt);
-
     while (pixel.Next())
     {
@@ -240,6 +244,6 @@
         UInt_t ab[2];
         const Float_t sum = fExtractor ?
-            CalcExtractor(pixel, pixel.GetNumHiGainSamples()) :
-            CalcSums(pixel, pixel.GetNumHiGainSamples(), ab[0], ab[1]);
+            CalcExtractor(pixel, nlo>0?nhi:0) :
+            CalcSums(pixel, nlo>0?nhi:0, ab[0], ab[1]);
 
         const UInt_t aidx   = (*fGeom)[idx].GetAidx();
Index: /trunk/MagicSoft/Mars/mpedestal/MPedestalSubtractedEvt.cc
===================================================================
--- /trunk/MagicSoft/Mars/mpedestal/MPedestalSubtractedEvt.cc	(revision 8360)
+++ /trunk/MagicSoft/Mars/mpedestal/MPedestalSubtractedEvt.cc	(revision 8361)
@@ -1,4 +1,4 @@
 /* ======================================================================== *\
-! $Name: not supported by cvs2svn $:$Id: MPedestalSubtractedEvt.cc,v 1.2 2007-01-15 12:06:15 tbretz Exp $
+! $Name: not supported by cvs2svn $:$Id: MPedestalSubtractedEvt.cc,v 1.3 2007-03-04 12:01:37 tbretz Exp $
 ! --------------------------------------------------------------------------
 !
@@ -105,6 +105,6 @@
     Byte_t *p0 = GetSamplesRaw(idx);
 
-    Byte_t *sathi0 = 0; // first saturating hi-gain slice
-    Byte_t *sathi1 = 0; // last  saturating hi-gain slice
+    Byte_t *sat0 = 0; // first saturating slice
+    Byte_t *sat1 = 0; // last  saturating slice
 
     Int_t num = 0;
@@ -115,13 +115,13 @@
         if (*ptr>=limit)
         {
-            sathi1 = ptr;
-            if (!sathi0)
-                sathi0 = ptr;
+            sat1 = ptr;
+            if (!sat0)
+                sat0 = ptr;
             num++;
         }
     }
 
-    last  = sathi1 ? sathi1-p0 : -1;
-    first = sathi0 ? sathi0-p0 : -1;
+    last  = sat1 ? sat1-p0 : -1;
+    first = sat0 ? sat0-p0 : -1;
 
     return num;
@@ -138,5 +138,5 @@
 // Warning: No range checks and no sanity checks are done!
 //
-Int_t MPedestalSubtractedEvt::GetMax(const Int_t idx, const Int_t first, const Int_t last, Int_t &val) const
+Int_t MPedestalSubtractedEvt::GetMax(const Int_t idx, const Int_t first, const Int_t last, UInt_t &val) const
 {
     // Get pointer to first slice to be considered
Index: /trunk/MagicSoft/Mars/mpedestal/MPedestalSubtractedEvt.h
===================================================================
--- /trunk/MagicSoft/Mars/mpedestal/MPedestalSubtractedEvt.h	(revision 8360)
+++ /trunk/MagicSoft/Mars/mpedestal/MPedestalSubtractedEvt.h	(revision 8361)
@@ -41,11 +41,11 @@
     Int_t GetSaturation(const Int_t idx, Int_t limit, Int_t &first, Int_t &last) const;
     //void  InterpolateSaturation(const Int_t idx, Int_t limit, Int_t first, Int_t last) const;
-    Int_t GetMax(const Int_t pixidx, const Int_t first, const Int_t last, Int_t &val) const;
+    Int_t GetMax(const Int_t pixidx, const Int_t first, const Int_t last, UInt_t &val) const;
     Int_t GetMax(const Int_t pixidx, const Int_t first, const Int_t last) const
     {
-        Int_t val;
+        UInt_t val;
         return GetMax(pixidx, first, last, val);
     }
-    Int_t GetMax(const Int_t pixidx, Int_t &val) const
+    Int_t GetMax(const Int_t pixidx, UInt_t &val) const
     {
         return GetMax(pixidx, 0, fNumSamples, val);
@@ -54,5 +54,5 @@
     Int_t GetMax(const Int_t pixidx) const
     {
-        Int_t val;
+        UInt_t val;
         return GetMax(pixidx, 0, fNumSamples, val);
     }
