Title: Garfield++ TrackSrim: premature termination at low ion energy and possible cluster-size dependence of ionisation yield

Hello,

I am using Garfield++ TrackSrim to simulate low-energy lithium-ion ionisation. I found unexpectedly low electron yields and would appreciate advice on whether my interpretation and proposed changes are reasonable.

My setup is:

  • Lithium ions, initial kinetic energies of 1–100 keV.
  • MediumMagboltz: He/N₂ = 98/2, 6 atm, 293.15 K.
  • SRIM input: lithium in pure helium, density 0.00108 g/cm³.
  • Work function: 40 eV.
  • Default combined energy-loss fluctuation model (SetModel(4)).
  • A large active region, so the tracks should stop inside the gas.

The SRIM table starts at 1.1 keV. I understand that using a pure-He table for the mixture, and extending it below its minimum energy, introduces separate physical uncertainties. My questions here concern the tracking and sampling logic.

1. Possible premature termination

In TrackSrim::NewTrack(), I found the following logic, abbreviated:

if (stpmin > stpmax) {
  // Debug message: "depositing all energy"
  if (deem + dehd > ekin) {
    eloss = ekin - dehd;
  } else {
    eloss = deem;
  }
  finish = true;
}

For a 5 keV ion, the initial short step gives approximately:

Electronic energy loss:       15.079 eV
Nuclear energy loss:          34.966 eV
Remaining kinetic energy:   4949.955 eV

Here, stpmin > stpmax, so the track terminates after this step, although most of its kinetic energy remains.

For this first step:

SRIM projected range at 5 keV: 62.11 μm
tracklength = 10 × range:      0.06211 cm
stpmax = tracklength - dsum:   0.06211 cm
stpmin:                       approximately 0.36944 cm

I tried retaining the mean electronic loss for the current step while removing the unconditional finish = true from this branch. Existing termination conditions for exhausted energy, track-length limits and geometry boundaries remain active.

2. Possible dependence of electron yield on cluster subdivision

With Fano sampling enabled, the original code draws an energy for the next ion pair:

const double ernd1 = RndmHeedWF(w, fano);
if (ernd1 > ecl) break;

If the available energy is insufficient, the unused energy is retained in epool, but this sampled ion-pair energy is discarded. A new value is drawn in the next cluster.

Could repeatedly discarding unaffordable draws bias the electron yield when a track is divided into many small clusters?

I tried preserving this pending draw across cluster boundaries within the same track. A new value is drawn only after the previous ion pair has been produced. This reduced the observed dependence of total electron yield on cluster subdivision.

3. Fluctuations after boundary truncation

When a step is shortened to a geometry boundary, the code recalculates its mean losses and samples the energy loss again. This occurs after the earlier negative-loss check.

In boundary tests, I observed negative energy losses from this second sampling path. I therefore tried:

  • Rechecking SmallestStep() after truncation.
  • Using mean loss if the shortened step is unsuitable for the fluctuation model.
  • Constraining electronic loss to [0, ekin - dehd].

The track still terminates at the boundary, retaining its outgoing kinetic energy.

Results

Mean total electron counts were:

Initial energy Original implementation, 200 tracks Modified implementation, 2000 tracks
1 keV 0 2.31
5 keV 0 23.23
10 keV 0.84 72.08
15 keV 138.88 138.74
20 keV 217.30 217.10

After the changes, the fully contained test tracks exhausted their kinetic energy. Deterministic electronic losses agreed with an independent integral of Se / (Se + Sn) over energy. Boundary tests retained outgoing energy, and subdivision tests showed improved consistency.

These checks establish numerical consistency, rather than the physical accuracy of the low-energy ionisation model.

My questions are:

  1. Is termination in the stpmin > stpmax branch intentional, or should tracking continue using mean energy loss?
  2. Is carrying an unaffordable RndmHeedWF draw across clusters consistent with the intended W/Fano sampling model?
  3. Is mean-loss fallback appropriate when boundary truncation makes a step too short for the fluctuation model?
  4. Is there an existing fix or a more suitable Garfield++ approach for low-energy heavy-ion ionisation?

Thank you.

Hi @pedro

Thanks for the detailed report. I can indeed reproduce the low yields on current master, and it does look like a bug in TrackSrim. The stpmin > stpmax branch stops tracks that still have energy left. The other two points you raise, and the changes you made for all three, also look reasonable.

As a check, I ran the unmodified code with SetModel(0) and SetFanoFactor(0.), which switch off the energy loss fluctuations and the Fano sampling, using a Li-in-He table built from the numbers in your gave. The total yields gives similar numbers compared with your modified implementation: 2, 23, 72, 138 and 215 electrons at 1, 5, 10, 15 and 20 keV, respectively. These settings round down to a whole number of electrons per track.

I need a bit more time to look into how best to fix this. Would you like to create a branch with your changes on GitLab, so that I can have a look? Otherwise, I can prepare a fix myself.

Kind regards, Djunes