diff options
author | tlatorre <tlatorre@uchicago.edu> | 2019-12-12 09:47:01 -0600 |
---|---|---|
committer | tlatorre <tlatorre@uchicago.edu> | 2019-12-12 09:47:01 -0600 |
commit | 837b18e78be24da4632d5f8e2e3a99012f8dc92d (patch) | |
tree | 8ba9a82334ecbe2dd2d76f621c7ab75fcba6fadf | |
parent | 709ae1f3da9d0feb0b29ca22979ddd93605c7646 (diff) | |
download | sddm-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.
-rw-r--r-- | src/fit.c | 13 |
1 files changed, 8 insertions, 5 deletions
@@ -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. */ |