From ebc95aa65925b06ce06c9db2791d8143448f2643 Mon Sep 17 00:00:00 2001 From: tlatorre Date: Tue, 28 Aug 2018 10:39:36 -0500 Subject: add path to the likelihood fit This commit updates the likelihood fit to use the KL path expansion. Currently, I'm just using one coefficient for the path in both x and y. --- src/path.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/path.c') diff --git a/src/path.c b/src/path.c index f09ec45..dff1dc7 100644 --- a/src/path.c +++ b/src/path.c @@ -36,6 +36,8 @@ path *path_init(double *pos, double *dir, double T0, double range, double theta0 path *p = malloc(sizeof(path)); + p->theta0 = theta0; + p->pos[0] = pos[0]; p->pos[1] = pos[1]; p->pos[2] = pos[2]; @@ -114,10 +116,13 @@ path *path_init(double *pos, double *dir, double T0, double range, double theta0 return p; } -void path_eval(path *p, double s, double *pos, double *dir, double *T, double *t) +void path_eval(path *p, double s, double *pos, double *dir, double *T, double *t, double *theta0) { double normal[3], k[3], tmp[3], phi; + if (s > p->spline[0]->x[p->spline[0]->size-1]) + s = p->spline[0]->x[p->spline[0]->size-1]; + tmp[0] = gsl_spline_eval(p->spline[0],s,p->acc[0]); tmp[1] = gsl_spline_eval(p->spline[1],s,p->acc[1]); tmp[2] = gsl_spline_eval(p->spline[2],s,p->acc[2]); @@ -146,6 +151,9 @@ void path_eval(path *p, double s, double *pos, double *dir, double *T, double *t normalize(tmp); rotate(dir,tmp,normal,phi); + + /* FIXME: This should be the *residual* scattering RMS. */ + *theta0 = p->theta0*sqrt(s); } void path_free(path *p) -- cgit