aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortlatorre <tlatorre@uchicago.edu>2018-07-05 14:29:17 -0400
committertlatorre <tlatorre@uchicago.edu>2018-07-05 14:29:17 -0400
commit82b66ad4a2674febf57c7a36a50e67dca3a871a5 (patch)
treedd91838bf2b41c95f9173ecbef887cb9963215d8
parent1ee8128fedd3e42f083389704d8be59eef6184bf (diff)
downloadsddm-82b66ad4a2674febf57c7a36a50e67dca3a871a5.tar.gz
sddm-82b66ad4a2674febf57c7a36a50e67dca3a871a5.tar.bz2
sddm-82b66ad4a2674febf57c7a36a50e67dca3a871a5.zip
add some comments and divide by the density
-rw-r--r--muon.c28
-rw-r--r--muon.h4
2 files changed, 26 insertions, 6 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;
}
diff --git a/muon.h b/muon.h
index bc7f03e..461339b 100644
--- a/muon.h
+++ b/muon.h
@@ -1,7 +1,7 @@
#ifndef MUON_H
#define MUON_H
-double get_range(double T);
-double get_dEdx(double T);
+double get_range(double T, double rho);
+double get_dEdx(double T, double rho);
#endif