aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortlatorre <tlatorre@uchicago.edu>2018-11-25 11:56:26 -0600
committertlatorre <tlatorre@uchicago.edu>2018-11-25 11:56:26 -0600
commit4372a0bb54b374061e1b00bca9da45aa0325e7c5 (patch)
tree53221e1c7c9226410189d0e4e50d81852ce86f86
parent5a730f68491ddf0fa4d83c779eca8d44b64bbe76 (diff)
downloadsddm-4372a0bb54b374061e1b00bca9da45aa0325e7c5.tar.gz
sddm-4372a0bb54b374061e1b00bca9da45aa0325e7c5.tar.bz2
sddm-4372a0bb54b374061e1b00bca9da45aa0325e7c5.zip
add a separate `dx_shower` parameter for the spacing of the shower track integral
-rw-r--r--src/fit.c5
-rw-r--r--src/likelihood.c4
-rw-r--r--src/likelihood.h2
3 files changed, 7 insertions, 4 deletions
diff --git a/src/fit.c b/src/fit.c
index 6ac97f1..eac7c79 100644
--- a/src/fit.c
+++ b/src/fit.c
@@ -39,6 +39,7 @@ static size_t iter;
typedef struct fitParams {
event *ev;
double dx;
+ double dx_shower;
int fast;
int print;
int id;
@@ -5003,7 +5004,7 @@ double nll(unsigned int n, const double *x, double *grad, void *params)
z2[0] = x[8];
gettimeofday(&tv_start, NULL);
- fval = nll_muon(fpars->ev, fpars->id, T, pos, dir, t0, z1, z2, 1, fpars->dx, fpars->fast);
+ fval = nll_muon(fpars->ev, fpars->id, T, pos, dir, t0, z1, z2, 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;
@@ -5212,6 +5213,7 @@ int fit_event(event *ev, double *xopt, double *fmin, int id)
* maximum number of function evaluations to 100, and the relative
* tolerance on the numerical integration to 10%. */
fpars.dx = 1.0;
+ fpars.dx_shower = 1.0;
fpars.fast = 1;
fpars.print = 0;
nlopt_set_ftol_abs(opt, 1.0);
@@ -5305,6 +5307,7 @@ int fit_event(event *ev, double *xopt, double *fmin, int id)
/* Now, we do the "real" minimization. */
fpars.dx = 1.0;
+ fpars.dx_shower = 1.0;
fpars.fast = 0;
fpars.print = 1;
nlopt_set_ftol_abs(opt, 1e-5);
diff --git a/src/likelihood.c b/src/likelihood.c
index d0ab20f..dcf681a 100644
--- a/src/likelihood.c
+++ b/src/likelihood.c
@@ -705,7 +705,7 @@ static double getKineticEnergy(double x, void *p)
return particle_get_energy(x, (particle *) p);
}
-double nll_muon(event *ev, int id, double T0, double *pos, double *dir, double t0, double *z1, double *z2, size_t n, double dx, int fast)
+double nll_muon(event *ev, int id, double T0, double *pos, double *dir, double t0, double *z1, double *z2, size_t n, double dx, double dx_shower, int fast)
{
/* Returns the negative log likelihood for event `ev` given a particle with
* id `id`, initial kinetic energy `T0`, position `pos`, direction `dir` and
@@ -790,7 +790,7 @@ double nll_muon(event *ev, int id, double T0, double *pos, double *dir, double t
/* Number of points to sample along the longitudinal direction for
* the electromagnetic shower. */
- npoints_shower = (size_t) ((xhi-xlo)/dx + 0.5);
+ npoints_shower = (size_t) ((xhi-xlo)/dx_shower + 0.5);
if (npoints_shower < MIN_NPOINTS) npoints_shower = MIN_NPOINTS;
diff --git a/src/likelihood.h b/src/likelihood.h
index f087e90..39b9028 100644
--- a/src/likelihood.h
+++ b/src/likelihood.h
@@ -64,6 +64,6 @@ typedef struct particle {
particle *particle_init(int id, double T0, size_t n);
double particle_get_energy(double x, particle *p);
void particle_free(particle *p);
-double nll_muon(event *ev, int id, double T0, double *pos, double *dir, double t0, double *z1, double *z2, size_t n, double dx, int fast);
+double nll_muon(event *ev, int id, double T0, double *pos, double *dir, double t0, double *z1, double *z2, size_t n, double dx, double dx_shower, int fast);
#endif