ClusterFinderMT¶
-
template<typename FRAME_TYPE = uint16_t, typename PEDESTAL_TYPE = double, typename CT = int32_t>
class ClusterFinderMT¶ ClusterFinderMT is a multi-threaded version of ClusterFinder. It uses a producer-consumer queue to distribute the frames to the threads. The clusters are collected in a single output queue.
- Template Parameters:
FRAME_TYPE – type of the frame data
PEDESTAL_TYPE – type of the pedestal data
CT – type of the cluster data
Public Functions
-
inline ClusterFinderMT(Shape<2> image_size, Shape<2> cluster_size, PEDESTAL_TYPE nSigma = 5.0, size_t capacity = 2000, size_t n_threads = 3)¶
Construct a new ClusterFinderMT object.
- Parameters:
image_size – size of the image
cluster_size – size of the cluster
nSigma – number of sigma above the pedestal to consider a photon
capacity – initial capacity of the cluster vector. Should match expected number of clusters in a frame per frame.
n_threads – number of threads to use
-
inline ProducerConsumerQueue<ClusterVector<int>> *sink()¶
Return the sink queue where all the clusters are collected.
Warning
You need to empty this queue otherwise the cluster finder will wait forever
-
inline void start()¶
Start all processing threads.
-
inline void stop()¶
Stop all processing threads.
-
inline void sync()¶
Wait for all the queues to be empty. Mostly used for timing tests.
-
inline void push_pedestal_frame(NDView<FRAME_TYPE, 2> frame)¶
Push a pedestal frame to all the cluster finders. The frames is expected to be dark. No photon finding is done. Just pedestal update.
-
inline void find_clusters(NDView<FRAME_TYPE, 2> frame, uint64_t frame_number = 0)¶
Push the frame to the queue of the next available thread. Function returns once the frame is in a queue.
Note
Spin locks with a default wait if the queue is full.
-
inline void clear_pedestal()¶
-
inline auto pedestal(size_t thread_index = 0)¶
Return the pedestal currently used by the cluster finder.
- Parameters:
thread_index – index of the thread
-
inline auto noise(size_t thread_index = 0)¶
Return the noise currently used by the cluster finder.
- Parameters:
thread_index – index of the thread