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

**URL:** <https://root-forum.cern.ch/t/title-garfield-tracksrim-premature-termination-at-low-ion-energy-and-possible-cluster-size-dependence-of-ionisation-yield/65042>\
**Category:** Garfield++\
**Created:** [October 29, 2026, 10:03am UTC](https://root-forum.cern.ch/t/title-garfield-tracksrim-premature-termination-at-low-ion-energy-and-possible-cluster-size-dependence-of-ionisation-yield/65042 "2026-10-29T10:03:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![pedro](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/pedro/32/37605_2.png) [@pedro](https://root-forum.cern.ch/u/pedro)\
**Post date:** [October 29, 2026, 10:03am UTC](https://root-forum.cern.ch/t/title-garfield-tracksrim-premature-termination-at-low-ion-energy-and-possible-cluster-size-dependence-of-ionisation-yield/65042/1 "2026-10-29T10:03:38Z")

</div>

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:

```auto
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:

```auto
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:

```auto
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:

```auto
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.

---

<div class="post-metadata">

**Author:** ![djjansse](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/d/8baadc/32.png) [@djjansse](https://root-forum.cern.ch/u/djjansse)\
**Post date:** [October 30, 2026, 4:52pm UTC](https://root-forum.cern.ch/t/title-garfield-tracksrim-premature-termination-at-low-ion-energy-and-possible-cluster-size-dependence-of-ionisation-yield/65042/2 "2026-10-30T16:52:46Z")

</div>

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](https://gitlab.cern.ch/garfield/garfieldpp), so that I can have a look? Otherwise, I can prepare a fix myself.

Kind regards, Djunes

---

<div class="post-metadata">

**Author:** ![system](https://root-forum.cern.ch/uploads/default/original/3X/e/f/efe4f24398fd8ffeb76bccb6ecc46d9d9c003376.png) [@system](https://root-forum.cern.ch/u/system)\
**Post date:** [November 13, 2026, 4:53pm UTC](https://root-forum.cern.ch/t/title-garfield-tracksrim-premature-termination-at-low-ion-energy-and-possible-cluster-size-dependence-of-ionisation-yield/65042/3 "2026-11-13T16:53:22Z")

</div>

Closed on November 13, 2026, 4:53pm UTC

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
