DUNE-DAQ
DUNE Trigger and Data Acquisition software
Toggle main menu visibility
Loading...
Searching...
No Matches
dunedaq
sourcecode
fdreadoutlibs
src
daphne
DAPHNEStreamFrameProcessor.cpp
Go to the documentation of this file.
1
9
#include "
fdreadoutlibs/daphne/DAPHNEStreamFrameProcessor.hpp
"
10
#include "
fddetdataformats/DAPHNEStreamFrame.hpp
"
11
12
#include <atomic>
13
#include <functional>
14
#include <memory>
15
#include <string>
16
17
using
dunedaq::datahandlinglibs::logging::TLVL_BOOKKEEPING
;
18
using
dunedaq::datahandlinglibs::logging::TLVL_FRAME_RECEIVED
;
19
20
namespace
dunedaq
{
21
namespace
fdreadoutlibs
{
22
23
void
24
DAPHNEStreamFrameProcessor::conf
(
const
appmodel::DataHandlerModule
*
conf
)
25
{
26
datahandlinglibs::TaskRawDataProcessorModel<types::DAPHNEStreamSuperChunkTypeAdapter>::add_preprocess_task
(
27
std::bind(&
DAPHNEStreamFrameProcessor::timestamp_check
,
this
, std::placeholders::_1));
28
// m_tasklist.push_back( std::bind(&DAPHNEStreamFrameProcessor::frame_error_check, this, std::placeholders::_1) );
29
TaskRawDataProcessorModel<types::DAPHNEStreamSuperChunkTypeAdapter>::conf
(
conf
);
30
}
31
35
void
36
DAPHNEStreamFrameProcessor::timestamp_check
(
frameptr
fp)
37
{
38
/* Let Source Emulator deal with this
39
// If EMU data, emulate perfectly incrementing timestamp
40
if (inherited::m_emulator_mode) { // emulate perfectly incrementing timestamp
41
uint64_t ts_next = m_previous_ts + 64; // NOLINT(build/unsigned)
42
auto df = reinterpret_cast<daphneframeptr>(((uint8_t*)fp)); // NOLINT
43
for (unsigned int i = 0; i < fp->get_num_frames(); ++i) { // NOLINT(build/unsigned)
44
//auto wfh = const_cast<dunedaq::fddetdataformats::WIB2Header*>(wf->get_wib_header());
45
df->set_timestamp(ts_next);
46
ts_next += 64;
47
df++;
48
}
49
}
50
*/
51
// Acquire timestamp
52
m_current_ts
= fp->
get_timestamp
();
53
uint64_t k_clock_frequency = 62500000;
// NOLINT(build/unsigned)
54
TLOG_DEBUG
(
TLVL_FRAME_RECEIVED
) <<
"Received DAPHNEStream frame timestamp value of "
<<
m_current_ts
<<
" ticks (..."
55
<< std::fixed << std::setprecision(8)
56
<< (
static_cast<
double
>
(
m_current_ts
% (k_clock_frequency * 1000)) /
57
static_cast<
double
>
(k_clock_frequency))
58
<<
" sec)"
;
// NOLINT
59
60
// Check timestamp
61
// RS warning : not fixed rate!
62
// if (m_current_ts - m_previous_ts != ???) {
63
// ++m_ts_error_ctr;
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
74
m_previous_ts
=
m_current_ts
;
75
m_last_processed_daq_ts
=
m_current_ts
;
76
}
77
81
void
82
DAPHNEStreamFrameProcessor::frame_error_check
(
frameptr
/*fp*/
)
83
{
84
// check error fields
85
}
86
87
}
// namespace fdreadoutlibs
88
}
// namespace dunedaq
TLVL_FRAME_RECEIVED
@ TLVL_FRAME_RECEIVED
Definition
ReadoutLogging.hpp:28
DAPHNEStreamFrameProcessor.hpp
DAPHNEStreamFrame.hpp
dunedaq::appmodel::DataHandlerModule
Definition
DataHandlerModule.hpp:36
dunedaq::datahandlinglibs::TaskRawDataProcessorModel::add_preprocess_task
void add_preprocess_task(Task &&task)
Definition
TaskRawDataProcessorModel.hxx:73
dunedaq::datahandlinglibs::TaskRawDataProcessorModel< types::DAPHNEStreamSuperChunkTypeAdapter >::TaskRawDataProcessorModel
TaskRawDataProcessorModel(std::unique_ptr< FrameErrorRegistry > &error_registry, bool post_processing_enabled)
Definition
TaskRawDataProcessorModel.hpp:50
dunedaq::datahandlinglibs::TaskRawDataProcessorModel< types::DAPHNEStreamSuperChunkTypeAdapter >::m_last_processed_daq_ts
std::atomic< uint64_t > m_last_processed_daq_ts
Definition
TaskRawDataProcessorModel.hpp:127
dunedaq::fdreadoutlibs::DAPHNEStreamFrameProcessor::m_previous_ts
timestamp_t m_previous_ts
Definition
DAPHNEStreamFrameProcessor.hpp:64
dunedaq::fdreadoutlibs::DAPHNEStreamFrameProcessor::m_problem_reported
bool m_problem_reported
Definition
DAPHNEStreamFrameProcessor.hpp:68
dunedaq::fdreadoutlibs::DAPHNEStreamFrameProcessor::m_ts_error_ctr
std::atomic< int > m_ts_error_ctr
Definition
DAPHNEStreamFrameProcessor.hpp:69
dunedaq::fdreadoutlibs::DAPHNEStreamFrameProcessor::m_current_ts
timestamp_t m_current_ts
Definition
DAPHNEStreamFrameProcessor.hpp:65
dunedaq::fdreadoutlibs::DAPHNEStreamFrameProcessor::frame_error_check
void frame_error_check(frameptr)
Definition
DAPHNEStreamFrameProcessor.cpp:82
dunedaq::fdreadoutlibs::DAPHNEStreamFrameProcessor::frameptr
types::DAPHNEStreamSuperChunkTypeAdapter * frameptr
Definition
DAPHNEStreamFrameProcessor.hpp:38
dunedaq::fdreadoutlibs::DAPHNEStreamFrameProcessor::conf
void conf(const appmodel::DataHandlerModule *conf) override
Set the emulator mode, if active, timestamps of processed packets are overwritten with new ones.
Definition
DAPHNEStreamFrameProcessor.cpp:24
dunedaq::fdreadoutlibs::DAPHNEStreamFrameProcessor::timestamp_check
void timestamp_check(frameptr)
Definition
DAPHNEStreamFrameProcessor.cpp:36
TLOG_DEBUG
#define TLOG_DEBUG(lvl,...)
Definition
Logging.hpp:116
TLOG
#define TLOG(...)
Definition
macro.hpp:21
dunedaq::datahandlinglibs::logging::TLVL_BOOKKEEPING
@ TLVL_BOOKKEEPING
Definition
ReadoutLogging.hpp:26
dunedaq::datahandlinglibs::logging::TLVL_FRAME_RECEIVED
@ TLVL_FRAME_RECEIVED
Definition
ReadoutLogging.hpp:28
dunedaq::fdreadoutlibs
Definition
CRTBernFrameProcessor.hpp:16
dunedaq
The DUNE-DAQ namespace.
Definition
cib_utilities.cpp:5
dunedaq::fdreadoutlibs::types::DAPHNEStreamSuperChunkTypeAdapter::get_timestamp
uint64_t get_timestamp() const
Definition
DAPHNEStreamSuperChunkTypeAdapter.hpp:34
Generated on
for DUNE-DAQ by
1.18.0