diff options
-rw-r--r-- | src/likelihood.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/likelihood.c b/src/likelihood.c index b02aeef..90fdd82 100644 --- a/src/likelihood.c +++ b/src/likelihood.c @@ -1247,9 +1247,9 @@ double nll(event *ev, vertex *v, size_t n, double dx, int ns, const int fast, in * We calculate this here to make sure that we don't integrate outside * of the PSUP because otherwise there is no code to model the fact * that the PSUP is optically separated from the water outside. */ - if (!intersect_sphere(v[j].pos,v[j].dir,PSUP_RADIUS,&distance_to_psup)) { - /* If the particle is outside the PSUP we just assume it produces - * no light. */ + if (NORM(v[j].pos) > PSUP_RADIUS || !intersect_sphere(v[j].pos,v[j].dir,PSUP_RADIUS,&distance_to_psup)) { + /* If the particle is outside the PSUP or it doesn't intersect the + * PSUP we just assume it produces no light. */ fprintf(stderr, "particle doesn't intersect PSUP!\n"); continue; } |