|
21 | 21 | #include <algorithm> |
22 | 22 | #include <cassert> |
23 | 23 | #include "FairLogger.h" |
| 24 | +#include "DataFormatsTOF/CompressedDataFormat.h" |
24 | 25 |
|
25 | 26 | using namespace o2::tof; |
26 | 27 |
|
@@ -190,18 +191,51 @@ void WindowFiller::fillOutputContainer(std::vector<Digit>& digits) |
190 | 191 | int npatterns = 0; |
191 | 192 |
|
192 | 193 | // check if patterns are in the current row |
| 194 | + unsigned int initrow = mFirstIR.orbit * Geo::NWINDOW_IN_ORBIT; |
193 | 195 | for (std::vector<PatternData>::reverse_iterator it = mCratePatterns.rbegin(); it != mCratePatterns.rend(); ++it) { |
194 | | - if (it->row > mReadoutWindowCurrent) { |
| 196 | + //printf("pattern row=%ld current=%ld\n",it->row - initrow,mReadoutWindowCurrent); |
| 197 | + |
| 198 | + if (it->row - initrow > mReadoutWindowCurrent) { |
195 | 199 | break; |
196 | 200 | } |
197 | 201 |
|
198 | | - if (it->row < mReadoutWindowCurrent) { // this should not happen |
| 202 | + if (it->row - initrow < mReadoutWindowCurrent) { // this should not happen |
199 | 203 | LOG(ERROR) << "One pattern skipped because appears to occur early of the current row " << it->row << " < " << mReadoutWindowCurrent << " ?!"; |
200 | 204 | } else { |
201 | | - mPatterns.push_back(it->pattern); |
202 | | - info.addedDiagnostic(it->icrate); |
| 205 | + uint32_t cpatt = it->pattern; |
| 206 | + auto dpatt = reinterpret_cast<compressed::Diagnostic_t*>(&cpatt); |
| 207 | + uint8_t slot = dpatt->slotID; |
| 208 | + uint32_t cbit = 1; |
203 | 209 |
|
| 210 | + mPatterns.push_back(slot + 28); // add slot |
| 211 | + info.addedDiagnostic(it->icrate); |
204 | 212 | npatterns++; |
| 213 | + |
| 214 | + for (int ibit = 0; ibit < 28; ibit++) { |
| 215 | + if (dpatt->faultBits & cbit) { |
| 216 | + mPatterns.push_back(ibit); // add bit error |
| 217 | + info.addedDiagnostic(it->icrate); |
| 218 | + npatterns++; |
| 219 | + } |
| 220 | + cbit <<= 1; |
| 221 | + } |
| 222 | + // uint8_t w1 = cpatt & 0xff; |
| 223 | + // uint8_t w2 = (cpatt >> 8) & 0xff; |
| 224 | + // uint8_t w3 = (cpatt >> 16) & 0xff; |
| 225 | + // uint8_t w4 = (cpatt >> 24) & 0xff; |
| 226 | + //// cpatt = w1 + (w2 + (w3 + uint(w4)*256)*256)*256; |
| 227 | + // mPatterns.push_back(w1); |
| 228 | + // info.addedDiagnostic(it->icrate); |
| 229 | + // npatterns++; |
| 230 | + // mPatterns.push_back(w2); |
| 231 | + // info.addedDiagnostic(it->icrate); |
| 232 | + // npatterns++; |
| 233 | + // mPatterns.push_back(w3); |
| 234 | + // info.addedDiagnostic(it->icrate); |
| 235 | + // npatterns++; |
| 236 | + // mPatterns.push_back(w4); |
| 237 | + // info.addedDiagnostic(it->icrate); |
| 238 | + // npatterns++; |
205 | 239 | } |
206 | 240 | mCratePatterns.pop_back(); |
207 | 241 | } |
@@ -265,12 +299,14 @@ void WindowFiller::flushOutputContainer(std::vector<Digit>& digits) |
265 | 299 | checkIfReuseFutureDigitsRO(); |
266 | 300 | } |
267 | 301 |
|
| 302 | + int nwindowperTF = o2::raw::HBFUtils::Instance().getNOrbitsPerTF() * Geo::NWINDOW_IN_ORBIT; |
| 303 | + |
268 | 304 | for (Int_t i = 0; i < MAXWINDOWS; i++) { |
269 | | - fillOutputContainer(digits); // fill last readout windows |
| 305 | + if (mReadoutWindowData.size() < nwindowperTF) { |
| 306 | + fillOutputContainer(digits); // fill last readout windows |
| 307 | + } |
270 | 308 | } |
271 | 309 |
|
272 | | - int nwindowperTF = o2::raw::HBFUtils::Instance().getNOrbitsPerTF() * Geo::NWINDOW_IN_ORBIT; |
273 | | - |
274 | 310 | // check that all orbits are complete in terms of number of readout windows |
275 | 311 | while ((mReadoutWindowData.size() % nwindowperTF)) { |
276 | 312 | fillOutputContainer(digits); // fill windows without digits to complete all orbits in the last TF |
@@ -306,7 +342,7 @@ void WindowFiller::checkIfReuseFutureDigits() |
306 | 342 | int isnext = Int_t(timestamp * Geo::READOUTWINDOW_INV) - (mReadoutWindowCurrent + 1); // to be replaced with uncalibrated time |
307 | 343 |
|
308 | 344 | if (isnext < 0) { // we jump too ahead in future, digit will be not stored |
309 | | - LOG(INFO) << "Digit lost because we jump too ahead in future. Current RO window=" << isnext << "\n"; |
| 345 | + LOG(DEBUG) << "Digit lost because we jump too ahead in future. Current RO window=" << isnext << "\n"; |
310 | 346 |
|
311 | 347 | // remove digit from array in the future |
312 | 348 | int labelremoved = digit->getLabel(); |
@@ -375,7 +411,7 @@ void WindowFiller::checkIfReuseFutureDigitsRO() // the same but using readout in |
375 | 411 | int isnext = row - mReadoutWindowCurrent; |
376 | 412 |
|
377 | 413 | if (isnext < 0) { // we jump too ahead in future, digit will be not stored |
378 | | - LOG(INFO) << "Digit lost because we jump too ahead in future. Current RO window=" << isnext << "\n"; |
| 414 | + LOG(DEBUG) << "Digit lost because we jump too ahead in future. Current RO window=" << isnext << "\n"; |
379 | 415 |
|
380 | 416 | // remove digit from array in the future |
381 | 417 | int labelremoved = digit->getLabel(); |
|
0 commit comments