DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
AVXThresholdProcessor.cpp
Go to the documentation of this file.
1
8
10
11namespace tpglibs {
12
14
15void
16AVXThresholdProcessor::configure(const nlohmann::json& config, const int16_t* plane_numbers)
17{
18 int16_t thresholds[16];
19 int16_t config_thresholds[3] = { config["plane0"], config["plane1"], config["plane2"] };
20
21 // Messy. Assumes plane numbers are in {0, 1, 2}.
22 for (int i = 0; i < 16; i++) {
23 thresholds[i] = config_thresholds[plane_numbers[i]];
24 }
25
26 m_threshold = _mm256_lddqu_si256(reinterpret_cast<__m256i*>(thresholds));
27}
28
29__m256i
30AVXThresholdProcessor::process(const __m256i& signal)
31{
32 __m256i mask = _mm256_cmpgt_epi16(signal, m_threshold);
33
34 // Essentially: mask[i] ? signal[i] : 0.
35 __m256i above_threshold = _mm256_blendv_epi8(_mm256_setzero_si256(), signal, mask);
36 return AVXProcessor::process(above_threshold);
37}
38
39} // 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.
void configure(const nlohmann::json &config, const int16_t *plane_numbers) override
Configures thresholds according to plane numbers.
__m256i process(const __m256i &signal) override
Masks channels with signals below threshold.