Index: /trunk/MagicSoft/Mars/Changelog
===================================================================
--- /trunk/MagicSoft/Mars/Changelog	(revision 4271)
+++ /trunk/MagicSoft/Mars/Changelog	(revision 4272)
@@ -30,4 +30,9 @@
      - replace fNumHiGainFADCSlices and fNumLoGainFADCSlices by a 
        TArrayF and increment ClassDef by 1 for the streamer.
+
+   * mcalib/MCalibrationChargeCalc.cc
+     - found a small bug making a difference in the number of valid 
+       pixels with the blind PIxel method and the ffactor method. Now
+       fixed. (The difference was usually a couple of pixels)
 
 
Index: /trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.cc
===================================================================
--- /trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.cc	(revision 4271)
+++ /trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.cc	(revision 4272)
@@ -1013,5 +1013,5 @@
           bad.SetUncalibrated( MBadPixelsPix::kDeviatingNumPhes );
           bad.SetUnsuitable  ( MBadPixelsPix::kUnsuitableRun    );
-          pix.SetExcluded();
+          pix.SetFFactorMethodValid(kFALSE);
           continue;
         }
@@ -1295,11 +1295,7 @@
       MCalibrationQEPix   &qepix = (MCalibrationQEPix&)  (*fQECam)[i];
 
-      if (!pix.IsFFactorMethodValid())
-        {
-          qepix.SetExcluded();
-          qepix.SetFFactorMethodValid(kFALSE,fPulserColor);
-          continue;
-        }
-      
+      if (bad.IsUnsuitable(MBadPixelsPix::kUnsuitableRun))
+        continue;
+
       const Float_t photons = avphotons / fGeom->GetPixRatio(i);
       const Float_t qe      = pix.GetPheFFactorMethod() / photons ;
@@ -1307,7 +1303,7 @@
       if (!pix.CalcMeanFFactor( photons , avphotrelvar ))
         {
-          pix.SetFFactorMethodValid(kFALSE);
-          qepix.SetFFactorMethodValid(kFALSE, fPulserColor);
           (*fBadPixels)[i].SetUncalibrated( MBadPixelsPix::kDeviatingNumPhes );
+          continue;
+          
         }
 
@@ -1341,11 +1337,10 @@
       
       MCalibrationChargePix &pix = (MCalibrationChargePix&)(*fCam)[i];
-
-      if (!pix.IsFFactorMethodValid())
+      MBadPixelsPix         &bad =                   (*fBadPixels)[i];
+
+      if (bad.IsUnsuitable(MBadPixelsPix::kUnsuitableRun))
         continue;
       
       const Float_t ffactor = pix.GetMeanFFactorFADC2Phot();
-      MBadPixelsPix    &bad = (*fBadPixels)[i];
-
       const Int_t   aidx   = (*fGeom)[i].GetAidx();
 
@@ -1357,5 +1352,20 @@
           bad.SetUncalibrated( MBadPixelsPix::kDeviatingFFactor );
           bad.SetUnsuitable  ( MBadPixelsPix::kUnsuitableRun    );
+        }
+    }
+
+  for (UInt_t i=0; i<npixels; i++)
+    {
+      
+      MCalibrationChargePix &pix = (MCalibrationChargePix&)(*fCam)[i];
+      MCalibrationQEPix   &qepix = (MCalibrationQEPix&)  (*fQECam)[i];
+      MBadPixelsPix         &bad =                   (*fBadPixels)[i];
+      
+      if (bad.IsUnsuitable(MBadPixelsPix::kUnsuitableRun))
+        {
+          qepix.SetFFactorMethodValid(kFALSE,fPulserColor);
+          pix.SetFFactorMethodValid(kFALSE);
           pix.SetExcluded();
+          continue;
         }
     }
@@ -1425,6 +1435,5 @@
         }
       
-      MBadPixelsPix       &bad   =                   (*fBadPixels)[i];
-
+      MBadPixelsPix &bad = (*fBadPixels)[i];
       if (bad.IsUnsuitable (MBadPixelsPix::kUnsuitableRun))
         {
