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 15 : REGISTER_NAIVEPROCESSOR_CREATOR("NaiveThresholdProcessor", NaiveThresholdProcessor)
14 :
15 0 : void NaiveThresholdProcessor::configure(const nlohmann::json& config, const int16_t* plane_numbers) {
16 0 : int16_t config_thresholds[3] = {config["plane0"], config["plane1"], config["plane2"]};
17 :
18 : // Messy. Assumes plane numbers are in {0, 1, 2}.
19 0 : for (int i = 0; i < 16; i++) {
20 0 : m_threshold[i] = config_thresholds[plane_numbers[i]];
21 : }
22 0 : }
23 :
24 0 : NaiveThresholdProcessor::naive_array_t NaiveThresholdProcessor::process(const naive_array_t& signal) {
25 0 : naive_array_t above_threshold;
26 0 : for (int i = 0; i < 16; i++) {
27 0 : if (signal[i] > m_threshold[i])
28 0 : above_threshold[i] = signal[i];
29 : }
30 0 : return NaiveProcessor::process(above_threshold);
31 : }
32 :
33 : } // namespace tpglibs
|