Belle II Software development
SVDMaxSumAlgorithm Class Reference

Class implementing the MaxSum algorithm. More...

#include <SVDMaxSumAlgorithm.h>

Public Member Functions

 SVDMaxSumAlgorithm (const Belle2::SVDShaperDigit::APVFloatSamples samples)
 Constructor with the APVFloatSamples.
 
virtual ~SVDMaxSumAlgorithm ()
 virtual destructor
 
int getFirstFrame ()
 
std::vector< float > getSelectedSamples ()
 

Protected Member Functions

void applyAlgorithm ()
 applies the algorithm
 

Protected Attributes

Belle2::SVDShaperDigit::APVFloatSamples m_samples
 strip samples
 
std::pair< int, std::vector< float > > m_result
 ADC of the acquired samples.
 

Detailed Description

Class implementing the MaxSum algorithm.

Definition at line 20 of file SVDMaxSumAlgorithm.h.

Constructor & Destructor Documentation

◆ SVDMaxSumAlgorithm()

Constructor with the APVFloatSamples.

Definition at line 28 of file SVDMaxSumAlgorithm.h.

29 : m_samples(samples)
30 {
32 };
Belle2::SVDShaperDigit::APVFloatSamples m_samples
strip samples
void applyAlgorithm()
applies the algorithm

◆ ~SVDMaxSumAlgorithm()

virtual ~SVDMaxSumAlgorithm ( )
inlinevirtual

virtual destructor

Definition at line 38 of file SVDMaxSumAlgorithm.h.

38{};

Member Function Documentation

◆ applyAlgorithm()

void applyAlgorithm ( )
inlineprotected

applies the algorithm

Definition at line 62 of file SVDMaxSumAlgorithm.h.

63 {
64
65 //Max Sum selection
66 if (m_samples.size() < 3)
67 B2ERROR("APV25 samples less than 3!?");
68
69 std::vector<float> Sum2bin(m_samples.size() - 1, 0);
70
71 for (int iBin = 0; iBin < static_cast<int>(m_samples.size()) - 1; ++iBin)
72 Sum2bin.at(iBin) = m_samples.at(iBin) + m_samples.at(iBin + 1);
73
74 auto itSum = std::max_element(std::begin(Sum2bin), std::end(Sum2bin));
75
76 int ctrFrame = std::distance(std::begin(Sum2bin), itSum);
77
78 if (ctrFrame == 0) ctrFrame = 1;
79
80 std::vector<float> selectedSamples = {m_samples.at(ctrFrame - 1), m_samples.at(ctrFrame), m_samples.at(ctrFrame + 1)};
81
82 m_result.first = ctrFrame - 1;
83 m_result.second = selectedSamples;
84
85 };
std::pair< int, std::vector< float > > m_result
ADC of the acquired samples.

◆ getFirstFrame()

int getFirstFrame ( )
inline
Returns
the first frame of the 3 selected samples

Definition at line 43 of file SVDMaxSumAlgorithm.h.

43{return m_result.first;}

◆ getSelectedSamples()

std::vector< float > getSelectedSamples ( )
inline
Returns
the 3 selected sample

Definition at line 48 of file SVDMaxSumAlgorithm.h.

48{return m_result.second;}

Member Data Documentation

◆ m_result

std::pair<int, std::vector<float> > m_result
protected

ADC of the acquired samples.

first frame, 3 selected sample

Definition at line 57 of file SVDMaxSumAlgorithm.h.

◆ m_samples

strip samples

Definition at line 54 of file SVDMaxSumAlgorithm.h.


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