diff options
author | tlatorre <tlatorre@uchicago.edu> | 2019-05-29 12:13:21 -0400 |
---|---|---|
committer | tlatorre <tlatorre@uchicago.edu> | 2019-05-29 12:13:21 -0400 |
commit | bf936151536484c266707f77ef7ef820668bb0ce (patch) | |
tree | 69bc5a6b6ac2fd049efd337913234298856717a7 /src/optics.c | |
parent | 9b76e490e74c827f63424133bb2e45f01cb1ea55 (diff) | |
download | sddm-bf936151536484c266707f77ef7ef820668bb0ce.tar.gz sddm-bf936151536484c266707f77ef7ef820668bb0ce.tar.bz2 sddm-bf936151536484c266707f77ef7ef820668bb0ce.zip |
add get_avg_index_{d2o,h2o} functions
Diffstat (limited to 'src/optics.c')
-rw-r--r-- | src/optics.c | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/src/optics.c b/src/optics.c index 89bee66..7782678 100644 --- a/src/optics.c +++ b/src/optics.c @@ -29,11 +29,8 @@ char optics_err[256]; /* Index of refraction in water and heavy water averaged over the Cerenkov - * spectrum and the PMT quantum efficiency. - * - * Set these to 0.0 so that it's obvious if someone forgets to call - * optics_init() before using them. */ -double avg_index_h2o = 0.0, avg_index_d2o = 0.0; + * spectrum and the PMT quantum efficiency. */ +static double avg_index_h2o = 0.0, avg_index_d2o = 0.0; /* Absorption coefficients for H2O, D2O, and acrylic as a function of * wavelength from SNOMAN. @@ -113,6 +110,26 @@ static double RIND_ACRYLIC_C3 = 0.32; * From http://pdg.lbl.gov/2018/reviews/rpp2018-rev-phys-constants.pdf. */ static double HC = 1.239841973976e3; +double get_avg_index_d2o(void) +{ + if (!initialized) { + fprintf(stderr, "average index in d2o hasn't been initialized!\n"); + exit(1); + } + + return avg_index_d2o; +} + +double get_avg_index_h2o(void) +{ + if (!initialized) { + fprintf(stderr, "average index in h2o hasn't been initialized!\n"); + exit(1); + } + + return avg_index_h2o; +} + double get_index(double p, double wavelength, double T) { /* Returns the index of refraction of pure water for a given density, |