Skip to content

Commit

Permalink
do not exit on no intersection (can happen rarely)
Browse files Browse the repository at this point in the history
  • Loading branch information
lobis committed Apr 19, 2024
1 parent fc072ce commit cc85348
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/PrimaryGeneratorAction.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -310,12 +310,12 @@ void PrimaryGeneratorAction::GeneratePrimaries(G4Event* event) {
1.0,
-1 * positionOnEllipseRotated.Y(),
};
const auto [intersectionFlag, intersection] = IntersectionLineSphere(positionOrigin, direction);
auto [intersectionFlag, intersection] = IntersectionLineSphere(positionOrigin, direction);
if (!intersectionFlag) {
cerr << "PrimaryGeneratorAction: cosmic generator intersection not found (this should never "
"happen)"
cout << "PrimaryGeneratorAction - ERROR: cosmic generator failed to find intersection. This "
"could happen very rarely. If it happens often, it's a bug."
<< endl;
exit(1);
intersection = positionOrigin; // just use the origin position (this should almost never happen)
}

fParticleGun.SetParticleEnergy(particle.GetEnergy() * keV);
Expand Down

0 comments on commit cc85348

Please sign in to comment.