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

#include <TriggerActivityMaker.hpp>

Inheritance diagram for triggeralgs::TriggerActivityMaker:
[legend]

Public Member Functions

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

Public Attributes

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 28 of file TriggerActivityMaker.hpp.

Constructor & Destructor Documentation

◆ ~TriggerActivityMaker()

virtual triggeralgs::TriggerActivityMaker::~TriggerActivityMaker ( )
virtualdefault

Member Function Documentation

◆ configure()

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

Reimplemented in triggeralgs::TAMakerADCSimpleWindowAlgorithm, triggeralgs::TAMakerBundleNAlgorithm, triggeralgs::TAMakerChannelAdjacencyAlgorithm, triggeralgs::TAMakerChannelDistanceAlgorithm, triggeralgs::TAMakerDBSCANAlgorithm, triggeralgs::TAMakerHorizontalMuonAlgorithm, triggeralgs::TAMakerMichelElectronAlgorithm, triggeralgs::TAMakerPlaneCoincidenceAlgorithm, and triggeralgs::TAMakerPrescaleAlgorithm.

Definition at line 111 of file TriggerActivityMaker.hpp.

112 {
113 // Don't do anyting if the config does not exist
114 if (!config.is_object()) {
115 return;
116 }
117
118 if (config.contains("prescale"))
119 m_prescale = config["prescale"];
120 if (config.contains("max_samples_over_threshold"))
121 m_max_samples_over_threshold = config["max_samples_over_threshold"];
122
123 TLOG() << "[TAM]: max sot : " << m_max_samples_over_threshold;
124 TLOG() << "[TAM]: prescale : " << m_prescale;
125 }
uint32_t m_max_samples_over_threshold
Time-over-threshold TP filtering.
uint64_t m_prescale
Configurable prescale factor.
#define TLOG(...)
Definition macro.hpp:22

◆ flush()

virtual void triggeralgs::TriggerActivityMaker::flush ( timestamp_t ,
std::vector< TriggerActivity > &  )
inlinevirtual

Reimplemented in triggeralgs::TAMakerSupernovaAlgorithm.

Definition at line 110 of file TriggerActivityMaker.hpp.

110{}

◆ operator()()

void triggeralgs::TriggerActivityMaker::operator() ( const TriggerPrimitive & input_tp,
std::vector< TriggerActivity > & output_ta )
inline

Definition at line 32 of file TriggerActivityMaker.hpp.

33 {
34 // Apply TP filtering
35 if (!preprocess(input_tp)) {
36 return;
37 }
38
39 // Process TP, to implement per alg triggeralgs
40 process(input_tp, output_ta);
41
42 // Postprocess TA, e.g. prescaling
43 postprocess(output_ta);
44 }
virtual void process(const TriggerPrimitive &input_tp, std::vector< TriggerActivity > &output_ta)=0
TP processing function that creates & fills TAs.
virtual void postprocess(std::vector< TriggerActivity > &output_ta)
Post-processing/filtering of the TAs, e.g. prescale.
virtual bool preprocess(const TriggerPrimitive &input_tp)
TP pre-processing/filtering.

◆ postprocess()

virtual void triggeralgs::TriggerActivityMaker::postprocess ( std::vector< TriggerActivity > & output_ta)
inlinevirtual

Post-processing/filtering of the TAs, e.g. prescale.

Takes a vector of TAs and removes ones that we want to filter out, e.g. based on prescaling.

Todo
: Like in preprocessing: implement something more efficient, e.g. vec of tasks
Parameters
output_ta[out]output triggeractivity vector

Definition at line 85 of file TriggerActivityMaker.hpp.

86 {
87 // Don't post-process TAs if there's no TAs made.
88 if (output_ta.size() == 0) {
89 return;
90 }
91
92 // Apply prescale by erasing TAs
93 if (m_prescale > 1) {
94 for (std::vector<TriggerActivity>::iterator iter = output_ta.begin(); iter != output_ta.end();) {
95 m_ta_count++;
96
97 if (m_ta_count % m_prescale != 0) {
98 iter = output_ta.erase(iter);
99 continue;
100 }
101
102 TLOG_DEBUG(TLVL_DEBUG_MEDIUM) << "Emitting prescaled TriggerActivity " << (m_ta_count-1)
103 << " with time start/end/activity: " << iter->time_start
104 << " " << iter->time_end << " " << iter->time_activity;
105 ++iter;
106 }
107 }
108 }
uint64_t m_ta_count
TA made count for prescaling.
#define TLOG_DEBUG(lvl,...)
Definition Logging.hpp:112

◆ preprocess()

virtual bool triggeralgs::TriggerActivityMaker::preprocess ( const TriggerPrimitive & input_tp)
inlinevirtual

TP pre-processing/filtering.

Takes a TP and returns true or false depending whether we want to process that TP into a TA algorithm.

Todo

: Implement tp-filtering, e.g. SOT, plane, channel and whatnot

: Implement something smarter & more efficient if no filtering: vector of functions, or c-o-c

Parameters
[in]intput_tpinput TP reference for filtering
Returns
bool true if we want to keep the TP

Definition at line 66 of file TriggerActivityMaker.hpp.

67 {
68 if (input_tp.samples_over_threshold > m_max_samples_over_threshold) {
69 return false;
70 }
71
72 return true;
73 }

◆ process()

virtual void triggeralgs::TriggerActivityMaker::process ( const TriggerPrimitive & input_tp,
std::vector< TriggerActivity > & output_ta )
pure virtual

Member Data Documentation

◆ m_data_vs_system_time

std::atomic<uint64_t> triggeralgs::TriggerActivityMaker::m_data_vs_system_time = 0

Definition at line 127 of file TriggerActivityMaker.hpp.

◆ m_initial_offset

std::atomic<uint64_t> triggeralgs::TriggerActivityMaker::m_initial_offset = 0

Definition at line 128 of file TriggerActivityMaker.hpp.

◆ m_max_samples_over_threshold

uint32_t triggeralgs::TriggerActivityMaker::m_max_samples_over_threshold = std::numeric_limits<uint32_t>::max()

Time-over-threshold TP filtering.

Definition at line 136 of file TriggerActivityMaker.hpp.

◆ m_prescale

uint64_t triggeralgs::TriggerActivityMaker::m_prescale = 1

Configurable prescale factor.

Definition at line 131 of file TriggerActivityMaker.hpp.

◆ m_ta_count

uint64_t triggeralgs::TriggerActivityMaker::m_ta_count = 0

TA made count for prescaling.

Definition at line 133 of file TriggerActivityMaker.hpp.


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