Index: trunk/MagicSoft/Mars/Changelog
===================================================================
--- trunk/MagicSoft/Mars/Changelog	(revision 4149)
+++ trunk/MagicSoft/Mars/Changelog	(revision 4150)
@@ -35,4 +35,10 @@
      - introduce data members to store the average number of photons by 
        the three methods
+
+   * mcalib/MCalibrationChargeCalc.cc
+     - calculate the limits for acceptance of number of photo-electrons
+       for the calculation of the mean by normal mean instead of weighted 
+       mean. There were too many outliers still present in the weighted
+       mean such to modify the result by a sizeable amount.
 
    * mpedestals/MPedCalcPedRun.cc
Index: trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.cc
===================================================================
--- trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.cc	(revision 4149)
+++ trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.cc	(revision 4150)
@@ -228,5 +228,5 @@
 const Float_t MCalibrationChargeCalc::fgLambdaErrLimit         = 0.2;
 const Float_t MCalibrationChargeCalc::fgLambdaCheckLimit       = 0.2;
-const Float_t MCalibrationChargeCalc::fgPheErrLimit            = 8.;
+const Float_t MCalibrationChargeCalc::fgPheErrLimit            = 3.;
 const Float_t MCalibrationChargeCalc::fgFFactorErrLimit        = 3.;
 // --------------------------------------------------------------------------
@@ -932,13 +932,10 @@
       
       const Float_t nphe  = pix.GetPheFFactorMethod();
-      const Float_t nvar  = pix.GetPheFFactorMethodVar();
+      const Float_t nvar  = pix.GetPheFFactorMethod()*pix.GetPheFFactorMethod();
       const Int_t   aidx  = (*fGeom)[i].GetAidx();
 
-      if (nvar > 0.)
-        {
-          areaphes    [aidx] += nphe;
-          areavars    [aidx] += nvar;
-          numareavalid[aidx] ++;
-        } 
+      areaphes    [aidx] += nphe;
+      areavars    [aidx] += nvar;
+      numareavalid[aidx] ++;
     } 
 
@@ -953,5 +950,15 @@
 
       areaphes[i] = areaphes[i] / numareavalid[i];
-      areavars[i] = areavars[i] / numareavalid[i];
+      areavars[i] = (areavars[i] - areaphes[i]*areaphes[i]/numareavalid[i]) / (numareavalid[i]-1.);
+
+      if (areavars[i] > 0.)
+        areavars[i] = TMath::Sqrt(areavars[i]);
+      else
+        {
+          *fLog << warn << GetDescriptor() << ": No pixels with valid variance of photo-electrons found "
+                << "in area index: " << i << endl;
+          continue;
+        }
+      
       lowlim  [i] = areaphes[i] - fPheErrLimit*TMath::Sqrt(areavars[i]);
       upplim  [i] = areaphes[i] + fPheErrLimit*TMath::Sqrt(areavars[i]);
@@ -1216,4 +1223,11 @@
   const UInt_t nareas   = fGeom->GetNumAreas();
 
+  //
+  // Set the results in the MCalibrationChargeCam
+  //
+  fCam->SetNumPhotonsFFactorMethod   (avphotons);
+  if (avphotrelvar > 0.)
+    fCam->SetNumPhotonsFFactorMethodErr(TMath::Sqrt( avphotrelvar * avphotons * avphotons));  
+
   Float_t lowlim           [nareas];
   Float_t upplim           [nareas];
