Problem 125 - uninitialized variable in G4MuonMinusCaptureAtRest
Summary: uninitialized variable in G4MuonMinusCaptureAtRest
Status: CLOSED FIXED
Alias: None
Product: Geant4
Classification: Unclassified
Component: processes/hadronic (show other problems)
Version: 2.0
Hardware: All All
: P5 critical
Assignee: Hans-Peter.Wellisch
URL:
Depends on:
Blocks:
 
Reported: 2000-07-10 13:49 CEST by dcasper
Modified: 2012-02-15 05:02 CET (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this problem.
Description dcasper 2000-07-10 13:49:37 CEST
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.
Comment 1 Hans-Peter.Wellisch 2000-07-12 04:21:59 CEST
implemented the suggested fix, and tagged
hadronics/stopping as 'stopping-V02-00-01'