33 TLOG() <<
"Looking for TP sink...";
36 TLOG() <<
"On outputs... (" << output->UID() <<
"," << output->get_data_type() <<
")";
38 if (output->get_data_type() ==
"TriggerPrimitiveVector") {
39 TLOG() <<
"Found TP sink.";
40 m_tp_sink = get_iom_sender<std::vector<trigger::TriggerPrimitiveTypeAdapter>>(output->UID());
41 TLOG() <<
" SINK INITIALIZED for TriggerPrimitives with UID : " << output->UID();
44 ers::error(datahandlinglibs::ResourceQueueError(
ERS_HERE,
"tp",
"DefaultRequestHandlerModel", excpt));
48 TLOG() <<
"Registering processing tasks...";
49 inherited::add_preprocess_task(std::bind(&DAPHNEEthFrameProcessor::timestamp_check,
this, std::placeholders::_1));
53 TLOG()<<
" PDS Data processor does not exist.";
56 if (proc_conf ==
nullptr) {
57 TLOG()<<
"PDS RawDataProcessor does not exist.";
59 m_def_adc_intg_thresh = proc_conf-> get_default_adc_intg_thresh();
62 if (geo_id !=
nullptr) {
63 m_det_id = geo_id->get_detector_id();
64 m_crate_id = geo_id->get_crate_id();
65 m_slot_id = geo_id->get_slot_id();
66 m_stream_id = geo_id->get_stream_id();
69 m_channel_map = dunedaq::detchannelmaps::make_pds_map(proc_conf->get_channel_map());
70 const std::vector<unsigned int> channel_mask_vec = proc_conf->get_channel_mask();
72 for (
int chan = 0; chan < 48; chan++) {
73 trgdataformats::channel_t off_channel = m_channel_map->get_offline_channel_from_det_crate_slot_stream_chan(m_det_id, m_crate_id, m_slot_id, m_stream_id, chan);
74 if (std::find(channel_mask_vec.begin(), channel_mask_vec.end(), off_channel) != channel_mask_vec.end())
75 m_channel_mask_set.insert(off_channel);
78 if (m_post_processing_enabled) {
80 inherited::add_preprocess_task(std::bind(&DAPHNEEthFrameProcessor::extract_tps,
this, std::placeholders::_1));
85 TLOG() <<
"Calling parent conf.";
86 inherited::conf(conf);
112DAPHNEEthFrameProcessor::timestamp_check(
frameptr fp)
129 uint64_t k_clock_frequency = 62500000;
130 TLOG_DEBUG(TLVL_FRAME_RECEIVED) <<
"Received DAPHNE frame timestamp value of " << m_current_ts <<
" ticks (..." << std::fixed << std::setprecision(8) << (static_cast<double>(m_current_ts % (k_clock_frequency*1000)) /
static_cast<double>(k_clock_frequency)) <<
" sec)";
133 if (m_ts_error_ctr > 1000) {
134 if (!m_problem_reported) {
135 std::cout <<
"*** Data Integrity ERROR *** Timestamp continuity is completely broken! "
136 <<
"Something is wrong with the FE source or with the configuration!\n";
137 m_problem_reported =
true;
141 m_previous_ts = m_current_ts;
142 m_last_processed_daq_ts = m_current_ts;
212DAPHNEEthFrameProcessor::generate_opmon_data() {
215 if (m_post_processing_enabled) {
216 auto now = std::chrono::high_resolution_clock::now();
217 int num_new_tps = m_num_new_tps.exchange(0);
218 int num_new_tps_suppressed_too_long = 0;
219 int num_new_tps_send_failed = m_tps_send_failed.exchange(0);
220 double seconds = std::chrono::duration_cast<std::chrono::microseconds>(
now - m_t0).count() / 1000000.;
221 TLOG_DEBUG(TLVL_BOOKKEEPING) <<
"TP rate: " << std::to_string(num_new_tps / seconds / 1000.) <<
" [kHz]";
222 TLOG_DEBUG(TLVL_BOOKKEEPING) <<
"Total new TPs: " << num_new_tps;
231 publish(std::move(tp_info));
237 inherited::generate_opmon_data();