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

#include <TCMakerSupernovaAlgorithm.hpp>

Inheritance diagram for triggeralgs::TCMakerSupernovaAlgorithm:
[legend]
Collaboration diagram for triggeralgs::TCMakerSupernovaAlgorithm:
[legend]

Public Member Functions

void process (const TriggerActivity &, std::vector< TriggerCandidate > &)
 The function that gets call when there is a new activity.
 
- Public Member Functions inherited from triggeralgs::TriggerCandidateMaker
virtual ~TriggerCandidateMaker ()=default
 
void operator() (const TriggerActivity &input_ta, std::vector< TriggerCandidate > &output_tc)
 
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)
 

Protected Member Functions

void FlushOldActivity (timestamp_t time_now)
 this function gets rid of the old activities
 

Protected Attributes

std::vector< TriggerActivity::TriggerActivityData > m_activity
 
std::atomic< int64_t > m_time_window = { 500'000'000 }
 Slinding time window to count activities.
 
std::atomic< uint16_t > m_threshold = { 3 }
 Minimum number of activities in the time window to issue a trigger.
 
std::atomic< uint16_t > m_hit_threshold = { 2 }
 Minimum number of primities in an activity.
 

Additional Inherited Members

- Public Attributes inherited from triggeralgs::TriggerCandidateMaker
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 21 of file TCMakerSupernovaAlgorithm.hpp.

Member Function Documentation

◆ FlushOldActivity()

void triggeralgs::TCMakerSupernovaAlgorithm::FlushOldActivity ( timestamp_t time_now)
inlineprotected

this function gets rid of the old activities

Definition at line 40 of file TCMakerSupernovaAlgorithm.hpp.

41 {
42 timestamp_diff_t how_far = time_now - m_time_window;
43 auto end = std::remove_if(
44 m_activity.begin(), m_activity.end(), [how_far, this](auto& c) -> bool { return (static_cast<dunedaq::trgdataformats::timestamp_diff_t>(c.time_start) < how_far); });
45 m_activity.erase(end, m_activity.end());
46 }
std::vector< TriggerActivity::TriggerActivityData > m_activity
std::atomic< int64_t > m_time_window
Slinding time window to count activities.
dunedaq::trgdataformats::timestamp_diff_t timestamp_diff_t
Definition Types.hpp:17

◆ process()

void TCMakerSupernovaAlgorithm::process ( const TriggerActivity & activity,
std::vector< TriggerCandidate > & cand )
virtual

The function that gets call when there is a new activity.

This decision maker just counts the number of activities in the time_window and triggers if the number of activities exceeds that.

Implements triggeralgs::TriggerCandidateMaker.

Definition at line 17 of file TCMakerSupernovaAlgorithm.cpp.

18{
19 timestamp_t time = activity.time_start;
20 FlushOldActivity(time); // get rid of old activities in the buffer
21 if (activity.inputs.size() > m_hit_threshold)
22 m_activity.push_back(static_cast<TriggerActivity::TriggerActivityData>(activity));
23
24 // Yay! we have a trigger!
25 if (m_activity.size() > m_threshold) {
26
28
30 tc.time_start = time - 500'000'000; // time_start (10 seconds before the start of the activity)
31 tc.time_end = activity.time_end; // time_end; but that should probably be _at least_ this number
32 tc.time_candidate = time;
33 tc.detid = detid;
34 tc.type = m_tc_type_out; // type ( flag that says what type of trigger might be (e.g. SN/Muon/Beam) )
35 tc.algorithm = TriggerCandidate::Algorithm::kSupernova; // algorithm ( flag that says which algorithm created the trigger (e.g. SN/HE/Solar) )
36 tc.inputs = m_activity;
37
38 m_activity.clear();
39 // Give the trigger word back
40 cand.push_back(tc);
41 }
42}
void FlushOldActivity(timestamp_t time_now)
this function gets rid of the old activities
std::atomic< uint16_t > m_threshold
Minimum number of activities in the time window to issue a trigger.
std::atomic< uint16_t > m_hit_threshold
Minimum number of primities in an activity.
TriggerCandidate::Type m_tc_type_out
Configurable TC type output.
constexpr detid_t WHOLE_DETECTOR
Definition Types.hpp:41
dunedaq::trgdataformats::timestamp_t timestamp_t
Definition Types.hpp:16
dunedaq::trgdataformats::detid_t detid_t
Definition Types.hpp:18
std::vector< TriggerPrimitive > inputs
std::vector< dunedaq::trgdataformats::TriggerActivityData > inputs

Member Data Documentation

◆ m_activity

std::vector<TriggerActivity::TriggerActivityData> triggeralgs::TCMakerSupernovaAlgorithm::m_activity
protected

Definition at line 31 of file TCMakerSupernovaAlgorithm.hpp.

◆ m_hit_threshold

std::atomic<uint16_t> triggeralgs::TCMakerSupernovaAlgorithm::m_hit_threshold = { 2 }
protected

Minimum number of primities in an activity.

Definition at line 37 of file TCMakerSupernovaAlgorithm.hpp.

37{ 2 }; // NOLINT(build/unsigned)

◆ m_threshold

std::atomic<uint16_t> triggeralgs::TCMakerSupernovaAlgorithm::m_threshold = { 3 }
protected

Minimum number of activities in the time window to issue a trigger.

Definition at line 35 of file TCMakerSupernovaAlgorithm.hpp.

35{ 3 }; // NOLINT(build/unsigned)

◆ m_time_window

std::atomic<int64_t> triggeralgs::TCMakerSupernovaAlgorithm::m_time_window = { 500'000'000 }
protected

Slinding time window to count activities.

Definition at line 33 of file TCMakerSupernovaAlgorithm.hpp.

33{ 500'000'000 };

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