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

#include <TAMakerADCSimpleWindowAlgorithm.hpp>

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

Classes

class  Window
 

Public Member Functions

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

TriggerActivity construct_ta () const
 

Private Attributes

Window m_current_window
 
uint64_t m_primitive_count = 0
 
uint32_t m_adc_threshold = 1200000
 
timestamp_t m_window_length = 100000
 

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 18 of file TAMakerADCSimpleWindowAlgorithm.hpp.

Member Function Documentation

◆ configure()

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

Reimplemented from triggeralgs::TriggerActivityMaker.

Definition at line 65 of file TAMakerADCSimpleWindowAlgorithm.cpp.

66{
68
69 //FIXME use some schema here
70 if (config.is_object()){
71 if (config.contains("window_length")) m_window_length = config["window_length"];
72 if (config.contains("adc_threshold")) m_adc_threshold = config["adc_threshold"];
73 }
74 else{
75 TLOG_DEBUG(TLVL_IMPORTANT) << "[TAM:ADCSW] The DEFAULT values of window_length and adc_threshold are being used.";
76 }
77 TLOG_DEBUG(TLVL_IMPORTANT) << "[TAM:ADCSW] If the total ADC of trigger primitives with times within a "
78 << m_window_length << " tick time window is above " << m_adc_threshold << " counts, a trigger will be issued.";
79}
virtual void configure(const nlohmann::json &config)
#define TLOG_DEBUG(lvl,...)
Definition Logging.hpp:112

◆ construct_ta()

TriggerActivity TAMakerADCSimpleWindowAlgorithm::construct_ta ( ) const
private

Definition at line 82 of file TAMakerADCSimpleWindowAlgorithm.cpp.

83{
84 TLOG_DEBUG(TLVL_DEBUG_LOW) << "[TAM:ADCSW] I am constructing a trigger activity!";
85 //TLOG_DEBUG(TRACE_NAME) << m_current_window;
86
87 TriggerPrimitive latest_tp_in_window = m_current_window.tp_list.back();
88 // The time_peak, time_activity, channel_* and adc_peak fields of this TA are irrelevent
89 // for the purpose of this trigger alg.
92 ta.time_end = latest_tp_in_window.time_start + latest_tp_in_window.samples_over_threshold * 32; // FIXME: Replace the hard-coded SOT to TOT scaling.
93 ta.time_peak = latest_tp_in_window.samples_to_peak * 32 + latest_tp_in_window.time_start; // FIXME: Replace STP to `time_peak` conversion.
95 ta.channel_start = latest_tp_in_window.channel;
96 ta.channel_end = latest_tp_in_window.channel;
97 ta.channel_peak = latest_tp_in_window.channel;
99 ta.adc_peak = latest_tp_in_window.adc_peak;
100 ta.detid = latest_tp_in_window.detid;
104 return ta;
105}
A single energy deposition on a TPC or PDS channel.
std::vector< TriggerPrimitive > inputs

◆ process()

void TAMakerADCSimpleWindowAlgorithm::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 24 of file TAMakerADCSimpleWindowAlgorithm.cpp.

25{
26
27 // The first time operator is called, reset
28 // window object.
30 m_current_window.reset(input_tp);
32 return;
33 }
34
35 // If the difference between the current TP's start time and the start of the window
36 // is less than the specified window size, add the TP to the window.
38 TLOG_DEBUG(TLVL_DEBUG_HIGH) << "[TAM:ADCSW] Window not yet complete, adding the input_tp to the window.";
39 m_current_window.add(input_tp);
40 }
41 // If the addition of the current TP to the window would make it longer
42 // than the specified window length, don't add it but check whether the sum of all adc in
43 // the existing window is above the specified threshold. If it is, make a TA and start
44 // a fresh window with the current TP.
46 TLOG_DEBUG(TLVL_DEBUG_LOW) << "[TAM:ADCSW] ADC integral in window is greater than specified threshold.";
47 output_ta.push_back(construct_ta());
48 TLOG_DEBUG(TLVL_DEBUG_HIGH) << "[TAM:ADCSW] Resetting window with input_tp.";
49 m_current_window.reset(input_tp);
50 }
51 // If it is not, move the window along.
52 else{
53 TLOG_DEBUG(TLVL_DEBUG_ALL) << "[TAM:ADCSW] Window is at required length but adc threshold not met, shifting window along.";
55 }
56
57 TLOG_DEBUG(TLVL_DEBUG_ALL) << "[TAM:ADCSW] " << m_current_window;
58
60
61 return;
62}
void move(TriggerPrimitive const &input_tp, timestamp_t const &window_length)

Member Data Documentation

◆ m_adc_threshold

uint32_t triggeralgs::TAMakerADCSimpleWindowAlgorithm::m_adc_threshold = 1200000
private

Definition at line 95 of file TAMakerADCSimpleWindowAlgorithm.hpp.

◆ m_current_window

Window triggeralgs::TAMakerADCSimpleWindowAlgorithm::m_current_window
private

Definition at line 91 of file TAMakerADCSimpleWindowAlgorithm.hpp.

◆ m_primitive_count

uint64_t triggeralgs::TAMakerADCSimpleWindowAlgorithm::m_primitive_count = 0
private

Definition at line 92 of file TAMakerADCSimpleWindowAlgorithm.hpp.

◆ m_window_length

timestamp_t triggeralgs::TAMakerADCSimpleWindowAlgorithm::m_window_length = 100000
private

Definition at line 96 of file TAMakerADCSimpleWindowAlgorithm.hpp.


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