Problem 888 - Infinite loop in novice/exampleN04 using geant4.8.1-patch01
Summary: Infinite loop in novice/exampleN04 using geant4.8.1-patch01
Status: RESOLVED FIXED
Alias: None
Product: Examples/Basic and Novice
Classification: Unclassified
Component: N04 (show other problems)
Version: 8.1
Hardware: PC Linux
: P2 critical
Assignee: dennis.herbert.wright
URL: Operation System is Scientific Linux ...
Depends on:
Blocks:
 
Reported: 2006-09-12 20:30 CEST by dengzy
Modified: 2007-04-08 18:25 CEST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this problem.
Description dengzy 2006-09-12 20:30:14 CEST
We encountered a dead-loop in our detector simulation using Geant4.8.1.p01
(hadronic
package QGSP). It seems our problem is related to AntiProtonInelastic process.
We find that for some low-energy anti-proton, its momentum and direction become
to NAN when
the program goes to infinite loop. In order to check if the problem is from our
side, I did a test using novice/exampleN04 provided by geant4.8.1.p01. First, I
did several changes in the eaxmple for antiproton tracking.


1) comment out StackingAction in exampleN04.cc, all scondaries will be reacked:
  // G4UserStackingAction* stacking_action = new ExN04StackingAction;
  // runManager->SetUserAction(stacking_action);
2) in ExN04PrimaryGeneratorAction.cc
   #include "Randomize.hh"
   G4ParticleDefinition* particle = particleTable->FindParticle
(particleName="anti_proton");
   set fParticleGun->SetParticleEnergy((51+G4UniformRand()*50)*MeV);
3) use exampleN04.in as macro file:
  # /mydet/RoIangle 10 deg
  # /mydet/reqmuon 1
  # /mydet/isomuon 1
   /control/verbose  1
   /run/verbose      1
   /tracking/verbose 0
   /run/beamOn 1000000

As a result, the same situation was found. The program went to infinite loop at
event 44990. See the tracking information below with /tracking/verbose 6


********************************************************************************
*************************
* G4Track Information:   Particle = anti_proton,   Track ID = 1,   Parent ID = 0
********************************************************************************
*************************



Step#      X         Y         Z        KineE    dEStep   StepLeng
TrakLeng     Volume     Process
    0      0 fm      0 fm      0 fm   67.9 MeV     0 eV      0 fm      0 fm
expHall_P    initStep


 >>DefinePhysicalStepLength (List of proposed StepLengths):
    ++ProposedStep(PostStep ) = 36918.282 : ProcName = AntiProtonInelastic (No
ForceCondition)
    ++ProposedStep(PostStep ) = 208773.54 : ProcName = hElastic (No
ForceCondition)
    ++ProposedStep(PostStep ) = 8.8941426 : ProcName = hIoni (No ForceCondition)
    ++ProposedStep(PostStep ) = 1.7976931e+308 : ProcName = msc (Forced)
    ++ProposedStep(PostStep ) = 1.7976931e+308 : ProcName = Transportation
(Forced)
    ++ProposedStep(AlongStep) =  50260.06 : ProcName = hIoni
(CandidateForSelection)
    ++ProposedStep(AlongStep) =  8.894141 : ProcName = msc
(NotCandidateForSelection)
    ++ProposedStep(AlongStep) =  8.894141 : ProcName = Transportation
(CandidateForSelection)
... ...
... big skip
#Step#      X         Y         Z        KineE    dEStep   StepLeng
TrakLeng     Volume     Process
   80  -20.4 cm   34.8 cm  -2.44 mm   2.13 MeV    12 MeV  1.26 mm   42.4 cm
trackerLayer_phys       hIoni


 >>DefinePhysicalStepLength (List of proposed StepLengths):
    ++ProposedStep(PostStep ) = 0.05207071664281887 : ProcName =
AntiProtonInelastic (No ForceCondition)
    ++ProposedStep(PostStep ) = 40.82619179226723 : ProcName = hElastic (No
ForceCondition)
    ++ProposedStep(PostStep ) = 1.797693134862316e+308 : ProcName = hIoni (No
ForceCondition)
    ++ProposedStep(PostStep ) = 1.797693134862316e+308 : ProcName = msc (Forced)
    ++ProposedStep(PostStep ) = 1.797693134862316e+308 : ProcName =
Transportation (Forced)
    ++ProposedStep(AlongStep) = 0.05316910600208757 : ProcName = hIoni
(CandidateForSelection)
    ++ProposedStep(AlongStep) = 0.05186068454676943 : ProcName = msc
(NotCandidateForSelection)
    ++ProposedStep(AlongStep) = 0.05186068454676943 : ProcName = Transportation
(CandidateForSelection)


 >>AlongStepDoIt (process by process):    Process Name = Transportation


    ++G4Step Information
      Address of G4Track    : 0xa346b20
      Step Length (mm)      : 0.05186068454676943
      Energy Deposit (MeV)  : 0
      -----------------------------------------------------------------------
        StepPoint Information               PreStep            PostStep
      -----------------------------------------------------------------------
         Position - x (mm)   :   -204.2736407465781  -204.3178574956753
         Position - y (mm)   :    348.4945252611842   348.5195802058862
         Position - z (mm)   :   -2.436856962280072   -2.42652936189449
         Global Time (ns)    :    4.329706447170537   4.332279994268195
         Local Time (ns)     :    4.329706447170537   4.332279994268195
         Proper Time (ns)    :    4.086523306909923   4.089091033453018
         Momentum Direct - x :  -0.8524280729078487 -0.8527845550176441
         Momentum Direct - y :   0.4834347442858566  0.4828056277504221
         Momentum Direct - z :   0.1991412276146746  0.1991412276146747
... ...
... small skip
... the first nan appears
 >>PostStepDoIt (process by process):    Process Name = AntiProtonInelastic


    ++G4Step Information
      Address of G4Track    : 0xa346b20
      Step Length (mm)      : 0.05207071664281887
      Energy Deposit (MeV)  : 2.05859873404215
      -----------------------------------------------------------------------
        StepPoint Information               PreStep            PostStep
      -----------------------------------------------------------------------
         Position - x (mm)   :   -204.2736407465781   -204.319970104144
         Position - y (mm)   :    348.4945252611842   348.5154997473365
         Position - z (mm)   :   -2.436856962280072  -2.425683387001505
         Global Time (ns)    :    4.329706447170537   4.332279994268195
         Local Time (ns)     :    4.329706447170537   4.332279994268195
         Proper Time (ns)    :    4.086523306909923   4.089091033453018
         Momentum Direct - x :  -0.8524280729078487                 nan
         Momentum Direct - y :   0.4834347442858566                 nan
         Momentum Direct - z :   0.1991412276146746                 nan
         Momentum - x (MeV/c):   -53.88345198779397                 nan
         Momentum - y (MeV/c):    30.55874584714016                 nan
         Momentum - z (MeV/c):    12.58806123120922                 nan
         Total Energy (MeV)  :    940.3991873554132   938.3405886213711
         Kinetic Energy (MeV):    2.126887355413274 0.06828862137112379
         Velocity (mm/ns)    :    20.15144179563204   3.616776901458536
         Volume Name         :    trackerLayer_phys   trackerLayer_phys
         Safety (mm)         :   0.7969176405153779  0.8333978912969117
         Polarization - x    :                    0                   0
         Polarization - y    :                    0                   0
         Polarization - Z    :                    0                   0
         Weight              :                    1                   1
         Step Status         :      AlongStep Proc.       PostStep Proc
         Process defined Step:                hIoni AntiProtonInelastic
      -----------------------------------------------------------------------
... ...
... small skip
#Step#      X         Y         Z        KineE    dEStep   StepLeng
TrakLeng     Volume     Process
   81  -20.4 cm   34.9 cm  -2.43 mm   68.3 keV  2.06 MeV  52.1 mum  42.4 cm
trackerLayer_phys  AntiProtonInelastic


 >>DefinePhysicalStepLength (List of proposed StepLengths):
    ++ProposedStep(PostStep ) = 44.52449073783492 : ProcName =
AntiProtonInelastic (No  ForceCondition)
    ++ProposedStep(PostStep ) = 36.7761184247093 : ProcName = hElastic (No
ForceCondition)
    ++ProposedStep(PostStep ) = 1.797693134862316e+308 : ProcName = hIoni (No
ForceCondition)
    ++ProposedStep(PostStep ) = 1.797693134862316e+308 : ProcName = msc (Forced)
    ++ProposedStep(PostStep ) = 1.797693134862316e+308 : ProcName =
Transportation (Forced)
    ++ProposedStep(AlongStep) = 0.000767365494101051 : ProcName = hIoni
(CandidateForSelection)
    ++ProposedStep(AlongStep) = 0.0007558743340329251 : ProcName = msc
(NotCandidateForSelection)

The program stopped here.


  How to solve this problem? Momentum is nan, why?

Thanks in advanced.
Comment 1 asai 2006-09-13 10:51:59 CEST
This seems the problem is not in the original exampleN04 but related to
antiproton process. This problem is thus forwarded to the hadronics working group.
Comment 2 dennis.herbert.wright 2007-02-26 12:49:59 CET
Problem was due to un-initialized kinematics being returned if the anti-proton
energy was very low ( < 0.1 MeV).   Now the exact kinematics of the anti-proton
as it enters the model is returned (essentially performing no hadronic
interaction).  The fix will be included in the next release.   Contact me if
you need the fix before then.