DUNE-DAQ
DUNE Trigger and Data Acquisition software
Toggle main menu visibility
Loading...
Searching...
No Matches
dunedaq
sourcecode
tpglibs
src
NaiveRunSumProcessor.cpp
Go to the documentation of this file.
1
8
9
#include "
tpglibs/NaiveRunSumProcessor.hpp
"
10
11
namespace
tpglibs
{
12
13
REGISTER_NAIVEPROCESSOR_CREATOR
(
"NaiveRunSumProcessor"
,
NaiveRunSumProcessor
)
14
15
void
16
NaiveRunSumProcessor::configure
(
const
nlohmann::json& config,
const
int16_t* plane_numbers)
17
{
18
#ifdef TPGLIBS_ENABLE_STATE_MONITORING
19
m_internal_state_name_registry.register_internal_state(
20
"r"
, std::shared_ptr<naive_array_t>(&
m_memory_factor
, [](
auto
*) {}));
21
m_internal_state_name_registry.register_internal_state(
"s"
,
22
std::shared_ptr<naive_array_t>(&
m_scale_factor
, [](
auto
*) {}));
23
m_internal_state_name_registry.register_internal_state(
"rs"
,
24
std::shared_ptr<naive_array_t>(&
m_running_sum
, [](
auto
*) {}));
25
configure_internal_state_collection
(config);
26
#endif
27
28
int16_t config_memory[3] = { config[
"memory_factor_plane0"
],
29
config[
"memory_factor_plane1"
],
30
config[
"memory_factor_plane2"
] };
31
int16_t config_scale[3] = { config[
"scale_factor_plane0"
],
32
config[
"scale_factor_plane1"
],
33
config[
"scale_factor_plane2"
] };
34
35
for
(
int
i = 0; i < 16; i++) {
36
m_memory_factor
[i] = config_memory[plane_numbers[i]];
37
m_scale_factor
[i] = config_scale[plane_numbers[i]];
38
}
39
}
40
41
NaiveRunSumProcessor::naive_array_t
42
NaiveRunSumProcessor::process
(
const
naive_array_t
& signal)
43
{
44
#ifdef TPGLIBS_ENABLE_STATE_MONITORING
45
m_samples++;
46
if
(m_collect_internal_state_flag && (m_samples % m_sample_period == 0)) {
47
m_internal_state_buffer_manager.write_to_active_buffer();
48
}
49
#endif
50
51
for
(
int
i = 0; i < 16; i++) {
52
int32_t scaled_rs =
_naive_div_int16
(
m_running_sum
[i], 10);
53
scaled_rs *=
m_memory_factor
[i];
54
55
int32_t scaled_signal =
_naive_div_int16
(signal[i], 10);
56
scaled_signal *=
m_scale_factor
[i];
57
58
int32_t intermediate = scaled_signal + scaled_rs;
59
m_running_sum
[i] = std::min(intermediate, INT16_MAX);
60
}
61
return
NaiveProcessor::process
(
m_running_sum
);
62
}
63
64
}
// namespace tpglibs
REGISTER_NAIVEPROCESSOR_CREATOR
#define REGISTER_NAIVEPROCESSOR_CREATOR(processor_name, processor_class)
Factory registration macro.
Definition
NaiveFactory.hpp:18
NaiveRunSumProcessor.hpp
tpglibs::AbstractProcessor< std::array< int16_t, 16 > >::configure_internal_state_collection
virtual void configure_internal_state_collection(const nlohmann::json &)
Definition
AbstractProcessor.hpp:89
tpglibs::NaiveProcessor::process
virtual naive_array_t process(const naive_array_t &signal) override
Simple signal pass-through on naive type.
Definition
NaiveProcessor.hpp:26
tpglibs::NaiveProcessor::naive_array_t
std::array< int16_t, 16 > naive_array_t
The naive version uses a standard array instead of __m256i.
Definition
NaiveProcessor.hpp:23
tpglibs::NaiveRunSumProcessor
Naive signal processor: Calculates the running sum of the signal.
Definition
NaiveRunSumProcessor.hpp:30
tpglibs::NaiveRunSumProcessor::m_scale_factor
naive_array_t m_scale_factor
The S factor in the model equation.
Definition
NaiveRunSumProcessor.hpp:35
tpglibs::NaiveRunSumProcessor::configure
void configure(const nlohmann::json &config, const int16_t *plane_numbers) override
Configures the R factor and S factor according to plane.
Definition
NaiveRunSumProcessor.cpp:16
tpglibs::NaiveRunSumProcessor::process
naive_array_t process(const naive_array_t &signal) override
Calculate and store the running sum.
Definition
NaiveRunSumProcessor.cpp:42
tpglibs::NaiveRunSumProcessor::m_running_sum
naive_array_t m_running_sum
The RS in the model equation.
Definition
NaiveRunSumProcessor.hpp:38
tpglibs::NaiveRunSumProcessor::m_memory_factor
naive_array_t m_memory_factor
The R factor in the model equation.
Definition
NaiveRunSumProcessor.hpp:32
tpglibs
Definition
AbstractFactory.hpp:20
tpglibs::_naive_div_int16
int16_t _naive_div_int16(const int16_t &a, const int16_t &b)
Naive model of AVX division in AVXUtils.
Definition
NaiveUtils.hpp:27
Generated on
for DUNE-DAQ by
1.18.0