DUNE-DAQ
DUNE Trigger and Data Acquisition software
Toggle main menu visibility
Loading...
Searching...
No Matches
dunedaq
sourcecode
triggeralgs
src
TCMakerChannelDistanceAlgorithm.cpp
Go to the documentation of this file.
1
8
9
#include "
triggeralgs/ChannelDistance/TCMakerChannelDistanceAlgorithm.hpp
"
10
11
#include "TRACE/trace.h"
12
#define TRACE_NAME "TCMakerChannelDistanceAlgorithm"
13
14
namespace
triggeralgs
{
15
16
void
17
TCMakerChannelDistanceAlgorithm::set_new_tc
(
const
TriggerActivity
& input_ta)
18
{
19
m_current_tc
=
TriggerCandidate
();
20
m_current_tc
.inputs.push_back(input_ta);
21
m_current_tp_count
= input_ta.
inputs
.size();
22
return
;
23
}
24
25
void
26
TCMakerChannelDistanceAlgorithm::configure
(
const
nlohmann::json& config)
27
{
28
TriggerCandidateMaker::configure
(config);
29
30
if
(config.contains(
"max_tp_count"
))
31
m_max_tp_count
= config[
"max_tp_count"
];
32
return
;
33
}
34
35
void
36
TCMakerChannelDistanceAlgorithm::set_tc_attributes
()
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;
46
m_current_tc
.algorithm =
TriggerCandidate::Algorithm::kChannelDistance
;
47
m_current_tc
.type =
m_tc_type_out
;
48
return
;
49
}
50
51
void
52
TCMakerChannelDistanceAlgorithm::process
(
const
TriggerActivity
& input_ta,
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
) {
64
set_tc_attributes
();
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
78
REGISTER_TRIGGER_CANDIDATE_MAKER
(
TRACE_NAME
,
TCMakerChannelDistanceAlgorithm
)
79
80
}
// namespace triggeralgs
TRACE_NAME
#define TRACE_NAME
Definition
TimestampEstimatorTimeSync.cpp:17
REGISTER_TRIGGER_CANDIDATE_MAKER
#define REGISTER_TRIGGER_CANDIDATE_MAKER(tcm_name, tcm_class)
Definition
TriggerCandidateFactory.hpp:14
triggeralgs::TCMakerChannelDistanceAlgorithm
Definition
TCMakerChannelDistanceAlgorithm.hpp:17
triggeralgs::TCMakerChannelDistanceAlgorithm::set_tc_attributes
void set_tc_attributes()
Definition
TCMakerChannelDistanceAlgorithm.cpp:36
triggeralgs::TCMakerChannelDistanceAlgorithm::m_max_tp_count
uint16_t m_max_tp_count
Definition
TCMakerChannelDistanceAlgorithm.hpp:27
triggeralgs::TCMakerChannelDistanceAlgorithm::set_new_tc
void set_new_tc(const TriggerActivity &input_ta)
Definition
TCMakerChannelDistanceAlgorithm.cpp:17
triggeralgs::TCMakerChannelDistanceAlgorithm::m_current_tp_count
uint16_t m_current_tp_count
Definition
TCMakerChannelDistanceAlgorithm.hpp:26
triggeralgs::TCMakerChannelDistanceAlgorithm::process
void process(const TriggerActivity &input_ta, std::vector< TriggerCandidate > &output_tcs)
TA processing function that creates & fills TCs.
Definition
TCMakerChannelDistanceAlgorithm.cpp:52
triggeralgs::TCMakerChannelDistanceAlgorithm::configure
void configure(const nlohmann::json &config)
Definition
TCMakerChannelDistanceAlgorithm.cpp:26
triggeralgs::TCMakerChannelDistanceAlgorithm::m_current_tc
TriggerCandidate m_current_tc
Definition
TCMakerChannelDistanceAlgorithm.hpp:25
triggeralgs::TriggerCandidateMaker::m_tc_type_out
TriggerCandidate::Type m_tc_type_out
Configurable TC type output.
Definition
TriggerCandidateMaker.hpp:138
triggeralgs::TriggerCandidateMaker::configure
virtual void configure(const nlohmann::json &config)
Definition
TriggerCandidateMaker.hpp:101
triggeralgs
Definition
AbstractFactory.hpp:18
TCMakerChannelDistanceAlgorithm.hpp
dunedaq::trgdataformats::TriggerCandidateData::Algorithm::kChannelDistance
@ kChannelDistance
Definition
TriggerCandidateData.hpp:77
triggeralgs::TriggerActivity
Definition
TriggerActivity.hpp:20
triggeralgs::TriggerActivity::inputs
std::vector< TriggerPrimitive > inputs
Definition
TriggerActivity.hpp:33
triggeralgs::TriggerCandidate
Definition
TriggerCandidate.hpp:20
Generated on
for DUNE-DAQ by
1.17.0