aboutsummaryrefslogtreecommitdiff
path: root/src/test-likelihood.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/test-likelihood.c')
-rw-r--r--src/test-likelihood.c37
1 files changed, 22 insertions, 15 deletions
diff --git a/src/test-likelihood.c b/src/test-likelihood.c
index f0266b9..45bbfe2 100644
--- a/src/test-likelihood.c
+++ b/src/test-likelihood.c
@@ -21,7 +21,7 @@ void simulate_cos_theta_distribution(int N, gsl_histogram *h, double T, double t
* distribution is simulated as a gaussian distribution with standard
* deviation `theta0`. */
int i;
- double theta, phi, wavelength, u, qe, index, cerenkov_angle, dir[3], n[3], dest[3], E, p, beta, cos_theta;
+ double theta, phi, wavelength, u, qe, index, cerenkov_angle, dir[3], n[3], dest[3], E, p, beta, cos_theta, thetax, thetay;
i = 0;
while (i < N) {
@@ -35,7 +35,7 @@ void simulate_cos_theta_distribution(int N, gsl_histogram *h, double T, double t
/* Check to see if the photon was detected. */
if (genrand_real2() > qe) continue;
- index = get_index(HEAVY_WATER_DENSITY, wavelength, 10.0);
+ index = get_index_snoman_d2o(wavelength);
/* Calculate total energy */
E = T + MUON_MASS;
@@ -45,21 +45,28 @@ void simulate_cos_theta_distribution(int N, gsl_histogram *h, double T, double t
cerenkov_angle = acos(1/(index*beta));
/* Assuming the muon track is dominated by small angle scattering, the
- * angular distribution will be a Gaussian centered around 0 with a
- * standard deviation of `theta0`. Here, we draw a random angle from
- * this distribution. */
- theta = randn()*theta0;
-
- n[0] = sin(theta);
- n[1] = 0;
+ * angular distribution looks like the product of two uncorrelated
+ * Gaussian distributions with a standard deviation of `theta0` in the
+ * plane perpendicular to the track direction. Here, we draw two random
+ * angles and then compute the polar and azimuthal angle for the track
+ * direction. */
+ thetax = randn()*theta0;
+ thetay = randn()*theta0;
+
+ theta = sqrt(thetax*thetax + thetay*thetay);
+ phi = atan2(thetay,thetax);
+
+ n[0] = sin(theta)*cos(phi);
+ n[1] = sin(theta)*sin(phi);
n[2] = cos(theta);
- /* To compute the direction of the photon, we start with a vector in
- * the x-z plane which is offset from the track direction by the
- * Cerenkov angle and then rotate it around the track direction by a
- * random angle `phi`. */
- dir[0] = sin(cerenkov_angle + theta);
- dir[1] = 0;
+ /* To compute the direction of the photon, we start with a vector which
+ * has the same azimuthal angle as the track direction but is offset
+ * from the track direction in the polar angle by the Cerenkov angle
+ * and then rotate it around the track direction by a random angle
+ * `phi`. */
+ dir[0] = sin(cerenkov_angle + theta)*cos(phi);
+ dir[1] = sin(cerenkov_angle + theta)*sin(phi);
dir[2] = cos(cerenkov_angle + theta);
phi = genrand_real2()*2*M_PI;