| Summary: | uninitialized variable in G4MuonMinusCaptureAtRest | ||
|---|---|---|---|
| Product: | Geant4 | Reporter: | dcasper |
| Component: | processes/hadronic | Assignee: | Hans-Peter.Wellisch |
| Status: | CLOSED FIXED | ||
| Severity: | critical | ||
| Priority: | P5 | ||
| Version: | 2.0 | ||
| Hardware: | All | ||
| OS: | All | ||
implemented the suggested fix, and tagged hadronics/stopping as 'stopping-V02-00-01' |
In G4MuonMinusCaptureAtRest::AtRestDoit, there is an uninitialized variable which results in crashes and incorrect results: if( G4UniformRand()*(lambdac + lambdad) > lambdac) { // Decay pEMCascade->DoBoundMuonMinusDecay(targetCharge,mass,&nCascade,Cascade); // Generate secondaries from capture } else { DoMuCapture(); } aParticleChange.SetNumberOfSecondaries( nGkine + nCascade ); In the above segment of code, if the program branches into the DoBoundMuonMinusDecay section of the if, the variable nGkine is not initialized, and can have a huge negative value when used in the call to SetNumberOfSecondaries. The line: nGkine = 0; should be inserted after the call to DoBoundMuonMinusDecay to fix the problem.