Skip to content

Commit cc85348

Browse files
committed
do not exit on no intersection (can happen rarely)
1 parent fc072ce commit cc85348

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/PrimaryGeneratorAction.cxx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -310,12 +310,12 @@ void PrimaryGeneratorAction::GeneratePrimaries(G4Event* event) {
310310
1.0,
311311
-1 * positionOnEllipseRotated.Y(),
312312
};
313-
const auto [intersectionFlag, intersection] = IntersectionLineSphere(positionOrigin, direction);
313+
auto [intersectionFlag, intersection] = IntersectionLineSphere(positionOrigin, direction);
314314
if (!intersectionFlag) {
315-
cerr << "PrimaryGeneratorAction: cosmic generator intersection not found (this should never "
316-
"happen)"
315+
cout << "PrimaryGeneratorAction - ERROR: cosmic generator failed to find intersection. This "
316+
"could happen very rarely. If it happens often, it's a bug."
317317
<< endl;
318-
exit(1);
318+
intersection = positionOrigin; // just use the origin position (this should almost never happen)
319319
}
320320

321321
fParticleGun.SetParticleEnergy(particle.GetEnergy() * keV);

0 commit comments

Comments
 (0)