aboutsummaryrefslogtreecommitdiff
path: root/src/fit.c
diff options
context:
space:
mode:
authortlatorre <tlatorre@uchicago.edu>2018-11-30 16:02:14 -0600
committertlatorre <tlatorre@uchicago.edu>2018-11-30 16:02:14 -0600
commit7892fb4b0814308c6eb612b6d8434bd974af5908 (patch)
tree6fb15babc41f02df6fca30a404120de1831b4297 /src/fit.c
parent2207f442dd78a69ed0fc45321fcb4ea821d5d409 (diff)
downloadsddm-7892fb4b0814308c6eb612b6d8434bd974af5908.tar.gz
sddm-7892fb4b0814308c6eb612b6d8434bd974af5908.tar.bz2
sddm-7892fb4b0814308c6eb612b6d8434bd974af5908.zip
add ability to fit for multiple vertices
Diffstat (limited to 'src/fit.c')
-rw-r--r--src/fit.c31
1 files changed, 17 insertions, 14 deletions
diff --git a/src/fit.c b/src/fit.c
index 0634116..714a1cc 100644
--- a/src/fit.c
+++ b/src/fit.c
@@ -4978,33 +4978,36 @@ static struct startingParameters {
double nll(unsigned int n, const double *x, double *grad, void *params)
{
fitParams *fpars = (fitParams *) params;
- double T, theta, phi, t0;
- double pos[3], dir[3];
+ double theta, phi;
double fval;
- double z1[1], z2[1];
struct timeval tv_start, tv_stop;
+ vertex v;
if (stop) nlopt_force_stop(opt);
- T = x[0];
+ v.id = fpars->id;
- pos[0] = x[1];
- pos[1] = x[2];
- pos[2] = x[3];
+ v.T0 = x[0];
+
+ v.pos[0] = x[1];
+ v.pos[1] = x[2];
+ v.pos[2] = x[3];
theta = x[4];
phi = x[5];
- dir[0] = sin(theta)*cos(phi);
- dir[1] = sin(theta)*sin(phi);
- dir[2] = cos(theta);
+ v.dir[0] = sin(theta)*cos(phi);
+ v.dir[1] = sin(theta)*sin(phi);
+ v.dir[2] = cos(theta);
+
+ v.t0 = x[6];
- t0 = x[6];
+ v.z1[0] = x[7];
+ v.z2[0] = x[8];
- z1[0] = x[7];
- z2[0] = x[8];
+ v.n = 1;
gettimeofday(&tv_start, NULL);
- fval = nll_muon(fpars->ev, fpars->id, T, pos, dir, t0, z1, z2, 1, fpars->dx, fpars->dx_shower, fpars->fast);
+ fval = nll_muon(fpars->ev, &v, 1, fpars->dx, fpars->dx_shower, fpars->fast);
gettimeofday(&tv_stop, NULL);
long long elapsed = (tv_stop.tv_sec - tv_start.tv_sec)*1000 + (tv_stop.tv_usec - tv_start.tv_usec)/1000;