Index: trunk/MagicSoft/Mars/Changelog
===================================================================
--- trunk/MagicSoft/Mars/Changelog	(revision 2990)
+++ trunk/MagicSoft/Mars/Changelog	(revision 2991)
@@ -55,4 +55,7 @@
        with rnd = R * (r2-r1)/2 to make sure that we cannot
        devide by 0
+
+   * manalysis/MPedCalcPedRun.cc:
+     - added some comments
 
 
Index: trunk/MagicSoft/Mars/manalysis/MPedCalcPedRun.cc
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MPedCalcPedRun.cc	(revision 2990)
+++ trunk/MagicSoft/Mars/manalysis/MPedCalcPedRun.cc	(revision 2991)
@@ -30,10 +30,48 @@
 //   MPedCalcPedRun
 //
-//  This task takes a pedestal run file and fills MPedestalCam during
-//  the Process() with the pedestal and rms computed in an event basis.
-//  In the PostProcess() MPedestalCam is finally filled with the pedestal
-//  mean and rms computed in a run basis.
-//  More than one run (file) can be merged
-//
+// This task takes a pedestal run file and fills MPedestalCam during
+// the Process() with the pedestal and rms computed in an event basis.
+// In the PostProcess() MPedestalCam is finally filled with the pedestal
+// mean and rms computed in a run basis.
+// More than one run (file) can be merged
+//
+//
+// Actually, MPedCalcPedRun applies the following formula (1):
+// 
+// PedRMS = Sqrt(  (sum(x_i2) - sum(x_i)/n) / n-1 / 14 )
+// 
+// where x_i is the sum of 14 FADC slices and sum means the sum over all
+// events, n is the number of events.
+// 
+// For a high number of events, this formula is equivalent to formula (2):
+// 
+// PedRMS = Sqrt(  (<x_i*x_i> - <x_i>*<x_i>*n) / 14  )
+// 
+// where <> is the mean over all events and x_i again the sum over the 14
+// slices.
+// 
+// If you assume statistical equivalence of all slices (say, all have equal
+// offset and are not correlated and fluctuate Gaussian), it should also be
+// equivalent to (old formula) (3):
+// 
+// PedRMS = Sqrt(  (<p_i*p_i> - <p_i>*<p_i>*m) / m  ) * Sqrt(14)
+// 
+// which is the RMS of a single slice (p_i) with m being the total number of
+// measurements, i.e. m = n*14, later re-scaled to the number of used slices
+// (the factor sqrt(14)).
+// 
+// If we assume that at least our pairs fluctuate independently and Gaussian,
+// then we can use the actual formula (1) in order to get what you call
+// fluctuations of pairs by the transformation:
+// 
+// PedRMS/pair = PedRMS (form. (3)) / Sqrt(7)
+// 
+// (However, we know that our slice-to-slice fluctuations are not Gaussian
+// (and moreover asymmetric) and that they are also correlated.)
+// 
+// We could still measure also the pair-to-pair fluctuations and add another
+// value to be investigated. What do you think?
+//
+// 
 //  Input Containers:
 //   MRawEvtData
