DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
tpglibs::AVXThresholdProcessor Class Reference

AVX signal processor: Passes signals above a threshold. More...

#include <AVXThresholdProcessor.hpp>

Inheritance diagram for tpglibs::AVXThresholdProcessor:
[legend]
Collaboration diagram for tpglibs::AVXThresholdProcessor:
[legend]

Public Member Functions

__m256i process (const __m256i &signal) override
 Masks channels with signals below threshold.
 
void configure (const nlohmann::json &config, const int16_t *plane_numbers) override
 Configures thresholds according to plane numbers.
 
- Public Member Functions inherited from tpglibs::AVXProcessor
- Public Member Functions inherited from tpglibs::AbstractProcessor< __m256i >
virtual ~AbstractProcessor ()=default
 
void set_next_processor (std::shared_ptr< AbstractProcessor< __m256i > > next_processor)
 Setter for next processor.
 

Private Attributes

__m256i m_threshold
 Vector of thresholds to apply.
 

Additional Inherited Members

- Public Types inherited from tpglibs::AbstractProcessor< __m256i >
using signal_type_t
 Signal type to process on. General __m256i.
 

Detailed Description

AVX signal processor: Passes signals above a threshold.

Definition at line 17 of file AVXThresholdProcessor.hpp.

Member Function Documentation

◆ configure()

void tpglibs::AVXThresholdProcessor::configure ( const nlohmann::json & config,
const int16_t * plane_numbers )
overridevirtual

Configures thresholds according to plane numbers.

Parameters
configJSON containing thresholds for the 3 planes.
plane_numbersArray of plane numbers. Gives the channels to apply the appropriate thresholds.

Implements tpglibs::AbstractProcessor< __m256i >.

Definition at line 15 of file AVXThresholdProcessor.cpp.

15 {
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}
__m256i m_threshold
Vector of thresholds to apply.

◆ process()

__m256i tpglibs::AVXThresholdProcessor::process ( const __m256i & signal)
overridevirtual

Masks channels with signals below threshold.

Parameters
signalVector of channel signals to process.
Returns
A vector of channel signals. Signals that were below threshold are set to 0.

Reimplemented from tpglibs::AVXProcessor.

Definition at line 27 of file AVXThresholdProcessor.cpp.

27 {
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}
virtual __m256i process(const __m256i &signal) override
Simple signal pass-through on __m256i type.

Member Data Documentation

◆ m_threshold

__m256i tpglibs::AVXThresholdProcessor::m_threshold
private

Vector of thresholds to apply.

Definition at line 19 of file AVXThresholdProcessor.hpp.


The documentation for this class was generated from the following files: