aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/fit.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/fit.c b/src/fit.c
index e1fe3b8..296fe2f 100644
--- a/src/fit.c
+++ b/src/fit.c
@@ -5243,13 +5243,16 @@ double get_expected_photons(int id, double T0, double distance, double cos_theta
}
/* Now, we add the expected number of shower photons. */
- nphotons += p->shower_photons*gsl_cdf_gamma_P(distance,p->pos_a,p->pos_b)*(1-interp1d(cos_theta,p->cos_theta,p->cdf_shower,p->n));
+ if (p->shower_photons)
+ nphotons += p->shower_photons*gsl_cdf_gamma_P(distance,p->pos_a,p->pos_b)*(1-interp1d(cos_theta,p->cos_theta,p->cdf_shower,p->n));
/* Now, we add the expected number of delta ray photons. */
- if (distance > p->range)
- nphotons += p->delta_ray_photons*(1-interp1d(cos_theta,p->cos_theta,p->cdf_delta,p->n));
- else
- nphotons += p->delta_ray_photons*distance/p->range*(1-interp1d(cos_theta,p->cos_theta,p->cdf_delta,p->n));
+ if (p->delta_ray_photons) {
+ if (distance > p->range)
+ nphotons += p->delta_ray_photons*(1-interp1d(cos_theta,p->cos_theta,p->cdf_delta,p->n));
+ else
+ nphotons += p->delta_ray_photons*distance/p->range*(1-interp1d(cos_theta,p->cos_theta,p->cdf_delta,p->n));
+ }
/* Finally we multiply by the average quantum efficiency and divide by 2 to
* account for the PMT coverage. */