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 { }
