Problem 1175

Summary: Program enters Infinite loop
Product: Geant4 Reporter: Nickolay <xterminal86>
Component: geometry/magneticfieldAssignee: tatiana.nikitina
Status: RESOLVED FIXED    
Severity: major CC: John.Apostolakis
Priority: P5    
Version: 9.4   
Hardware: PC   
OS: Linux   
Attachments: geometry and output

Description Nickolay 2011-02-21 16:12:08 CET
Created attachment 101 [details]
geometry and output

After I start simulation the program stops after few seconds without any reason. I looked it in gdb and strace - nothing. Verbose modes also give no errors or anything. But, the only thing I managed to see, is that when I disable magnetic field OR physics interaction OR change geometry (not using boolean solid) everything seems to go fine... Additional info is in attachment. Thanks.
Comment 1 John Apostolakis 2011-02-22 10:36:45 CET
Could you please re-run with 
  /tracking/verbose 1 
and show the last lines of output ?  This should identify the volume in which the simulation is when the problem occurs.  

A second step is to run with the geometry check mode.  You can find instructions how to do this in the Applications Developers Guide in the Documention.  Just search for "check_mode".   ( With older versions of Geant4 you needed also to set verbose mode to get check mode output - but you do not have to do this any longer. )

Right now, we can only speculate a potential cause: it could be that this is a problem in the geometry description (an overlap) which is confusing the navigator, or a problem in the algorithm of the torus, which is the most challenging solid you use.  With more information from you, it should be possible to identify the source of the problem.

Thanks & regards, John
Comment 2 Nickolay 2011-02-24 08:23:32 CET
*********************************************************************************************************
* G4Track Information:   Particle = neutron,   Track ID = 597,   Parent ID = 585
*********************************************************************************************************

Step#    X(mm)    Y(mm)    Z(mm) KinE(MeV)  dE(MeV) StepLeng TrackLeng  NextVolume ProcName
    0 1.04e+04    -10.2    -3.65     0.754        0        0         0 chamber_phys initStep
    1 1.04e+04    -10.2    -3.65     0.754        0 0.000607  0.000607  field_phys Transportation


Program stops when particle enters field volume (field_phys) from any other, but I don't understand why it works some lines above. There are such situations and everything goes fine. I tried to sort it out by almost everything I can get from G4Track or G4Step (process or energy or step length), but all this are different when everything stops. Very weird problem.
Comment 3 tatiana.nikitina 2011-02-25 10:34:12 CET
Dear Nickolay,

 Running the code of your DetectorConstruction with CheckOverlaps()
 reported some overlaps. This is most probably the source of the problem.
Checking overlaps for volume field_phys ... OK!
Checking overlaps for volume beam_screen_phys ... OK!
Checking overlaps for volume plank_near_phys ...
WARNING - G4PVPlacement::CheckOverlaps()
          Overlap is detected for volume plank_near_phys
          with beam_screen_phys volume's
          local point (2.8039e+06,7235.67,-14), overlapping by at least: 200 um

*** G4Exception : InvalidSetup
      issued by : G4PVPlacement::CheckOverlaps()
Overlap with volume already placed !
*** This is just a warning message.
Checking overlaps for volume plank_far_phys ...
WARNING - G4PVPlacement::CheckOverlaps()
          Overlap is detected for volume plank_far_phys
          with beam_screen_phys volume's
          local point (2.80395e+06,3602.51,14), overlapping by at least: 200 um

*** G4Exception : InvalidSetup
      issued by : G4PVPlacement::CheckOverlaps()
Overlap with volume already placed !
*** This is just a warning message.
Checking overlaps for volume chamber_phys ... OK!
Checking overlaps for volume magnet_phys ...
WARNING - G4PVPlacement::CheckOverlaps()
          Overlap is detected for volume magnet_phys
          apparently fully encapsulating volume field_phys
          at the same level !

*** G4Exception : InvalidSetup
      issued by : G4PVPlacement::CheckOverlaps()
Overlap with volume already placed !
*** This is just a warning message.
Checking overlaps for volume detector_phys ... OK!

You can activate CheckOverLaps in the G4PVPlacement at the construction by changing value of pSurfChk to true:

 G4PVPlacement(       G4Transform3D      solidTransform,
                         G4LogicalVolume*   pCurrentLogical,
                   const G4String&          pName,
                         G4LogicalVolume*   pMotherLogical,
                         G4bool             pMany,
                         G4int              pCopyNo,
                         G4bool             pSurfChk=true ) 
 Best Regards,

Tatiana Nikitina
Comment 4 Nickolay 2011-02-26 11:17:58 CET
I changed sizes and got rid of this warning, but it has no effect on the simulation. The same freeze still occur.
Comment 5 tatiana.nikitina 2011-03-06 22:30:14 CET
Dear Nickolay,

Thank you for trial. I have run your test, but I don't have the infinite loop, program is finishing normally.
Can you print the position, direction, energy with bigger precision? 

Best Regards,

Tatiana
Comment 6 Nickolay 2011-03-07 12:20:49 CET
I am executing a macro in main() via /control/execute command. Here is the macro:

/gun/particle proton
/gun/position 0.000000 0.290800 2.061000 cm
/gun/direction 1.000000 -0.000065 0.000424
/gun/energy 6850.000000 GeV
/run/beamOn
/gun/position 0.000000 0.020070 1.860000 cm
/gun/direction 1.000000 -0.000005 0.000360
/gun/energy 6870.000000 GeV
/run/beamOn
/gun/position 0.000000 0.140000 1.714000 cm
/gun/direction 1.000000 -0.000030 0.000304
/gun/energy 6886.000000 GeV
/run/beamOn
Comment 7 tatiana.nikitina 2011-06-30 09:31:31 CEST
Dear Nickolay,

The problem is solved. 
Relative radial tolerance was introduced for G4Torus for case of large Toruses.
The fix will be included in next geant4 release.

Best Regards,

Tatiana Nikitina