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

#include <TAMakerChannelDistanceAlgorithm.hpp>

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

Public Member Functions

void process (const TriggerPrimitive &input_tp, std::vector< TriggerActivity > &output_tas)
 TP processing function that creates & fills TAs.
 
void configure (const nlohmann::json &config)
 
void set_ta_attributes ()
 
- Public Member Functions inherited from triggeralgs::TriggerActivityMaker
virtual ~TriggerActivityMaker ()=default
 
void operator() (const TriggerPrimitive &input_tp, std::vector< TriggerActivity > &output_ta)
 
virtual bool preprocess (const TriggerPrimitive &input_tp)
 TP pre-processing/filtering.
 
virtual void postprocess (std::vector< TriggerActivity > &output_ta)
 Post-processing/filtering of the TAs, e.g. prescale.
 
virtual void flush (timestamp_t, std::vector< TriggerActivity > &)
 

Private Member Functions

void set_new_ta (const TriggerPrimitive &input_tp)
 

Private Attributes

TriggerActivity m_current_ta
 
uint32_t m_max_channel_distance = 50
 
uint64_t m_window_length = 8000
 
uint16_t m_min_tps = 20
 
uint32_t m_current_lower_bound
 
uint32_t m_current_upper_bound
 

Additional Inherited Members

- Public Attributes inherited from triggeralgs::TriggerActivityMaker
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_ta_count = 0
 TA made count for prescaling.
 
uint32_t m_max_samples_over_threshold = std::numeric_limits<uint32_t>::max()
 Time-over-threshold TP filtering.
 

Detailed Description

Definition at line 17 of file TAMakerChannelDistanceAlgorithm.hpp.

Member Function Documentation

◆ configure()

void triggeralgs::TAMakerChannelDistanceAlgorithm::configure ( const nlohmann::json & config)
virtual

Reimplemented from triggeralgs::TriggerActivityMaker.

Definition at line 58 of file TAMakerChannelDistanceAlgorithm.cpp.

59{
61
62 if (config.contains("min_tps"))
63 m_min_tps = config["min_tps"];
64 if (config.contains("window_length"))
65 m_window_length = config["window_length"];
66 if (config.contains("max_channel_distance"))
67 m_max_channel_distance = config["max_channel_distance"];
68
69 return;
70}
virtual void configure(const nlohmann::json &config)

◆ process()

void triggeralgs::TAMakerChannelDistanceAlgorithm::process ( const TriggerPrimitive & input_tp,
std::vector< TriggerActivity > & output_ta )
virtual

TP processing function that creates & fills TAs.

Parameters
input_tp[in]Input TP for the triggering algorithm
output_ta[out]Output vector of TAs to fill by the algorithm

Implements triggeralgs::TriggerActivityMaker.

Definition at line 27 of file TAMakerChannelDistanceAlgorithm.cpp.

29{
30
31 // Start a new TA if not already going.
32 if (m_current_ta.inputs.empty()) {
33 set_new_ta(input_tp);
34 return;
35 }
36
37 // Check to close the TA based on time.
38 if (input_tp.time_start - m_current_ta.inputs.front().time_start > m_window_length) {
39 // Check to block the TA based on min TPs.
40 if (m_current_ta.inputs.size() >= m_min_tps) {
42 output_tas.push_back(m_current_ta);
43 }
44 set_new_ta(input_tp);
45 return;
46 }
47
48 // Check to skip the TP if it's outside the current channel bounds.
49 if (input_tp.channel > m_current_upper_bound || input_tp.channel < m_current_lower_bound)
50 return;
51
52 m_current_ta.inputs.push_back(input_tp);
55}
dunedaq::trgdataformats::channel_diff_t channel_diff_t
Definition Types.hpp:21
std::vector< TriggerPrimitive > inputs

◆ set_new_ta()

void triggeralgs::TAMakerChannelDistanceAlgorithm::set_new_ta ( const TriggerPrimitive & input_tp)
private

Definition at line 17 of file TAMakerChannelDistanceAlgorithm.cpp.

18{
20 m_current_ta.inputs.push_back(input_tp);
23 return;
24}

◆ set_ta_attributes()

void triggeralgs::TAMakerChannelDistanceAlgorithm::set_ta_attributes ( )

Definition at line 73 of file TAMakerChannelDistanceAlgorithm.cpp.

74{
75 TriggerPrimitive first_tp = m_current_ta.inputs.front();
76 TriggerPrimitive last_tp = m_current_ta.inputs.back();
77
78 m_current_ta.channel_start = first_tp.channel;
79 m_current_ta.channel_end = last_tp.channel;
80
81 m_current_ta.time_start = first_tp.time_start;
82 m_current_ta.time_end = last_tp.time_start;
83
84 m_current_ta.detid = first_tp.detid;
85
88
90 for (const TriggerPrimitive& tp : m_current_ta.inputs) {
91 m_current_ta.adc_integral += tp.adc_integral;
92 if (tp.adc_peak <= m_current_ta.adc_peak)
93 continue;
94 m_current_ta.adc_peak = tp.adc_peak;
95 m_current_ta.channel_peak = tp.channel;
96 m_current_ta.time_peak = tp.samples_to_peak * 32 + tp.time_start; // FIXME: Replace STP to `time_peak` conversion.
97 }
99}
dunedaq::trgdataformats::TriggerPrimitive TriggerPrimitive

Member Data Documentation

◆ m_current_lower_bound

uint32_t triggeralgs::TAMakerChannelDistanceAlgorithm::m_current_lower_bound
private

Definition at line 29 of file TAMakerChannelDistanceAlgorithm.hpp.

◆ m_current_ta

TriggerActivity triggeralgs::TAMakerChannelDistanceAlgorithm::m_current_ta
private

Definition at line 25 of file TAMakerChannelDistanceAlgorithm.hpp.

◆ m_current_upper_bound

uint32_t triggeralgs::TAMakerChannelDistanceAlgorithm::m_current_upper_bound
private

Definition at line 30 of file TAMakerChannelDistanceAlgorithm.hpp.

◆ m_max_channel_distance

uint32_t triggeralgs::TAMakerChannelDistanceAlgorithm::m_max_channel_distance = 50
private

Definition at line 26 of file TAMakerChannelDistanceAlgorithm.hpp.

◆ m_min_tps

uint16_t triggeralgs::TAMakerChannelDistanceAlgorithm::m_min_tps = 20
private

Definition at line 28 of file TAMakerChannelDistanceAlgorithm.hpp.

◆ m_window_length

uint64_t triggeralgs::TAMakerChannelDistanceAlgorithm::m_window_length = 8000
private

Definition at line 27 of file TAMakerChannelDistanceAlgorithm.hpp.


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