aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortlatorre <tlatorre@uchicago.edu>2018-10-21 11:14:56 -0500
committertlatorre <tlatorre@uchicago.edu>2018-10-21 11:14:56 -0500
commit8ae8d1092fe5a875cff50b5ca18eb7d676f55deb (patch)
tree1fd0c13a5e1c5a52b85ddfef17245961e17b0f83 /src
parentd99646d0cc6632b53a4b68072c2c33c1d3f7b977 (diff)
downloadsddm-8ae8d1092fe5a875cff50b5ca18eb7d676f55deb.tar.gz
sddm-8ae8d1092fe5a875cff50b5ca18eb7d676f55deb.tar.bz2
sddm-8ae8d1092fe5a875cff50b5ca18eb7d676f55deb.zip
fix use of uninitialized variables
Diffstat (limited to 'src')
-rw-r--r--src/likelihood.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/likelihood.c b/src/likelihood.c
index 7a42ed9..a57346b 100644
--- a/src/likelihood.c
+++ b/src/likelihood.c
@@ -167,7 +167,8 @@ static double get_expected_charge(double x, double beta, double theta0, double *
cos_theta_pmt = DOT(pmt_dir,pmt_normal);
- if (cos_theta_pmt > 0) return 0;
+ *reflected = 0.0;
+ if (cos_theta_pmt > 0) return 0.0;
/* Calculate the cosine of the angle between the track direction and the
* vector to the PMT. */
@@ -183,7 +184,8 @@ static double get_expected_charge(double x, double beta, double theta0, double *
n = n_h2o;
}
- if (beta < 1/n) return 0;
+ *reflected = 0.0;
+ if (beta < 1/n) return 0.0;
theta_pmt = acos(-cos_theta_pmt);
f_reflec = get_weighted_pmt_reflectivity(theta_pmt);
@@ -402,6 +404,8 @@ double get_total_charge_approx(double T0, double *pos, double *dir, particle *p,
mom = sqrt(E*E - p->mass*p->mass);
beta = mom/E;
+ *t = 0.0;
+ *mu_reflected = 0.0;
if (beta < 1/n_d2o) return 0.0;
/* `prob` is the number of photons emitted per cm by the particle at a
@@ -417,6 +421,10 @@ double get_total_charge_approx(double T0, double *pos, double *dir, particle *p,
cos_theta_pmt = DOT(pmt_dir,pmts[i].normal)/NORM(pmt_dir);
+ *t = 0.0;
+ *mu_reflected = 0.0;
+ if (cos_theta_pmt > 0) return 0.0;
+
/* Calculate the sine of the angle between the track direction and the PMT
* at the position `s` along the track. */
cos_theta = DOT(dir,pmt_dir)/NORM(pmt_dir);