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::AbstractProcessor< __m256i >
virtual ~AbstractProcessor ()=default
virtual void configure_internal_state_collection (const nlohmann::json &)
 No-op: state monitoring disabled at build time.
void set_next_processor (std::shared_ptr< AbstractProcessor< __m256i > > next_processor)
 Setter for next processor.
std::shared_ptr< AbstractProcessor< __m256i > > get_next_processor ()
 Getter for next processor.
virtual std::vector< std::string > get_requested_internal_state_names () const
 Get the names of requested internal states (delegates to registry).
virtual ProcessorMetricArray< std::array< int16_t, 16 > > read_internal_states_as_integer_array ()

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 16 of file AVXThresholdProcessor.cpp.

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}
__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 30 of file AVXThresholdProcessor.cpp.

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}
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 20 of file AVXThresholdProcessor.hpp.


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