Index: trunk/MagicSoft/Mars/Changelog
===================================================================
--- trunk/MagicSoft/Mars/Changelog	(revision 1551)
+++ trunk/MagicSoft/Mars/Changelog	(revision 1552)
@@ -1,3 +1,10 @@
                                                                   -*-*- END -*-*-
+ 2002/10/19: Abelardo Moralejo
+
+   * manalysis/MCerPhotCalc.cc
+     -Added check of whether a pixel has all its FADC slices empty before
+      subtracting pedestal.
+
+
  2002/10/18: Thomas Bretz
 
Index: trunk/MagicSoft/Mars/manalysis/MCerPhotCalc.cc
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MCerPhotCalc.cc	(revision 1551)
+++ trunk/MagicSoft/Mars/manalysis/MCerPhotCalc.cc	(revision 1552)
@@ -188,17 +188,22 @@
 
 	// Mean pedestal:
-        const Double_t mean = fEnableFix ? ped.GetMean()-0.5 : ped.GetMean();
+        Double_t mean = fEnableFix ? ped.GetMean()-0.5 : ped.GetMean();
 
 	Byte_t *ptr = pixel.GetHiGainSamples();
 
 	Float_t nphot = 0.;
-
-	for(Int_t i = 0; i<fWeight.GetSize(); i++)
+	Float_t nphoterr = 0.;
+
+	// Calculate pixel signal unless it has all FADC slices empty:
+
+	if (pixel.GetSumHiGainSamples()>0)
 	  {
-	    BinSignal[i] =  (Float_t) ptr[i] - mean;
-	    nphot       +=  BinSignal[i] * fWeight[i];
+	    for(Int_t i = 0; i<fWeight.GetSize(); i++)
+	      {
+		BinSignal[i] =  (Float_t) ptr[i] - mean;
+		nphot       +=  BinSignal[i] * fWeight[i];
+	      }
+	    nphoterr = ped.GetSigma()* fSumQuadWeights;
 	  }
-
-	Float_t nphoterr = ped.GetSigma()* fSumQuadWeights;
 
         fCerPhotEvt->AddPixel(pixid, nphot, nphoterr);
