diff --git a/image_analysis/spot_finding/StrongPixelSet.cpp b/image_analysis/spot_finding/StrongPixelSet.cpp index c12e12fc..439d3050 100644 --- a/image_analysis/spot_finding/StrongPixelSet.cpp +++ b/image_analysis/spot_finding/StrongPixelSet.cpp @@ -10,16 +10,16 @@ #include "StrongPixelSet.h" StrongPixelSet::StrongPixelSet() : strong_pixel_count(0) { - pixels.reserve(UINT16_MAX); + pixels.reserve(max_strong_pixel_per_module); } void StrongPixelSet::AddStrongPixel(uint16_t col, uint16_t line, int32_t photons) { pixels.push_back(strong_pixel{.col = col, .line = line, .counts = photons}); + ++strong_pixel_count; } bool is_far_enough(strong_pixel pixel0, strong_pixel pixel1) { - auto line_diff = pixel0.line - pixel1.line; - return line_diff > 1 || line_diff < -1; + return (pixel1.line - pixel0.line) > 1; } bool is_adjacent(strong_pixel pixel0, strong_pixel pixel1) { @@ -30,11 +30,8 @@ bool is_adjacent(strong_pixel pixel0, strong_pixel pixel1) { uint32_t StrongPixelSet::find_root(uint32_t e) { uint32_t r = e; - //assert(r < L.size()); - while (L[r] != r) { + while (L[r] != r) r = L[r]; - //assert(r < L.size()); - } return r; } @@ -42,11 +39,9 @@ uint32_t StrongPixelSet::make_union(uint32_t e1, uint32_t e2) { uint32_t e; if (e1 < e2) { e = e1; - //assert(e2 < L.size()); L[e2] = e; } else { e = e2; - //assert(e1 < L.size()); L[e1] = e; } return e;