DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
TAMakerBundleNAlgorithm.cpp
Go to the documentation of this file.
1
10
11#include "TRACE/trace.h"
12#define TRACE_NAME "TAMakerBundleNAlgorithm"
13
14namespace triggeralgs {
15
18
20 // Using the first TA as reference.
21 TriggerPrimitive first_tp = m_current_ta.inputs.front();
22 TriggerPrimitive last_tp = m_current_ta.inputs.back();
23
26
29
30 m_current_ta.detid = first_tp.detid;
31
34
36 for (const TriggerPrimitive& tp : m_current_ta.inputs) {
38 if (tp.adc_peak <= m_current_ta.adc_peak) continue;
41 m_current_ta.time_peak = tp.samples_to_peak * 32 + tp.time_start; // FIXME: Replace STP to `time_peak` conversion.
42 }
44 return;
45}
46
50
51void
52TAMakerBundleNAlgorithm::process(const TriggerPrimitive& input_tp, std::vector<TriggerActivity>& output_tas)
53{
54 // Expect that TPs are inherently time ordered.
55 m_current_ta.inputs.push_back(input_tp);
56
57 if (bundle_condition()) {
58 TLOG_DEBUG(TLVL_DEBUG_HIGH) << "[TA:BN] Emitting BundleN TA with " << m_current_ta.inputs.size() << " TPs.";
60 output_tas.push_back(m_current_ta);
61
62 // Reset the current.
64 }
65
66 // Should never reach this step. In this case, send it out.
67 if (m_current_ta.inputs.size() > m_bundle_size) {
68 TLOG_DEBUG(TLVL_IMPORTANT) << "[TA:BN] Emitting large BundleN TriggerActivity with " << m_current_ta.inputs.size() << " TPs.";
70 output_tas.push_back(m_current_ta);
71
72 // Reset the current.
74 }
75}
76
77void
78TAMakerBundleNAlgorithm::configure(const nlohmann::json& config)
79{
80 if (config.is_object() && config.contains("bundle_size")) {
81 m_bundle_size = config["bundle_size"];
82 }
83}
84
86} // namespace triggeralgs
87
#define REGISTER_TRIGGER_ACTIVITY_MAKER(tam_name, tam_class)
void process(const TriggerPrimitive &input_tp, std::vector< TriggerActivity > &output_tas)
TP processing function that creates & fills TAs.
void configure(const nlohmann::json &config)
#define TLOG_DEBUG(lvl,...)
Definition Logging.hpp:112
@ TLVL_DEBUG_HIGH
Definition Logging.hpp:24
#define TRACE_NAME
A single energy deposition on a TPC or PDS channel.
std::vector< TriggerPrimitive > inputs