Index: /trunk/MagicSoft/Mars/mraw/MRawEvtData.cc
===================================================================
--- /trunk/MagicSoft/Mars/mraw/MRawEvtData.cc	(revision 2654)
+++ /trunk/MagicSoft/Mars/mraw/MRawEvtData.cc	(revision 2655)
@@ -549,5 +549,5 @@
     case 5:
         val = Next.GetIdxMaxHiLoGainSample();
-	break;
+        return val >= 0;
     }
 
Index: /trunk/MagicSoft/Mars/mraw/MRawEvtPixelIter.cc
===================================================================
--- /trunk/MagicSoft/Mars/mraw/MRawEvtPixelIter.cc	(revision 2654)
+++ /trunk/MagicSoft/Mars/mraw/MRawEvtPixelIter.cc	(revision 2655)
@@ -221,5 +221,6 @@
 // --------------------------------------------------------------------------
 //
-// Returns the index of the FADC slice the maximum signal in
+// Returns the index of the FADC slice the maximum signal in. If the highest
+// slices have the same value the last one is returned.
 //
 Byte_t MRawEvtPixelIter::GetIdxMaxHiGainSample() const
@@ -240,8 +241,13 @@
 // --------------------------------------------------------------------------
 //
-// Returns the index of the FADC slice the maximum signal in
-//
-Byte_t MRawEvtPixelIter::GetIdxMaxLoGainSample() const
-{
+// Returns the index of the FADC slice the maximum signal in. If no lo-gains
+// are available -1 is returned. If the highest slices have the same value the
+// last one is returned.
+//
+Short_t MRawEvtPixelIter::GetIdxMaxLoGainSample() const
+{
+    if (!HasLoGain())
+        return -1; // means: not found
+
     Byte_t max  = 0;
     Byte_t maxi = 0;
@@ -260,22 +266,21 @@
 //
 // Returns the index of the maximum FADC slice from high gain at first. If 
-// high gain is saturated it returns the low gain one. 
-// Att! Here the index range is from 1 to 15. 
-// 0 means that an error occured (hi-gain saturated and no lo-gain available).
+// high gain is saturated it returns the low gain one.
+// If no lo-gains are existing and the hi-gains have saturating values
+// a negative value (-1) is returned.
 // 
-
-Byte_t MRawEvtPixelIter::GetIdxMaxHiLoGainSample() const
-{
-    Byte_t maxi = 0;
-
-    if (this->GetMaxHiGainSample() == 255) 
-    {
-	 if (this->HasLoGain())
-	    maxi = this->GetIdxMaxLoGainSample();
-    }
-    else
-         maxi = this->GetIdxMaxHiGainSample();
-
-    return maxi+1;
+Short_t MRawEvtPixelIter::GetIdxMaxHiLoGainSample() const
+{
+    Byte_t max  = 0;
+    Char_t maxi = 0;
+
+    for (int i=fNumHiGainSamples-1; i>=0; i--)
+        if (fHiGainPos[i]>max)
+        {
+            max  = fHiGainPos[i];
+            maxi = i;
+        }
+
+    return max<0xff ? maxi : GetIdxMaxLoGainSample();
 }
 
Index: /trunk/MagicSoft/Mars/mraw/MRawEvtPixelIter.h
===================================================================
--- /trunk/MagicSoft/Mars/mraw/MRawEvtPixelIter.h	(revision 2654)
+++ /trunk/MagicSoft/Mars/mraw/MRawEvtPixelIter.h	(revision 2655)
@@ -83,9 +83,9 @@
     Float_t GetVarHiGainSamples() const;
 
-    Byte_t GetIdxMaxHiGainSample() const;
-    Byte_t GetIdxMaxLoGainSample() const;
-    Byte_t GetMaxHiGainSample() const;
-    Byte_t GetMaxLoGainSample() const;
-    Byte_t GetIdxMaxHiLoGainSample() const;
+    Byte_t  GetMaxHiGainSample() const;
+    Byte_t  GetMaxLoGainSample() const;
+    Byte_t  GetIdxMaxHiGainSample() const;
+    Short_t GetIdxMaxLoGainSample() const;
+    Short_t GetIdxMaxHiLoGainSample() const;
 
     Bool_t HasLoGain() const
