DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
TCMakerChannelDistanceAlgorithm.cpp
Go to the documentation of this file.
1
10
11#include "TRACE/trace.h"
12#define TRACE_NAME "TCMakerChannelDistanceAlgorithm"
13
14namespace triggeralgs {
15
16void
18{
20 m_current_tc.inputs.push_back(input_ta);
21 m_current_tp_count = input_ta.inputs.size();
22 return;
23}
24
25void
26TCMakerChannelDistanceAlgorithm::configure(const nlohmann::json& config)
27{
29
30 if (config.contains("max_tp_count"))
31 m_max_tp_count = config["max_tp_count"];
32 return;
33}
34
35void
37{
38 auto& first_ta = m_current_tc.inputs.front();
39 auto& last_ta = m_current_tc.inputs.back();
40
41 m_current_tc.time_start = first_ta.time_start;
42 m_current_tc.time_end = last_ta.time_end;
43 m_current_tc.time_candidate = last_ta.time_start; // Since this is the TA that closed the TC.
44
45 m_current_tc.detid = first_ta.detid;
48 return;
49}
50
51void
53 std::vector<TriggerCandidate>& output_tcs)
54{
55
56 // Start a new TC if not already going.
57 if (m_current_tc.inputs.empty()) {
58 set_new_tc(input_ta);
59 return;
60 }
61
62 // Check to close the TC based on TP contents.
63 if (input_ta.inputs.size() + m_current_tp_count > m_max_tp_count) {
65 output_tcs.push_back(m_current_tc);
66
67 set_new_tc(input_ta);
68 return;
69 }
70
71 // Append the new TA and increase the TP count.
72 m_current_tc.inputs.push_back(input_ta);
73 m_current_tp_count += input_ta.inputs.size();
74 return;
75}
76
77// Register algo in TC Factory
79
80} // namespace triggeralgs
#define REGISTER_TRIGGER_CANDIDATE_MAKER(tcm_name, tcm_class)
void process(const TriggerActivity &input_ta, std::vector< TriggerCandidate > &output_tcs)
TA processing function that creates & fills TCs.
TriggerCandidate::Type m_tc_type_out
Configurable TC type output.
virtual void configure(const nlohmann::json &config)
#define TRACE_NAME
std::vector< TriggerPrimitive > inputs
std::vector< dunedaq::trgdataformats::TriggerActivityData > inputs