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

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::vector< TriggerPrimitivetp_list
 

Friends

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

Detailed Description

Definition at line 27 of file TAMakerADCSimpleWindowAlgorithm.hpp.

Member Function Documentation

◆ add()

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

Definition at line 32 of file TAMakerADCSimpleWindowAlgorithm.hpp.

32 {
33 // Add the input TP's contribution to the total ADC and add it to
34 // the TP list.
35 adc_integral += input_tp.adc_integral;
36 tp_list.push_back(input_tp);
37 };

◆ clear()

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

Definition at line 38 of file TAMakerADCSimpleWindowAlgorithm.hpp.

38 {
39 tp_list.clear();
40 };

◆ is_empty()

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

Definition at line 29 of file TAMakerADCSimpleWindowAlgorithm.hpp.

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

◆ move()

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

Definition at line 41 of file TAMakerADCSimpleWindowAlgorithm.hpp.

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

◆ reset()

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

Definition at line 64 of file TAMakerADCSimpleWindowAlgorithm.hpp.

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

Friends And Related Symbol Documentation

◆ operator<<

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

Definition at line 75 of file TAMakerADCSimpleWindowAlgorithm.hpp.

75 {
76 if(window.is_empty()) os << "Window is empty!\n";
77 else{
78 os << "Window start: " << window.time_start << ", end: " << window.tp_list.back().time_start;
79 os << ". Total of: " << window.adc_integral << " ADC counts with " << window.tp_list.size() << " TPs.\n";
80 }
81 return os;
82 };

Member Data Documentation

◆ adc_integral

uint32_t triggeralgs::TAMakerADCSimpleWindowAlgorithm::Window::adc_integral

Definition at line 85 of file TAMakerADCSimpleWindowAlgorithm.hpp.

◆ time_start

timestamp_t triggeralgs::TAMakerADCSimpleWindowAlgorithm::Window::time_start

Definition at line 84 of file TAMakerADCSimpleWindowAlgorithm.hpp.

◆ tp_list

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

Definition at line 86 of file TAMakerADCSimpleWindowAlgorithm.hpp.


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