Index: trunk/MagicSoft/Mars/Changelog
===================================================================
--- trunk/MagicSoft/Mars/Changelog	(revision 4241)
+++ trunk/MagicSoft/Mars/Changelog	(revision 4242)
@@ -25,4 +25,10 @@
      - separated calls for light guides eff. , QE, and coll. eff.
    
+   * mcalib/MCalibrationChargeCalc.[h,cc]
+     - fixed a small bug in the calculation of the error on the number 
+       of photons with the F-Factor method, did not include the division
+       by number of pixels for the precision of the QE. This does not 
+       affect the general analysis. 
+
 
  2004/05/28: Markus Gaug
Index: trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.cc
===================================================================
--- trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.cc	(revision 4241)
+++ trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.cc	(revision 4242)
@@ -229,5 +229,5 @@
 const Float_t MCalibrationChargeCalc::fgLambdaCheckLimit       = 0.5;
 const Float_t MCalibrationChargeCalc::fgPheErrLimit            = 3.5;
-const Float_t MCalibrationChargeCalc::fgFFactorErrLimit        = 3.;
+const Float_t MCalibrationChargeCalc::fgFFactorErrLimit        = 3.5;
 // --------------------------------------------------------------------------
 //
@@ -294,8 +294,9 @@
 {
   
-    fNumHiGainSamples        = 0.;
-    fNumLoGainSamples        = 0.;
-    fSqrtHiGainSamples       = 0.;
-    fSqrtLoGainSamples       = 0.;
+    fNumHiGainSamples          = 0.;
+    fNumLoGainSamples          = 0.;
+    fSqrtHiGainSamples         = 0.;
+    fSqrtLoGainSamples         = 0.;
+    fNumInnerFFactorMethodUsed = 0;
     SkipHiLoGainCalibration( kFALSE );    
 }
@@ -1022,4 +1023,7 @@
       areaphes      [aidx]   += nphe;
       numareavalid  [aidx]   ++;
+
+      if (aidx == 0)
+        fNumInnerFFactorMethodUsed++;
       //       sectorweights [sector] += weight;
       //      sectorphes    [sector] += weight*nphe;
@@ -1210,7 +1214,11 @@
 // av.Num.photons(area index) = av.Num.Phes(area index) 
 //                            / MCalibrationQEPix::GetDefaultQE(fPulserColor) 
+//                            / MCalibrationQEPix::GetPMTCollectionEff()
+//                            / MCalibrationQEPix::GetLightGuidesEff(fPulserColor)
 //                            / MCalibrationQECam::GetPlexiglassQE()
 //
-// Calculate the variance on the average number of photons.
+// Calculate the variance on the average number of photons assuming that the error on the 
+// Quantum efficiency is reduced by the number of used inner pixels, but the rest of the 
+// values keeps it ordinary error since it is systematic.
 //
 // Loop over pixels: 
@@ -1227,4 +1235,5 @@
 //
 // - Set QE in MCalibrationQEPix::SetQEFFactor ( QE, fPulserColor );
+//
 // - Set Variance of QE in  MCalibrationQEPix::SetQEFFactorVar ( Variance, fPulserColor );
 // - Set bit MCalibrationQEPix::SetFFactorMethodValid(kTRUE,fPulserColor) 
@@ -1235,13 +1244,24 @@
 {
 
+  if (fNumInnerFFactorMethodUsed < 2)
+    {
+      *fLog << warn << GetDescriptor() 
+            << ": Could not calculate F-Factor Method: Less than 2 inner pixels valid! " << endl;
+      return;
+    }
+  
   MCalibrationChargePix &avpix = (MCalibrationChargePix&)fCam->GetAverageArea(0);
   MCalibrationQEPix     &qepix = (MCalibrationQEPix&)  fQECam->GetAverageArea(0);  
 
   const Float_t avphotons   = avpix.GetPheFFactorMethod()       
-                           / qepix.GetDefaultQE(fPulserColor)
+                           / qepix.GetDefaultQE(fPulserColor) 
+                           / qepix.GetPMTCollectionEff()
+                           / qepix.GetLightGuidesEff(fPulserColor)
                            / fQECam->GetPlexiglassQE();
 
   const Float_t avphotrelvar = avpix.GetPheFFactorMethodRelVar() 
-                            + qepix.GetDefaultQERelVar(fPulserColor)
+                            + qepix.GetDefaultQERelVar(fPulserColor) / fNumInnerFFactorMethodUsed
+                            + qepix.GetPMTCollectionEffRelVar()
+                            + qepix.GetLightGuidesEffRelVar(fPulserColor)
                             + fQECam->GetPlexiglassQERelVar();
 
Index: trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.h
===================================================================
--- trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.h	(revision 4241)
+++ trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.h	(revision 4242)
@@ -65,5 +65,6 @@
   Float_t fSqrtLoGainSamples;                  // Square root nr. Low -Gain FADC slices used by extractor 
   MCalibrationCam::PulserColor_t fPulserColor; // Calibration LEDs colour 
-
+  Int_t   fNumInnerFFactorMethodUsed;          // Number of inner pixels used for F-Factor Method calibration
+  
   TString fOutputPath;                         // Path to the output file
   TString fOutputFile;                         // Name of the output file  
