Problem 2177

Summary: General Particle Source can be stack in infinite loop, if Emin and Emax set in Mono mode.
Product: Geant4 Reporter: Thomas <vathomas>
Component: eventAssignee: asai
Status: RESOLVED FIXED    
Severity: minor    
Priority: P4    
Version: 10.5   
Hardware: All   
OS: All   

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