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

#include <TAMakerBundleNAlgorithm.hpp>

Inheritance diagram for triggeralgs::TAMakerBundleNAlgorithm:
[legend]
Collaboration diagram for triggeralgs::TAMakerBundleNAlgorithm:
[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)
 
bool bundle_condition ()
 
- 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_ta_attributes ()
 

Private Attributes

uint64_t m_bundle_size = 1
 
TriggerActivity m_current_ta
 

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 TAMakerBundleNAlgorithm.hpp.

Member Function Documentation

◆ bundle_condition()

bool triggeralgs::TAMakerBundleNAlgorithm::bundle_condition ( )

Definition at line 47 of file TAMakerBundleNAlgorithm.cpp.

◆ configure()

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

Reimplemented from triggeralgs::TriggerActivityMaker.

Definition at line 78 of file TAMakerBundleNAlgorithm.cpp.

79{
80 if (config.is_object() && config.contains("bundle_size")) {
81 m_bundle_size = config["bundle_size"];
82 }
83}

◆ process()

void triggeralgs::TAMakerBundleNAlgorithm::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 52 of file TAMakerBundleNAlgorithm.cpp.

53{
54 // Expect that TPs are inherently time ordered.
55 m_current_ta.inputs.push_back(input_tp);
56
57 if (bundle_condition()) {
58 TLOG_DEBUG(TLVL_DEBUG_HIGH) << "[TA:BN] Emitting BundleN TA with " << m_current_ta.inputs.size() << " TPs.";
60 output_tas.push_back(m_current_ta);
61
62 // Reset the current.
64 }
65
66 // Should never reach this step. In this case, send it out.
67 if (m_current_ta.inputs.size() > m_bundle_size) {
68 TLOG_DEBUG(TLVL_IMPORTANT) << "[TA:BN] Emitting large BundleN TriggerActivity with " << m_current_ta.inputs.size() << " TPs.";
70 output_tas.push_back(m_current_ta);
71
72 // Reset the current.
74 }
75}
#define TLOG_DEBUG(lvl,...)
Definition Logging.hpp:112

◆ set_ta_attributes()

void triggeralgs::TAMakerBundleNAlgorithm::set_ta_attributes ( )
private

Definition at line 19 of file TAMakerBundleNAlgorithm.cpp.

19 {
20 // Using the first TA as reference.
21 TriggerPrimitive first_tp = m_current_ta.inputs.front();
22 TriggerPrimitive last_tp = m_current_ta.inputs.back();
23
24 m_current_ta.channel_start = first_tp.channel;
25 m_current_ta.channel_end = last_tp.channel;
26
27 m_current_ta.time_start = first_tp.time_start;
28 m_current_ta.time_end = last_tp.time_start;
29
30 m_current_ta.detid = first_tp.detid;
31
34
36 for (const TriggerPrimitive& tp : m_current_ta.inputs) {
37 m_current_ta.adc_integral += tp.adc_integral;
38 if (tp.adc_peak <= m_current_ta.adc_peak) continue;
39 m_current_ta.adc_peak = tp.adc_peak;
40 m_current_ta.channel_peak = tp.channel;
41 m_current_ta.time_peak = tp.samples_to_peak * 32 + tp.time_start; // FIXME: Replace STP to `time_peak` conversion.
42 }
44 return;
45}
dunedaq::trgdataformats::TriggerPrimitive TriggerPrimitive

Member Data Documentation

◆ m_bundle_size

uint64_t triggeralgs::TAMakerBundleNAlgorithm::m_bundle_size = 1
private

Definition at line 26 of file TAMakerBundleNAlgorithm.hpp.

◆ m_current_ta

TriggerActivity triggeralgs::TAMakerBundleNAlgorithm::m_current_ta
private

Definition at line 27 of file TAMakerBundleNAlgorithm.hpp.


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