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
30
32
35
36#include <atomic>
37#include <functional>
38#include <memory>
39#include <string>
40
42
43namespace dunedaq {
44namespace fdreadoutlibs {
45
46class DAPHNEFrameProcessor : public datahandlinglibs::TaskRawDataProcessorModel<types::DAPHNESuperChunkTypeAdapter>
47{
48
49public:
53 using timestamp_t = std::uint64_t; // NOLINT(build/unsigned)
55
56 // Constructor
57 explicit DAPHNEFrameProcessor(std::unique_ptr<datahandlinglibs::FrameErrorRegistry>& error_registry,
58 bool post_processing_enabled)
59 : datahandlinglibs::TaskRawDataProcessorModel<types::DAPHNESuperChunkTypeAdapter>(error_registry,
60 post_processing_enabled)
61 {
62 }
63
64 // Override config for pipeline setup
65 void conf(const appmodel::DataHandlerModule* conf) override;
66
67 void start(const appfwk::DAQModule::CommandData_t& args) override;
68 void stop(const appfwk::DAQModule::CommandData_t& args) override;
69
70protected:
71 virtual void generate_opmon_data() override;
72
76 void timestamp_check(frameptr /*fp*/);
77
81 void frame_error_check(frameptr /*fp*/);
82
83 // Internals
86 bool m_first_ts_fake = true;
88 bool m_problem_reported = false;
89 std::atomic<int> m_ts_error_ctr{ 0 };
90
93
94private:
95 // PDSChannelMap
96 std::shared_ptr<detchannelmaps::PDSChannelMap> m_channel_map;
97 std::vector<std::pair<trgdataformats::channel_t, int16_t>> m_channel_plane_numbers;
98
99 uint32_t m_det_id; // NOLINT(build/unsigned)
100 uint32_t m_crate_id; // NOLINT(build/unsigned)
101 uint32_t m_slot_id; // NOLINT(build/unsigned)
102 uint32_t m_stream_id; // NOLINT(build/unsigned)
103
104 std::set<unsigned int> m_channel_mask_set;
106
107 std::shared_ptr<iomanager::SenderConcept<std::vector<trigger::TriggerPrimitiveTypeAdapter>>> m_tp_sink;
108
109 std::atomic<uint64_t> m_num_new_tps{ 0 }; // NOLINT(build/unsigned)
110 std::atomic<uint64_t> m_tps_suppressed_too_long{ 0 };
111 std::atomic<uint64_t> m_tps_send_failed{ 0 };
112 std::atomic<uint64_t> m_frame_counter{ 0 };
113
114 std::chrono::time_point<std::chrono::high_resolution_clock> m_t0;
115};
116
117} // namespace fdreadoutlibs
118} // namespace dunedaq
119
120#endif // FDREADOUTLIBS_INCLUDE_FDREADOUTLIBS_DAPHNE_DAPHNEFRAMEPROCESSOR_HPP_
TaskRawDataProcessorModel(std::unique_ptr< FrameErrorRegistry > &error_registry, bool post_processing_enabled)
datahandlinglibs::TaskRawDataProcessorModel< types::DAPHNESuperChunkTypeAdapter > inherited
std::shared_ptr< detchannelmaps::PDSChannelMap > m_channel_map
void conf(const appmodel::DataHandlerModule *conf) override
Set the emulator mode, if active, timestamps of processed packets are overwritten with new ones.
void stop(const appfwk::DAQModule::CommandData_t &args) override
Stop operation.
std::vector< std::pair< trgdataformats::channel_t, int16_t > > m_channel_plane_numbers
dunedaq::fddetdataformats::DAPHNEFrame * daphneframeptr
types::DAPHNESuperChunkTypeAdapter * frameptr
const types::DAPHNESuperChunkTypeAdapter * constframeptr
DAPHNEFrameProcessor(std::unique_ptr< datahandlinglibs::FrameErrorRegistry > &error_registry, bool post_processing_enabled)
void start(const appfwk::DAQModule::CommandData_t &args) override
Start operation.
std::shared_ptr< iomanager::SenderConcept< std::vector< trigger::TriggerPrimitiveTypeAdapter > > > m_tp_sink
std::chrono::time_point< std::chrono::high_resolution_clock > m_t0
dunedaq::trgdataformats::TriggerPrimitive peak_to_tp(dunedaq::fddetdataformats::DAPHNEFrame &frame, int i)
The DUNE-DAQ namespace.
A single energy deposition on a TPC or PDS channel.