aboutsummaryrefslogtreecommitdiff
path: root/src/likelihood.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/likelihood.c')
-rw-r--r--src/likelihood.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/likelihood.c b/src/likelihood.c
index f78eee8..99258a9 100644
--- a/src/likelihood.c
+++ b/src/likelihood.c
@@ -146,7 +146,7 @@ double get_total_charge_approx(double T0, double *pos, double *dir, muon_energy
*
* `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, theta, x, z, s, a, b, beta, E, p, T, omega, cos_theta_cerenkov, theta_cerenkov, n_d2o, n_h2o, sin_theta, E0, p0, beta0, f, cos_theta_pmt, absorption_length_h2o, absorption_length_d2o, l_h2o, l_d2o, wavelength0;
+ double pmt_dir[3], tmp[3], R, cos_theta, x, z, s, a, b, beta, E, p, 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, l_h2o, l_d2o, wavelength0;
/* Calculate beta at the start of the track. */
E0 = T0 + MUON_MASS;
@@ -163,15 +163,14 @@ double get_total_charge_approx(double T0, double *pos, double *dir, muon_energy
/* Calculate the cosine of the angle between the track direction and the
* vector to the PMT at the start of the track. */
cos_theta = DOT(dir,pmt_dir);
- /* Compute the angle between the track direction and the PMT. */
- theta = acos(cos_theta);
+ sin_theta = sqrt(1-pow(cos_theta,2));
/* Compute the Cerenkov angle at the start of the track. */
wavelength0 = 400.0;
n_d2o = get_index_snoman_d2o(wavelength0);
n_h2o = get_index_snoman_h2o(wavelength0);
cos_theta_cerenkov = 1/(n_d2o*beta0);
- theta_cerenkov = acos(cos_theta_cerenkov);
+ sin_theta_cerenkov = sqrt(1-pow(cos_theta_cerenkov,2));
/* Now, we compute the distance along the track where the PMT is at the
* Cerenkov angle.
@@ -179,7 +178,7 @@ double get_total_charge_approx(double T0, double *pos, double *dir, muon_energy
* Note: This formula comes from using the "Law of sines" where the three
* vertices of the triangle are the starting position of the track, the
* point along the track that we want to find, and the PMT position. */
- s = R*sin(theta_cerenkov-theta)/sqrt(1-pow(cos_theta_cerenkov,2));
+ s = R*(sin_theta_cerenkov*cos_theta - cos_theta_cerenkov*sin_theta)/sin_theta_cerenkov;
/* Make sure that the point is somewhere along the track between 0 and
* `smax`. */