9#ifndef TPGLIBS_TPGENERATOR_HPP_
10#define TPGLIBS_TPGENERATOR_HPP_
19#include <unordered_map>
48 void configure(
const std::vector<std::pair<std::string, nlohmann::json>>& configs,
49 const std::vector<std::pair<dunedaq::trgdataformats::channel_t, int16_t>> channel_plane_numbers,
50 const int sample_tick_difference);
82 std::unordered_map<dunedaq::trgdataformats::channel_t, std::vector<std::pair<std::string, int16_t>>>
get_processor_metrics();
100 template <
typename T>
101 std::vector<dunedaq::trgdataformats::TriggerPrimitive>
operator()(
const T* frame) {
103 std::vector<dunedaq::trgdataformats::TriggerPrimitive> tp_aggr;
104 tp_aggr.reserve(T::s_num_channels * T::s_time_samples_per_frame / 2);
106 const typename T::word_t (*words_ptr)[T::s_bits_per_adc] = frame->adc_words;
107 const uint64_t timestamp = frame->get_timestamp();
111 for (
int t = 0; t < T::s_time_samples_per_frame; t++) {
112 const typename T::word_t *time_sample = *(words_ptr + t);
113 char* cursor = (
char*) time_sample;
120 __m256i regi = _mm256_lddqu_si256((__m256i*)cursor);
123 regi = _mm256_permutevar8x32_epi32(regi, _mm256_setr_epi32(1, 2, 3, 4, 5, 6, 7, 0));
126 std::vector<dunedaq::trgdataformats::TriggerPrimitive> tps =
m_tpg_pipelines[p].process(expanded_subframe);
128 for (
auto tp : tps) {
130 tp_aggr.push_back(tp);
132 cursor += register_alignment / 8;
void free_metric_collector()
std::vector< dunedaq::trgdataformats::TriggerPrimitive > operator()(const T *frame)
Driving function for the TPG.
void set_metric_collector_enable_state(bool state)
std::shared_ptr< ProcessorMetricCollector< __m256i > > get_processor_metric_collector_ptr()
std::vector< uint16_t > m_sot_minima
void set_sot_minima(const std::vector< uint16_t > &sot_minima)
Set the minimum samples over threshold for a TP according to plane.
bool get_metric_collector_enable_state()
std::unordered_map< dunedaq::trgdataformats::channel_t, std::vector< std::pair< std::string, int16_t > > > get_processor_metrics()
void configure(const std::vector< std::pair< std::string, nlohmann::json > > &configs, const std::vector< std::pair< dunedaq::trgdataformats::channel_t, int16_t > > channel_plane_numbers, const int sample_tick_difference)
Setup and configure the AVX pipelines.
bool m_tpg_metric_collect_enabled
void * get_processor_metric_collector()
Lazily initialize and return the processor metric collector.
__m256i expand_frame(const __m256i ®i)
std::vector< AVXPipeline > m_tpg_pipelines
__m256i old_expand_frame(const __m256i ®i)
Expansion from 14-bit signals to 16-bit.
void signal_metric_collection()
int m_sample_tick_difference
static const uint8_t m_num_channels_per_pipeline
std::shared_ptr< ProcessorMetricCollector< __m256i > > m_processor_metric_collector_ptr