DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
TCMakerSupernovaAlgorithm.hpp
Go to the documentation of this file.
1
9#ifndef TRIGGERALGS_SRC_TRIGGERALGS_SUPERNOVA_TRIGGERCANDIDATEMAKERSUPERNOVA_HPP_
10#define TRIGGERALGS_SRC_TRIGGERALGS_SUPERNOVA_TRIGGERCANDIDATEMAKERSUPERNOVA_HPP_
11
13#include "triggeralgs/Types.hpp"
14
15#include <algorithm>
16#include <atomic>
17#include <limits>
18#include <vector>
19
20namespace triggeralgs {
22{
25
26public:
28 void process(const TriggerActivity&, std::vector<TriggerCandidate>&);
29
30protected:
31 std::vector<TriggerActivity::TriggerActivityData> m_activity;
33 std::atomic<int64_t> m_time_window = { 500'000'000 };
35 std::atomic<uint16_t> m_threshold = { 3 }; // NOLINT(build/unsigned)
37 std::atomic<uint16_t> m_hit_threshold = { 2 }; // NOLINT(build/unsigned)
38
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 }
47};
48
49} // namespace triggeralgs
50
51#endif // TRIGGERALGS_SRC_TRIGGERALGS_SUPERNOVA_TRIGGERCANDIDATEMAKERSUPERNOVA_HPP_
std::vector< TriggerActivity::TriggerActivityData > m_activity
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.
void process(const TriggerActivity &, std::vector< TriggerCandidate > &)
The function that gets call when there is a new activity.
std::atomic< uint16_t > m_hit_threshold
Minimum number of primities in an activity.
std::atomic< int64_t > m_time_window
Slinding time window to count activities.
dunedaq::trgdataformats::timestamp_t timestamp_t
Definition Types.hpp:16
dunedaq::trgdataformats::timestamp_diff_t timestamp_diff_t
Definition Types.hpp:17