Index: /trunk/MagicSoft/Mars/Changelog
===================================================================
--- /trunk/MagicSoft/Mars/Changelog	(revision 4130)
+++ /trunk/MagicSoft/Mars/Changelog	(revision 4131)
@@ -54,7 +54,12 @@
      - replaced the relative limit for acceptance of the time resolution 
        by an absolute limit
-
-   * mcalib/MCalibrationChargeCalc.cc
+     - set up output statistics logging (data written into DB)
+
+   * mcalib/MCalibrationChargeCalc.[h,cc]
      - moved limit for acceptance of number of phe;s from 5 to 8
+     - set up output statistics logging (data written into DB)
+
+   * mjobs/MJCalibration.cc
+     - set up output statistics logging (data written into DB)
 
 
Index: /trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.cc
===================================================================
--- /trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.cc	(revision 4130)
+++ /trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.cc	(revision 4131)
@@ -251,4 +251,6 @@
 // - fPheErrLimit       to fgPheErrLimit  
 // - fPulserColor       to MCalibrationCam::kCT1
+// - fOutputPath        to "."
+// - fOutputFile        to "ChargeCalibStat.txt"
 // 
 // Calls:
@@ -276,4 +278,6 @@
   SetPheErrLimit();
   SetPulserColor(MCalibrationCam::kNONE);
+  SetOutputPath();
+  SetOutputFile();
 
   Clear();
@@ -650,4 +654,10 @@
   FinalizePINDiodeQECam();
 
+  //
+  // Re-direct the output to an ascii-file from now on:
+  //
+  MLog asciilog;
+  asciilog.SetOutputFile(GetOutputFile(),kTRUE);
+  SetLogStream(&asciilog);
   //
   // Finalize calibration statistics
@@ -694,4 +704,6 @@
                     "Pixels with unsuccesful Gauss fit to the Lo Gain: ");
 
+  SetLogStream(&gLog);
+
   return kTRUE;
 }
@@ -1540,2 +1552,10 @@
 }
 
+// --------------------------------------------------------------------------
+//
+// Get the output file
+// 
+TString MCalibrationChargeCalc::GetOutputFile()
+{
+  return Form("%s/%s", (const char*)fOutputPath, (const char*)fOutputFile);
+}
Index: /trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.h
===================================================================
--- /trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.h	(revision 4130)
+++ /trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.h	(revision 4131)
@@ -67,4 +67,5 @@
 
   TString fOutputPath;                         // Path to the output file
+  TString fOutputFile;                         // Name of the output file  
   
   // Pointers
@@ -82,4 +83,5 @@
 
   // functions
+  TString GetOutputFile();
   void   FinalizePedestals      ( const MPedestalPix &ped, MCalibrationChargePix &cal, const Int_t aidx );
   Bool_t FinalizeCharges        ( MCalibrationChargePix &cal, MBadPixelsPix &bad      );
@@ -113,4 +115,5 @@
   void SetLambdaCheckLimit  ( const Float_t f=fgLambdaCheckLimit       ) { fLambdaCheckLimit  = f;   }
   void SetOutputPath        ( const char   *path="."                   );
+  void SetOutputFile        ( const char   *file="ChargeCalibStat.txt" ) { fOutputFile        = file; }
   void SetPheErrLimit       ( const Float_t f=fgPheErrLimit            ) { fPheErrLimit       = f;   }  
   void SetPulserColor       ( const MCalibrationCam::PulserColor_t col ) { fPulserColor       = col; }
Index: /trunk/MagicSoft/Mars/mcalib/MCalibrationRelTimeCalc.cc
===================================================================
--- /trunk/MagicSoft/Mars/mcalib/MCalibrationRelTimeCalc.cc	(revision 4130)
+++ /trunk/MagicSoft/Mars/mcalib/MCalibrationRelTimeCalc.cc	(revision 4131)
@@ -81,4 +81,6 @@
 // Initializes:
 // - fRelTimeResolutionLimit to fgRelTimeResolutionimit
+// - fOutputPath        to "."
+// - fOutputFile        to "TimeCalibStat.txt"
 //
 // Calls:
@@ -93,4 +95,6 @@
   
   SetRelTimeResolutionLimit();
+  SetOutputPath();
+  SetOutputFile();
  
   Clear();
@@ -226,4 +230,10 @@
   FinalizeBadPixels();
 
+  //
+  // Re-direct the output to an ascii-file from now on:
+  //
+  MLog asciilog;
+  asciilog.SetOutputFile(GetOutputFile(),kTRUE);
+  SetLogStream(&asciilog);
   //
   // Finalize calibration statistics
@@ -243,4 +253,7 @@
   PrintUncalibrated(MBadPixelsPix::kRelTimeNotFitted,     
                     "Pixels with unsuccesful Gauss fit to the times:   ");
+
+  SetLogStream(&gLog);
+
   return kTRUE;
 }
@@ -348,7 +361,4 @@
       upplim  [aidx]  = areasum [aidx] + fRelTimeResolutionLimit;
       
-      *fLog << endl;
-      *fLog << inf << GetDescriptor() << ": Limits for acceptance of time resolution: ["
-            << Form("%4.2f%s%4.2f",lowlim[aidx],",",upplim[aidx]) << "] in area index " << aidx;
     }
   *fLog << endl;  
@@ -495,2 +505,21 @@
 }
 
+// --------------------------------------------------------------------------
+//
+// Set the path for output file
+// 
+void MCalibrationRelTimeCalc::SetOutputPath(const char *path)
+{
+  fOutputPath = path;
+  if (fOutputPath.EndsWith("/"))
+    fOutputPath = fOutputPath(0, fOutputPath.Length()-1);
+}
+
+// --------------------------------------------------------------------------
+//
+// Get the output file
+// 
+TString MCalibrationRelTimeCalc::GetOutputFile()
+{
+  return Form("%s/%s", (const char*)fOutputPath, (const char*)fOutputFile);
+}
Index: /trunk/MagicSoft/Mars/mcalib/MCalibrationRelTimeCalc.h
===================================================================
--- /trunk/MagicSoft/Mars/mcalib/MCalibrationRelTimeCalc.h	(revision 4130)
+++ /trunk/MagicSoft/Mars/mcalib/MCalibrationRelTimeCalc.h	(revision 4131)
@@ -38,4 +38,7 @@
   Byte_t  fFlags;                               // Bit-field for the flags
   
+  TString fOutputPath;                          // Path to the output file
+  TString fOutputFile;                          // Name of the output file  
+  
   // Pointers
   MBadPixelsCam              *fBadPixels;      //  Bad Pixels 
@@ -47,4 +50,5 @@
 
   // functions
+  TString GetOutputFile();
   void   FinalizeAverageResolution();
   void   FinalizeRelTimes     ();
@@ -65,4 +69,6 @@
   void Clear(const Option_t *o="");
   
+  void SetOutputPath        ( const char   *path="."                   );
+  void SetOutputFile        ( const char   *file="TimeCalibStat.txt"   ) { fOutputFile        = file; }
   void SetRelTimeResolutionLimit ( const Float_t f=fgRelTimeResolutionLimit    ) { fRelTimeResolutionLimit = f;   }
 
Index: /trunk/MagicSoft/Mars/mjobs/MJCalibration.cc
===================================================================
--- /trunk/MagicSoft/Mars/mjobs/MJCalibration.cc	(revision 4130)
+++ /trunk/MagicSoft/Mars/mjobs/MJCalibration.cc	(revision 4131)
@@ -801,4 +801,5 @@
 TString MJCalibration::GetOutputFile() const
 {
+
     if (!fRuns)
         return "";
@@ -918,5 +919,10 @@
   MExtractTimeSpline       timespline;
   MCalibrationChargeCalc   calcalc;
+  calcalc.SetOutputPath(fOutputPath);
+  calcalc.SetOutputFile(Form("%s-ChargeCalibStat.txt",fRuns->GetRunsAsFileName().Data()));
+
   MCalibrationRelTimeCalc  timecalc;
+  timecalc.SetOutputPath(fOutputPath);
+  timecalc.SetOutputFile(Form("%s-TimeCalibStat.txt",fRuns->GetRunsAsFileName().Data()));
   
   // 
