Index: trunk/MagicSoft/Mars/manalysis/MApplyPadding.cc
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MApplyPadding.cc	(revision 1693)
+++ trunk/MagicSoft/Mars/manalysis/MApplyPadding.cc	(revision 1713)
@@ -253,7 +253,9 @@
    newPed.InitSize(fPed->GetSize());
 
-   const UInt_t npix = fPed->GetSize(); // Total number of pixels
+   //   const UInt_t npix = fPed->GetSize(); 
+   const UInt_t npix = fEvt->GetNumPixels(); // Total number of pixels
+
    for (UInt_t i=0; i<npix; i++) {
-     MCerPhotPix pix = fEvt->operator[](i);
+     MCerPhotPix pix = fEvt->operator[](i);      
      if (!pix.IsPixelUsed())
        continue;
@@ -266,5 +268,4 @@
      Double_t error = pix.GetErrorPhot();
      pix.SetErrorPhot(sqrt(error*error + quadraticDiff));
-     
      MPedestalPix ppix = fPed->operator[](i);
      MPedestalPix npix;
