Changeset 15186 for trunk/FACT++
- Timestamp:
- 03/30/13 11:46:32 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/ftmctrl.cc
r15185 r15186 1256 1256 uint64_t odiff = fDynamicData.fOnTimeCounter; 1257 1257 uint32_t cdiff = fHeader.fTriggerCounter; 1258 1259 // When the state changes (trigger on or trigger off) 1260 // The counters will be resetted, thus in the next report 1261 // the correct counters are the counters itself, or the correct 1262 // offset is 0. For the first call, fPrevState is 0 (which is not 1263 // a valid state, so it will be considered as 'changed') and 1264 // fTimeStamp, fTimeStampOn and fTriggerCounter are also 0. 1265 // The checks on the on-time counter and the trigger counter 1266 // are just for the very unlikely case that we miss the state 1267 // change because we get no updated reports in between. 1258 uint64_t tdiff = fHeader.fTimeStamp; 1259 1260 // The easiest way to detect whether the counters have been 1261 // reset or not is to detect a state change, because with 1262 // every state change they are reset. However, there are cases 1263 // when the trigger is switched on already (data run) and 1264 // the trigger is turned off ans switched on again within 1265 // a very short time, that the state of the previous and the 1266 // new report is the same. So in addition we have to check 1267 // for other indications. Any counter decreasing is a hint. 1268 // None of them should ever decrease. So all three are checked. 1268 1269 const uint8_t state = fHeader.fState & FTM::States::kFtmStates; 1269 1270 1270 1271 const bool first = state!=fPrevState || 1272 fHeader.fTimeStamp<fTimeStamp || 1271 1273 fHeader.fTriggerCounter<fTriggerCounter || 1272 1274 fDynamicData.fOnTimeCounter<fTimeStampOn; … … 1274 1276 if (!first) 1275 1277 { 1278 tdiff -= fTimeStamp; 1276 1279 odiff -= fTimeStampOn; 1277 1280 cdiff -= fTriggerCounter; … … 1281 1284 // too large because the previous report is taken as reference, 1282 1285 // but this is the best what could be done. 1283 const uint64_t tdiff = fHeader.fTimeStamp - fTimeStamp; 1284 const float rate = fHeader.fTimeStamp>fTimeStamp ? 0 : 1000000*float(cdiff)/tdiff; 1286 const float rate = tdiff==0 ? 0 : 1e6*cdiff/tdiff; 1285 1287 1286 1288 fTimeStamp = fHeader.fTimeStamp; … … 1290 1292 1291 1293 const FTM::DimTriggerRates rates(fHeader, fDynamicData, fStaticData, 1292 first ? -1 : rate, first ? -1 :tdiff*1e-6, odiff*1e-6);1294 rate, tdiff*1e-6, odiff*1e-6); 1293 1295 1294 1296 fDimTriggerRates.setQuality(fHeader.fState);
Note:
See TracChangeset
for help on using the changeset viewer.