Index: trunk/Mars/msimcamera/MSimCamera.cc
===================================================================
--- trunk/Mars/msimcamera/MSimCamera.cc	(revision 17209)
+++ trunk/Mars/msimcamera/MSimCamera.cc	(revision 17383)
@@ -254,45 +254,45 @@
         //       * areaOfOnePulse / samplingRate;
         // Therefore I need the following variables
-        Double_t accidentalPhotonRate   = 0; // [MHz]
-        Float_t crossTalkProb           = 0; // [1]
-        Double_t areaOfOnePulse         = 0; // [ADC-Counts * s]
-        Double_t samplingRate           = 0; // [slices * MHz]
+        // Double_t accidentalPhotonRate; // [MHz]
+        // Float_t crossTalkProb;         // [1]
+        // Double_t areaOfOnePulse;       // [ADC-Counts * s]
+        // Double_t samplingRate;         // [slices * MHz]
 
         // The accidental photon rate is stored in GHz, so we have to multiply
         // with 1E3 to get MHz:
-        MPedestalPix &accPhoPix         = (*fAccidentalPhotons)[i];
-        accidentalPhotonRate            = accPhoPix.GetPedestal() * 1E3;
+        const MPedestalPix &accPhoPix = (*fAccidentalPhotons)[i];
+
+        const Double_t accidentalPhotonRate = accPhoPix.GetPedestal() * 1e3; //[MHz]
+
         Double_t currentAccidentalPhotonRate = accidentalPhotonRate;
-
-        if(fACTimeConstant!=0)
+        if (fACTimeConstant!=0)
         {
-            Double_t accidentalPhotons      = fACTimeConstant * accidentalPhotonRate;
-            Double_t sigmaAccidentalPhotons = sqrt(accidentalPhotons);
-
-            TRandom3 *random = new TRandom3(0);
-            Double_t gaus = random->Gaus(accidentalPhotons,sigmaAccidentalPhotons);
+            const Double_t accidentalPhotons      = fACTimeConstant * accidentalPhotonRate;
+            const Double_t sigmaAccidentalPhotons = sqrt(accidentalPhotons);
+
+            const Double_t gaus = gRandom->Gaus(accidentalPhotons,sigmaAccidentalPhotons);
+
             currentAccidentalPhotonRate = gaus / fACTimeConstant;
-	    delete random;
         }
 
-        // I don't know how to get the variable fCrosstalkProb from
+        // FIXME: I don't know how to get the variable fCrosstalkProb from
         // the class APD (see MAvalanchePhotoDiode.h), because there is no
         // getter for the APD array(fAPDs) in MSimAPD.
         // So I set the crossTalkProb hardcoded to the value 0.15, which is
         // equal to the value of the apd of type 4
-        crossTalkProb                   = 0.15;
+        const Double_t crossTalkProb = 0.15;
 
         // To get the area of one Pulse, I only need to calculate the Integral
         // of the Pulse Shape, which is stored in fSpline. Because the spline is
         // normalized to a maximal amplitude of 1.0, I had to multiply it with
-        // the Default gain:
-        areaOfOnePulse                  = fSpline->Integral() * fDefaultGain;
+        // the Default gain [ADC-Counts * s]
+        const Double_t areaOfOnePulse = fSpline->Integral() * fDefaultGain;
 
         // The sampling rate I get from the RunHeader:
-        samplingRate                    = fRunHeader->GetFreqSampling();
-
-        Double_t accouplingPerSlice = currentAccidentalPhotonRate
-                * (1 + crossTalkProb + fACFudgeFactor)
-                * areaOfOnePulse / samplingRate;
+        const Double_t samplingRate = fRunHeader->GetFreqSampling(); // [slices * MHz]
+
+        const Double_t accouplingPerSlice = currentAccidentalPhotonRate
+            * (1 + crossTalkProb + fACFudgeFactor)
+            * areaOfOnePulse / samplingRate;
 
         // The accoupling is substracted from the timeline by decreasing the
