Index: /trunk/MagicSoft/Mars/Changelog
===================================================================
--- /trunk/MagicSoft/Mars/Changelog	(revision 5197)
+++ /trunk/MagicSoft/Mars/Changelog	(revision 5198)
@@ -30,6 +30,9 @@
   * mcalib/MCalibrationChargeCalc.cc
     - after talking with Florian, we reduced the electronic noise for the 
-      low-gain pedestal calculation from 1.5 to 0.8, independent from
+      low-gain pedestal calculation from 1.5 to 1.0, independent from
       inner or outer pixels. 
+    - additionally found a small bug in the calculation of the low-gain 
+      pedestal RMS which amounts to about the same size as the difference 
+      in the assumed electronic noise.
 
   * mcalib/MCalibrationChargeCalc.cc
Index: /trunk/MagicSoft/Mars/mcalib/MCalibrationChargePix.cc
===================================================================
--- /trunk/MagicSoft/Mars/mcalib/MCalibrationChargePix.cc	(revision 5197)
+++ /trunk/MagicSoft/Mars/mcalib/MCalibrationChargePix.cc	(revision 5198)
@@ -989,5 +989,5 @@
 //
 // Convert the NSB ped. RMS contribution to the low-gain with the formula:
-// - LoGain NSB square      = - HiGain NSB square / (fConversionHiLo*fConversionHiLo)
+// - LoGain NSB square      =  HiGain NSB square / (fConversionHiLo*fConversionHiLo)
 // - Var(LoGain NSB square) = ( Var(HiGain NSB square) / (HiGain NSB square * HiGain NSB square)
 //                              + GetConversionHiLoRelVar()   
@@ -1006,14 +1006,13 @@
     return;
 
-  const Float_t elecPedRms     = gkElectronicPedRms * TMath::Sqrt(logainsamples) / fConversionHiLo;
-  const Float_t elecPedRmsVar  = ( GetElectronicPedRmsRelVar() + GetConversionHiLoRelVar() )
-                               * elecPedRms * elecPedRms;
-  
-  Float_t pedRmsSquare      = fPedRms * fPedRms;
-  Float_t pedRmsSquareVar   = fPedVar * pedRmsSquare; // fPedRmsErr = fPedErr/2.
-  
-  //
-  // We do not know the Lo Gain Pedestal RMS, so we have to retrieve it 
-  // from the HI GAIN (all calculation per slice up to now):  
+  const Float_t elecPedRms     = gkElectronicPedRms * TMath::Sqrt(logainsamples);
+  const Float_t elecPedRmsVar  = GetElectronicPedRmsRelVar() * elecPedRms * elecPedRms;
+  
+  Float_t pedRmsSquare         = fPedRms * fPedRms;
+  Float_t pedRmsSquareVar      = fPedVar * pedRmsSquare; // fPedRmsErr = fPedErr/2.
+  
+  //
+  // We do not know the Low Gain Pedestal RMS, so we have to retrieve it 
+  // from the High Gain:  
   //
   // We extract the pure NSB contribution:
@@ -1033,12 +1032,9 @@
   
 
-  Float_t higainNsbSquare        =  pedRmsSquare    - elecRmsSquare;
-  Float_t higainNsbSquareRelVar  = (pedRmsSquareVar + elecRmsSquareVar);
-
+  Float_t higainNsbSquare     =  pedRmsSquare    - elecRmsSquare;
+  Float_t higainNsbSquareVar  = (pedRmsSquareVar + elecRmsSquareVar);
 
   if (higainNsbSquare < 0.001)
     higainNsbSquare = 0.;
-  else
-    higainNsbSquareRelVar  /= (higainNsbSquare * higainNsbSquare) ;
   
   if (IsDebug())
@@ -1046,5 +1042,5 @@
       *fLog << dbginf << "ID: " << GetPixId() 
             << " HiGain NSB Square:  " << higainNsbSquare
-            << " Rel.Var.HiGain NSB Square:  " << higainNsbSquareRelVar
+            << " Var.HiGain NSB Square:  " << higainNsbSquareVar
             << endl;
     }
@@ -1058,6 +1054,11 @@
 
   const Float_t logainNsbSquare         =   higainNsbSquare       / conversionSquare;
-  const Float_t logainNsbSquareVar      = ( higainNsbSquareRelVar + conversionSquareRelVar )
-                                	  * logainNsbSquare * logainNsbSquare;
+  //
+  // Calculation of variance of: c = a/b
+  //                    Delta(c)^2 = ( Delta(a)^2 + a^2/b^2*(Delta(b)^2 )  / b^2
+  //
+  const Float_t logainNsbSquareVar      = ( higainNsbSquareVar 
+                                         + conversionSquareRelVar * higainNsbSquare * higainNsbSquare ) 
+                                          / conversionSquare / conversionSquare;
     
   fLoGainPedRmsSquare    = logainNsbSquare    + elecRmsSquare;
