DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
dunedaq::fdreadoutlibs::TDEFrameProcessor Class Reference

#include <TDEFrameProcessor.hpp>

Inheritance diagram for dunedaq::fdreadoutlibs::TDEFrameProcessor:
[legend]
Collaboration diagram for dunedaq::fdreadoutlibs::TDEFrameProcessor:
[legend]

Public Types

using inherited = datahandlinglibs::TaskRawDataProcessorModel<types::TDEFrameTypeAdapter>
 
using frameptr = types::TDEFrameTypeAdapter*
 
using tdeframeptr = dunedaq::fddetdataformats::TDE16Frame*
 
using timestamp_t = std::uint64_t
 
- Public Types inherited from dunedaq::opmonlib::MonitorableObject
using NodePtr = std::weak_ptr<MonitorableObject>
 
using NewNodePtr = std::shared_ptr<MonitorableObject>
 
using ElementId = std::string
 

Public Member Functions

 TDEFrameProcessor (std::unique_ptr< datahandlinglibs::FrameErrorRegistry > &error_registry, bool post_processing_enabled)
 
void conf (const appmodel::DataHandlerModule *conf) override
 Set the emulator mode, if active, timestamps of processed packets are overwritten with new ones.
 
- Public Member Functions inherited from dunedaq::datahandlinglibs::TaskRawDataProcessorModel< types::TDEFrameTypeAdapter >
 TaskRawDataProcessorModel (std::unique_ptr< FrameErrorRegistry > &error_registry, bool post_processing_enabled)
 
 ~TaskRawDataProcessorModel ()
 
void scrap (const nlohmann::json &) override
 Unconfigure.
 
void start (const nlohmann::json &) override
 Start operation.
 
void stop (const nlohmann::json &) override
 Stop operation.
 
void reset_last_daq_time ()
 
std::uint64_t get_last_daq_time () override
 Get newest timestamp of last seen packet.
 
void preprocess_item (types::TDEFrameTypeAdapter *item) override
 Preprocess one element.
 
void postprocess_item (const types::TDEFrameTypeAdapter *item) override
 Postprocess one element.
 
void add_preprocess_task (Task &&task)
 
void add_postprocess_task (Task &&task)
 
void invoke_all_preprocess_functions (types::TDEFrameTypeAdapter *item)
 
void launch_all_preprocess_functions (types::TDEFrameTypeAdapter *item)
 
- Public Member Functions inherited from dunedaq::datahandlinglibs::RawDataProcessorConcept< types::TDEFrameTypeAdapter >
 RawDataProcessorConcept ()
 
 RawDataProcessorConcept (const RawDataProcessorConcept &)=delete
 RawDataProcessorConcept is not copy-constructible.
 
 RawDataProcessorConcept (RawDataProcessorConcept &&)=delete
 RawDataProcessorConcept is not move-constructible.
 
virtual ~RawDataProcessorConcept ()
 
RawDataProcessorConceptoperator= (const RawDataProcessorConcept &)=delete
 RawDataProcessorConcept is not copy-assginable.
 
RawDataProcessorConceptoperator= (RawDataProcessorConcept &&)=delete
 RawDataProcessorConcept is not move-assignable.
 
- Public Member Functions inherited from dunedaq::opmonlib::MonitorableObject
 MonitorableObject (const MonitorableObject &)=delete
 
MonitorableObjectoperator= (const MonitorableObject &)=delete
 
 MonitorableObject (MonitorableObject &&)=delete
 
MonitorableObjectoperator= (MonitorableObject &&)=delete
 
virtual ~MonitorableObject ()=default
 
auto get_opmon_id () const noexcept
 
auto get_opmon_level () const noexcept
 

Protected Member Functions

void timestamp_check (frameptr fp)
 
void frame_error_check (frameptr)
 
- Protected Member Functions inherited from dunedaq::datahandlinglibs::TaskRawDataProcessorModel< types::TDEFrameTypeAdapter >
virtual void generate_opmon_data () override
 
void run_post_processing_thread (std::function< void(const types::TDEFrameTypeAdapter *)> &function, folly::ProducerConsumerQueue< const types::TDEFrameTypeAdapter * > &queue)
 
- Protected Member Functions inherited from dunedaq::opmonlib::MonitorableObject
 MonitorableObject ()=default
 
void register_node (ElementId name, NewNodePtr)
 
void publish (google::protobuf::Message &&, CustomOrigin &&co={}, OpMonLevel l=to_level(EntryOpMonLevel::kDefault)) const noexcept
 

Protected Attributes

timestamp_t m_previous_ts [64] = {0}
 
timestamp_t m_current_ts = 0
 
bool m_first_ts_missmatch = true
 
bool m_problem_reported = false
 
std::atomic< int > m_ts_error_ctr { 0 }
 
uint64_t m_clock_frequency
 
- Protected Attributes inherited from dunedaq::datahandlinglibs::TaskRawDataProcessorModel< types::TDEFrameTypeAdapter >
std::vector< std::function< void(types::TDEFrameTypeAdapter *)> > m_preprocess_functions
 
std::unique_ptr< FrameErrorRegistry > & m_error_registry
 
bool m_post_processing_enabled
 
std::atomic< bool > m_run_marker
 
std::vector< std::function< void(const types::TDEFrameTypeAdapter *)> > m_post_process_functions
 
std::vector< std::unique_ptr< folly::ProducerConsumerQueue< const types::TDEFrameTypeAdapter * > > > m_items_to_postprocess_queues
 
std::vector< std::unique_ptr< utilities::ReusableThread > > m_post_process_threads
 
size_t m_postprocess_queue_sizes
 
daqdataformats::SourceID m_sourceid
 
std::atomic< uint64_t > m_last_processed_daq_ts
 

Additional Inherited Members

- Static Public Member Functions inherited from dunedaq::opmonlib::MonitorableObject
static bool publishable_metric (OpMonLevel entry, OpMonLevel system) noexcept
 

Detailed Description

Definition at line 32 of file TDEFrameProcessor.hpp.

Member Typedef Documentation

◆ frameptr

◆ inherited

◆ tdeframeptr

◆ timestamp_t

Definition at line 40 of file TDEFrameProcessor.hpp.

Constructor & Destructor Documentation

◆ TDEFrameProcessor()

dunedaq::fdreadoutlibs::TDEFrameProcessor::TDEFrameProcessor ( std::unique_ptr< datahandlinglibs::FrameErrorRegistry > & error_registry,
bool post_processing_enabled )
inlineexplicit

Definition at line 42 of file TDEFrameProcessor.hpp.

43 : TaskRawDataProcessorModel<types::TDEFrameTypeAdapter
44>(error_registry, post_processing_enabled)
45 {}
TaskRawDataProcessorModel(std::unique_ptr< FrameErrorRegistry > &error_registry, bool post_processing_enabled)

Member Function Documentation

◆ conf()

void dunedaq::fdreadoutlibs::TDEFrameProcessor::conf ( const appmodel::DataHandlerModule * conf)
overridevirtual

Set the emulator mode, if active, timestamps of processed packets are overwritten with new ones.

Reimplemented from dunedaq::datahandlinglibs::TaskRawDataProcessorModel< types::TDEFrameTypeAdapter >.

Definition at line 19 of file TDEFrameProcessor.cpp.

20{
22 std::bind(&TDEFrameProcessor::timestamp_check, this, std::placeholders::_1));
23 // m_tasklist.push_back( std::bind(&TDEFrameProcessor::frame_error_check, this, std::placeholders::_1) );
25
26 m_clock_frequency = 50000000; //FIXME
27}
void conf(const appmodel::DataHandlerModule *conf) override
Set the emulator mode, if active, timestamps of processed packets are overwritten with new ones.

◆ frame_error_check()

void dunedaq::fdreadoutlibs::TDEFrameProcessor::frame_error_check ( frameptr )
protected

Pipeline Stage 2.: Check TDE headers for error flags

Definition at line 82 of file TDEFrameProcessor.cpp.

83{
84 // check error fields
85}

◆ timestamp_check()

void dunedaq::fdreadoutlibs::TDEFrameProcessor::timestamp_check ( frameptr fp)
protected

Pipeline Stage 1.: Check proper timestamp increments in TDE frames

Definition at line 33 of file TDEFrameProcessor.cpp.

34{
35 //auto tdef.= reinterpret_cast<dunedaq::fddetdataformats::TDE16Frame*>(fp); // NOLINT
36 auto tdef = fp->data; // NOLINT
37 /* Let Source Emulator deal with this
38 // If EMU data, emulate perfectly incrementing timestamp
39 if (inherited::m_emulator_mode) { // emulate perfectly incrementing timestamp
40 if (m_previous_ts[tdef.get_channel()] == 0)
41 m_previous_ts[tdef.get_channel()] = tdef.get_timestamp();
42 auto ts_next = m_previous_ts[tdef.get_channel()] + (dunedaq::fddetdataformats::ticks_between_adc_samples * dunedaq::fddetdataformats::tot_adc16_samples); // NOLINT(build/unsigned)
43 tdef.set_timestamp(ts_next);
44 }
45*/
46 // Acquire timestamp
47 m_current_ts = tdef.get_timestamp();
48 auto ch = tdef.get_channel();
49 auto tdefh = tdef.get_daq_header();
50 TLOG_DEBUG(TLVL_FRAME_RECEIVED) << "Checking TDE frame timestamp value of " << m_current_ts
51 << " , crate " << tdefh->crate_id << ", slot " << tdefh->slot_id << ", stream " << tdefh->stream_id; // NOLINT
52
53 // Check timestamp
56 m_error_registry->add_error("MISSING_FRAMES",
58 if (m_first_ts_missmatch) { // log once
59 //TLOG_DEBUG(TLVL_BOOKKEEPING) << "First timestamp MISSMATCH! -> | previous: " << std::to_string(m_previous_ts[ch])
60 TLOG() << "First timestamp MISSMATCH for channel " << ch<< "! -> | previous: " << std::to_string(m_previous_ts[ch])
61 << " current: " + std::to_string(m_current_ts);
63 }
64 }
65
66 if (m_ts_error_ctr > 1000) {
67 if (!m_problem_reported) {
68 TLOG() << "*** Data Integrity ERROR *** Timestamp continuity is completely broken! "
69 << "Something is wrong with the FE source or with the configuration!";
70 m_problem_reported = true;
71 }
72 }
73
76}
#define TLOG_DEBUG(lvl,...)
Definition Logging.hpp:112
#define TLOG(...)
Definition macro.hpp:22
static constexpr int tot_adc16_samples
static constexpr int ticks_between_adc_samples
PDS Frame with unphysical timestamp detected with ch

Member Data Documentation

◆ m_clock_frequency

uint64_t dunedaq::fdreadoutlibs::TDEFrameProcessor::m_clock_frequency
protected

Definition at line 67 of file TDEFrameProcessor.hpp.

◆ m_current_ts

timestamp_t dunedaq::fdreadoutlibs::TDEFrameProcessor::m_current_ts = 0
protected

Definition at line 63 of file TDEFrameProcessor.hpp.

◆ m_first_ts_missmatch

bool dunedaq::fdreadoutlibs::TDEFrameProcessor::m_first_ts_missmatch = true
protected

Definition at line 64 of file TDEFrameProcessor.hpp.

◆ m_previous_ts

timestamp_t dunedaq::fdreadoutlibs::TDEFrameProcessor::m_previous_ts[64] = {0}
protected

Definition at line 62 of file TDEFrameProcessor.hpp.

62{0};

◆ m_problem_reported

bool dunedaq::fdreadoutlibs::TDEFrameProcessor::m_problem_reported = false
protected

Definition at line 65 of file TDEFrameProcessor.hpp.

◆ m_ts_error_ctr

std::atomic<int> dunedaq::fdreadoutlibs::TDEFrameProcessor::m_ts_error_ctr { 0 }
protected

Definition at line 66 of file TDEFrameProcessor.hpp.

66{ 0 };

The documentation for this class was generated from the following files: