Skip to content

Add Bethe Bloch energy loss model #259

Merged
Yassid merged 7 commits intoATTPC:developfrom
anthoak13:Bethe-Bloch-Impl
Mar 8, 2026
Merged

Add Bethe Bloch energy loss model #259
Yassid merged 7 commits intoATTPC:developfrom
anthoak13:Bethe-Bloch-Impl

Conversation

@anthoak13
Copy link
Member

Adds Bethe Bloch as an energy loss model to the code.

This was mostly done as a test of how Claude Code interacts with out codebase, but the results were very good and is probably worth including. Below you can see the results of this class compared to the expected output from wikipedia.

Screenshot 2026-03-03 135339

Screenshot 2026-03-03 135451

anthoak13 and others added 6 commits March 3, 2026 09:11
Implements the Bethe-Bloch stopping power formula as a new AtELossModel
subclass supporting heavy charged particles (PDG 2022, Eq. 34.1) and
electrons (Leo 1994, Eq. 2.38). A tk::spline cache of dx/dE enables
O(log n) range integrals. Newton's method is used for GetEnergy,
matching the AtELossTable strategy. Straggling uses the Bohr
approximation. Low-energy breakdown of the formula is handled by
extrapolating dEdx ∝ sqrt(E) below the validity threshold.

Includes 8 unit tests (proton/alpha/pion/electron in H2 and Ar,
self-consistency, straggling sanity, Bloch approximation) and a ROOT
macro to plot proton stopping power in Al for visual comparison against
the PDG reference curve.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
SetMaterial, SetI, and SetDensity all change physical parameters that
the cached dx/dE spline depends on, but previously left it stale.
SetMaterial now calls BuildSpline at the end (removing the redundant
explicit call from the constructor). SetI is moved from an inline
header one-liner to a proper definition that rebuilds the spline.
SetDensity overrides the base class virtual and rebuilds the spline
after updating fDensity.

Adds SettersRebuildSpline test to verify each setter takes effect
immediately without a manual BuildSpline call.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@anthoak13
Copy link
Member Author

@Yassid @RealAurio I added the Bethe-Bloch mostly as a test, but I think it could be useful for the pion work?

@RealAurio
Copy link
Contributor

Bethe

Hello @anthoak13, maybe @gxifrag will be interested in this too, she is the one working with the Kalman Filter right now.

@Yassid
Copy link
Member

Yassid commented Mar 8, 2026

@anthoak13 Yes this is a good idea. We are doing extensive tests of the KF performance and this is certainly critical.

@Yassid Yassid merged commit 82ecba9 into ATTPC:develop Mar 8, 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.

3 participants