aboutsummaryrefslogtreecommitdiff
path: root/src/fit.c
diff options
context:
space:
mode:
authortlatorre <tlatorre@uchicago.edu>2019-12-12 09:47:01 -0600
committertlatorre <tlatorre@uchicago.edu>2019-12-12 09:47:01 -0600
commit837b18e78be24da4632d5f8e2e3a99012f8dc92d (patch)
tree8ba9a82334ecbe2dd2d76f621c7ab75fcba6fadf /src/fit.c
parent709ae1f3da9d0feb0b29ca22979ddd93605c7646 (diff)
downloadsddm-837b18e78be24da4632d5f8e2e3a99012f8dc92d.tar.gz
sddm-837b18e78be24da4632d5f8e2e3a99012f8dc92d.tar.bz2
sddm-837b18e78be24da4632d5f8e2e3a99012f8dc92d.zip
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.
Diffstat (limited to 'src/fit.c')
-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. */