DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
DAPHNEFrameProcessor.hpp
Go to the documentation of this file.
1
8#ifndef FDREADOUTLIBS_INCLUDE_FDREADOUTLIBS_DAPHNE_DAPHNEFRAMEPROCESSOR_HPP_
9#define FDREADOUTLIBS_INCLUDE_FDREADOUTLIBS_DAPHNE_DAPHNEFRAMEPROCESSOR_HPP_
10
11#include "logging/Logging.hpp"
12
16
18#include "iomanager/Sender.hpp"
19
23
27
28
29#include <atomic>
30#include <functional>
31#include <memory>
32#include <string>
33
35
36namespace dunedaq {
37
38ERS_DECLARE_ISSUE(fdreadoutlibs,
39 PDSPeakIgnored,
40 "Ignoring PDS Peak with ts=" << timestamp << ", ch=" << channel << ", sc_iframe=" << superchunk_iframe << ", ipeak=" << ipeak,
41 ((uint64_t)timestamp) ((uint64_t)channel) ((size_t)superchunk_iframe) ((size_t)ipeak))
42
43ERS_DECLARE_ISSUE(fdreadoutlibs,
45 "PDS Frame with unphysical timestamp detected with ts=" << timestamp << ", ch=" << channel << ", sc_iframe=" << superchunk_iframe,
46 ((uint64_t)timestamp) ((uint64_t)channel) ((size_t)superchunk_iframe))
47
48
49namespace fdreadoutlibs {
50
51class DAPHNEFrameProcessor : public datahandlinglibs::TaskRawDataProcessorModel<types::DAPHNESuperChunkTypeAdapter>
52{
53
54public:
56 using frameptr = types::DAPHNESuperChunkTypeAdapter*;
57 using daphneframeptr = dunedaq::fddetdataformats::DAPHNEFrame*;
58 using timestamp_t = std::uint64_t; // NOLINT(build/unsigned)
59 using constframeptr = const types::DAPHNESuperChunkTypeAdapter*;
60
61 // Constructor
62 explicit DAPHNEFrameProcessor(std::unique_ptr<datahandlinglibs::FrameErrorRegistry>& error_registry, bool post_processing_enabled)
64 {}
65
66 // Override config for pipeline setup
67 void conf(const appmodel::DataHandlerModule* conf) override;
68
69 void start(const nlohmann::json& args) override;
70 void stop(const nlohmann::json& args) override;
71
72protected:
73 virtual void generate_opmon_data() override;
74
78 void timestamp_check(frameptr /*fp*/);
79
83 void frame_error_check(frameptr /*fp*/);
84
85 // Internals
86 timestamp_t m_previous_ts = 0;
87 timestamp_t m_current_ts = 0;
88 bool m_first_ts_fake = true;
89 bool m_first_ts_missmatch = true;
90 bool m_problem_reported = false;
91 std::atomic<int> m_ts_error_ctr{ 0 };
92
93 void extract_tps( constframeptr fp);
95
96private:
97
98 std::shared_ptr<iomanager::SenderConcept<std::vector<trigger::TriggerPrimitiveTypeAdapter>>> m_tp_sink;
99
100 std::atomic<uint64_t> m_new_hits{ 0 }; // NOLINT(build/unsigned)
101 std::atomic<uint64_t> m_new_tps{ 0 }; // NOLINT(build/unsigned)
102 std::atomic<uint64_t> m_tps_suppressed_too_long{ 0 };
103 std::atomic<uint64_t> m_tps_send_failed{ 0 };
104 std::atomic<uint64_t> m_frame_counter{ 0 };
105
106 std::chrono::time_point<std::chrono::high_resolution_clock> m_t0;
107
108};
109
110} // namespace fdreadoutlibs
111} // namespace dunedaq
112
113#endif // FDREADOUTLIBS_INCLUDE_FDREADOUTLIBS_DAPHNE_DAPHNEFRAMEPROCESSOR_HPP_
#define ERS_DECLARE_ISSUE(namespace_name, class_name, message, attributes)
Including Qt Headers.
A single energy deposition on a TPC or PDS channel.