DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
AVXThresholdProcessor.cpp
Go to the documentation of this file.
1
10
11namespace tpglibs {
12
13REGISTER_AVXPROCESSOR_CREATOR("AVXThresholdProcessor", AVXThresholdProcessor)
14
15void AVXThresholdProcessor::configure(const nlohmann::json& config, const int16_t* plane_numbers) {
16 int16_t thresholds[16];
17 int16_t config_thresholds[3] = {config["plane0"], config["plane1"], config["plane2"]};
18
19 // Messy. Assumes plane numbers are in {0, 1, 2}.
20 for (int i = 0; i < 16; i++) {
21 thresholds[i] = config_thresholds[plane_numbers[i]];
22 }
23
24 m_threshold = _mm256_lddqu_si256(reinterpret_cast<__m256i*>(thresholds));
25}
26
27__m256i AVXThresholdProcessor::process(const __m256i& signal) {
28 __m256i mask = _mm256_cmpgt_epi16(signal, m_threshold);
29
30 // Essentially: mask[i] ? signal[i] : 0.
31 __m256i above_threshold = _mm256_blendv_epi8(_mm256_setzero_si256(), signal, mask);
32 return AVXProcessor::process(above_threshold);
33}
34
35} // namespace tpglibs
#define REGISTER_AVXPROCESSOR_CREATOR(processor_name, processor_class)
Factory registration macro.
virtual __m256i process(const __m256i &signal) override
Simple signal pass-through on __m256i type.
AVX signal processor: Passes signals above a threshold.
__m256i m_threshold
Vector of thresholds to apply.
__m256i process(const __m256i &signal) override
Masks channels with signals below threshold.