Index: trunk/MagicSoft/Simulation/Detector/include-MFadc/MFadc.cxx
===================================================================
--- trunk/MagicSoft/Simulation/Detector/include-MFadc/MFadc.cxx	(revision 6584)
+++ trunk/MagicSoft/Simulation/Detector/include-MFadc/MFadc.cxx	(revision 6588)
@@ -24,5 +24,5 @@
 	     Float_t trigger_delay, Float_t fadc_slices_per_ns,
 	     Int_t fadc_slices_written, Int_t gainswitchamp,
-	     Int_t shiftfromswitch2lowgain) {
+	     Int_t shiftfromswitch2lowgain, Int_t hi2logainpeak) {
   //
   //  Constructor overloaded II 
@@ -55,4 +55,5 @@
   fGainSwitchAmp = gainswitchamp;
   fShiftFromSwitch2LowGain = shiftfromswitch2lowgain;
+  fHi2LoGainPeak = hi2logainpeak;
 
   fSlices_mFadc = (Int_t)(TOTAL_TRIGGER_TIME*fFadcSlicesPerNanosec);
@@ -988,4 +989,6 @@
 
       // Now put the low gain:
+      // FIXME: for now, the shift between the high and low gain peaks has to be an integer number
+      // of FADC slices. But in the data the shift is ~16.5 slices. This has to be implemented.
       i=0;
       for ( Int_t is = iFirstSlice; is < (iFirstSlice+fFadcSlices); is++ ) 
@@ -995,5 +998,5 @@
 	      if (switch_i > 0 && (i+fFadcSlices) >= switch_i)
 		output_lowgain[ip][i] = pedestal[ip] + 
-		  (sig[ip][is]-pedestal[ip])/high2low_gain;
+		  (sig[ip][is-(fHi2LoGainPeak-fFadcSlices)]-pedestal[ip])/high2low_gain;
 	      // Once the shift occurs, low gain is filled with the high
 	      // gain signal scaled down by the factor high2low_gain
Index: trunk/MagicSoft/Simulation/Detector/include-MFadc/MFadc.hxx
===================================================================
--- trunk/MagicSoft/Simulation/Detector/include-MFadc/MFadc.hxx	(revision 6584)
+++ trunk/MagicSoft/Simulation/Detector/include-MFadc/MFadc.hxx	(revision 6588)
@@ -110,8 +110,14 @@
                         // to fill the low gain with a scaled down version of the pulse in the
                         // high gain. Else we put in the continuation of the high gain. 
+                        // By default it is now 120 ADC counts (see constructor).
 
   Int_t fShiftFromSwitch2LowGain; 
   // Distance in FADC slices from the slice in which the amplitude
   // fGainSwitchAmp is reached to were the switch to low gain will happen.
+  // By default it is now 13 slices (see constructor)
+
+  Int_t fHi2LoGainPeak;
+  // Distance in FADC slices from the signal peak in the high gain to the signal peak in
+  // the low gain. By default we set now 16 slices (see constructor).
 
   //
@@ -138,5 +144,6 @@
 	Int_t   fadc_slices_written = FADC_SLICES,
 	Int_t   gainswitchamp = 120,
-	Int_t   shiftfromswitch2lowgain = 13);
+	Int_t   shiftfromswitch2lowgain = 13,
+	Int_t   hi2logainpeak = 16);
 
   void SetSeed(UInt_t seed)  {GenElec->SetSeed(seed);}
