aboutsummaryrefslogtreecommitdiff
path: root/muon.c
diff options
context:
space:
mode:
Diffstat (limited to 'muon.c')
-rw-r--r--muon.c28
1 files changed, 24 insertions, 4 deletions
diff --git a/muon.c b/muon.c
index ab79666..e225526 100644
--- a/muon.c
+++ b/muon.c
@@ -132,23 +132,43 @@ err:
return -1;
}
-double get_range(double T)
+double get_range(double T, double rho)
{
+ /* Returns the approximate range a muon with kinetic energy `T` will travel
+ * in water before losing all of its energy. This range is interpolated
+ * based on data from the PDG which uses the continuous slowing down
+ * approximation.
+ *
+ * `T` should be in MeV, and `rho` should be in g/cm^3.
+ *
+ * Return value is in cm.
+ *
+ * See http://pdg.lbl.gov/2018/AtomicNuclearProperties/adndt.pdf. */
if (!initialized) {
if (init()) {
exit(1);
}
}
- return gsl_spline_eval(spline_range, T, acc_range);
+ return gsl_spline_eval(spline_range, T, acc_range)/rho;
}
-double get_dEdx(double T)
+
+double get_dEdx(double T, double rho)
{
+ /* Returns the approximate dE/dx for a muon in water with kinetic energy
+ * `T`.
+ *
+ *
+ * `T` should be in MeV and `rho` in g/cm^3.
+ *
+ * Return value is in MeV/cm.
+ *
+ * See http://pdg.lbl.gov/2018/AtomicNuclearProperties/adndt.pdf. */
if (!initialized) {
if (init()) {
exit(1);
}
}
- return gsl_spline_eval(spline_dEdx, T, acc_dEdx);
+ return gsl_spline_eval(spline_dEdx, T, acc_dEdx)/rho;
}