From 837b18e78be24da4632d5f8e2e3a99012f8dc92d Mon Sep 17 00:00:00 2001 From: tlatorre Date: Thu, 12 Dec 2019 09:47:01 -0600 Subject: update get_expected_photons() This commit updates get_expected_photons() to check if there are any shower photons or delta ray photons before adding them since if there aren't any shower photons or delta ray photons the PDF isn't constructed. --- src/fit.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src') 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. */ -- cgit