aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/likelihood.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/likelihood.c b/src/likelihood.c
index 5ca9c8d..4a368c6 100644
--- a/src/likelihood.c
+++ b/src/likelihood.c
@@ -355,7 +355,11 @@ int get_delta_ray_weights(particle *p, double range, double distance_to_psup, do
* compute cos(theta) for each of these values, map that value back to x,
* and then compute the weight associated with that point. */
for (i = 0; i < n + 1; i++) {
- cdf = cdf1 + i*delta;
+ if (i < n)
+ cdf = cdf1 + i*delta;
+ else
+ cdf = cdf2;
+
cos_theta = gsl_spline_eval(p->spline_delta,cdf,p->acc_delta);
xcdf = cos_theta_to_x(cos_theta,R,cos_gamma,sin_gamma);
@@ -446,7 +450,11 @@ int get_shower_weights(particle *p, double distance_to_psup, double *x, double *
* compute cos(theta) for each of these values, map that value back to x,
* and then compute the weight associated with that point. */
for (i = 0; i < n + 1; i++) {
- cdf = cdf1 + i*delta;
+ if (i < n)
+ cdf = cdf1 + i*delta;
+ else
+ cdf = cdf2;
+
cos_theta = gsl_spline_eval(p->spline_shower,cdf,p->acc_shower);
xcdf = cos_theta_to_x(cos_theta,R,cos_gamma,sin_gamma);