aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortlatorre <tlatorre@uchicago.edu>2018-10-19 14:03:23 -0500
committertlatorre <tlatorre@uchicago.edu>2018-10-19 14:03:23 -0500
commit3fd77cfe01a585d4f5f5d41be1deb6016190467b (patch)
tree2b19d9392b3c0b4383e2388cc97e9459f12c2e6b /src
parent2a6911cfe04e59fe5157cbb2005629a3a3d635fe (diff)
downloadsddm-3fd77cfe01a585d4f5f5d41be1deb6016190467b.tar.gz
sddm-3fd77cfe01a585d4f5f5d41be1deb6016190467b.tar.bz2
sddm-3fd77cfe01a585d4f5f5d41be1deb6016190467b.zip
speed up get_total_charge_approx()
Diffstat (limited to 'src')
-rw-r--r--src/likelihood.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/likelihood.c b/src/likelihood.c
index 8e3f983..3ee8445 100644
--- a/src/likelihood.c
+++ b/src/likelihood.c
@@ -332,7 +332,7 @@ double get_total_charge_approx(double T0, double *pos, double *dir, particle *p,
*
* `smax` is currently calculated as the point where the particle velocity
* drops to 0.8 times the speed of light. */
- double pmt_dir[3], tmp[3], R, cos_theta, x, z, s, a, b, beta, E, mom, T, omega, cos_theta_cerenkov, sin_theta_cerenkov, n_d2o, n_h2o, sin_theta, E0, p0, beta0, f, cos_theta_pmt, absorption_length_h2o, absorption_length_d2o, absorption_length_acrylic, l_h2o, l_d2o, l_acrylic, wavelength0, f_reflected;
+ double pmt_dir[3], tmp[3], R, cos_theta, x, z, s, a, b, beta, E, mom, T, omega, cos_theta_cerenkov, sin_theta_cerenkov, n_d2o, n_h2o, sin_theta, E0, p0, beta0, f, cos_theta_pmt, theta_pmt, absorption_length_h2o, absorption_length_d2o, absorption_length_acrylic, l_h2o, l_d2o, l_acrylic, wavelength0, f_reflected;
/* Calculate beta at the start of the track. */
E0 = T0 + p->mass;
@@ -429,8 +429,9 @@ double get_total_charge_approx(double T0, double *pos, double *dir, particle *p,
double frac = sqrt(2)*n_d2o*x*beta0*theta0;
- f = get_weighted_pmt_response(acos(-cos_theta_pmt));
- f_reflected = get_weighted_pmt_reflectivity(acos(-cos_theta_pmt));
+ theta_pmt = acos(-cos_theta_pmt);
+ f = get_weighted_pmt_response(theta_pmt);
+ f_reflected = get_weighted_pmt_reflectivity(theta_pmt);
absorption_length_d2o = get_absorption_length_snoman_d2o(wavelength0);
absorption_length_h2o = get_absorption_length_snoman_h2o(wavelength0);