aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/likelihood.c2
-rw-r--r--src/scattering.c8
-rw-r--r--src/scattering.h2
-rw-r--r--src/test-likelihood.c3
4 files changed, 5 insertions, 10 deletions
diff --git a/src/likelihood.c b/src/likelihood.c
index 587349b..17cde5d 100644
--- a/src/likelihood.c
+++ b/src/likelihood.c
@@ -603,7 +603,7 @@ static void get_expected_charge(double beta, double theta0, double *pos, double
* pretty low, this is expected to be a very small effect. */
prob_sct = 1.0 - get_fsct_d2o(l_d2o)*get_fsct_h2o(l_h2o)*get_fsct_acrylic(AV_THICKNESS);
- charge = omega*FINE_STRUCTURE_CONSTANT*z*z*(1-(1/(beta*beta*n*n)))*get_probability(beta, cos_theta, theta0);
+ charge = omega*FINE_STRUCTURE_CONSTANT*z*z*(1-(1/(beta*beta*n*n)))*get_probability(beta, cos_theta, sin_theta, theta0);
*reflected = (1.0-prob_abs)*(1.0-prob_sct)*f_reflec*charge + prob_sct*charge;
diff --git a/src/scattering.c b/src/scattering.c
index 25b17d4..2512cda 100644
--- a/src/scattering.c
+++ b/src/scattering.c
@@ -191,14 +191,8 @@ void init_interpolation(void)
gsl_integration_cquad_workspace_free(w);
}
-double get_probability(double beta, double cos_theta, double theta0)
+double get_probability(double beta, double cos_theta, double sin_theta, double theta0)
{
- double sin_theta;
-
- /* Technically this isn't defined up to a sign, but it doesn't matter since
- * we are going to square it everywhere. */
- sin_theta = sqrt(1-pow(cos_theta,2));
-
/* Make sure theta0 is less than MAX_THETA0, otherwise it's possible that
* gsl_spline2d_eval() will quit. */
if (theta0 > MAX_THETA0) theta0 = MAX_THETA0;
diff --git a/src/scattering.h b/src/scattering.h
index 265f653..43e59f7 100644
--- a/src/scattering.h
+++ b/src/scattering.h
@@ -23,7 +23,7 @@
#define MAX_THETA0 1.0
void init_interpolation(void);
-double get_probability(double beta, double cos_theta, double theta0);
+double get_probability(double beta, double cos_theta, double sin_theta, double theta0);
double get_probability2(double beta);
double get_weighted_quantum_efficiency(void);
void free_interpolation(void);
diff --git a/src/test-likelihood.c b/src/test-likelihood.c
index 5bb7788..497a6eb 100644
--- a/src/test-likelihood.c
+++ b/src/test-likelihood.c
@@ -189,7 +189,8 @@ int main(int argc, char **argv)
double lo, hi;
gsl_histogram_get_range(h, i, &lo, &hi);
double cos_theta = (lo+hi)/2.0;
- h->bin[i] = get_probability(beta, cos_theta, theta0);
+ double sin_theta = sqrt(1-cos_theta*cos_theta);
+ h->bin[i] = get_probability(beta, cos_theta, sin_theta, theta0);
}
free_interpolation();