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

AVX signal processor: Estimates the pedestal and subtracts. More...

#include <AVXFrugalPedestalSubtractProcessor.hpp>

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

Public Member Functions

__m256i process (const __m256i &signal) override
 Estimate the pedestal using the given signal and subtract.
 
void configure (const nlohmann::json &config, const int16_t *plane_numbers) override
 Configure the accumulation limit according to plane number.
 
- 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.
 

Protected Attributes

__m256i m_pedestal = _mm256_set1_epi16(0x4000)
 Vector of estimated pedestals for each channel.
 
__m256i m_accum = _mm256_setzero_si256()
 Vector of counts that a channel's signal was above or below m_pedestal.
 
int16_t m_accum_limit {10}
 Count limit before committing to a pedestal shift.
 

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: Estimates the pedestal and subtracts.

Given a history of signals, this estimates the pedestal by shifting the current estimate when it is wrong in the same direction m_accum_limit times. For example, if the input signal is greater (less) than the estimated pedestal 10 (configurable) times in a row, then increment (decrement) the pedestal.

Definition at line 22 of file AVXFrugalPedestalSubtractProcessor.hpp.

Member Function Documentation

◆ configure()

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

Configure the accumulation limit according to plane number.

Parameters
configJSON config for the accumulation limits per plane.
plane_numbersArray of plane numbers. Gives the channels to apply the accumulation limit.

Implements tpglibs::AbstractProcessor< __m256i >.

Definition at line 15 of file AVXFrugalPedestalSubtractProcessor.cpp.

15 {
16 m_accum_limit = config["accum_limit"];
17}
int16_t m_accum_limit
Count limit before committing to a pedestal shift.

◆ process()

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

Estimate the pedestal using the given signal and subtract.

Parameters
signalA vector of channel signals.
Returns
The input signal minus the estimated pedestal.

Reimplemented from tpglibs::AVXProcessor.

Definition at line 19 of file AVXFrugalPedestalSubtractProcessor.cpp.

19 {
20 // Find the channels that are above or below the pedestal.
21 __m256i is_gt = _mm256_cmpgt_epi16(signal, m_pedestal);
22 __m256i is_lt = _mm256_cmpgt_epi16(m_pedestal, signal);
23
24 // Update m_accum.
25 __m256i to_add = _mm256_setzero_si256(); // Assumes equal to pedestal.
26 to_add = _mm256_blendv_epi8(to_add, _mm256_set1_epi16(1), is_gt); // Set the above pedestal case.
27 to_add = _mm256_blendv_epi8(to_add, _mm256_set1_epi16(-1), is_lt); // Set the below pedestal case.
28
29 m_accum = _mm256_add_epi16(m_accum, to_add);
30
31 // Check the accum limit condition.
32 is_gt = _mm256_cmpgt_epi16(m_accum, _mm256_set1_epi16(m_accum_limit)); // m_accum > +limit.
33 is_lt = _mm256_cmpgt_epi16(_mm256_set1_epi16(-1*m_accum_limit), m_accum); // m_accum < -limit = -limit > m_accum.
34
35 to_add = _mm256_setzero_si256();
36 to_add = _mm256_blendv_epi8(to_add, _mm256_set1_epi16(1), is_gt);
37 to_add = _mm256_blendv_epi8(to_add, _mm256_set1_epi16(-1), is_lt);
38
39 // Update pedestal.
40 m_pedestal = _mm256_adds_epi16(m_pedestal, to_add);
41
42 // Reset too high/low m_accum channels.
43 __m256i need_reset = _mm256_or_si256(is_lt, is_gt);
44 m_accum = _mm256_blendv_epi8(m_accum, _mm256_setzero_si256(), need_reset);
45
46 return AVXProcessor::process(_mm256_sub_epi16(signal, m_pedestal));
47}
__m256i m_pedestal
Vector of estimated pedestals for each channel.
__m256i m_accum
Vector of counts that a channel's signal was above or below m_pedestal.
virtual __m256i process(const __m256i &signal) override
Simple signal pass-through on __m256i type.

Member Data Documentation

◆ m_accum

__m256i tpglibs::AVXFrugalPedestalSubtractProcessor::m_accum = _mm256_setzero_si256()
protected

Vector of counts that a channel's signal was above or below m_pedestal.

Definition at line 28 of file AVXFrugalPedestalSubtractProcessor.hpp.

◆ m_accum_limit

int16_t tpglibs::AVXFrugalPedestalSubtractProcessor::m_accum_limit {10}
protected

Count limit before committing to a pedestal shift.

Definition at line 31 of file AVXFrugalPedestalSubtractProcessor.hpp.

31{10};

◆ m_pedestal

__m256i tpglibs::AVXFrugalPedestalSubtractProcessor::m_pedestal = _mm256_set1_epi16(0x4000)
protected

Vector of estimated pedestals for each channel.

Definition at line 25 of file AVXFrugalPedestalSubtractProcessor.hpp.


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