Index: trunk/MagicSoft/Simulation/Detector/include-MFadc/MFadc.cxx
===================================================================
--- trunk/MagicSoft/Simulation/Detector/include-MFadc/MFadc.cxx	(revision 1199)
+++ trunk/MagicSoft/Simulation/Detector/include-MFadc/MFadc.cxx	(revision 1200)
@@ -328,18 +328,33 @@
 }
 
-void MFadc::ElecNoise() {
-  //
-  //  
-  //
-  
-  for ( Int_t i = 0 ; i < CAMERA_PIXELS; i++) {
-    if ( used [i] == TRUE ) {
-      for ( Int_t is=0 ; is< (Int_t)SLICES_MFADC ; is++ ) {
-
-	sig[i][is] += GenElec->Gaus(0., 2.) ; 
-
-      }
-    }
-  }
+void MFadc::ElecNoise(Float_t value) {
+  // ============================================================
+  //
+  //    adds the noise due to optronic and electronic 
+  //    to the signal
+  //
+
+    for ( Int_t i = 0 ; i < CAMERA_PIXELS; i++) {
+	//
+	//  but at the beginning we must check if this pixel is
+	//  hitted the first time
+	//
+	if ( used[i] == FALSE ) {
+	    used [i] = TRUE ; 
+	    
+	    for (Int_t ii=0; ii < (Int_t)SLICES_MFADC; ii++ ) {
+		sig[i][ii] = 0. ; 
+	    }
+	}
+	//      
+	//  Then the noise is introduced for each time slice
+	//
+	for ( Int_t is=0 ; is< (Int_t)SLICES_MFADC ; is++ ) {
+	    
+	    sig[i][is] += GenElec->Gaus(0., value) ; 
+	    
+	}
+	
+    }
 }
 
@@ -463,5 +478,5 @@
       for ( Int_t is=iFirstSlice ; is < (iFirstSlice+FADC_SLICES) ; is++ ) {
 	if (is< (Int_t)SLICES_MFADC && sig[ip][is]>0.0)
-	  output[ip][i++]=(UChar_t) sig[ip][is];
+	  output[ip][i++]=(UChar_t) (sig[ip][is]+0.5);
 	else 
 	  output[ip][i++]= 0;
