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

#include <TriggerCandidateMaker.hpp>

Inheritance diagram for triggeralgs::TriggerCandidateMaker:
[legend]

Public Member Functions

virtual ~TriggerCandidateMaker ()=default
 
void operator() (const TriggerActivity &input_ta, std::vector< TriggerCandidate > &output_tc)
 
virtual void process (const TriggerActivity &input_ta, std::vector< TriggerCandidate > &output_tc)=0
 TA processing function that creates & fills TCs.
 
virtual bool preprocess (const TriggerActivity &)
 TA pre-processing/filtering.
 
virtual void postprocess (std::vector< TriggerCandidate > &output_tc)
 Post-processing/filtering of the TCs, e.g. prescale.
 
virtual void flush (timestamp_t, std::vector< TriggerCandidate > &)
 
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_tc_count = 0
 TC made count for prescaling.
 
TriggerCandidate::Type m_tc_type_out = TriggerCandidate::Type::kUnknown
 Configurable TC type output.
 

Detailed Description

Definition at line 28 of file TriggerCandidateMaker.hpp.

Constructor & Destructor Documentation

◆ ~TriggerCandidateMaker()

virtual triggeralgs::TriggerCandidateMaker::~TriggerCandidateMaker ( )
virtualdefault

Member Function Documentation

◆ configure()

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

Reimplemented in triggeralgs::TCMakerADCSimpleWindowAlgorithm, triggeralgs::TCMakerBundleNAlgorithm, triggeralgs::TCMakerChannelAdjacencyAlgorithm, triggeralgs::TCMakerChannelDistanceAlgorithm, triggeralgs::TCMakerDBSCANAlgorithm, triggeralgs::TCMakerHorizontalMuonAlgorithm, triggeralgs::TCMakerMichelElectronAlgorithm, triggeralgs::TCMakerPlaneCoincidenceAlgorithm, and triggeralgs::TCMakerPrescaleAlgorithm.

Definition at line 101 of file TriggerCandidateMaker.hpp.

102 {
103 // Don't do anyting if the config does not exist
104 if (!config.is_object()) {
105 return;
106 }
107
108 if (config.contains("prescale")) {
109 m_prescale = config["prescale"];
110 }
111
112 if (config.contains("tc_type_name")) {
115 }
116
118 // 27-Feb-2025, KAB: moified the following statement to check whether the configuration
119 // contains the tc_type_name parameter before trying to add it do the exception message.
120 throw(InvalidConfiguration(ERS_HERE, "Provided an unknown output TC type: " +
121 (config.contains("tc_type_name") ?
122 std::string(config["tc_type_name"]) : "null")));
123 }
124
125 TLOG() << "[TCM]: prescale : " << m_prescale;
126 TLOG() << "[TCM]: TC type out: " << config["tc_type_name"];
127 }
#define ERS_HERE
TriggerCandidate::Type m_tc_type_out
Configurable TC type output.
uint64_t m_prescale
Configurable prescale factor.
#define TLOG(...)
Definition macro.hpp:22
int string_to_trigger_candidate_type(const std::string &name)
Factory couldn t std::string alg_name InvalidConfiguration
Definition Issues.hpp:33

◆ flush()

virtual void triggeralgs::TriggerCandidateMaker::flush ( timestamp_t ,
std::vector< TriggerCandidate > &  )
inlinevirtual

Definition at line 100 of file TriggerCandidateMaker.hpp.

100{}

◆ operator()()

void triggeralgs::TriggerCandidateMaker::operator() ( const TriggerActivity & input_ta,
std::vector< TriggerCandidate > & output_tc )
inline

Definition at line 32 of file TriggerCandidateMaker.hpp.

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

◆ postprocess()

virtual void triggeralgs::TriggerCandidateMaker::postprocess ( std::vector< TriggerCandidate > & output_tc)
inlinevirtual

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

Takes a vector of TCs 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_tc[out]output trigger candidate vector

Definition at line 78 of file TriggerCandidateMaker.hpp.

79 {
80 // Don't post-process TCs if there's no TCs made.
81 if (output_tc.size() == 0) {
82 return;
83 }
84
85 // Apply prescale by erasing TCs
86 if (m_prescale > 1) {
87 for (std::vector<TriggerCandidate>::iterator iter = output_tc.begin(); iter != output_tc.end();) {
88 m_tc_count++;
89
90 if (m_tc_count % m_prescale != 0) {
91 iter = output_tc.erase(iter);
92 continue;
93 }
94
95 TLOG_DEBUG(TLVL_DEBUG_10) << "Emitting prescaled TriggerCandidate " << (m_tc_count-1);
96 ++iter;
97 }
98 }
99 }
uint64_t m_tc_count
TC made count for prescaling.
#define TLOG_DEBUG(lvl,...)
Definition Logging.hpp:112

◆ preprocess()

virtual bool triggeralgs::TriggerCandidateMaker::preprocess ( const TriggerActivity & )
inlinevirtual

TA pre-processing/filtering.

Todo

: Implement ta-filtering, e.g. by plane or sub-detector

: 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 63 of file TriggerCandidateMaker.hpp.

64 {
65 return true;
66 }

◆ process()

virtual void triggeralgs::TriggerCandidateMaker::process ( const TriggerActivity & input_ta,
std::vector< TriggerCandidate > & output_tc )
pure virtual

Member Data Documentation

◆ m_data_vs_system_time

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

Definition at line 129 of file TriggerCandidateMaker.hpp.

◆ m_initial_offset

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

Definition at line 130 of file TriggerCandidateMaker.hpp.

◆ m_prescale

uint64_t triggeralgs::TriggerCandidateMaker::m_prescale = 1

Configurable prescale factor.

Definition at line 133 of file TriggerCandidateMaker.hpp.

◆ m_tc_count

uint64_t triggeralgs::TriggerCandidateMaker::m_tc_count = 0

TC made count for prescaling.

Definition at line 135 of file TriggerCandidateMaker.hpp.

◆ m_tc_type_out

TriggerCandidate::Type triggeralgs::TriggerCandidateMaker::m_tc_type_out = TriggerCandidate::Type::kUnknown

Configurable TC type output.

Definition at line 138 of file TriggerCandidateMaker.hpp.


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