Index: trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.cc
===================================================================
--- trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.cc	(revision 3678)
+++ trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.cc	(revision 3679)
@@ -571,6 +571,6 @@
   if (cal.GetMeanErr() < fChargeErrLimit) 
     {
-      *fLog << warn << GetDesriptor() << ": Sigma of Fitted Charge: " << cal.GetMeanErr() << " is smaller than "
-            << fChargeErrLimit << " in Pixel  " << cal.GetPixId() << endl;
+      *fLog << warn << GetDescriptor() << ": Sigma of Fitted Charge: " << cal.GetMeanErr() 
+            << " is smaller than " << fChargeErrLimit << " in Pixel  " << cal.GetPixId() << endl;
       bad.SetUncalibrated( MBadPixelsPix::kChargeErrNotValid );
     }
@@ -578,5 +578,5 @@
    if (cal.GetMean() < fChargeRelErrLimit*cal.GetMeanErr()) 
     {
-      *fLog << warn << GetDesriptor() << ": Fitted Charge: " << cal.GetMean() << " is smaller than "
+      *fLog << warn << GetDescriptor() << ": Fitted Charge: " << cal.GetMean() << " is smaller than "
             << fChargeRelErrLimit << "* its error: " << cal.GetMeanErr() 
             << " in Pixel  " << cal.GetPixId() << endl;
@@ -586,5 +586,5 @@
   if (cal.GetSigma() < cal.GetPedRms())
     {
-      *fLog << warn << GetDesriptor() << ": Sigma of Fitted Charge: " << cal.GetSigma() 
+      *fLog << warn << GetDescriptor() << ": Sigma of Fitted Charge: " << cal.GetSigma() 
 	    << " smaller than Pedestal RMS: " << cal.GetPedRms() << " in Pixel  " << cal.GetPixId() << endl;
       bad.SetUncalibrated( MBadPixelsPix::kChargeSigmaNotValid );
@@ -607,5 +607,5 @@
   if ( cal.GetAbsTimeMean() < lowerlimit)
     {
-      *fLog << warn << GetDesriptor() << ": Mean ArrivalTime in first " << fTimeLowerLimit 
+      *fLog << warn << GetDescriptor() << ": Mean ArrivalTime in first " << fTimeLowerLimit 
             << " extraction bin of the Pixel " << cal.GetPixId() << endl;
       *fLog << cal.GetAbsTimeMean() << "   " << lowerlimit << endl;
@@ -615,5 +615,5 @@
   if ( cal.GetAbsTimeMean() > upperlimit )
     {
-      *fLog << warn << GetDesriptor() << ": Mean ArrivalTime in last " << fTimeUpperLimit 
+      *fLog << warn << GetDescriptor() << ": Mean ArrivalTime in last " << fTimeUpperLimit 
             << " two extraction bins of the Pixel " << cal.GetPixId() << endl;
       *fLog << cal.GetAbsTimeMean() << "   " << upperlimit << endl;
@@ -670,5 +670,5 @@
   if (fPINDiode->GetMean() < fChargeLimit*fPINDiode->GetPedRms())
     {
-      *fLog << warn << GetDesriptor() << ": Fitted Charge is smaller than "
+      *fLog << warn << GetDescriptor() << ": Fitted Charge is smaller than "
             << fChargeLimit << " Pedestal RMS in PINDiode " << endl;
       return kFALSE;
@@ -677,5 +677,5 @@
   if (fPINDiode->GetMeanErr() < fChargeErrLimit) 
     {
-      *fLog << warn << GetDesriptor() << ": Error of Fitted Charge is smaller than "
+      *fLog << warn << GetDescriptor() << ": Error of Fitted Charge is smaller than "
             << fChargeErrLimit << " in PINDiode " << endl;
       return kFALSE;
@@ -684,5 +684,5 @@
   if (fPINDiode->GetMean() < fChargeRelErrLimit*fPINDiode->GetMeanErr()) 
     {
-      *fLog << warn << GetDesriptor() << ": Fitted Charge is smaller than "
+      *fLog << warn << GetDescriptor() << ": Fitted Charge is smaller than "
             << fChargeRelErrLimit << "* its error in PINDiode " << endl;
       return kFALSE;
@@ -691,5 +691,5 @@
   if (fPINDiode->GetSigma() < fPINDiode->GetPedRms())
     {
-      *fLog << warn << GetDesriptor() << ": Sigma of Fitted Charge smaller than Pedestal RMS in PINDiode " << endl;
+      *fLog << warn << GetDescriptor() << ": Sigma of Fitted Charge smaller than Pedestal RMS in PINDiode " << endl;
       return kFALSE;
     }
@@ -702,5 +702,5 @@
   if (fPINDiode->GetAbsTimeMean() < lowerlimit)
     {
-      *fLog << warn << GetDesriptor() << ": Mean ArrivalTime in first " << fTimeLowerLimit 
+      *fLog << warn << GetDescriptor() << ": Mean ArrivalTime in first " << fTimeLowerLimit 
             << " extraction bin in PIN Diode " << endl;
       *fLog << fPINDiode->GetAbsTimeMean() << "   " << lowerlimit << endl;
@@ -710,5 +710,5 @@
   if ( fPINDiode->GetAbsTimeMean() > upperlimit )
     {
-      *fLog << warn << GetDesriptor() << ": Mean ArrivalTime in last " << fTimeUpperLimit 
+      *fLog << warn << GetDescriptor() << ": Mean ArrivalTime in last " << fTimeUpperLimit 
             << " two extraction bins in PIN Diode " << endl;
       *fLog << fPINDiode->GetAbsTimeMean() << "   " << upperlimit << endl;
@@ -754,5 +754,5 @@
   if (2.*(lambdacheck-lambda)/(lambdacheck+lambda) < fLambdaCheckLimit)
     {
-      *fLog << warn << GetDesriptor() << ": Lambda and Lambda-Check differ by more than "
+      *fLog << warn << GetDescriptor() << ": Lambda and Lambda-Check differ by more than "
             << fLambdaCheckLimit << " in the Blind Pixel " << endl;
       return kFALSE;
@@ -761,5 +761,5 @@
   if (lambdaerr < fLambdaErrLimit) 
     {
-      *fLog << warn << GetDesriptor() << ": Error of Fitted Lambda is greater than "
+      *fLog << warn << GetDescriptor() << ": Error of Fitted Lambda is greater than "
             << fLambdaErrLimit << " in Blind Pixel " << endl;
       return kFALSE;
@@ -952,50 +952,7 @@
     }
 
-  MCalibrationChargePix &avpix = (MCalibrationChargePix&)fCam->GetAverageArea(0);
-  MCalibrationQEPix     &qepix = (MCalibrationQEPix&)  fQECam->GetAverageArea(0);  
-
-  const Float_t avphotonflux = avpix.GetPheFFactorMethod()       
-                             / qepix.GetQEFFactor(fPulserColor)
-                             / fQECam->GetPlexiglassQE();
-
-  const Float_t avfluxrelvar = avpix.GetPheFFactorMethodRelVar() 
-                             + qepix.GetQEFFactorRelVar(fPulserColor)
-                             + fQECam->GetPlexiglassQERelVar();
-  //
-  // Third loop: With the knowledge of the overall photon flux, calculate the total 
-  //             F-Factor of the whole readout per pixel and set the quantum efficiencies 
-  //             after the F-Factor method.
-  //
-  for (UInt_t i=0; i<npixels; i++)
-    {
-      
-      MCalibrationChargePix &pix = (MCalibrationChargePix&)(*fCam)[i];
-      MCalibrationQEPix   &qepix = (MCalibrationQEPix&)  (*fQECam)[i];
-
-      if (!pix.IsFFactorMethodValid())
-        {
-          qepix.SetFFactorMethodValid(kFALSE,fPulserColor);
-          continue;
-        }
-      
-      const Float_t photons    = avphotonflux / fGeom->GetPixRatio(i);
-      const Float_t conv       = photons      / pix.GetPheFFactorMethod();
-
-      if (!pix.CalcMeanFFactor( photons , avfluxrelvar ))
-        {
-          pix.SetFFactorMethodValid(kFALSE);
-          qepix.SetFFactorMethodValid(kFALSE, fPulserColor);
-          (*fBadPixels)[i].SetUncalibrated( MBadPixelsPix::kDeviatingNumPhes );
-        }
-
-      const Float_t convrelvar = avfluxrelvar +  pix.GetPheFFactorMethodRelVar();
-
-      qepix.SetQEFFactor    ( conv                    , fPulserColor );
-      qepix.SetQEFFactorVar ( convrelvar * conv * conv, fPulserColor );      
-    }
-  
-
   return kTRUE;
 }
+
 
 // ----------------------------------------------------------------------
@@ -1046,4 +1003,53 @@
 //
 //
+void MCalibrationChargeCalc::FinalizeFFactorQECam()
+{
+
+  MCalibrationChargePix &avpix = (MCalibrationChargePix&)fCam->GetAverageArea(0);
+  MCalibrationQEPix     &qepix = (MCalibrationQEPix&)  fQECam->GetAverageArea(0);  
+
+  const Float_t avphotonflux = avpix.GetPheFFactorMethod()       
+                             / qepix.GetQEFFactor(fPulserColor)
+                             / fQECam->GetPlexiglassQE();
+
+  const Float_t avfluxrelvar = avpix.GetPheFFactorMethodRelVar() 
+                             + qepix.GetQEFFactorRelVar(fPulserColor)
+                             + fQECam->GetPlexiglassQERelVar();
+
+  const UInt_t npixels  = fGeom->GetNumPixels();
+
+  for (UInt_t i=0; i<npixels; i++)
+    {
+      
+      MCalibrationChargePix &pix = (MCalibrationChargePix&)(*fCam)[i];
+      MCalibrationQEPix   &qepix = (MCalibrationQEPix&)  (*fQECam)[i];
+
+      if (!pix.IsFFactorMethodValid())
+        {
+          qepix.SetFFactorMethodValid(kFALSE,fPulserColor);
+          continue;
+        }
+      
+      const Float_t photons    = avphotonflux / fGeom->GetPixRatio(i);
+      const Float_t conv       = photons      / pix.GetPheFFactorMethod();
+
+      if (!pix.CalcMeanFFactor( photons , avfluxrelvar ))
+        {
+          pix.SetFFactorMethodValid(kFALSE);
+          qepix.SetFFactorMethodValid(kFALSE, fPulserColor);
+          (*fBadPixels)[i].SetUncalibrated( MBadPixelsPix::kDeviatingNumPhes );
+        }
+
+      const Float_t convrelvar = avfluxrelvar +  pix.GetPheFFactorMethodRelVar();
+
+      qepix.SetQEFFactor    ( conv                    , fPulserColor );
+      qepix.SetQEFFactorVar ( convrelvar * conv * conv, fPulserColor );      
+      qepix.UpdateFFactorMethod();
+    }
+}
+
+// ------------------------------------------------------------------------
+//
+//
 void MCalibrationChargeCalc::FinalizeBlindPixelQECam()
 {
@@ -1094,4 +1100,5 @@
       qepix.SetQEBlindPixel    ( conv                    , fPulserColor );
       qepix.SetQEBlindPixelVar ( convrelvar * conv * conv, fPulserColor );      
+      qepix.UpdateBlindPixelMethod();
     }
 }
@@ -1142,4 +1149,5 @@
       qepix.SetQEPINDiode    ( conv                    , fPulserColor );
       qepix.SetQEPINDiodeVar ( convrelvar * conv * conv, fPulserColor );      
+      qepix.UpdateBlindPixelMethod();
     }
 }
@@ -1265,4 +1273,5 @@
   // Finalize QE Cam
   //
+  FinalizeFFactorQECam();
   FinalizeBlindPixelQECam();
   FinalizePINDiodeQECam();
Index: trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.h
===================================================================
--- trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.h	(revision 3678)
+++ trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.h	(revision 3679)
@@ -102,5 +102,6 @@
   Bool_t FinalizeBlindPixel();
   Bool_t FinalizeFFactorMethod();
-  void   FinalizeBadPixels();  
+  void   FinalizeBadPixels();
+  void   FinalizeFFactorQECam();  
   void   FinalizeBlindPixelQECam();
   void   FinalizePINDiodeQECam();
