aboutsummaryrefslogtreecommitdiff
path: root/src/fit.c
AgeCommit message (Collapse)Author
2018-09-20add git SHA1 hash to output filetlatorre
2018-09-20add time elapsed to the output filetlatorre
2018-09-20add a command line option to only fit the first eventtlatorre
This commit adds the ability to run the fit program with the --skip-second-event flag to only fit the first event after a MAST bank. This way we avoid fitting secondaries like Michel electrons when fitting MC events.
2018-09-20add absorption lengths for D2O and H2O weighted by the Cerenkov spectrum and ↵tlatorre
the quantum efficiency
2018-09-19change output file format to YAMLtlatorre
2018-09-18stop fitting when the likelihood difference is less than 1e-2tlatorre
2018-09-18add free_charge() to free memory used to interpolate the charge distributionstlatorre
2018-09-18add a ctrl-c handlertlatorre
2018-09-13fix width formatting for t0tlatorre
2018-09-12small updates to speed things uptlatorre
2018-09-12update the starting parameterstlatorre
2018-09-11only print the likelihood value once for each iteration during the "quick" ↵tlatorre
minimization phase
2018-09-11fix the energy and position when doing the "quick" minimizationstlatorre
2018-09-11switch order of expressions to avoid a valgrind warningtlatorre
2018-09-11add PMT responsetlatorre
This commit adds code to read in the PMT response from the PMTR bank from SNOMAN. This file was used for the grey disk model in SNOMAN and was created using a full 3D simulation of the PMT and concentrator. Since the PMT response in SNOMAN included the quantum efficiency of the PMT, we have to divide that out to get just the PMT response independent of the quantum efficiency. I also updated the likelihood calculation to use the pmt response. Currently the energy is being fit too high which I think will improve when we update the solid angle calculation to use the radius of the concentrator instead of the PMT.
2018-09-10add a fast likelihood functiontlatorre
This commit adds a fast function to calculate the expected number of PE at a PMT without numerically integrating over the track. This calculation is *much* faster than integrating over the track (~30 ms compared to several seconds) and so we use it during the "quick" minimization phase of the fit to quickly find the best position.
2018-09-04update kinetic energy step size to 2% of initial kinetic energy guesstlatorre
2018-09-04update fit to guess energy, direction, and t0tlatorre
This commit updates the initial guess for the energy using a simple heuristic of ~6 hits/MeV. I also updated the initial phase where we do a bunch of "quick" minimizations to loop over a series of starting positions and automatically calculate the approximate direction and t0 for the event.
2018-08-31start by doing a series of "quick" minimizationstlatorre
This commit updates the fit_event function to first do a series of "quick" minimizations to try and find a good set of starting parameters for the "real" fit. I also updated the bounds on theta and phi since having hard bounds on these angle coordinates could prevent the fitter from finding the minimum.
2018-08-31add epsrel argument to likelihood functiontlatorre
2018-08-31update the lower bound for the energy in the fittlatorre
2018-08-31update the criterion for the fit convergencetlatorre
2018-08-31update likelihood check to 1e-5 since that's what we pass to nlopttlatorre
2018-08-31fit in a do while loop until the fit converges to the same likelihood valuetlatorre
2018-08-31add option to save fit results to a text filetlatorre
2018-08-31update printf arguments to keep output alignedtlatorre
2018-08-31print out how long the likelihood function takestlatorre
2018-08-28add path to the likelihood fittlatorre
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.
2018-08-14fix ev pointer bugtlatorre
2018-08-14update pmt hit array in event struct to be MAX_PMTS longtlatorre
2018-08-14add lower and upper bounds for the fit parameterstlatorre
2018-08-14add function to fit event and clear event after each fittlatorre
2018-08-14set stopping criteratlatorre
2018-08-14update the printf format string for the fit parameterstlatorre
2018-08-14update fit to use nlopt for minimizationtlatorre
The GSL library only has the Nelder Mead Simplex algorithm for doing multidimensional minimization without gradient information. The nlopt library has lots of different minimization algorithms so it's easier to switch between them to see which one works best.
2018-08-14fix how the RMS scattering angle is calculatedtlatorre
The RMS scattering angle calculation comes from Equation 33.15 in the PDG article on the passage of particles through matter. It's not entirely obvious if this equation is correct for a long track. It seems like it should be integrated along the track to add up the contributions at different energies, but it's not obvious how to do that with the log term. In any case, the way I was previously calculating it (by using the momentum and velocity at each point along the track) was definitely wrong. I will try this out and perhaps try to integrate it later.
2018-08-14move everything to src directorytlatorre