From 971b228d35cdde3e9d537942e1eb34153ba74802 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Wed, 25 Feb 2026 17:22:12 -0600 Subject: [PATCH 1/3] feat: switch to DormandPrince745 stepper by default --- src/dd4pod/python/npsim.py | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/src/dd4pod/python/npsim.py b/src/dd4pod/python/npsim.py index 737f679..c1732cd 100755 --- a/src/dd4pod/python/npsim.py +++ b/src/dd4pod/python/npsim.py @@ -8,6 +8,7 @@ Modified with standard EIC EPIC requirements. """ from __future__ import absolute_import, unicode_literals +import g4units import logging import sys @@ -25,6 +26,40 @@ # https://github.com/AIDASoft/DD4hep/pull/1376 RUNNER.parseOptions() + # Set the magnetic field stepper + # Reference situations: + # - a 1 MeV delta electron in a 1.7 T field bends with a radius of about 0.002 m + # - a 100 MeV electron in a 1.7 T field bends with a radius of about 0.2 m + # - a 1 GeV electron in a 1.7 T field bends with a radius of about 2 m + # - a 5 GeV electron in a 1.7 T field bends with a radius of about 10 m + # + # stepper: DormandPrince745 has 6 field evaluations per step, compared to 11 in ClassicalRK4 + RUNNER.field.stepper = "DormandPrince745" + # equation: Mag_UsualEqRhs is the default + RUNNER.field.equation = "Mag_UsualEqRhs" + # eps_min: min relative step error, Geant4 recommended default is 5e-05 + RUNNER.field.eps_min = 5e-05 + # eps_max: max relative step error, Geant4 recommended default is 0.001 + # i.e. a 100 MeV electron with eps_min = 1e-04 may accumulate absolute errors + # on the scale of 0.02 mm per radius, or of order the vertex silicon tracker pixel pitch + RUNNER.field.eps_max = 1e-04 + # delta_chord: max distance between true curved track and chord, + # which defines maximum step size L = √(8 r · delta_chord), + # i.e. a 100 MeV electron with delta_chord of 0.025 mm (chosen + # to be on the order of the vertex tracker pixel size) + # will have max step size of 6 mm + RUNNER.field.delta_chord = 0.025 * g4units.mm + # delta_one_step: max distance between true endpoint and step endpoint, + # chosen on the order of the vertex tracker pixel size + RUNNER.field.delta_one_step = 0.01 * g4units.mm + # delta_intersection: max distance between true intersection and intersection found by stepper, + # chosen on the order of the vertex tracker pixel size + RUNNER.field.delta_intersection = 0.01 * g4units.mm + # min_chord_step: floor on the chord finder's step size to prevent runaway bisection + # near boundaries or for sub-MeV secondaries (r < 0.5 mm). For all physical tracks + # the natural step L = √(8r·delta_chord) >> 0.01 mm so this rarely activates. + RUNNER.field.min_chord_step = 0.01 * g4units.mm + # Ensure that Cerenkov and optical physics are always loaded def setupCerenkov(kernel): from DDG4 import PhysicsList From 59a2ec82f2e3e6cba908e59c6ce8da7779123aed Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Wed, 25 Feb 2026 17:58:31 -0600 Subject: [PATCH 2/3] fix: typo eps_max Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- src/dd4pod/python/npsim.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dd4pod/python/npsim.py b/src/dd4pod/python/npsim.py index c1732cd..4a85c4f 100755 --- a/src/dd4pod/python/npsim.py +++ b/src/dd4pod/python/npsim.py @@ -40,7 +40,7 @@ # eps_min: min relative step error, Geant4 recommended default is 5e-05 RUNNER.field.eps_min = 5e-05 # eps_max: max relative step error, Geant4 recommended default is 0.001 - # i.e. a 100 MeV electron with eps_min = 1e-04 may accumulate absolute errors + # i.e. a 100 MeV electron with eps_max = 1e-04 may accumulate absolute errors # on the scale of 0.02 mm per radius, or of order the vertex silicon tracker pixel pitch RUNNER.field.eps_max = 1e-04 # delta_chord: max distance between true curved track and chord, From 4a06767f86890bf2749aafbfb37f49821b8f8869 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Wed, 25 Feb 2026 18:00:06 -0600 Subject: [PATCH 3/3] fix: avoid UTF characters --- src/dd4pod/python/npsim.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dd4pod/python/npsim.py b/src/dd4pod/python/npsim.py index 4a85c4f..c3d6fb5 100755 --- a/src/dd4pod/python/npsim.py +++ b/src/dd4pod/python/npsim.py @@ -44,7 +44,7 @@ # on the scale of 0.02 mm per radius, or of order the vertex silicon tracker pixel pitch RUNNER.field.eps_max = 1e-04 # delta_chord: max distance between true curved track and chord, - # which defines maximum step size L = √(8 r · delta_chord), + # which defines maximum step size L = sqrt(8 * r * delta_chord), # i.e. a 100 MeV electron with delta_chord of 0.025 mm (chosen # to be on the order of the vertex tracker pixel size) # will have max step size of 6 mm