Index: trunk/MagicSoft/Mars/mraw/MRawEvtPixelIter.cc
===================================================================
--- trunk/MagicSoft/Mars/mraw/MRawEvtPixelIter.cc	(revision 3927)
+++ trunk/MagicSoft/Mars/mraw/MRawEvtPixelIter.cc	(revision 3949)
@@ -239,12 +239,13 @@
     return -1; // means: not found
   
+  Byte_t *ptr = fLoGainPos+lofirst+1;
   Byte_t *max = fLoGainPos+lofirst;
-  Byte_t *ptr = max+1;
-
-  const Byte_t *end = fLoGainPos + fNumLoGainSamples + 1;
-  
+  const Byte_t *end = fLoGainPos + fNumLoGainSamples;
+	
   do if (*ptr>*max) max = ptr;
   while (++ptr != end);
   
+  gLog << count << endl;
+
   return max-fLoGainPos;
 }
@@ -293,4 +294,5 @@
 Byte_t MRawEvtPixelIter::GetMaxLoGainSample() const
 {
+
     Byte_t max = 0;
 
