Index: trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.cc
===================================================================
--- trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.cc	(revision 4129)
+++ trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.cc	(revision 4130)
@@ -757,26 +757,27 @@
 {
 
+  /*
   const Float_t mean    = cal.IsHiGainSaturation() ? cal.GetConvertedLoGainMean()    : cal.GetMean();
   const Float_t meanerr = cal.IsHiGainSaturation() ? cal.GetConvertedLoGainMeanErr() : cal.GetMeanErr();
   const Float_t sigma   = cal.IsHiGainSaturation() ? cal.GetConvertedLoGainSigma()   : cal.GetSigma();
-
-  if (mean < fChargeLimit*cal.GetPedRms())
-    {
-      *fLog << warn << GetDescriptor() << ": Fitted Charge: " << mean << " is smaller than "
+  */
+  if (cal.GetMean() < fChargeLimit*cal.GetPedRms())
+    {
+      *fLog << warn << GetDescriptor() << ": Fitted Charge: " << cal.GetMean() << " is smaller than "
             << fChargeLimit << " Pedestal RMS: " <<  cal.GetPedRms() << " in Pixel  " << cal.GetPixId() << endl;
       bad.SetUncalibrated( MBadPixelsPix::kChargeIsPedestal);
     }
   
-   if (mean < fChargeRelErrLimit*meanerr) 
-    {
-      *fLog << warn << GetDescriptor() << ": Fitted Charge: " << mean << " is smaller than "
-            << fChargeRelErrLimit << "* its error: " << meanerr
+   if (cal.GetMean() < fChargeRelErrLimit*cal.GetMeanErr()) 
+    {
+      *fLog << warn << GetDescriptor() << ": Fitted Charge: " << cal.GetMean() << " is smaller than "
+            << fChargeRelErrLimit << "* its error: " << cal.GetMeanErr()
             << " in Pixel  " << cal.GetPixId() << endl;
       bad.SetUncalibrated( MBadPixelsPix::kChargeRelErrNotValid );
     }
 
-  if (sigma < cal.GetPedRms())
-    {
-      *fLog << warn << GetDescriptor() << ": Sigma of Fitted Charge: " << sigma
+  if (cal.GetSigma() < cal.GetPedRms())
+    {
+      *fLog << warn << GetDescriptor() << ": Sigma of Fitted Charge: " << cal.GetSigma()
 	    << " smaller than Pedestal RMS: " << cal.GetPedRms() << " in Pixel  " << cal.GetPixId() << endl;
       bad.SetUncalibrated( MBadPixelsPix::kChargeSigmaNotValid );
@@ -1528,2 +1529,13 @@
 }
 
+// --------------------------------------------------------------------------
+//
+// Set the path for output file
+// 
+void MCalibrationChargeCalc::SetOutputPath(const char *path)
+{
+  fOutputPath = path;
+  if (fOutputPath.EndsWith("/"))
+    fOutputPath = fOutputPath(0, fOutputPath.Length()-1);
+}
+
Index: trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.h
===================================================================
--- trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.h	(revision 4129)
+++ trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.h	(revision 4130)
@@ -66,4 +66,6 @@
   MCalibrationCam::PulserColor_t fPulserColor; // Calibration LEDs colour 
 
+  TString fOutputPath;                         // Path to the output file
+  
   // Pointers
   MBadPixelsCam              *fBadPixels;      //  Bad Pixels 
@@ -110,4 +112,5 @@
   void SetLambdaErrLimit    ( const Float_t f=fgLambdaErrLimit         ) { fLambdaErrLimit    = f;   }
   void SetLambdaCheckLimit  ( const Float_t f=fgLambdaCheckLimit       ) { fLambdaCheckLimit  = f;   }
+  void SetOutputPath        ( const char   *path="."                   );
   void SetPheErrLimit       ( const Float_t f=fgPheErrLimit            ) { fPheErrLimit       = f;   }  
   void SetPulserColor       ( const MCalibrationCam::PulserColor_t col ) { fPulserColor       = col; }
Index: trunk/MagicSoft/Mars/mcalib/MCalibrationChargePix.cc
===================================================================
--- trunk/MagicSoft/Mars/mcalib/MCalibrationChargePix.cc	(revision 4129)
+++ trunk/MagicSoft/Mars/mcalib/MCalibrationChargePix.cc	(revision 4130)
@@ -214,4 +214,22 @@
   return fConversionHiLoVar / (fConversionHiLo * fConversionHiLo);
 }
+
+// --------------------------------------------------------------------------
+//
+// Get the relative variance of the electronics pedestal RMS
+// - If aidx is 0, return rel. variance of gkElectronicPedRmsInner
+// - If aidx is 1, return rel. variance of gkElectronicPedRmsOuter
+//
+const Float_t MCalibrationChargePix::GetElectronicPedRmsRelVar(const Int_t aidx) const 
+{
+
+  if (aidx == 0)
+    return gkElectronicPedRmsErr * gkElectronicPedRmsErr / gkElectronicPedRmsInner / gkElectronicPedRmsInner;
+
+  if (aidx == 1)
+    return gkElectronicPedRmsErr * gkElectronicPedRmsErr / gkElectronicPedRmsOuter / gkElectronicPedRmsOuter;
+
+  return -1.;
+}
  
 
@@ -783,7 +801,8 @@
     return;
 
-  const Float_t elecPedRms     = (aidx > 0 ? gkElectronicPedRmsOuter : gkElectronicPedRmsInner ) 
-                               * TMath::Sqrt(logainsamples);
-  const Float_t elecPedRmsVar  = gkElectronicPedRmsErr * gkElectronicPedRmsErr * logainsamples;
+  const Float_t elecPedRms     = (aidx == 0 ? gkElectronicPedRmsInner : gkElectronicPedRmsOuter ) 
+                               * TMath::Sqrt(logainsamples) / fConversionHiLo;
+  const Float_t elecPedRmsVar  = ( GetElectronicPedRmsRelVar(aidx) + GetConversionHiLoRelVar() )
+                               * elecPedRms * elecPedRms;
   
   Float_t pedRmsSquare      = fPedRms * fPedRms;
Index: trunk/MagicSoft/Mars/mcalib/MCalibrationChargePix.h
===================================================================
--- trunk/MagicSoft/Mars/mcalib/MCalibrationChargePix.h	(revision 4129)
+++ trunk/MagicSoft/Mars/mcalib/MCalibrationChargePix.h	(revision 4130)
@@ -44,4 +44,5 @@
   enum  { kFFactorMethodValid   };          // Possible bits to be set
 
+  const Float_t GetElectronicPedRmsRelVar(const Int_t aidx) const;
   const Float_t GetConversionHiLoRelVar()  const;
   const Float_t GetFFactorRelVar()     const;
Index: trunk/MagicSoft/Mars/mcalib/MCalibrationRelTimeCalc.cc
===================================================================
--- trunk/MagicSoft/Mars/mcalib/MCalibrationRelTimeCalc.cc	(revision 4129)
+++ trunk/MagicSoft/Mars/mcalib/MCalibrationRelTimeCalc.cc	(revision 4130)
@@ -72,5 +72,5 @@
 using namespace std;
 
-const Float_t MCalibrationRelTimeCalc::fgRelTimeResolutionLimit = 0.5;
+const Float_t MCalibrationRelTimeCalc::fgRelTimeResolutionLimit = 0.75;
 // --------------------------------------------------------------------------
 //
Index: trunk/MagicSoft/Mars/mcalib/MCalibrationRelTimeCalc.h
===================================================================
--- trunk/MagicSoft/Mars/mcalib/MCalibrationRelTimeCalc.h	(revision 4129)
+++ trunk/MagicSoft/Mars/mcalib/MCalibrationRelTimeCalc.h	(revision 4130)
@@ -32,5 +32,5 @@
 private:
 
-  static const Float_t fgRelTimeResolutionLimit; //! Default for fRelTimeResolutionLimit (now set to: 0.5)
+  static const Float_t fgRelTimeResolutionLimit; //! Default for fRelTimeResolutionLimit (now set to: 0.75)
  
   // Variables
