Problem 1536 - Infinite loop in G4MuMinusCapturePrecompound::ApplyYourself
Summary: Infinite loop in G4MuMinusCapturePrecompound::ApplyYourself
Status: RESOLVED FIXED
Alias: None
Product: Geant4
Classification: Unclassified
Component: processes/hadronic/stopping (show other problems)
Version: 9.6
Hardware: PC Linux
: P5 normal
Assignee: Vladimir.Ivantchenko
URL:
Depends on:
Blocks:
 
Reported: 2013-12-06 02:25 CET by Zach Marshall
Modified: 2014-01-31 19:38 CET (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this problem.
Description Zach Marshall 2013-12-06 02:25:18 CET
Hi there,

We've found in the wild, while running G4 9.6 patch2, instances of the do/while loop in G4MuMinusCapturePrecompound::ApplyYourself causing infinite loops.  The code I'm referring to is here:

http://www-geant4.kek.jp/lxr/source/processes/hadronic/stopping/src/G4MuMinusCapturePrecompound.cc#L91

The stack we have from GDB is:

#0  0x00002b8bb8e25bb7 in CLHEP::dSFMTEngine::flat() ()
   from /cvmfs/atlas.cern.ch/repo/sw/software/x86_64-slc5-gcc43-opt/17.7.1/AtlasProduction/17.7.1.2/InstallArea/x86_64-slc5-gcc43-opt/lib/libAtlasCLHEP_RandomGenerators.so
#1  0x00002b8bb3603b9e in G4RandomDirection () at /tmp/jchapman/build/source/global/HEPRandom/include/G4RandomDirection.hh:57
#2  G4MuMinusCapturePrecompound::ApplyYourself (this=0x20419800, projectile=..., targetNucleus=...) at src/G4MuMinusCapturePrecompound.cc:185
#3  0x00002b8bb35fa82c in G4HadronStoppingProcess::AtRestDoIt (this=0x2065d000, track=...) at src/G4HadronStoppingProcess.cc:194

Coming back later - with the simulation having not completed a step yet - gives:

#0  operator* (a=<optimized out>, p=...) at /tmp/jchapman/CLHEP/Vector/ThreeVector.icc:55
#1  CLHEP::HepLorentzVector::boostVector (this=0x7fff5d6d0db0) at /afs/cern.ch/sw/lcg/external/clhep/2.1.2.3-atl01/src/CLHEP/Vector/src/LorentzVector.cc:188
#2  0x00002b8bb3603adb in G4MuMinusCapturePrecompound::ApplyYourself (this=0x20419800, projectile=..., targetNucleus=...) at src/G4MuMinusCapturePrecompound.cc:177
#3  0x00002b8bb35fa82c in G4HadronStoppingProcess::AtRestDoIt (this=0x2065d000, track=...) at src/G4HadronStoppingProcess.cc:194

Looks and smells like a bug to me.  When the code fails, it is propagating a mu- that begins with 116.5402 MeV of KE (pT=118.7672) inside our straw tube tracker (mostly light materials).  Given that it's trying to stop, I suppose the KE has run out of the muon already.


Thanks,
Zach
Comment 1 Vladimir.Ivantchenko 2013-12-12 18:40:58 CET
Thank you Zach, it is likely buggy place. In Geant4 10.0 the problem is solved by replacing this model with the new one based on the Bertini cascade. For 9.6 the fix should be provided for the patch.

VI
Comment 2 Vladimir.Ivantchenko 2014-01-31 19:37:35 CET
Hi Zach,

sorry for the delay. The fix of the bug is done by reimplementing the same algorithm as was in previous versions of Geant4 (unsafe change was introduced in 9.6). Also protection against long loop is included. The fix will be available with the next Geant4 patch.

VI