DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
TCMakerDBSCANAlgorithm.cpp
Go to the documentation of this file.
1
10
11#include "TRACE/trace.h"
12#define TRACE_NAME "TCMakerDBSCANAlgorithm"
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
26TCMakerDBSCANAlgorithm::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
52TCMakerDBSCANAlgorithm::process(const TriggerActivity& input_ta, std::vector<TriggerCandidate>& output_tcs)
53{
54 // Start a new TC if not already going.
55 if (m_current_tc.inputs.empty()) {
56 set_new_tc(input_ta);
57 return;
58 }
59
60 // Check to close the TC based on TP contents.
61 if (input_ta.inputs.size() + m_current_tp_count > m_max_tp_count) {
63 output_tcs.push_back(m_current_tc);
64 set_new_tc(input_ta);
65 return;
66 }
67
68 // Append the new TA and increase the TP count.
69 m_current_tc.inputs.push_back(input_ta);
70 m_current_tp_count += input_ta.inputs.size();
71 return;
72}
73
74// Register algo in TC Factory.
76
77} // namespace triggeralgs
#define REGISTER_TRIGGER_CANDIDATE_MAKER(tcm_name, tcm_class)
void configure(const nlohmann::json &config)
void set_new_tc(const TriggerActivity &input_ta)
void process(const TriggerActivity &input_ta, std::vector< TriggerCandidate > &output_tc)
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