I have two issues with G4Tet. 1. Ignoring degeneracy of G4Tet G4Tet class checks the degeneracy of the tetrahedrons by default. When constructing the class I can ignore the degeneracy by using a boolean variable as below (otherwise, the program aborts after calling the fatal exception). G4bool chk; G4Tet("tet", v0, v1, v2, v3, &chk); However, when I use the method G4Tet::SetVertices(), there is no way to ignore it, and it just aborts when it detects any degenerated tetrahedron. My first request is that if degeneracy doesn't make a fatal problem in tracking, could you please add the same option in G4Tet::SetVertices()? Or maybe I can make a pull request for this. 2. Track stuck in G4Tet For the upper issue, I got a response that it may cause track stuck (https://geant4-forum.web.cern.ch/t/degeneracy-of-the-g4tet/6202). However, the thing is that track stuck has been a long problem even with not degenerated tetrahedrons. To address this problem, what we are using is the class to slightly push the stuck particle, which looks like below. TETSteppingAction::TETSteppingAction() : G4UserSteppingAction(), kCarTolerance(1.0000000000000002e-07), stepCounter(0), checkFlag(0) {} TETSteppingAction::~TETSteppingAction() {} void TETSteppingAction::UserSteppingAction(const G4Step* step) { // Slightly move the particle when the step length of five continuous steps is // shorter than the tolerance (0.1 nm) // G4Track* theTrack = step->GetTrack(); G4bool CheckingLength = (step->GetStepLength() < kCarTolerance); if(CheckingLength) { ++stepCounter; if( checkFlag && stepCounter>=5 ) { // kill the track if the particle is stuck even after the slight move // (this hardly occurs) theTrack->SetTrackStatus(fStopAndKill); stepCounter=0; checkFlag=0; } else if( stepCounter>=5 ) { // if a particle is at the same position (step length < 0.1 nm) for five consecutive steps, // slightly move (0.1 nm) the stuck particle in the direction of momentum theTrack->SetPosition(theTrack->GetPosition() + theTrack->GetMomentumDirection()*kCarTolerance); checkFlag=1; } } else stepCounter=0; } I am the author of the code to calculate doses in tetrahedral mesh phantoms, which is planned to be included in Geant4 example, and this code also includes the class to slightly push the stuck particle. If it is possible, it would be great if this track stuck issue can be addressed without such extra SteppingAction class.
*** Problem 2428 has been marked as a duplicate of this problem. ***
1. A flag for ignorance of degeneracy G4Tet::SetVertices() will be available in the upcoming new version of Geant4. 2. Geant4 has a built-in "push mechanism". Why you decided to implemented your own one? To investigate the reason of appearance of stuck tracks, could you please provide us with additional information on where it happens, I mean, the tetrahedron vertices, the coordinates of the point and the direction of the trajectory.
Great! Thank you for your help. Track stuck in G4Tet is very rare. When using our tetrahedral mesh human phantom, it occurs like once 1e20 events. So from today, I will try to collect at least ten the track stuck cases and let you know the details. It may take few days.
The ignorance of degeneracy flag has been added to the signature of G4Tet::SetVertices() in Geant4.11. Reproduction of the situation with stuck tracks does not seem possible without additional information. We close the issue.