Add Bethe Bloch energy loss model #259
Merged
Yassid merged 7 commits intoATTPC:developfrom Mar 8, 2026
Merged
Conversation
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>
Member
Author
|
@Yassid @RealAurio I added the Bethe-Bloch mostly as a test, but I think it could be useful for the pion work? |
Contributor
Hello @anthoak13, maybe @gxifrag will be interested in this too, she is the one working with the Kalman Filter right now. |
Member
|
@anthoak13 Yes this is a good idea. We are doing extensive tests of the KF performance and this is certainly critical. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.