Index: trunk/FACT++/src/ftmctrl.cc
===================================================================
--- trunk/FACT++/src/ftmctrl.cc	(revision 15185)
+++ trunk/FACT++/src/ftmctrl.cc	(revision 15186)
@@ -1256,17 +1256,19 @@
         uint64_t odiff = fDynamicData.fOnTimeCounter;
         uint32_t cdiff = fHeader.fTriggerCounter;
-
-        // When the state changes (trigger on or trigger off)
-        // The counters will be resetted, thus in the next report
-        // the correct counters are the counters itself, or the correct
-        // offset is 0. For the first call, fPrevState is 0 (which is not
-        // a valid state, so it will be considered as 'changed') and
-        // fTimeStamp, fTimeStampOn and fTriggerCounter are also 0.
-        // The checks on the on-time counter and the trigger counter
-        // are just for the very unlikely case that we miss the state
-        // change because we get no updated reports in between.
+        uint64_t tdiff = fHeader.fTimeStamp;
+
+        // The easiest way to detect whether the counters have been
+        // reset or not is to detect a state change, because with
+        // every state change they are reset. However, there are cases
+        // when the trigger is switched on already (data run) and
+        // the trigger is turned off ans switched on again within
+        // a very short time, that the state of the previous and the
+        // new report is the same. So in addition we have to check
+        // for other indications. Any counter decreasing is a hint.
+        // None of them should ever decrease. So all three are checked.
         const uint8_t state = fHeader.fState & FTM::States::kFtmStates;
 
         const bool first = state!=fPrevState ||
+            fHeader.fTimeStamp<fTimeStamp ||
             fHeader.fTriggerCounter<fTriggerCounter ||
             fDynamicData.fOnTimeCounter<fTimeStampOn;
@@ -1274,4 +1276,5 @@
         if (!first)
         {
+            tdiff -= fTimeStamp;
             odiff -= fTimeStampOn;
             cdiff -= fTriggerCounter;
@@ -1281,6 +1284,5 @@
         // too large because the previous report is taken as reference,
         // but this is the best what could be done.
-        const uint64_t tdiff = fHeader.fTimeStamp - fTimeStamp;
-        const float    rate  = fHeader.fTimeStamp>fTimeStamp ? 0 : 1000000*float(cdiff)/tdiff;
+        const float rate = tdiff==0 ? 0 : 1e6*cdiff/tdiff;
 
         fTimeStamp      = fHeader.fTimeStamp;
@@ -1290,5 +1292,5 @@
 
         const FTM::DimTriggerRates rates(fHeader, fDynamicData, fStaticData,
-                                         first ? -1 : rate, first ? -1 : tdiff*1e-6, odiff*1e-6);
+                                         rate, tdiff*1e-6, odiff*1e-6);
 
         fDimTriggerRates.setQuality(fHeader.fState);
