Skip to content

The RawDataContainer that marks the end of a scan iteration for the Histogrammer

Alex Toldaiev requested to merge otoldaie/YARR:devel_LoopEndInHistogrammer into devel

StdDataLoop sends an empty RawDataContainer with bool LoopStatus::is_end_of_iteration set to true, that marks the end of the scan iteration in the stream of RX data. From this marker RawDataContainer, the data processors create an empty FrontEndData with the same LoopStatus. The histogrammer publishes its histograms only when it sees the end of iteration marker, and it ignores the data with this is_end_of_iteration.

Motivation: the StdDataLoop that is based on the feedback from event processing cannot know how many events it received in RawData from RxCore and pushed to data processors until the processors parse the RawData and return the feedback to StdDataLoop. It can decide whether the iteration data-taking has finished only when it has already sent all the data for processing. Therefore StdDataLoop has to send an additional empty container that serves as a marker of the end of the scan iteration for all processing threads, i.e. the data processors and the histogrammer.

Right now, this synchronization of the processing threads to scan iterations happens implicitly, as a scan iteration sends only 1 RawDataContainer for processing.

The Histogrammer calls create on the algorithms only when it is processing a new iteration, which is defined by bool is_new_iteration. On publish it resets the bool to true.

Updated the tests to include this logic. Added a test specifically for the operation of LoopStatus END in the Histogrammer: test_histogrammer.cpp.

modified:   src/libYarr/HistogramAlgorithm.cpp
modified:   src/libYarr/include/HistogramAlgorithm.h
modified:   src/libYarr/include/LoopStatus.h
modified:   src/libYarr/tests/CMakeLists.txt
new file:   src/libYarr/tests/test_histogrammer.cpp
modified:   src/libYarr/tests/test_hits_per_event.cpp
modified:   src/libYarr/tests/test_l13d.cpp
modified:   src/libYarr/tests/test_l1dist.cpp
modified:   src/libYarr/tests/test_occupancy.cpp
modified:   src/libYarr/tests/test_tot3d.cpp
modified:   src/libYarr/tests/test_tot_dist.cpp

Merge request reports