aboutsummaryrefslogtreecommitdiff
path: root/src/test-likelihood.c
diff options
context:
space:
mode:
authortlatorre <tlatorre@uchicago.edu>2018-08-27 10:59:31 -0500
committertlatorre <tlatorre@uchicago.edu>2018-08-27 10:59:31 -0500
commita84cfbe584580f08ca0a88f176cb49cdf801665e (patch)
tree9e51ec936b02e6bcdbe48fce43c1a70fcaf1b63e /src/test-likelihood.c
parent779266ec72a5c76ee52043ab3ae17479ba6a9788 (diff)
downloadsddm-a84cfbe584580f08ca0a88f176cb49cdf801665e.tar.gz
sddm-a84cfbe584580f08ca0a88f176cb49cdf801665e.tar.bz2
sddm-a84cfbe584580f08ca0a88f176cb49cdf801665e.zip
fix how multiple Coulomb scattering is treated
Previously I had been assuming that a particle undergoing many small angle Coulomb scatters had a track direction whose polar angle was a Gaussian. However, this was just due to a misunderstanding of the PDG section "Multiple scattering through small angles" in the "Passage of particles through matter" article. In fact, what is described by a Gaussian is the polar angle projected onto a plane. Therefore the distribution of the polar angle is actually: (1/(sqrt(2*pi)*theta0**2))*theta*exp(-theta**2/(2*theta0)) This commit updates the code in scattering.c to correctly calculate the probability that a photon is emitted at a particular angle. I also updated test-likelihood.c to simulate a track correctly.
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;