Index: trunk/MagicSoft/Mars/manalysis/MCerPhotCalc.cc
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MCerPhotCalc.cc	(revision 2325)
+++ trunk/MagicSoft/Mars/manalysis/MCerPhotCalc.cc	(revision 2347)
@@ -116,8 +116,12 @@
         return kFALSE;
 
-    // Calculate quadratic sum of weights:
+    // Calculate sum and quadratic sum of weights:
+    fSumWeights = 0;
     fSumQuadWeights = 0;
     for (Int_t i=0; i<fWeight.GetSize(); i++)
-      fSumQuadWeights += fWeight[i]*fWeight[i];
+      {
+	fSumWeights += fWeight[i];
+	fSumQuadWeights += fWeight[i]*fWeight[i];
+      }
 
     fSumQuadWeights = sqrt(fSumQuadWeights);
@@ -182,5 +186,5 @@
         const Double_t offset = fEnableFix ? ped.GetPedestal()-0.5 : ped.GetPedestal();
 
-        ped.Set(offset*fSumQuadWeights*fSumQuadWeights,
+        ped.Set(offset*fSumWeights,
 		ped.GetPedestalRms()*fSumQuadWeights);
     }
@@ -202,4 +206,6 @@
 
     MRawEvtPixelIter pixel(fRawEvt);
+
+    Int_t SaturatedPixels = 0;
 
     while (pixel.Next())
@@ -222,14 +228,48 @@
         Byte_t *ptr = pixel.GetHiGainSamples();
 
-        Float_t nphot = 0;
-        for(Int_t i=0; i<fWeight.GetSize(); i++)
+        Int_t i;
+        Double_t nphot = 0;
+        for (i=0; i<fWeight.GetSize(); i++)
+        {
+            if (ptr[i]==0xff)
+                break;
             nphot += ptr[i]*fWeight[i];
-
-        nphot -= ped.GetPedestal();
+        }
+
+	Bool_t SaturatedLG = kFALSE;
+
+        if (i<fWeight.GetSize())
+        {
+	    nphot = 0;
+
+            ptr = pixel.GetLoGainSamples();
+            if (ptr==NULL)
+            {
+                *fLog << warn << "WARNING - Pixel #" << idx << " saturated but has no lo gains.. skipping!" << endl;
+                return kCONTINUE;
+            }
+
+            for (i=0; i<fWeight.GetSize(); i++)
+            {
+	      if (ptr[i]==0xff)
+		SaturatedLG = kTRUE;
+
+	      nphot += ptr[i]*fWeight[i];
+            }
+
+            nphot -= ped.GetPedestal();
+            nphot *= 10;
+        }
+        else
+            nphot -= ped.GetPedestal();
 
         fCerPhotEvt->AddPixel(idx, nphot, 0);
 
-        // FIXME! Handling of Lo Gains is missing!
-    }
+	if (SaturatedLG)
+	  SaturatedPixels ++;
+    }
+
+    if (SaturatedPixels > 0)
+      *fLog << warn << "WARNING " << SaturatedPixels << "pixels had saturating low gains..." << endl;
 
     fCerPhotEvt->FixSize();
Index: trunk/MagicSoft/Mars/manalysis/MCerPhotCalc.h
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MCerPhotCalc.h	(revision 2325)
+++ trunk/MagicSoft/Mars/manalysis/MCerPhotCalc.h	(revision 2347)
@@ -35,4 +35,5 @@
     TArrayF         fWeight;  // Weights for adding up the ADC slices
     Float_t         fSumQuadWeights;
+    Float_t         fSumWeights;
 
     void SetDefaultWeights();
