Line data Source code
1 : /**
2 : * @file NaiveThresholdProcessor.hpp
3 : *
4 : * @copyright This is part of the DUNE DAQ Software Suite, copyright 2020.
5 : * Licensing/copyright details are in the COPYING file that you should have
6 : * received with this code.
7 : */
8 :
9 : #include "tpglibs/NaiveThresholdProcessor.hpp"
10 :
11 : namespace tpglibs {
12 :
13 13 : REGISTER_NAIVEPROCESSOR_CREATOR("NaiveThresholdProcessor", NaiveThresholdProcessor)
14 :
15 : void
16 0 : NaiveThresholdProcessor::configure(const nlohmann::json& config, const int16_t* plane_numbers)
17 : {
18 0 : int16_t config_thresholds[3] = { config["plane0"], config["plane1"], config["plane2"] };
19 :
20 : // Messy. Assumes plane numbers are in {0, 1, 2}.
21 0 : for (int i = 0; i < 16; i++) {
22 0 : m_threshold[i] = config_thresholds[plane_numbers[i]];
23 : }
24 0 : }
25 :
26 : NaiveThresholdProcessor::naive_array_t
27 0 : NaiveThresholdProcessor::process(const naive_array_t& signal)
28 : {
29 0 : naive_array_t above_threshold;
30 0 : for (int i = 0; i < 16; i++) {
31 0 : if (signal[i] > m_threshold[i])
32 0 : above_threshold[i] = signal[i];
33 : }
34 0 : return NaiveProcessor::process(above_threshold);
35 : }
36 :
37 : } // namespace tpglibs
|