aboutsummaryrefslogtreecommitdiff
path: root/src/misc.h
diff options
context:
space:
mode:
authortlatorre <tlatorre@uchicago.edu>2019-01-10 09:17:09 -0600
committertlatorre <tlatorre@uchicago.edu>2019-01-10 09:17:09 -0600
commit1df2bedf516d5fd9c305ba065bf4cf1007967e41 (patch)
treea2f84efe2c6a579d8d781fd773cde9b359d28d8d /src/misc.h
parent29f4c9d95b20b0e39b39bf7cee868a132768ccb6 (diff)
downloadsddm-1df2bedf516d5fd9c305ba065bf4cf1007967e41.tar.gz
sddm-1df2bedf516d5fd9c305ba065bf4cf1007967e41.tar.bz2
sddm-1df2bedf516d5fd9c305ba065bf4cf1007967e41.zip
update find_peaks algorithm
Previously, the algorithm used to find peaks was to search for all peaks in the Hough transform above some constant fraction of the highest peak. This algorithm could have issues finding smaller peaks away from the highest peak. The new algorithm instead finds the highest peak in the Hough transform and then recomputes the Hough transform ignoring all PMT hits within the Cerenkov cone of the first peak. The next peak is found from this transform and the process is iteratively repeated until a certain number of peaks are found. One disadvantage of this new system is that it will *always* find the same number of peaks and this will usually be greater than the actual number of rings in the event. This is not a problem though since when fitting the event we loop over all possible peaks and do a quick fit to determine the starting point and so false positives are OK because the real peaks will fit better during this quick fit. Another potential issue with this new method is that by rejecting all PMT hits within the Cerenkov cone of the first peak we could miss a second peak very close to the first peak. This is partially mitigated by the fact that when we loop over all possible combinations of the particle ids and directions we allow each peak to be used more than once. For example, when fitting for the hypothesis that an event is caused by two electrons and one muon and given two possible directions 1 and 2, we will fit for the following possible direction combinations: 1 1 1 1 1 2 1 2 1 1 2 2 2 2 1 2 2 2 Therefore if there is a second ring close to the first it is possible to fit it correctly since we will seed the quick fit with two particles pointing in the same direction. This commit also adds a few tests for new functions and changes the energy step size during the quick fit to 10% of the starting energy value.
Diffstat (limited to 'src/misc.h')
-rw-r--r--src/misc.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/misc.h b/src/misc.h
index 02df398..20197bb 100644
--- a/src/misc.h
+++ b/src/misc.h
@@ -31,5 +31,8 @@ size_t ipow(size_t base, size_t exp);
void product(size_t n, size_t r, size_t *result);
void unique_vertices(int *id, size_t n, size_t npeaks, size_t *result, size_t *nvertices);
void combinations_with_replacement(size_t n, size_t r, size_t *result, size_t *len);
+size_t argmax(double *a, size_t n);
+size_t argmin(double *a, size_t n);
+void get_dir(double *dir, double theta, double phi);
#endif