Skip to content

Commit 3289589

Browse files
sawenzelclaude
andcommitted
Let the stuck-track push of the VecGeom navigator grow
This fixes events aborted with kRelocating when a track runs tangent to a curved face. - Such a track stays within the tolerance of the face for about sqrt(2 R tolerance), microns, and a field-free medium on one side and a field on the other make the two sides disagree about which of them holds it. - The push after ten zero steps was 100 kCarTolerance, as in G4Navigator, which is ten VecGeom tolerances and too short to leave that band before the abort at twenty-five. - It now grows fourfold per try up to a micron and doubles from the eleventh try on, about 65 um before the abort. - The abort stays for a track that is stuck for another reason. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
1 parent 0004184 commit 3289589

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

‎Detectors/gconfig/src/VecGeomG4Navigator.cxx‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,13 +160,18 @@ G4double VecGeomG4Navigator::ComputeStep(const G4ThreeVector& globalPoint, const
160160
G4double step = std::max(vgStep, 0.) * kVGToG4;
161161
const bool entering = mStepState.GetCurrentLevel() > mCurState.GetCurrentLevel();
162162

163-
// A track that is not moving, handled as G4Navigator does: after ten zero steps the step is
164-
// lengthened by 100 kCarTolerance, after twenty-five the event is aborted.
163+
// A track that is not moving, with G4Navigator's thresholds: after ten zero steps the step is
164+
// lengthened, after twenty-five the event is aborted.
165165
if (step < 0.05 * kCarTolerance) {
166166
++mZeroStepCount;
167167
if (++mNzeroSteps >= kActionThresholdNoZeroSteps) {
168168
++mStuckPushCount;
169-
step += 100. * kCarTolerance;
169+
// The push grows from Geant4's 100 kCarTolerance fourfold per try to a micron and doubles from the
170+
// eleventh try on: a track tangent to a curved face stays within the tolerance of it for microns.
171+
const int tries = mNzeroSteps - kActionThresholdNoZeroSteps;
172+
constexpr double kMicron = 1.e-3 * CLHEP::mm;
173+
step += tries < 10 ? std::min(100. * kCarTolerance * std::pow(4., tries), kMicron)
174+
: kMicron * static_cast<double>(2 << (tries - 10));
170175
if (mNzeroSteps >= kAbandonThresholdNoZeroSteps) {
171176
++mAbandonCount;
172177
std::ostringstream msg;

0 commit comments

Comments
 (0)