| Summary: | Track stuck in G4Tet + Ignoring degeneracy of G4Tet | ||
|---|---|---|---|
| Product: | Bugzilla | Reporter: | Haegin Han <haeginh> |
| Component: | general | Assignee: | Koichi Murakami <Koichi.Murakami> |
| Status: | RESOLVED DUPLICATE | ||
| Severity: | minor | ||
| Priority: | P4 | ||
| Version: | other | ||
| Hardware: | All | ||
| OS: | All | ||
*** This problem has been marked as a duplicate of problem 2427 *** |
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.