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

#include <TAMakerSupernovaAlgorithm.hpp>

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

Public Member Functions

void process (const TriggerPrimitive &input_tp, std::vector< TriggerActivity > &output_ta) override
 TP processing function that creates & fills TAs.
 
void flush (timestamp_t, std::vector< TriggerActivity > &tas) override
 
- 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 configure (const nlohmann::json &config)
 

Protected Attributes

timestamp_diff_t m_time_tolerance
 
channel_t m_channel_tolerance
 Maximum tolerated time difference between two primitives to form an activity (in 50 MHz clock ticks)
 

Private Member Functions

bool is_time_consistent (const TriggerPrimitive &input_tp) const
 This activity maker makes an activity with all the trigger primitives.
 
bool is_channel_consistent (const TriggerPrimitive &input_tp) const
 
TriggerActivity MakeTriggerActivity () const
 Maximum tolerated channel number difference between two primitives to form an activity.
 

Private Attributes

timestamp_t m_time_start = 0
 
timestamp_t m_time_end = 0
 
timestamp_t m_time_peak = 0
 
timestamp_t m_time_activity = 0
 
channel_diff_t m_channel_start = 0
 
channel_diff_t m_channel_end = 0
 
channel_diff_t m_channel_peak = 0
 
uint64_t m_adc_integral = 0
 
uint16_t m_adc_peak = 0
 
detid_t m_detid = 0
 
TriggerActivity::Type m_type = TriggerActivity::Type::kTPC
 
TriggerActivity::Algorithm m_algorithm = TriggerActivity::Algorithm::kSupernova
 
std::vector< TriggerPrimitivem_tp_list
 

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 19 of file TAMakerSupernovaAlgorithm.hpp.

Member Function Documentation

◆ flush()

void triggeralgs::TAMakerSupernovaAlgorithm::flush ( timestamp_t ,
std::vector< TriggerActivity > & tas )
inlineoverridevirtual

Reimplemented from triggeralgs::TriggerActivityMaker.

Definition at line 52 of file TAMakerSupernovaAlgorithm.hpp.

52{ tas.push_back(MakeTriggerActivity()); }
TriggerActivity MakeTriggerActivity() const
Maximum tolerated channel number difference between two primitives to form an activity.

◆ is_channel_consistent()

bool triggeralgs::TAMakerSupernovaAlgorithm::is_channel_consistent ( const TriggerPrimitive & input_tp) const
inlineprivate

Definition at line 38 of file TAMakerSupernovaAlgorithm.hpp.

39 {
40
41 bool is_close_to_edge = (m_channel_tolerance > abs(channel_diff_t(input_tp.channel) - m_channel_end) ||
42 m_channel_tolerance > abs(channel_diff_t(input_tp.channel) - m_channel_start));
43
44 bool is_in_between_edge = (input_tp.channel > m_channel_start && input_tp.channel < m_channel_end);
45
46 return is_in_between_edge || is_close_to_edge;
47 }
channel_t m_channel_tolerance
Maximum tolerated time difference between two primitives to form an activity (in 50 MHz clock ticks)
dunedaq::trgdataformats::channel_diff_t channel_diff_t
Definition Types.hpp:21

◆ is_time_consistent()

bool triggeralgs::TAMakerSupernovaAlgorithm::is_time_consistent ( const TriggerPrimitive & input_tp) const
inlineprivate

This activity maker makes an activity with all the trigger primitives.

Definition at line 23 of file TAMakerSupernovaAlgorithm.hpp.

24 {
25 timestamp_t tend = input_tp.time_start + input_tp.samples_over_threshold * 32; // FIXME: Replace the hard-coded SOT to TOT scaling.
26
27 bool is_close_to_edge = (m_time_tolerance > abs(timestamp_diff_t(input_tp.time_start) - timestamp_diff_t(m_time_end))) ||
28 m_time_tolerance > abs(timestamp_diff_t(input_tp.time_start) - timestamp_diff_t(m_time_start)) ||
31
32 bool is_in_between_edge = ((tend > m_time_start && tend < m_time_end) ||
33 (input_tp.time_start > m_time_start && input_tp.time_start < m_time_end));
34
35 return is_in_between_edge || is_close_to_edge;
36 }
dunedaq::trgdataformats::timestamp_t timestamp_t
Definition Types.hpp:16
dunedaq::trgdataformats::timestamp_diff_t timestamp_diff_t
Definition Types.hpp:17

◆ MakeTriggerActivity()

TriggerActivity triggeralgs::TAMakerSupernovaAlgorithm::MakeTriggerActivity ( ) const
inlineprivate

Maximum tolerated channel number difference between two primitives to form an activity.

Definition at line 61 of file TAMakerSupernovaAlgorithm.hpp.

62 {
64 ta.time_start = m_time_start;
65 ta.time_end = m_time_end;
66 ta.time_peak = m_time_peak;
67 ta.time_activity = m_time_activity;
68 ta.channel_start = m_channel_start;
69
70 ta.channel_end = m_channel_end;
71 ta.channel_peak = m_channel_peak;
72 ta.adc_integral = m_adc_integral;
73 ta.adc_peak = m_adc_peak;
74 ta.detid = m_detid;
75
76 ta.type = m_type;
77 ta.algorithm = m_algorithm;
78 ta.inputs = m_tp_list;
79 return ta;
80 }

◆ process()

void TAMakerSupernovaAlgorithm::process ( const TriggerPrimitive & input_tp,
std::vector< TriggerActivity > & output_ta )
overridevirtual

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 21 of file TAMakerSupernovaAlgorithm.cpp.

22{
23 // Time measurement
24 // auto now = std::chrono::steady_clock::now();
25 // m_algorithm = (uint32_t)pd_clock(now.time_since_epoch()).count();
26
27 timestamp_t tend = input_tp.time_start + input_tp.samples_over_threshold * 32; // FIXME: Replace the hard-coded SOT to TOT scaling.
28
29 if (m_time_start == 0) {
30 m_tp_list.erase(m_tp_list.begin(), m_tp_list.end());
31 m_tp_list.push_back(input_tp);
32 m_time_start = input_tp.time_start;
33 m_time_end = tend;
34 m_time_peak = input_tp.samples_to_peak * 32 + input_tp.time_start; // FIXME: Replace STP to `time_peak` conversion.
35 m_channel_start = input_tp.channel;
36 m_channel_end = input_tp.channel;
37 m_channel_peak = input_tp.channel;
39 m_adc_peak = input_tp.adc_peak;
40 m_detid = input_tp.detid;
41 return;
42 }
43
44 bool time_ok = is_time_consistent(input_tp);
45 bool channel_ok = is_channel_consistent(input_tp);
46
47 if (!time_ok && !channel_ok) {
48 output_ta.push_back(MakeTriggerActivity());
49 m_tp_list.erase(m_tp_list.begin(), m_tp_list.end());
50 m_tp_list.push_back(input_tp);
51 m_time_start = input_tp.time_start;
52 m_time_end = tend;
53 m_time_peak = input_tp.samples_to_peak * 32 + input_tp.time_start; // FIXME: Replace STP to `time_peak` conversion.
54 m_channel_start = input_tp.channel;
55 m_channel_end = input_tp.channel;
56 m_channel_peak = input_tp.channel;
58 m_adc_peak = input_tp.adc_peak;
59 m_detid = input_tp.detid;
60 return;
61 }
62
63 if (input_tp.time_start < m_time_start)
64 m_time_start = input_tp.time_start;
65
66 if (tend > m_time_end)
67 m_time_end = tend;
68
69 if (input_tp.adc_peak > m_adc_peak) {
70 m_time_peak = input_tp.samples_to_peak * 32 + input_tp.time_start; // FIXME: Replace STP to `time_peak` conversion.
71 m_adc_peak = input_tp.adc_peak;
72 m_channel_peak = input_tp.channel;
73 }
74
75 if (input_tp.channel > m_channel_end)
76 m_channel_end = input_tp.channel;
77
78 if (input_tp.channel < m_channel_start)
79 m_channel_start = input_tp.channel;
80
81 m_tp_list.push_back(input_tp);
82 m_adc_integral += input_tp.adc_integral;
83 m_detid |= input_tp.detid;
84}
bool is_channel_consistent(const TriggerPrimitive &input_tp) const
bool is_time_consistent(const TriggerPrimitive &input_tp) const
This activity maker makes an activity with all the trigger primitives.

Member Data Documentation

◆ m_adc_integral

uint64_t triggeralgs::TAMakerSupernovaAlgorithm::m_adc_integral = 0
private

Definition at line 89 of file TAMakerSupernovaAlgorithm.hpp.

◆ m_adc_peak

uint16_t triggeralgs::TAMakerSupernovaAlgorithm::m_adc_peak = 0
private

Definition at line 90 of file TAMakerSupernovaAlgorithm.hpp.

◆ m_algorithm

TriggerActivity::Algorithm triggeralgs::TAMakerSupernovaAlgorithm::m_algorithm = TriggerActivity::Algorithm::kSupernova
private

Definition at line 93 of file TAMakerSupernovaAlgorithm.hpp.

◆ m_channel_end

channel_diff_t triggeralgs::TAMakerSupernovaAlgorithm::m_channel_end = 0
private

Definition at line 87 of file TAMakerSupernovaAlgorithm.hpp.

◆ m_channel_peak

channel_diff_t triggeralgs::TAMakerSupernovaAlgorithm::m_channel_peak = 0
private

Definition at line 88 of file TAMakerSupernovaAlgorithm.hpp.

◆ m_channel_start

channel_diff_t triggeralgs::TAMakerSupernovaAlgorithm::m_channel_start = 0
private

Definition at line 86 of file TAMakerSupernovaAlgorithm.hpp.

◆ m_channel_tolerance

channel_t triggeralgs::TAMakerSupernovaAlgorithm::m_channel_tolerance
protected
Initial value:
=
2

Maximum tolerated time difference between two primitives to form an activity (in 50 MHz clock ticks)

Definition at line 57 of file TAMakerSupernovaAlgorithm.hpp.

◆ m_detid

detid_t triggeralgs::TAMakerSupernovaAlgorithm::m_detid = 0
private

Definition at line 91 of file TAMakerSupernovaAlgorithm.hpp.

◆ m_time_activity

timestamp_t triggeralgs::TAMakerSupernovaAlgorithm::m_time_activity = 0
private

Definition at line 85 of file TAMakerSupernovaAlgorithm.hpp.

◆ m_time_end

timestamp_t triggeralgs::TAMakerSupernovaAlgorithm::m_time_end = 0
private

Definition at line 83 of file TAMakerSupernovaAlgorithm.hpp.

◆ m_time_peak

timestamp_t triggeralgs::TAMakerSupernovaAlgorithm::m_time_peak = 0
private

Definition at line 84 of file TAMakerSupernovaAlgorithm.hpp.

◆ m_time_start

timestamp_t triggeralgs::TAMakerSupernovaAlgorithm::m_time_start = 0
private

Definition at line 82 of file TAMakerSupernovaAlgorithm.hpp.

◆ m_time_tolerance

timestamp_diff_t triggeralgs::TAMakerSupernovaAlgorithm::m_time_tolerance
protected
Initial value:
=
250

Definition at line 55 of file TAMakerSupernovaAlgorithm.hpp.

◆ m_tp_list

std::vector<TriggerPrimitive> triggeralgs::TAMakerSupernovaAlgorithm::m_tp_list
private

Definition at line 95 of file TAMakerSupernovaAlgorithm.hpp.

◆ m_type

TriggerActivity::Type triggeralgs::TAMakerSupernovaAlgorithm::m_type = TriggerActivity::Type::kTPC
private

Definition at line 92 of file TAMakerSupernovaAlgorithm.hpp.


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