Fix spot finding + fix FPGA network LEDs behavior

This commit is contained in:
2023-12-16 09:20:46 +01:00
parent e88f00f090
commit d66b6b949d
14 changed files with 102 additions and 27 deletions

View File

@@ -7,7 +7,8 @@
StrongPixelSet::StrongPixelSet(const DiffractionExperiment &experiment)
: xpixel(experiment.GetXPixelsNum()),
ypixel(experiment.GetYPixelsNum()),
strong_pixel_vector(experiment.GetPixelsNum(), false) {
strong_pixel_vector(experiment.GetPixelsNum(), false),
strong_pixel_count(0) {
}
void StrongPixelSet::AddStrongPixel(uint16_t col, uint16_t line, int32_t photons) {
@@ -128,6 +129,14 @@ size_t StrongPixelSet::Common(const StrongPixelSet &set) const {
void StrongPixelSet::ReadFPGAOutput(const DiffractionExperiment& experiment,
const DeviceOutput &output,
uint16_t module) {
strong_pixel_count += output.spot_finding_result.strong_pixel_count;
// Too many strong pixels will kill performance in data processing, so protection is needed
// Also if there are no strong pixels, there is no point in looking for them
if ((output.spot_finding_result.strong_pixel_count == 0) ||
(output.spot_finding_result.strong_pixel_count > max_strong_pixels_fpga))
return;
auto out_ptr = (uint32_t *) output.spot_finding_result.strong_pixel;
for (int i = 0; i < RAW_MODULE_SIZE / (8 * sizeof(out_ptr[0])); i++) {
if (out_ptr[i]) {
@@ -141,3 +150,7 @@ void StrongPixelSet::ReadFPGAOutput(const DiffractionExperiment& experiment,
}
}
}
uint32_t StrongPixelSet::GetStrongPixelCount() const {
return strong_pixel_count;
}