Skip to content

Commit 507223a

Browse files
committed
ITS: improve STFDecoder&Clusterer error messages and account for delay longer that ROF
Signed-off-by: Felix Schlepper <felix.schlepper@cern.ch>
1 parent 7f7c1bd commit 507223a

File tree

2 files changed

+25
-15
lines changed

2 files changed

+25
-15
lines changed

Detectors/ITSMFT/common/workflow/src/ClustererSpec.cxx

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -145,13 +145,18 @@ void ClustererDPL<N>::run(ProcessingContext& pc)
145145
for (const auto& rof : clusROFVec) {
146146
const auto& ir = rof.getBCData();
147147
if (ir < firstIR) {
148-
LOGP(warn, "Discard ROF {} preceding TF 1st orbit {}{}", ir.asString(), firstTForbit, ((mDoStaggering) ? std::format(", layer {}", layer) : ""));
148+
LOGP(warn, "Discard ROF {} preceding TF 1st orbit {}{}", ir.asString(), firstTForbit, ((mDoStaggering) ? std::format(" on layer {}", layer) : ""));
149149
continue;
150150
}
151-
const auto irToFirst = ir - firstIR;
151+
auto irToFirst = ir - firstIR;
152+
if (irToFirst.toLong() - par.getROFDelayInBC(iLayer) < 0) {
153+
LOGP(warn, "Discard ROF {} preceding TF 1st orbit {} due to imposed ROF delay{}", ir.asString(), firstTForbit, ((mDoStaggering) ? std::format(" on layer {}", iLayer) : ""));
154+
continue;
155+
}
156+
irToFirst -= par.getROFDelayInBC(iLayer);
152157
const long irROF = irToFirst.toLong() / par.getROFLengthInBC(iLayer);
153158
if (irROF >= nROFsTF) {
154-
LOGP(warn, "Discard ROF {} exceding TF orbit range{}", ir.asString(), ((mDoStaggering) ? std::format(", layer {}", layer) : ""));
159+
LOGP(warn, "Discard ROF {} exceding TF orbit range{}", ir.asString(), ((mDoStaggering) ? std::format(" on layer {}", layer) : ""));
155160
continue;
156161
}
157162
auto& expROF = expClusRofVec[irROF];
@@ -160,11 +165,11 @@ void ClustererDPL<N>::run(ProcessingContext& pc)
160165
expROF.setNEntries(rof.getNEntries());
161166
} else {
162167
if (expROF.getNEntries() < rof.getNEntries()) {
163-
LOGP(warn, "Repeating ROF {} with {} clusters, prefer to already processed instance with {} clusters{}", rof.asString(), rof.getNEntries(), expROF.getNEntries(), ((mDoStaggering) ? std::format(", layer {}", layer) : ""));
168+
LOGP(warn, "Repeating {} with {} clusters, prefer to already processed instance with {} clusters{}", rof.asString(), rof.getNEntries(), expROF.getNEntries(), ((mDoStaggering) ? std::format(" on layer {}", layer) : ""));
164169
expROF.setFirstEntry(rof.getFirstEntry());
165170
expROF.setNEntries(rof.getNEntries());
166171
} else {
167-
LOGP(warn, "Repeating ROF {} with {} clusters, discard preferring already processed instance with {} clusters{}", rof.asString(), rof.getNEntries(), expROF.getNEntries(), ((mDoStaggering) ? std::format(", layer {}", layer) : ""));
172+
LOGP(warn, "Repeating {} with {} clusters, discard preferring already processed instance with {} clusters{}", rof.asString(), rof.getNEntries(), expROF.getNEntries(), ((mDoStaggering) ? std::format(" on layer {}", layer) : ""));
168173
}
169174
}
170175
}

Detectors/ITSMFT/common/workflow/src/STFDecoderSpec.cxx

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ void STFDecoder<Mapping>::run(ProcessingContext& pc)
211211
const int MaxErrLog = 2;
212212
static int errLocCount = 0;
213213
if (errLocCount++ < MaxErrLog) {
214-
LOGP(warn, "Impossible ROF IR {}, previous was {}, TF 1st IR was {}, discarding in decoding", mDecoder[iLayer]->getInteractionRecord().asString(), lastIR.asString(), mFirstIR.asString());
214+
LOGP(warn, "Impossible ROF IR {}{}, previous was {}, TF 1st IR was {}, discarding in decoding", mDecoder[iLayer]->getInteractionRecord().asString(), ((mDoStaggering) ? std::format(" on layer {}", iLayer) : ""), lastIR.asString(), mFirstIR.asString());
215215
}
216216
nTriggersProcessed = 0x7fffffff; // to account for a problem with event
217217
continue;
@@ -233,7 +233,7 @@ void STFDecoder<Mapping>::run(ProcessingContext& pc)
233233
if ((nROFsTF != nTriggersProcessed) && mROFErrRepIntervalMS > 0 && mTFCounter > 1 && nTriggersProcessed > 0) {
234234
long currTS = std::chrono::time_point_cast<std::chrono::milliseconds>(std::chrono::system_clock::now()).time_since_epoch().count();
235235
if (currTS - lastErrReportTS > mROFErrRepIntervalMS) {
236-
LOGP(critical, "Inconsistent number of ROF per TF:{} for layer {}. From parameters: {} from readout (muting further reporting for {} ms)", nLayer, nROFsTF, nTriggersProcessed, mROFErrRepIntervalMS);
236+
LOGP(critical, "Inconsistent number of ROF per TF {}{} from parameters. Received {} from readout (muting further reporting for {} ms)", nROFsTF, ((mDoStaggering) ? std::format(" on layer {}", iLayer) : ""), nTriggersProcessed, mROFErrRepIntervalMS);
237237
lastErrReportTS = currTS;
238238
}
239239
}
@@ -254,13 +254,13 @@ void STFDecoder<Mapping>::run(ProcessingContext& pc)
254254
static size_t nErr = 0;
255255
auto maxWarn = o2::conf::VerbosityConfig::Instance().maxWarnRawParser;
256256
if (++nErr < maxWarn) {
257-
LOGP(alarm, "EXCEPTION {} in raw decoder, abandoning TF decoding {}", e.what(), nErr == maxWarn ? "(will mute further warnings)" : "");
257+
LOGP(alarm, "EXCEPTION {} in raw decoder{}, abandoning TF decoding {}", e.what(), ((mDoStaggering) ? std::format(" on layer {}", iLayer) : ""), nErr == maxWarn ? "(will mute further warnings)" : "");
258258
}
259259
}
260260
if (mDoDigits) {
261261
pc.outputs().snapshot(Output{orig, "DIGITS", iLayer}, digVec);
262262
std::vector<o2::itsmft::ROFRecord> expDigRofVec(nROFsTF);
263-
ensureContinuousROF(digROFVec, expDigRofVec, iLayer, nROFsTF, "Digits");
263+
ensureContinuousROF(digROFVec, expDigRofVec, iLayer, nROFsTF, "digits");
264264
pc.outputs().snapshot(Output{orig, "DIGITSROF", iLayer}, digROFVec);
265265
mEstNDig[iLayer] = std::max(mEstNDig[iLayer], size_t(digVec.size() * 1.2));
266266
if (mDoCalibData) {
@@ -272,7 +272,7 @@ void STFDecoder<Mapping>::run(ProcessingContext& pc)
272272

273273
if (mDoClusters) { // we are not obliged to create vectors which are not requested, but other devices might not know the options of this one
274274
std::vector<o2::itsmft::ROFRecord> expClusRofVec(nROFsTF);
275-
ensureContinuousROF(clusROFVec, expClusRofVec, iLayer, nROFsTF, "Clusters");
275+
ensureContinuousROF(clusROFVec, expClusRofVec, iLayer, nROFsTF, "clusters");
276276
pc.outputs().snapshot(Output{orig, "COMPCLUSTERS", iLayer}, clusCompVec);
277277
pc.outputs().snapshot(Output{orig, "PATTERNS", iLayer}, clusPattVec);
278278
pc.outputs().snapshot(Output{orig, "CLUSTERSROF", iLayer}, expClusRofVec);
@@ -437,13 +437,18 @@ void STFDecoder<Mapping>::ensureContinuousROF(const std::vector<ROFRecord>& rofV
437437
for (const auto& rof : rofVec) {
438438
const auto& ir = rof.getBCData();
439439
if (ir < mFirstIR) {
440-
LOGP(warn, "Discard ROF {} preceding TF 1st orbit {}{}", ir.asString(), mFirstTFOrbit, ((mDoStaggering) ? std::format(", layer {}", lr) : ""));
440+
LOGP(warn, "Discard ROF {} preceding TF 1st orbit {}{}", ir.asString(), mFirstTFOrbit, ((mDoStaggering) ? std::format(" on layer {}", lr) : ""));
441441
continue;
442442
}
443-
const auto irToFirst = ir - mFirstIR;
443+
auto irToFirst = ir - mFirstIR;
444+
if (irToFirst.toLong() - par.getROFDelayInBC(lr) < 0) {
445+
LOGP(warn, "Discard ROF {} preceding TF 1st orbit {} due to imposed ROF delay{}", ir.asString(), mFirstTFOrbit, ((mDoStaggering) ? std::format(" on layer {}", lr) : ""));
446+
continue;
447+
}
448+
irToFirst -= par.getROFDelayInBC(lr);
444449
const long irROF = irToFirst.toLong() / par.getROFLengthInBC(lr);
445450
if (irROF >= nROFsTF) {
446-
LOGP(warn, "Discard ROF {} exceding TF orbit range, layer:{}", ir.asString(), ((mDoStaggering) ? std::format(", layer {}", lr) : ""));
451+
LOGP(warn, "Discard ROF {} exceding TF orbit range{}", ir.asString(), ((mDoStaggering) ? std::format(" on layer {}", lr) : ""));
447452
continue;
448453
}
449454
auto& expROF = expROFVec[irROF];
@@ -452,11 +457,11 @@ void STFDecoder<Mapping>::ensureContinuousROF(const std::vector<ROFRecord>& rofV
452457
expROF.setNEntries(rof.getNEntries());
453458
} else {
454459
if (expROF.getNEntries() < rof.getNEntries()) {
455-
LOGP(warn, "Repeating {} with {}, prefer to already processed instance with {} clusters{}", rof.asString(), rof.getNEntries(), expROF.getNEntries(), ((mDoStaggering) ? std::format(", layer {}", lr) : ""));
460+
LOGP(warn, "Repeating {} with {} {}, prefer to already processed instance with {} {}{}", rof.asString(), rof.getNEntries(), name, expROF.getNEntries(), name, ((mDoStaggering) ? std::format(" on layer {}", lr) : ""));
456461
expROF.setFirstEntry(rof.getFirstEntry());
457462
expROF.setNEntries(rof.getNEntries());
458463
} else {
459-
LOGP(warn, "Repeating {} with {}, discard preferring already processed instance with {} clusters{}", rof.asString(), rof.getNEntries(), expROF.getNEntries(), ((mDoStaggering) ? std::format(", layer {}", lr) : ""));
464+
LOGP(warn, "Repeating {} with {} {}, discard preferring already processed instance with {} {}{}", rof.asString(), rof.getNEntries(), name, expROF.getNEntries(), name, ((mDoStaggering) ? std::format(" on layer {}", lr) : ""));
460465
}
461466
}
462467
}

0 commit comments

Comments
 (0)