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

#include <TDMakerSupernovaAlgorithm.hpp>

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

Public Member Functions

void operator() (const TriggerCandidate &, std::vector< TriggerDecision > &)
 This decision maker just spits out the trigger candidates.
 
- Public Member Functions inherited from triggeralgs::TriggerDecisionMaker
virtual ~TriggerDecisionMaker ()=default
 
virtual void flush (std::vector< TriggerDecision > &)
 
virtual void configure (const nlohmann::json &)
 

Protected Member Functions

void FlushOldCandidate (dunedaq::trgdataformats::timestamp_t time_now)
 this function gets rid of the old activities
 

Protected Attributes

std::vector< TriggerCandidatem_candidate
 
std::atomic< dunedaq::trgdataformats::timestamp_t > m_time_window = { 500'000'000 }
 Sliding time window to count activities.
 
std::atomic< uint16_t > m_threshold = { 1 }
 Minimum number of activities in the time window to issue a trigger.
 
std::atomic< uint16_t > m_hit_threshold = { 1 }
 Minimum number of primities in an activity.
 

Detailed Description

Definition at line 21 of file TDMakerSupernovaAlgorithm.hpp.

Member Function Documentation

◆ FlushOldCandidate()

void triggeralgs::TDMakerSupernovaAlgorithm::FlushOldCandidate ( dunedaq::trgdataformats::timestamp_t time_now)
inlineprotected

this function gets rid of the old activities

Definition at line 39 of file TDMakerSupernovaAlgorithm.hpp.

40 {
41 dunedaq::trgdataformats::timestamp_diff_t how_far = time_now - m_time_window;
42 auto end = std::remove_if(
43 m_candidate.begin(), m_candidate.end(), [how_far, this](auto& c) -> bool { return (static_cast<dunedaq::trgdataformats::timestamp_diff_t>(c.time_start) < how_far); });
44 m_candidate.erase(end, m_candidate.end());
45 }
std::atomic< dunedaq::trgdataformats::timestamp_t > m_time_window
Sliding time window to count activities.

◆ operator()()

void TDMakerSupernovaAlgorithm::operator() ( const TriggerCandidate & cand,
std::vector< TriggerDecision > & decisions )
virtual

This decision maker just spits out the trigger candidates.

The function that returns the final trigger decision (copy of a candidate for now)

Implements triggeralgs::TriggerDecisionMaker.

Definition at line 20 of file TDMakerSupernovaAlgorithm.cpp.

21{
22
23 std::vector<TriggerCandidate> vCand;
24 vCand.push_back(cand);
25
26 auto now = std::chrono::steady_clock::now();
27 // Timestamp
28 uint32_t algorithm = (uint32_t)pd_clock(now.time_since_epoch()).count(); // NOLINT(build/unsigned)
29
30 TriggerDecision trigger{ cand.time_start,
31 cand.time_end,
32 cand.time_candidate,
33 0,
34 0,
35 0,
36 // cand.detid,
37 0,
39 cand.version,
40 vCand };
41
42 // Give the trigger word back
43 decisions.push_back(trigger);
44 return;
45}
std::chrono::duration< double, std::ratio< 1, 62500000 > > pd_clock
static int64_t now()

Member Data Documentation

◆ m_candidate

std::vector<TriggerCandidate> triggeralgs::TDMakerSupernovaAlgorithm::m_candidate
protected

Definition at line 30 of file TDMakerSupernovaAlgorithm.hpp.

◆ m_hit_threshold

std::atomic<uint16_t> triggeralgs::TDMakerSupernovaAlgorithm::m_hit_threshold = { 1 }
protected

Minimum number of primities in an activity.

Definition at line 36 of file TDMakerSupernovaAlgorithm.hpp.

36{ 1 }; // NOLINT(build/unsigned)

◆ m_threshold

std::atomic<uint16_t> triggeralgs::TDMakerSupernovaAlgorithm::m_threshold = { 1 }
protected

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

Definition at line 34 of file TDMakerSupernovaAlgorithm.hpp.

34{ 1 }; // NOLINT(build/unsigned)

◆ m_time_window

std::atomic<dunedaq::trgdataformats::timestamp_t> triggeralgs::TDMakerSupernovaAlgorithm::m_time_window = { 500'000'000 }
protected

Sliding time window to count activities.

Definition at line 32 of file TDMakerSupernovaAlgorithm.hpp.

32{ 500'000'000 };

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