LCOV - code coverage report
Current view: top level - fdreadoutlibs/src/tde - TDEFrameProcessor.cpp (source / functions) Coverage Total Hit
Test: code.result Lines: 0.0 % 31 0
Test Date: 2026-02-16 10:18:04 Functions: 0.0 % 6 0

            Line data    Source code
       1              : /*
       2              :  * @file TDEFrameProcessor.cpp TDE specific Task based raw processor
       3              :  * implementation
       4              :  *
       5              :  * This is part of the DUNE DAQ , copyright 2020.
       6              :  * Licensing/copyright details are in the COPYING file that you should have
       7              :  * received with this code.
       8              :  */
       9              : #include "fddetdataformats/TDE16Frame.hpp"
      10              : #include "fdreadoutlibs/tde/TDEFrameProcessor.hpp"
      11              : 
      12              : using dunedaq::datahandlinglibs::logging::TLVL_BOOKKEEPING;
      13              : using dunedaq::datahandlinglibs::logging::TLVL_FRAME_RECEIVED;
      14              : 
      15              : namespace dunedaq {
      16              : namespace fdreadoutlibs {
      17              : 
      18              : void 
      19            0 : TDEFrameProcessor::conf(const appmodel::DataHandlerModule* conf)
      20              : {
      21            0 :   inherited::add_preprocess_task(
      22            0 :       std::bind(&TDEFrameProcessor::timestamp_check, this, std::placeholders::_1));
      23              :   // m_tasklist.push_back( std::bind(&TDEFrameProcessor::frame_error_check, this, std::placeholders::_1) );
      24            0 :   inherited::conf(conf);
      25              : 
      26            0 :   m_clock_frequency = 50000000; //FIXME
      27            0 : }
      28              : 
      29              : /**
      30              :  * Pipeline Stage 1.: Check proper timestamp increments in TDE frames
      31              :  * */
      32              : void 
      33            0 : TDEFrameProcessor::timestamp_check(frameptr fp)
      34              : {
      35              :   //auto tdef.= reinterpret_cast<dunedaq::fddetdataformats::TDE16Frame*>(fp); // NOLINT
      36            0 :   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            0 :   m_current_ts = tdef.get_timestamp();
      48            0 :   auto ch = tdef.get_channel();
      49            0 :   auto tdefh = tdef.get_daq_header();
      50            0 :   TLOG_DEBUG(TLVL_FRAME_RECEIVED) << "Checking TDE frame timestamp value of " << m_current_ts 
      51            0 :           << " , crate " << tdefh->crate_id << ", slot " << tdefh->slot_id << ", stream " << tdefh->stream_id; // NOLINT
      52              : 
      53              :   // Check timestamp
      54            0 :   if (m_previous_ts[ch]!=0 && m_current_ts - m_previous_ts[ch] != dunedaq::fddetdataformats::ticks_between_adc_samples * dunedaq::fddetdataformats::tot_adc16_samples) {
      55            0 :     ++m_ts_error_ctr;
      56            0 :     m_error_registry->add_error("MISSING_FRAMES",
      57            0 :                                 datahandlinglibs::FrameErrorRegistry::ErrorInterval(m_previous_ts[ch] + (dunedaq::fddetdataformats::ticks_between_adc_samples * dunedaq::fddetdataformats::tot_adc16_samples), m_current_ts));
      58            0 :     if (m_first_ts_missmatch) { // log once
      59              :       //TLOG_DEBUG(TLVL_BOOKKEEPING) << "First timestamp MISSMATCH! -> | previous: " << std::to_string(m_previous_ts[ch])
      60            0 :       TLOG() << "First timestamp MISSMATCH for channel " << ch<< "! -> | previous: " << std::to_string(m_previous_ts[ch])
      61            0 :                                    << " current: " + std::to_string(m_current_ts);
      62            0 :       m_first_ts_missmatch = false;
      63              :     }
      64              :   }
      65              : 
      66            0 :   if (m_ts_error_ctr > 1000) {
      67            0 :     if (!m_problem_reported) {
      68            0 :       TLOG() << "*** Data Integrity ERROR *** Timestamp continuity is completely broken! "
      69            0 :              << "Something is wrong with the FE source or with the configuration!";
      70            0 :       m_problem_reported = true;
      71              :     }
      72              :   }
      73              : 
      74            0 :   m_previous_ts[ch] = m_current_ts;
      75            0 :   m_last_processed_daq_ts = m_current_ts;
      76            0 : }
      77              : 
      78              : /**
      79              :  * Pipeline Stage 2.: Check TDE headers for error flags
      80              :  * */
      81              : void 
      82            0 : TDEFrameProcessor::frame_error_check(frameptr /*fp*/)
      83              : {
      84              :   // check error fields
      85            0 : }
      86              : 
      87              : } // namespace fdreadoutlibs
      88              : } // namespace dunedaq
        

Generated by: LCOV version 2.0-1