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
31
33
34
37
38#include <atomic>
39#include <functional>
40#include <memory>
41#include <string>
42
44
45namespace dunedaq {
46namespace fdreadoutlibs {
47
48class DAPHNEFrameProcessor : public datahandlinglibs::TaskRawDataProcessorModel<types::DAPHNESuperChunkTypeAdapter>
49{
50
51public:
55 using timestamp_t = std::uint64_t; // NOLINT(build/unsigned)
57
58 // Constructor
59 explicit DAPHNEFrameProcessor(std::unique_ptr<datahandlinglibs::FrameErrorRegistry>& error_registry, bool post_processing_enabled)
60 : datahandlinglibs::TaskRawDataProcessorModel<types::DAPHNESuperChunkTypeAdapter>(error_registry, post_processing_enabled)
61 {}
62
63
64
65 // Override config for pipeline setup
66 void conf(const appmodel::DataHandlerModule* conf) override;
67
68 void start(const appfwk::DAQModule::CommandData_t& args) override;
69 void stop(const appfwk::DAQModule::CommandData_t& args) override;
70
71protected:
72 virtual void generate_opmon_data() override;
73
77 void timestamp_check(frameptr /*fp*/);
78
82 void frame_error_check(frameptr /*fp*/);
83
84 // Internals
87 bool m_first_ts_fake = true;
89 bool m_problem_reported = false;
90 std::atomic<int> m_ts_error_ctr{ 0 };
91
92 void extract_tps( constframeptr fp);
94
95private:
96
97 //PDSChannelMap
98 std::shared_ptr<detchannelmaps::PDSChannelMap> m_channel_map;
99 std::vector<std::pair<trgdataformats::channel_t, int16_t>> m_channel_plane_numbers;
100
101 uint32_t m_det_id; // NOLINT(build/unsigned)
102 uint32_t m_crate_id; // NOLINT(build/unsigned)
103 uint32_t m_slot_id; // NOLINT(build/unsigned)
104 uint32_t m_stream_id; // NOLINT(build/unsigned)
105
106 std::set<unsigned int> m_channel_mask_set;
108
109
110
111 std::shared_ptr<iomanager::SenderConcept<std::vector<trigger::TriggerPrimitiveTypeAdapter>>> m_tp_sink;
112
113 std::atomic<uint64_t> m_num_new_tps{ 0 }; // NOLINT(build/unsigned)
114 std::atomic<uint64_t> m_tps_suppressed_too_long{ 0 };
115 std::atomic<uint64_t> m_tps_send_failed{ 0 };
116 std::atomic<uint64_t> m_frame_counter{ 0 };
117
118 std::chrono::time_point<std::chrono::high_resolution_clock> m_t0;
119
120
121};
122
123} // namespace fdreadoutlibs
124} // namespace dunedaq
125
126#endif // FDREADOUTLIBS_INCLUDE_FDREADOUTLIBS_DAPHNE_DAPHNEFRAMEPROCESSOR_HPP_
TaskRawDataProcessorModel(std::unique_ptr< FrameErrorRegistry > &error_registry, bool post_processing_enabled)
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
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.