A Python package for quick energy loss calculations in typical detector materials for particle and nuclear physics. Implements the Bethe-Bloch formula, Sternheimer density effect, Landau/Vavilov fluctuations, continuous-slowdown range, and radiation length.
Accuracy: ~10% in general; breaks down at very low velocity (β < 1/137).
pip install -e .Requires Python ≥ 3.9, numpy ≥ 1.21, scipy ≥ 1.7.
Call get_material(material, state) to obtain a Material object that holds all the constants needed for calculations (Z, A, density, mean excitation energy, plasma energy, etc.).
| Material | States |
|---|---|
argon |
gas, liquid |
krypton |
gas, liquid |
xenon |
gas, liquid |
silicon |
solid |
water |
liquid |
scintillator |
liquid (toluene C₇H₈), solid (polyethylene C₂H₄) |
cf4 |
gas (at 2 bar) |
iron |
solid |
import energyloss as el
lar = el.get_material("argon", "liquid")
si = el.get_material("silicon", "solid")
print(el.list_materials()) # all (material, state) pairsA Particle bundles the rest mass (GeV/c²) and electric charge together. Built-in presets:
| Name | Mass (GeV/c²) | Charge |
|---|---|---|
ELECTRON |
5.110×10⁻⁴ | −1 |
MUON |
0.10566 | 1 |
PION |
0.13957 | 1 |
KAON |
0.49368 | 1 |
PROTON |
0.93827 | 1 |
DEUTERON |
1.87561 | 1 |
ALPHA |
3.72738 | 2 |
Custom particles (e.g. heavy ions) can be defined with Particle(mass, charge):
carbon = el.Particle(mass=11.177, charge=6) # 12C ionAll functions take momentum P in GeV/c and a Particle; never raw mass and charge separately.
Restricted Bethe-Bloch mean energy loss ⟨dE/dx⟩ in MeV per g/cm².
tcut— delta-ray energy cut (MeV).0gives the full Bethe formula withtcut = Wmax.density_correction— apply the Sternheimer parameterisation of the density effect.
lar = el.get_material("argon", "liquid")
# Full Bethe for a 1 GeV muon
el.dedx(1.0, el.MUON, lar)
# Restricted loss (5 MeV cut) with density correction
el.dedx(1.0, el.MUON, lar, tcut=5.0, density_correction=True)Landau most-probable energy loss Δₚ in MeV for a slab of given thickness (g/cm²).
si = el.get_material("silicon", "solid")
dx = 0.0699 # 300 µm × 2.33 g/cc
el.most_probable_loss(3.0, el.PION, si, dx)Effective sigma (FWHM / 2.355) of the Landau/Vavilov distribution in MeV.
Landau distribution probability density at deposited energy epsilon (MeV), returning MeV⁻¹. Uses the Moyal approximation.
Draw a random Landau-distributed energy deposition in MeV. Uses the Moyal approximation.
# Simulate 10 000 events in 300 µm silicon
samples = [el.landau_random(0.0699, 3.0, el.PION, si) for _ in range(10_000)]Continuous-slowdown approximation (CSDA) range. Returns a dict:
| Key | Description |
|---|---|
P |
Input momentum (GeV/c) |
T_kin |
Initial kinetic energy (MeV) |
dedx_init |
Initial dE/dx (MeV/cm) |
range |
CSDA range (cm) |
saturated_T |
Saturated kinetic energy integral (MeV) |
el.range_dedx(0.5, el.PROTON, el.get_material("argon", "liquid"))Sternheimer density effect correction δ (dimensionless).
Momentum (GeV/c) corresponding to a given kinetic energy T (MeV), via the relativistic relation p = √(T² + 2·T·m).
el.momentum_from_ke(432.99, el.PROTON) # → 1.0 GeV/cKinetic energy (MeV) corresponding to a given momentum P (GeV/c), via the relativistic relation T = √(P² + m²) − m. Inverse of momentum_from_ke.
el.ke_from_momentum(1.0, el.PROTON) # → 432.99 MeVMaximum energy transfer to a single electron (MeV).
Rutherford differential cross section (cm²/eV) at electron recoil energy W (eV).
Inverse radiation length 1/X₀ in (g/cm²)⁻¹ for an element with atomic number Z and mass A (g/mol). X₀ itself is 1 / inv_rad_length(Z, A).
X0_si = 1 / el.inv_rad_length(14, 28.086) # → 21.8 g/cm²
X0_pb = 1 / el.inv_rad_length(82, 207.2) # → 6.4 g/cm²A full set of example calculations and a momentum-scan plot are in examples.py:
python examples.pyThis prints tables for dE/dx, z² charge scaling, proton ranges, Landau most-probable vs Bethe mean, and radiation lengths, then saves a plot of muon dE/dx vs momentum to dedx_muon.png.
| Quantity | Unit |
|---|---|
| Momentum P, mass M | GeV/c, GeV/c² |
| Kinetic energy, energy loss | MeV |
| Thickness | g/cm² |
| Density | g/cm³ |
| dE/dx | MeV per g/cm² |
| dE/dx × density | MeV/cm |
| Cross section (Rutherford) | cm²/eV |
Milind V. Diwan — original Mathematica package (2023), Python port (2026).
