DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
triggeralgs::TCMakerChannelAdjacencyAlgorithm Class Reference

#include <TCMakerChannelAdjacencyAlgorithm.hpp>

Inheritance diagram for triggeralgs::TCMakerChannelAdjacencyAlgorithm:
[legend]
Collaboration diagram for triggeralgs::TCMakerChannelAdjacencyAlgorithm:
[legend]

Public Member Functions

void process (const TriggerActivity &, std::vector< TriggerCandidate > &)
 TA processing function that creates & fills TCs.
 
void configure (const nlohmann::json &config)
 
- Public Member Functions inherited from triggeralgs::TriggerCandidateMaker
virtual ~TriggerCandidateMaker ()=default
 
void operator() (const TriggerActivity &input_ta, std::vector< TriggerCandidate > &output_tc)
 
virtual bool preprocess (const TriggerActivity &)
 TA pre-processing/filtering.
 
virtual void postprocess (std::vector< TriggerCandidate > &output_tc)
 Post-processing/filtering of the TCs, e.g. prescale.
 
virtual void flush (timestamp_t, std::vector< TriggerCandidate > &)
 

Private Member Functions

TriggerCandidate construct_tc () const
 
void add_window_to_record (TAWindow window)
 

Private Attributes

TAWindow m_current_window
 
uint64_t m_activity_count = 0
 
bool m_trigger_on_adc = false
 
bool m_trigger_on_n_channels = false
 
uint32_t m_adc_threshold = 1200000
 
uint16_t m_n_channels_threshold = 600
 
timestamp_t m_window_length = 80000
 
std::vector< TAWindowm_window_record
 

Additional Inherited Members

- Public Attributes inherited from triggeralgs::TriggerCandidateMaker
std::atomic< uint64_t > m_data_vs_system_time = 0
 
std::atomic< uint64_t > m_initial_offset = 0
 
uint64_t m_prescale = 1
 Configurable prescale factor.
 
uint64_t m_tc_count = 0
 TC made count for prescaling.
 
TriggerCandidate::Type m_tc_type_out = TriggerCandidate::Type::kUnknown
 Configurable TC type output.
 

Detailed Description

Definition at line 19 of file TCMakerChannelAdjacencyAlgorithm.hpp.

Member Function Documentation

◆ add_window_to_record()

void TCMakerChannelAdjacencyAlgorithm::add_window_to_record ( TAWindow window)
private

Definition at line 137 of file TCMakerChannelAdjacencyAlgorithm.cpp.

138{
139 m_window_record.push_back(window);
140 return;
141}

◆ configure()

void TCMakerChannelAdjacencyAlgorithm::configure ( const nlohmann::json & config)
virtual

Reimplemented from triggeralgs::TriggerCandidateMaker.

Definition at line 83 of file TCMakerChannelAdjacencyAlgorithm.cpp.

84{
86
87 if (config.is_object()) {
88 if (config.contains("trigger_on_adc"))
89 m_trigger_on_adc = config["trigger_on_adc"];
90 if (config.contains("trigger_on_n_channels"))
91 m_trigger_on_n_channels = config["trigger_on_n_channels"];
92 if (config.contains("adc_threshold"))
93 m_adc_threshold = config["adc_threshold"];
94 if (config.contains("n_channels_threshold"))
95 m_n_channels_threshold = config["n_channels_threshold"];
96 if (config.contains("window_length"))
97 m_window_length = config["window_length"];
98 }
99
100 // Both trigger flags were false. This will never trigger.
102 TLOG_DEBUG(TLVL_VERY_IMPORTANT) << "[TCM:CA] Not triggering! All trigger flags are false!";
103 throw BadConfiguration(ERS_HERE, TRACE_NAME);
104 }
105
106 return;
107}
#define ERS_HERE
virtual void configure(const nlohmann::json &config)
#define TLOG_DEBUG(lvl,...)
Definition Logging.hpp:112
#define TRACE_NAME

◆ construct_tc()

TriggerCandidate TCMakerChannelAdjacencyAlgorithm::construct_tc ( ) const
private

Definition at line 110 of file TCMakerChannelAdjacencyAlgorithm.cpp.

111{
112 TriggerActivity latest_ta_in_window = m_current_window.inputs.back();
113
116 tc.time_end = latest_ta_in_window.inputs.back().time_start;
118 tc.detid = latest_ta_in_window.detid;
119 tc.type = m_tc_type_out;
121
122 // Take the list of triggeralgs::TriggerActivity in the current
123 // window and convert them (implicitly) to detdataformats'
124 // TriggerActivityData, which is the base class of TriggerActivity
125 for (auto& ta : m_current_window.inputs) {
126 tc.inputs.push_back(ta);
127 if (ta.time_end > tc.time_end) {
128 tc.time_end = ta.time_end;
129 }
130 }
131
132 return tc;
133}
timestamp_t time_start
Definition TAWindow.hpp:52
std::vector< TriggerActivity > inputs
Definition TAWindow.hpp:55
TriggerCandidate::Type m_tc_type_out
Configurable TC type output.
std::vector< TriggerPrimitive > inputs
std::vector< dunedaq::trgdataformats::TriggerActivityData > inputs

◆ process()

void TCMakerChannelAdjacencyAlgorithm::process ( const TriggerActivity & input_ta,
std::vector< TriggerCandidate > & output_tc )
virtual

TA processing function that creates & fills TCs.

Parameters
input_ta[in]Input TA for the triggering algorithm
output_tc[out]Output vector of TCs to fill by the algorithm

Implements triggeralgs::TriggerCandidateMaker.

Definition at line 26 of file TCMakerChannelAdjacencyAlgorithm.cpp.

28{
29
30 // The first time process() is called, reset window object.
32 m_current_window.reset(activity);
34 }
35
36 // If the difference between the current TA's start time and the start of the window
37 // is less than the specified window size, add the TA to the window.
38 else if ((activity.time_start - m_current_window.time_start) < m_window_length) {
39 TLOG_DEBUG(TLVL_DEBUG_HIGH) << "[TCM:CA] Window not yet complete, adding the activity to the window.";
40 m_current_window.add(activity);
41 }
42 // If it is not, move the window along.
43 else {
44 TLOG_DEBUG(TLVL_DEBUG_ALL)
45 << "[TCM:CA] TAWindow is at required length but specified threshold not met, shifting window along.";
47 }
48
49 // If the addition of the current TA to the window would make it longer
50 // than the specified window length, don't add it but check whether the sum of all adc in
51 // the existing window is above the specified threshold. If it is, and we are triggering on ADC,
52 // make a TA and start a fresh window with the current TP.
54 TLOG_DEBUG(TLVL_DEBUG_MEDIUM) << "[TCM:CA] m_current_window.adc_integral " << m_current_window.adc_integral
55 << " - m_adc_threshold " << m_adc_threshold;
57 TLOG_DEBUG(TLVL_DEBUG_MEDIUM) << "[TCM:CA] tc.time_start=" << tc.time_start << " tc.time_end=" << tc.time_end
58 << " len(tc.inputs) " << tc.inputs.size();
59
60 for (const auto& ta : tc.inputs) {
61 TLOG_DEBUG(TLVL_DEBUG_ALL) << "[TCM:CA] [TA] ta.time_start=" << ta.time_start << " ta.time_end=" << ta.time_end
62 << " ta.adc_integral=" << ta.adc_integral;
63 }
64
65 output_tc.push_back(tc);
67 }
68
69 // If the addition of the current TA to the window would make it longer
70 // than the specified window length, don't add it but check whether the number of hit channels in
71 // the existing window is above the specified threshold. If it is, and we are triggering on channels,
72 // make a TC and start a fresh window with the current TA.
74 output_tc.push_back(construct_tc());
76 }
77
79 return;
80}
void clear()
Clear all inputs.
Definition TAWindow.cpp:35
void add(const TriggerActivity &input_ta)
Add the input TA's contribution to the total ADC, increase the hit count of all of the channels which...
Definition TAWindow.cpp:16
bool is_empty() const
Definition TAWindow.hpp:22
void reset(TriggerActivity const &input_ta)
Reset window content on the input.
Definition TAWindow.cpp:79
uint16_t n_channels_hit()
Definition TAWindow.hpp:34
void move(TriggerActivity const &input_ta, timestamp_t const &window_length)
Find all of the TAs in the window that need to be removed if the input_ta is to be added and the size...
Definition TAWindow.cpp:45

Member Data Documentation

◆ m_activity_count

uint64_t triggeralgs::TCMakerChannelAdjacencyAlgorithm::m_activity_count = 0
private

Definition at line 32 of file TCMakerChannelAdjacencyAlgorithm.hpp.

◆ m_adc_threshold

uint32_t triggeralgs::TCMakerChannelAdjacencyAlgorithm::m_adc_threshold = 1200000
private

Definition at line 37 of file TCMakerChannelAdjacencyAlgorithm.hpp.

◆ m_current_window

TAWindow triggeralgs::TCMakerChannelAdjacencyAlgorithm::m_current_window
private

Definition at line 31 of file TCMakerChannelAdjacencyAlgorithm.hpp.

◆ m_n_channels_threshold

uint16_t triggeralgs::TCMakerChannelAdjacencyAlgorithm::m_n_channels_threshold = 600
private

Definition at line 38 of file TCMakerChannelAdjacencyAlgorithm.hpp.

◆ m_trigger_on_adc

bool triggeralgs::TCMakerChannelAdjacencyAlgorithm::m_trigger_on_adc = false
private

Definition at line 35 of file TCMakerChannelAdjacencyAlgorithm.hpp.

◆ m_trigger_on_n_channels

bool triggeralgs::TCMakerChannelAdjacencyAlgorithm::m_trigger_on_n_channels = false
private

Definition at line 36 of file TCMakerChannelAdjacencyAlgorithm.hpp.

◆ m_window_length

timestamp_t triggeralgs::TCMakerChannelAdjacencyAlgorithm::m_window_length = 80000
private

Definition at line 39 of file TCMakerChannelAdjacencyAlgorithm.hpp.

◆ m_window_record

std::vector<TAWindow> triggeralgs::TCMakerChannelAdjacencyAlgorithm::m_window_record
private

Definition at line 43 of file TCMakerChannelAdjacencyAlgorithm.hpp.


The documentation for this class was generated from the following files: