DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
TDMakerSupernovaAlgorithm.hpp
Go to the documentation of this file.
1
9#ifndef TRIGGERALGS_SRC_TRIGGERALGS_SUPERNOVA_TRIGGERDECISIONMAKERSUPERNOVA_HPP_
10#define TRIGGERALGS_SRC_TRIGGERALGS_SUPERNOVA_TRIGGERDECISIONMAKERSUPERNOVA_HPP_
11
14
15#include <algorithm>
16#include <atomic>
17#include <limits>
18#include <vector>
19
20namespace triggeralgs {
22{
24
25public:
27 void operator()(const TriggerCandidate&, std::vector<TriggerDecision>&);
28
29protected:
30 std::vector<TriggerCandidate> m_candidate;
32 std::atomic<dunedaq::trgdataformats::timestamp_t> m_time_window = { 500'000'000 };
34 std::atomic<uint16_t> m_threshold = { 1 }; // NOLINT(build/unsigned)
36 std::atomic<uint16_t> m_hit_threshold = { 1 }; // NOLINT(build/unsigned)
37
39 void FlushOldCandidate(dunedaq::trgdataformats::timestamp_t time_now)
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 }
46};
47
48} // namespace triggeralgs
49
50#endif // TRIGGERALGS_SRC_TRIGGERALGS_SUPERNOVA_TRIGGERDECISIONMAKERSUPERNOVA_HPP_
std::atomic< dunedaq::trgdataformats::timestamp_t > m_time_window
Sliding time window to count activities.
std::atomic< uint16_t > m_hit_threshold
Minimum number of primities in an activity.
void operator()(const TriggerCandidate &, std::vector< TriggerDecision > &)
This decision maker just spits out the trigger candidates.
std::atomic< uint16_t > m_threshold
Minimum number of activities in the time window to issue a trigger.
void FlushOldCandidate(dunedaq::trgdataformats::timestamp_t time_now)
this function gets rid of the old activities