Problem 2177 - General Particle Source can be stack in infinite loop, if Emin and Emax set in Mono mode.
Summary: General Particle Source can be stack in infinite loop, if Emin and Emax set i...
Status: RESOLVED FIXED
Alias: None
Product: Geant4
Classification: Unclassified
Component: event (show other problems)
Version: 10.5
Hardware: All All
: P4 minor
Assignee: asai
URL:
Depends on:
Blocks:
 
Reported: 2019-07-16 15:57 CEST by Thomas
Modified: 2019-10-01 22:53 CEST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this problem.
Description Thomas 2019-07-16 15:57:03 CEST
Hi,

I hope this is the correct category for this problem.
Assume that your program uses the G4GeneralParticleSource for generating primaries and the following commands are given:

Idle> /gps/ene/type Mono
Idle> /gps/ene/mono 6 MeV
Idle> /gps/ene/min 1 keV
Idle> /gps/ene/max 10 keV
Idle> /run/beamOn 1

Then the program falls into an infite loop, since the energy for the monoenergetic particles is outside the min and max limits (the problem is a "while" loop in file G4SPSEneDistribution.cc, line 1221, function G4double G4SPSEneDistribution::GenerateOne(G4ParticleDefinition* a)).

This behavior is counterintuitive, since the min and max are for linear spectrum and may be set in a previous run. Then switching in monoenergetic beam will make the simulation to hang.

Best Regards,
Thomas V.
Comment 1 asai 2019-10-01 22:53:53 CEST
Thank you for reporting this issue. The fix will be included in the next public release.
Kind regards,
Makoto