Problem 1038

Summary: G4WilsonAbrasionModel::ApplyYourself() loops forever sometimes
Product: Geant4 Reporter: Derek Dolney <nospam>
Component: processes/hadronic/models/abrasionAssignee: PRTruscott
Status: RESOLVED FIXED    
Severity: critical CC: dennis.herbert.wright
Priority: P5    
Version: other   
Hardware: All   
OS: All   

Description Derek Dolney 2009-01-05 20:44:43 CET
There is this code in processes/hadronic/models/abrasion/src/G4WilsonAbrasionModel.cc:

// Sample the impact parameter.  For the moment, this class takes account of
// electrostatic effects on the impact parameter, but (like HZETRN AND NUCFRG2)
// does not make any correction for the effects of nuclear-nuclear repulsion.
//
    G4double rPT   = rP + rT;
    G4double rPTsq = rPT * rPT;
    r              = 1.1 * rPT;
    while (r > rPT)
    {
      G4double bsq = rPTsq * G4UniformRand();
      r            = (rm + std::sqrt(rm*rm + 4.0*bsq)) / 2.0;
    }
    rsq = r * r;

The problem is, it is possible to have initial conditions such that rm > rPT, and so this while loop will never exit. The simulation will never finish this event, and data from previous events may be lost, depending on how the user has arranged to have their data stored.

I am registering G4WilsonAbrasionModel for GenericIons of energy 0--80 MeV. Using primary protons of 100 MeV, tracking through 100 cm of water, I get stuck in G4WilsonAbrasionModel about once every 10 million events.
Comment 1 flei 2010-04-26 12:20:26 CEST
The problem should have been fixed in the newer g4 release. Pete Truscott will check to confirm this.
Comment 2 dennis.herbert.wright 2011-05-15 18:35:29 CEST
D.H. Wright: confirmed that problem was fixed by P.R. Truscott before release 9.4