Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

8 Commits

Folders and files

Repository files navigation

energyloss

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).

Installation

pip install -e .

Requires Python ≥ 3.9, numpy ≥ 1.21, scipy ≥ 1.7.


Concepts

Materials

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) pairs

Particles

A 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 ion

All functions take momentum P in GeV/c and a Particle; never raw mass and charge separately.


API Reference

dedx(P, particle, mat, tcut=0.0, density_correction=False)

Restricted Bethe-Bloch mean energy loss ⟨dE/dx⟩ in MeV per g/cm².

  • tcut — delta-ray energy cut (MeV). 0 gives the full Bethe formula with tcut = 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)

most_probable_loss(P, particle, mat, thickness, density_correction=False)

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)

sigma(P, particle, mat, thickness)

Effective sigma (FWHM / 2.355) of the Landau/Vavilov distribution in MeV.

landau_pdf(epsilon, dx, P, particle, mat)

Landau distribution probability density at deposited energy epsilon (MeV), returning MeV⁻¹. Uses the Moyal approximation.

landau_random(dx, P, particle, mat)

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)]

range_dedx(P, particle, mat)

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"))

density_effect(P, particle, mat)

Sternheimer density effect correction δ (dimensionless).

momentum_from_ke(T, particle)

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/c

ke_from_momentum(P, particle)

Kinetic 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 MeV

wmax(P, particle)

Maximum energy transfer to a single electron (MeV).

rutherford(W, P, particle)

Rutherford differential cross section (cm²/eV) at electron recoil energy W (eV).

inv_rad_length(Z, A)

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²

Examples

A full set of example calculations and a momentum-scan plot are in examples.py:

python examples.py

This 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.

Muon dE/dx vs momentum


Unit conventions

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

Author

Milind V. Diwan — original Mathematica package (2023), Python port (2026).

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages