9#include <top/dataobjects/TOPRawWaveform.h>
25 return Integral(sampleRise, samplePeak, sampleFall);
30 int min = samplePeak - 3 * (samplePeak - sampleRise);
32 int max = samplePeak + 4 * (sampleFall + 1 - samplePeak);
34 if (max > size) max = size;
45 int thresholdCount)
const
50 int currentThr = threshold;
51 bool lastState =
false;
55 for (
int i = 0; i < size; i++) {
56 const auto& adc =
m_data[i];
57 if (adc > currentThr and i < size - 1) {
58 currentThr = threshold - hysteresis;
59 if (!lastState or adc >
m_data[samplePeak]) samplePeak = i;
63 currentThr = threshold;
64 if (lastState and aboveThr >= thresholdCount) {
65 auto halfValue =
m_data[samplePeak] / 2;
66 auto sampleRise = samplePeak;
67 while (sampleRise > 0 and
m_data[sampleRise] > halfValue) sampleRise--;
68 if (sampleRise == 0 and
m_data[sampleRise] > halfValue)
continue;
69 auto sampleFall = samplePeak;
70 while (sampleFall < size - 1 and
m_data[sampleFall] > halfValue) sampleFall++;
71 if (sampleFall == size - 1 and
m_data[sampleFall] > halfValue)
continue;
int getIntegral(int sampleRise, int samplePeak, int sampleFall) const
Returns integral of a peak.
int Integral(int sampleRise, int samplePeak, int sampleFall) const
Returns integral of a peak.
int featureExtraction(int threshold, int hysteresis, int thresholdCount) const
Do feature extraction.
Abstract base class for different kinds of events.