aboutsummaryrefslogtreecommitdiff
path: root/src/path.h
blob: 449088f535a677a6bd410f7257e01a6a3fdfa51c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#ifndef PATH_H
#define PATH_H

#include <gsl/gsl_spline.h>
#include <stddef.h> /* for size_t */

/* Minimum value for the scattering RMS `theta0`.
 *
 * This is a bit of a hack to correct for the fact that we assume the
 * probability of a photon hitting a PMT is uniform across the face of a PMT.
 * By introducing a minimum value for the scattering RMS we broaden the angular
 * distribution such that it effectively averages across the face of a PMT.
 *
 * FIXME: Should do some tests to figure out what is the best value. */
#define MIN_THETA0 0.01

typedef double getKineticEnergyFunc(double x, void *params);

typedef struct path {
    double pos[3];
    double dir[3];
    double theta0;

    size_t n;

    double *s;
    double *x;
    double *y;
    double *z;
    double *T;
    double *t;
    double *dx;
    double *dy;
    double *dz;
} path;

double path_get_coefficient(unsigned int k, double *s, double *x, double theta0, size_t n);
path *path_init(double *pos, double *dir, double T0, double range, double theta0, getKineticEnergyFunc *fun, void *params, double *z1, double *z2, size_t n, double m);
void path_eval(path *p, double s, double *pos, double *dir, double *T, double *t, double *theta0);
void path_free(path *p);

#endif