DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
tpglibs::TPGPipeline< T, U > Class Template Referenceabstract

Abstract class for the TPG pipeline. More...

#include <TPGPipeline.hpp>

Public Types

using processor_t = T
 Processor type to use. Generally AVX.
 
using signal_t = U
 Signal type to use. Generally __m256i.
 

Public Member Functions

virtual ~TPGPipeline ()=default
 
virtual 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)
 Configure the pieces to the pipeline.
 
virtual std::vector< dunedaq::trgdataformats::TriggerPrimitiveprocess (const signal_t &signal)
 Process a signal through the pipeline.
 
virtual bool check_for_tps (const signal_t &tp_mask)=0
 Pure virtual function that will check if any TPs can be generated.
 
virtual signal_t save_state (const signal_t &processed_signal)=0
 Pure virtual function that will save the state of the generation.
 
virtual std::vector< dunedaq::trgdataformats::TriggerPrimitivegenerate_tps (const signal_t &tp_mask)=0
 Pure virtual function that will generate TPs given a mask to draw from.
 
virtual void set_sot_minima (const std::vector< uint16_t > &sot_minima)
 Set the samples over threshold minimum values.
 
virtual void attach_to_metric_collector (ProcessorMetricCollector< signal_t > &collector, size_t pipeline_id)
 Register all processors in this pipeline with the metric collector.
 

Protected Attributes

signal_t m_adc_integral_lo {}
 The on-going ADC integral for channels that are considered active.
 
signal_t m_adc_integral_hi {}
 
signal_t m_adc_peak {}
 The ADC peak for channels that are considered active.
 
signal_t m_samples_over_threshold {}
 The samples over threshold for channels that are considered active.
 
signal_t m_samples_to_peak {}
 The number of samples from time_start to the ADC peak.
 
dunedaq::trgdataformats::channel_t m_channels [16]
 Detector channel numbers for the 16 channels that are being processed.
 
int16_t m_plane_numbers [16]
 Detector plane numbers for the 16 channels that are being processed.
 
uint16_t m_sot_minima [3]
 The samples over threshold minimum that a TP from plane i must have.
 
std::shared_ptr< AbstractFactory< processor_t > > m_factory = AbstractFactory<processor_t>::get_instance()
 Processor factory singleton.
 
std::shared_ptr< processor_tm_processor_head
 Processor head to start from.
 

Detailed Description

template<typename T, typename U>
class tpglibs::TPGPipeline< T, U >

Abstract class for the TPG pipeline.

Definition at line 29 of file TPGPipeline.hpp.

Member Typedef Documentation

◆ processor_t

template<typename T , typename U >
using tpglibs::TPGPipeline< T, U >::processor_t = T

Processor type to use. Generally AVX.

Definition at line 32 of file TPGPipeline.hpp.

◆ signal_t

template<typename T , typename U >
using tpglibs::TPGPipeline< T, U >::signal_t = U

Signal type to use. Generally __m256i.

Definition at line 34 of file TPGPipeline.hpp.

Constructor & Destructor Documentation

◆ ~TPGPipeline()

template<typename T , typename U >
virtual tpglibs::TPGPipeline< T, U >::~TPGPipeline ( )
virtualdefault

Member Function Documentation

◆ attach_to_metric_collector()

template<typename T , typename U >
virtual void tpglibs::TPGPipeline< T, U >::attach_to_metric_collector ( ProcessorMetricCollector< signal_t > & collector,
size_t pipeline_id )
inlinevirtual

Register all processors in this pipeline with the metric collector.

Definition at line 103 of file TPGPipeline.hpp.

103 {
104 if (m_processor_head == nullptr) return;
105
106 m_processor_head->attach_to_metric_collector(collector, pipeline_id);
107 }
std::shared_ptr< processor_t > m_processor_head
Processor head to start from.

◆ check_for_tps()

template<typename T , typename U >
virtual bool tpglibs::TPGPipeline< T, U >::check_for_tps ( const signal_t & tp_mask)
pure virtual

Pure virtual function that will check if any TPs can be generated.

Implemented in tpglibs::AVXPipeline.

◆ configure()

template<typename T , typename U >
virtual void tpglibs::TPGPipeline< T, U >::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 )
inlinevirtual

Configure the pieces to the pipeline.

Parameters
configsVector of processors and configurations to be used.
channel_plane_numbersVector of channel numbers and their plane numbers.

Definition at line 44 of file TPGPipeline.hpp.

44 {
45 std::shared_ptr<processor_t> prev_processor = nullptr;
46
47 for (int i = 0; i < 16; i++) {
48 m_channels[i] = channel_plane_numbers[i].first;
49 m_plane_numbers[i] = channel_plane_numbers[i].second;
50 }
51
52 for (const auto& name_config : configs) {
53 // Get the requested processor.
54 std::shared_ptr<processor_t> processor = m_factory->create_processor(name_config.first);
55
56 // Configure it.
57 processor->configure(name_config.second, m_plane_numbers);
58
59 // If it's the first one, make it the head.
60 if (!prev_processor) {
61 m_processor_head = processor;
62 prev_processor = processor;
63 continue;
64 }
65
66 // Otherwise, start linking the chain.
67 prev_processor->set_next_processor(processor);
68 prev_processor = processor;
69 }
70 }
int16_t m_plane_numbers[16]
Detector plane numbers for the 16 channels that are being processed.
std::shared_ptr< AbstractFactory< processor_t > > m_factory
Processor factory singleton.
dunedaq::trgdataformats::channel_t m_channels[16]
Detector channel numbers for the 16 channels that are being processed.

◆ generate_tps()

template<typename T , typename U >
virtual std::vector< dunedaq::trgdataformats::TriggerPrimitive > tpglibs::TPGPipeline< T, U >::generate_tps ( const signal_t & tp_mask)
pure virtual

Pure virtual function that will generate TPs given a mask to draw from.

Implemented in tpglibs::AVXPipeline.

◆ process()

template<typename T , typename U >
virtual std::vector< dunedaq::trgdataformats::TriggerPrimitive > tpglibs::TPGPipeline< T, U >::process ( const signal_t & signal)
inlinevirtual

Process a signal through the pipeline.

Definition at line 75 of file TPGPipeline.hpp.

75 {
76 signal_t tp_mask = save_state(m_processor_head->process(signal));
77
78 std::vector<dunedaq::trgdataformats::TriggerPrimitive> tps;
79 if (check_for_tps(tp_mask))
80 tps = generate_tps(tp_mask);
81
82 return tps;
83 }
virtual bool check_for_tps(const signal_t &tp_mask)=0
Pure virtual function that will check if any TPs can be generated.
U signal_t
Signal type to use. Generally __m256i.
virtual std::vector< dunedaq::trgdataformats::TriggerPrimitive > generate_tps(const signal_t &tp_mask)=0
Pure virtual function that will generate TPs given a mask to draw from.
virtual signal_t save_state(const signal_t &processed_signal)=0
Pure virtual function that will save the state of the generation.

◆ save_state()

template<typename T , typename U >
virtual signal_t tpglibs::TPGPipeline< T, U >::save_state ( const signal_t & processed_signal)
pure virtual

Pure virtual function that will save the state of the generation.

Implemented in tpglibs::AVXPipeline.

◆ set_sot_minima()

template<typename T , typename U >
virtual void tpglibs::TPGPipeline< T, U >::set_sot_minima ( const std::vector< uint16_t > & sot_minima)
inlinevirtual

Set the samples over threshold minimum values.

Definition at line 95 of file TPGPipeline.hpp.

95 {
96 int idx = 0;
97 for (auto sot_minimum : sot_minima) {
98 m_sot_minima[idx++] = sot_minimum;
99 }
100 }
uint16_t m_sot_minima[3]
The samples over threshold minimum that a TP from plane i must have.

Member Data Documentation

◆ m_adc_integral_hi

template<typename T , typename U >
signal_t tpglibs::TPGPipeline< T, U >::m_adc_integral_hi {}
protected

Definition at line 112 of file TPGPipeline.hpp.

112{};

◆ m_adc_integral_lo

template<typename T , typename U >
signal_t tpglibs::TPGPipeline< T, U >::m_adc_integral_lo {}
protected

The on-going ADC integral for channels that are considered active.

Definition at line 111 of file TPGPipeline.hpp.

111{};

◆ m_adc_peak

template<typename T , typename U >
signal_t tpglibs::TPGPipeline< T, U >::m_adc_peak {}
protected

The ADC peak for channels that are considered active.

Definition at line 114 of file TPGPipeline.hpp.

114{};

◆ m_channels

template<typename T , typename U >
dunedaq::trgdataformats::channel_t tpglibs::TPGPipeline< T, U >::m_channels[16]
protected

Detector channel numbers for the 16 channels that are being processed.

Definition at line 120 of file TPGPipeline.hpp.

◆ m_factory

template<typename T , typename U >
std::shared_ptr<AbstractFactory<processor_t> > tpglibs::TPGPipeline< T, U >::m_factory = AbstractFactory<processor_t>::get_instance()
protected

Processor factory singleton.

Definition at line 126 of file TPGPipeline.hpp.

◆ m_plane_numbers

template<typename T , typename U >
int16_t tpglibs::TPGPipeline< T, U >::m_plane_numbers[16]
protected

Detector plane numbers for the 16 channels that are being processed.

Definition at line 122 of file TPGPipeline.hpp.

◆ m_processor_head

template<typename T , typename U >
std::shared_ptr<processor_t> tpglibs::TPGPipeline< T, U >::m_processor_head
protected

Processor head to start from.

Definition at line 128 of file TPGPipeline.hpp.

◆ m_samples_over_threshold

template<typename T , typename U >
signal_t tpglibs::TPGPipeline< T, U >::m_samples_over_threshold {}
protected

The samples over threshold for channels that are considered active.

Definition at line 116 of file TPGPipeline.hpp.

116{};

◆ m_samples_to_peak

template<typename T , typename U >
signal_t tpglibs::TPGPipeline< T, U >::m_samples_to_peak {}
protected

The number of samples from time_start to the ADC peak.

Definition at line 118 of file TPGPipeline.hpp.

118{};

◆ m_sot_minima

template<typename T , typename U >
uint16_t tpglibs::TPGPipeline< T, U >::m_sot_minima[3]
protected

The samples over threshold minimum that a TP from plane i must have.

Definition at line 124 of file TPGPipeline.hpp.


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