Skip to content

Add initial documentation and fix energy loss bugs#260

Merged
anthoak13 merged 10 commits intoATTPC:developfrom
anthoak13:BethBlochStraggling
Apr 2, 2026
Merged

Add initial documentation and fix energy loss bugs#260
anthoak13 merged 10 commits intoATTPC:developfrom
anthoak13:BethBlochStraggling

Conversation

@anthoak13
Copy link
Copy Markdown
Member

@anthoak13 anthoak13 commented Apr 1, 2026

This PR:

  1. Fix a bug in CATIMA energy loss models in the generation of the the brag curve (units were off by a factor of 10).
  2. Fixes bugs in bethe-bloch implementation - notably where straggeling was calculated with BB.
  3. Allows for a custom CATIMA config to be used in the catima energy loss class
  4. Adds macros to visualize the different energy loss models for various particles.
  5. Adds documentation on code organization and commands to build, execute tests, etc in the docs folder

- GetElossStraggling/GetdEdxStraggling: evaluate dEdx at energyFin
  (Tschalar formula requires stopping power at the exit point, not
  entrance; error was largest near the Bragg peak)
- BuildSpline: replace manual trapezoidal rule for Ω²(E) with a spline
  of 1/dEdx³ and segment-wise Simpson integration (exact for cubics)
- AtELossCATIMA: add fConfig member and SetConfig() so callers can
  tune the CATIMA calculation model; thread fConfig through all catima
  API calls (default_config preserves existing behaviour)
- AtELossBetheBlochTest: add AtELossBetheBlochVsCATIMAFixture comparing
  GetRangeVariance and GetElossStraggling against pure-Bohr CATIMA
  (z_eff_type::none) at narrow and wide energy traversals up to 10→1 MeV
Adds macro/tests/ELossComparison/ELossComparison.C with four scenarios
(proton/deuteron/alpha in D2, proton in He) comparing BetheBloch, CATIMA,
and SRIM Table models via dE/dx, range, Bragg curve, and straggling plots.
Add documentation into four subdirectories directly under docs/:
- tooling/: installation, daily-use (merged setup+building), testing
- contributing/: contributor guide, new-module, code-style
- reference/: modules, data-model, branch-io-contracts, macro-cookbook
- subsystems/: simulation/reconstruction pipelines, generators, psa, energy-loss

docs/development/ is reserved for branch-specific in-progress
notes (fitting-status.md, UKF.md, etc.).

Update all cross-links and the CLAUDE.md to point to the new docs
rather than repeat the information.
GetBraggCurve stored result.dEdxi * fDensity directly (MeV/cm) into
the output vector, while all other paths (GetdEdx, base-class
GetBraggCurve) divide by 10 to convert to MeV/mm.  The energy-step
calculation in the same loop used dEdx * rangeStepSize / 10, which
accidentally cancelled the unit error during tracking, so range and
energy results were unaffected — only the returned dEdx y-values were
10× too large, inflating the displayed Bragg peak height relative to
BB and SRIM curves.

Adds a fourth model per scenario — CATIMA with bare projectile charge
(z_eff_type::none) and dEdx corrections disabled (no Barkas, Lindhard,
or shell corrections) — to isolate which physics differences drive the
disagreement between Bethe-Bloch and full CATIMA:

- dEdx/range divergence at low energy → effective charge (Pierce-Blann)
- Range straggling floor in BB vs steep fall in CATIMA → Firsov/Lindhard-X
  straggling correction (hardwired in CATIMA, absent in BB)
- Bragg peak shape difference → effective charge suppressing dEdx as v→0
@anthoak13 anthoak13 force-pushed the BethBlochStraggling branch 2 times, most recently from ea4e636 to 32a9fae Compare April 1, 2026 19:42
Also fixes clang-formatting
@anthoak13 anthoak13 force-pushed the BethBlochStraggling branch from 32a9fae to 5dae8c1 Compare April 1, 2026 19:58
@anthoak13 anthoak13 marked this pull request as ready for review April 2, 2026 01:50
@anthoak13 anthoak13 merged commit 4d6ff4d into ATTPC:develop Apr 2, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant