Skip to content

Commit c575d91

Browse files
jackal1-66sawenzel
authored andcommitted
Add protection against skipped loopers
1 parent a5a6318 commit c575d91

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

Generators/src/Generator.cxx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,20 +248,26 @@ Bool_t
248248
LOG(error) << "Failed to generate loopers event";
249249
return kFALSE;
250250
}
251-
if (mTPCLoopersGen->getNLoopers() == 0) {
251+
const auto nCandidates = mTPCLoopersGen->getNLoopers();
252+
if (nCandidates == 0) {
252253
LOG(warning) << "No loopers generated for this event";
253254
return kTRUE;
254255
}
255256
const auto& looperParticles = mTPCLoopersGen->importParticles();
257+
const auto skippedLoopers = mTPCLoopersGen->getNSkipped();
256258
if (looperParticles.empty()) {
259+
if (skippedLoopers == nCandidates) {
260+
// all candidate loopers were dropped by the geometrical protection
261+
LOG(debug) << "All " << skippedLoopers << " candidate loopers were outside the TPC active volume; none added for this event";
262+
return kTRUE;
263+
}
257264
LOG(error) << "Failed to import loopers particles";
258265
return kFALSE;
259266
}
260267
// Append the generated looper particles to the main particle list
261268
mParticles.insert(mParticles.end(), looperParticles.begin(), looperParticles.end());
262269

263270
LOG(debug) << "Added " << looperParticles.size() << " looper particles";
264-
const auto skippedLoopers = mTPCLoopersGen->getNSkipped();
265271
if (skippedLoopers > 0) {
266272
LOG(debug) << "Geometrical protection skipped " << skippedLoopers << " loopers outside the TPC active volume";
267273
}

0 commit comments

Comments
 (0)