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

#include <TAMakerADCSimpleWindowAlgorithm.hpp>

Public Member Functions

bool is_empty () const
 
void add (TriggerPrimitive const &input_tp)
 
void clear ()
 
void move (TriggerPrimitive const &input_tp, timestamp_t const &window_length)
 
void reset (TriggerPrimitive const &input_tp)
 

Public Attributes

timestamp_t time_start
 
uint32_t adc_integral
 
std::deque< TriggerPrimitivetp_list
 

Friends

std::ostream & operator<< (std::ostream &os, const Window &window)
 

Detailed Description

Definition at line 26 of file TAMakerADCSimpleWindowAlgorithm.hpp.

Member Function Documentation

◆ add()

void triggeralgs::TAMakerADCSimpleWindowAlgorithm::Window::add ( TriggerPrimitive const & input_tp)

Definition at line 28 of file TAMakerADCSimpleWindowAlgorithm.cpp.

28 {
29 // Add the input TP's contribution to the total ADC and add it to
30 // the TP list.
31 adc_integral += input_tp.adc_integral;
32 tp_list.push_back(input_tp);
33}

◆ clear()

void triggeralgs::TAMakerADCSimpleWindowAlgorithm::Window::clear ( )
inline

Definition at line 36 of file TAMakerADCSimpleWindowAlgorithm.hpp.

36 {
37 tp_list.clear();
38 };

◆ is_empty()

bool triggeralgs::TAMakerADCSimpleWindowAlgorithm::Window::is_empty ( ) const
inline

Definition at line 30 of file TAMakerADCSimpleWindowAlgorithm.hpp.

30 {
31 return tp_list.empty();
32 };

◆ move()

void triggeralgs::TAMakerADCSimpleWindowAlgorithm::Window::move ( TriggerPrimitive const & input_tp,
timestamp_t const & window_length )

Definition at line 36 of file TAMakerADCSimpleWindowAlgorithm.cpp.

36 {
37 // Find all of the TPs in the window that need to be removed
38 // if the input_tp is to be added and the size of the window
39 // is to be conserved.
40 // Substract those TPs' contribution from the total window ADC.
41 uint32_t n_tps_to_erase = 0;
42 for(auto tp : tp_list){
43 if(input_tp.time_start-tp.time_start >= window_length){
44 n_tps_to_erase++;
45 adc_integral -= tp.adc_integral;
46 } else {
47 break;
48 }
49 }
50 // Erase the TPs from the window.
51 tp_list.erase(tp_list.begin(), tp_list.begin()+n_tps_to_erase);
52
53 // Make the window start time the start time of what is now the
54 // first TP.
55 if(!tp_list.empty()){
56 time_start = tp_list.front().time_start;
57 add(input_tp);
58 } else {
59 reset(input_tp);
60 }
61}

◆ reset()

void triggeralgs::TAMakerADCSimpleWindowAlgorithm::Window::reset ( TriggerPrimitive const & input_tp)

Definition at line 65 of file TAMakerADCSimpleWindowAlgorithm.cpp.

65 {
66 // Empty the TP list.
67 tp_list.clear();
68 // Set the start time of the window to be the start time of the
69 // input_tp.
70 time_start = input_tp.time_start;
71 // Start the total ADC integral.
72 adc_integral = input_tp.adc_integral;
73 // Add the input TP to the TP list.
74 tp_list.push_back(input_tp);
75}

Friends And Related Symbol Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream & os,
const Window & window )
friend

Definition at line 79 of file TAMakerADCSimpleWindowAlgorithm.cpp.

81{
82 if (window.is_empty()) {
83 os << "Window is empty!\n";
84 } else {
85 os << "Window start: " << window.time_start
86 << ", end: " << window.tp_list.back().time_start
87 << ". Total of: " << window.adc_integral
88 << " ADC counts with " << window.tp_list.size()
89 << " TPs.\n";
90 }
91 return os;
92}

Member Data Documentation

◆ adc_integral

uint32_t triggeralgs::TAMakerADCSimpleWindowAlgorithm::Window::adc_integral

Definition at line 45 of file TAMakerADCSimpleWindowAlgorithm.hpp.

◆ time_start

timestamp_t triggeralgs::TAMakerADCSimpleWindowAlgorithm::Window::time_start

Definition at line 44 of file TAMakerADCSimpleWindowAlgorithm.hpp.

◆ tp_list

std::deque<TriggerPrimitive> triggeralgs::TAMakerADCSimpleWindowAlgorithm::Window::tp_list

Definition at line 46 of file TAMakerADCSimpleWindowAlgorithm.hpp.


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