Index: /trunk/Mars/msimcamera/MSimCamera.cc
===================================================================
--- /trunk/Mars/msimcamera/MSimCamera.cc	(revision 19663)
+++ /trunk/Mars/msimcamera/MSimCamera.cc	(revision 19664)
@@ -297,7 +297,13 @@
     // FIXME: Should we use a higher sampling here?
 
+    // Start end end of sampling window (in ns, converted to samples)
+    // The sampling window starts at start+pulsewidth to have a potential
+    // previous pulse in the widdow. The trigger should then be at
+    // start+pulsewidth+triggerpos
     const Double_t start = fStat->GetTimeFirst()*freq;
     const Double_t end   = fStat->GetTimeLast() *freq;
 
+    // Length of the simulated window (in units of samples)
+    // nlen = (last-first)+roi+pulsewidth
     const UInt_t   nlen  = TMath::CeilNint(end-start);
 
@@ -313,13 +319,13 @@
     }
 
-    const Double_t pl = fSpline->GetXmin()*freq;
-    const Double_t pr = fSpline->GetXmax()*freq;
+    const Double_t pw = fSpline->GetXmax()-fSpline->GetXmin(); // [samples] Width of pulse
 
     // Init the arrays and set the range which will contain valid data
+    // FIXME: There must be some contingency for all the time offsets...
+    // otherwise, we might loose late triggers!!!!!
     fCamera->Init(npix, nlen);
-    fCamera->SetValidRange(TMath::FloorNint(pr), TMath::CeilNint(nlen+pl));
+    fCamera->SetValidRange(TMath::FloorNint(pw), nlen);
 
     Double_t timeoffset[npix];
-
 
     // Add electronic noise to empty channels
@@ -504,6 +510,8 @@
         const Double_t gain = (*fGain)[idx].GetPedestal();
 
+        // The "-GetXmin" ensures that a photon at t=0 does not get sampled
+        // before the sampling window!
         // === FIXME === FIXME === FIXME === Frequency!!!!
-        (*fCamera)[idx].AddPulse(*fSpline, t, ph.GetWeight()*gain);
+        (*fCamera)[idx].AddPulse(*fSpline, t - fSpline->GetXmin(), ph.GetWeight()*gain);
     }
 
