Index: trunk/MagicSoft/Mars/mcalib/MCalibCalcFromPast.cc
===================================================================
--- trunk/MagicSoft/Mars/mcalib/MCalibCalcFromPast.cc	(revision 7200)
+++ trunk/MagicSoft/Mars/mcalib/MCalibCalcFromPast.cc	(revision 7288)
@@ -93,5 +93,6 @@
       fIntensBad(NULL),
       fChargeCalc(NULL), fRelTimeCalc(NULL), fCalibrate(NULL),
-      fNumCam(0), fNumEvents(0), fUpdateWithFFactorMethod(kTRUE), fUpdateNumPhes(kTRUE)
+    fNumCam(0), fNumEvents(0), fUpdateWithFFactorMethod(kTRUE), fUpdateNumPhes(kTRUE),
+    fNumFails(0)
 {
 
@@ -252,5 +253,26 @@
     }
 
+  fNumFails = 0;
+
   return kTRUE;
+}
+
+// --------------------------------------------------------------------------
+//
+// Set fNumEvents=0
+//
+// This is necessary because the calibration histograms do reset themself
+// if ReInit is called, so they are empty. MCalibCalcFromPast errornously
+// ignores how many events are in the histograms but count the number
+// itself.
+//
+Bool_t MCalibCalcFromPast::ReInit(MParList *pList)
+{
+    if (fNumEvents>0)
+        *fLog << inf << fNumEvents << " calibration events at the end of the last file have been skipped." << endl;
+
+    fNumEvents = 0;
+
+    return kTRUE;
 }
 
@@ -288,8 +310,11 @@
   if (fChargeCalc)
     {
-      if (!fChargeCalc->Finalize())
-          return kERROR;
-
-      if (fUpdateNumPhes)
+        if (!fChargeCalc->Finalize())
+        {
+            fNumFails++;
+            *fLog << warn << "WARNING - Finalization of charges failed the " << fNumFails << " time..." << endl;
+        }
+
+        if (fUpdateNumPhes)
         {
           MCalibrationChargePix &avpix =(MCalibrationChargePix&)fIntensCharge->GetCam()->GetAverageArea(0);
@@ -336,17 +361,15 @@
 // - MHCalibrationCam::ResetHists()
 //
-Bool_t MCalibCalcFromPast::Finalize(const char* name)
-{
-
-  MHCalibrationCam *hist = (MHCalibrationCam*)fParList->FindObject(name);
-  if (hist)
-    {
-      hist->Finalize();
-      hist->ResetHists();
-      return kTRUE;
-    }
-
-  return kFALSE;
-  
+Bool_t MCalibCalcFromPast::Finalize(const char* name, Bool_t finalize)
+{
+    MHCalibrationCam *hist = (MHCalibrationCam*)fParList->FindObject(name, "MHCalibrationCam");
+    if (!hist)
+        return kFALSE;
+
+    if (finalize)
+        hist->Finalize();
+
+    hist->ResetHists();
+    return kTRUE;
 }
 
@@ -398,7 +421,26 @@
 Int_t MCalibCalcFromPast::PostProcess()
 {
-  *fLog << inf << "Number of Calibration Cams: " << fNumCam << endl;
-  return kTRUE;
-  
+    if (GetNumExecutions()==0)
+        return kTRUE;
+
+    // Now we reset all histograms to make sure that the PostProcess
+    // of the following tasks doesn't try to finalize a partly empty
+    // histogram!
+    Finalize("MHCalibrationChargeCam",      kFALSE);
+    Finalize("MHCalibrationChargeBlindCam", kFALSE);
+    Finalize("MHCalibrationRelTimeCam",     kFALSE);
+
+    if (fChargeCalc)
+        fChargeCalc->ResetNumProcessed();
+
+    if (fNumCam==0)
+        return kTRUE;
+
+    *fLog << inf << endl;
+    *fLog << GetDescriptor() << " execution statistics:" << endl;
+    *fLog << " " << setw(7) << fNumFails << " (" << Form("%5.1f", 100.*fNumFails/fNumCam) << "%) updates failed." << endl;
+    *fLog << endl;
+
+    return kTRUE;
 }
 
@@ -468,6 +510,4 @@
     }
 
-
-
     return rc;
 }
Index: trunk/MagicSoft/Mars/mcalib/MCalibCalcFromPast.h
===================================================================
--- trunk/MagicSoft/Mars/mcalib/MCalibCalcFromPast.h	(revision 7200)
+++ trunk/MagicSoft/Mars/mcalib/MCalibCalcFromPast.h	(revision 7288)
@@ -59,12 +59,15 @@
   TArrayF fPhesVar;
 
+  Int_t fNumFails;          //! How often got the update skipped?
+
   // MTask
   Int_t  PreProcess(MParList *pList);
   Int_t  Process();
-  Int_t  PostProcess();  
+  Int_t  PostProcess();
+  Bool_t ReInit(MParList *pList);
 
   // MCalibCalcFromPast
   Bool_t ReInitialize();
-  Bool_t Finalize(const char* name);
+  Bool_t Finalize(const char* name, Bool_t finalize=kTRUE);
 
   Bool_t UpdateMeanPhes();
Index: trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.h
===================================================================
--- trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.h	(revision 7200)
+++ trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.h	(revision 7288)
@@ -183,4 +183,6 @@
   void Clear(const Option_t *o="");
 
+  void ResetNumProcessed() { fNumProcessed=0; }
+
   Int_t Finalize();
 
