/*! * @file SPeakFinder.h * @author Dan Saunders, on behalf of the SoLid collaboration. * @date 17 Feb 2016 */ #ifndef SPeakFinder_h_ #define SPeakFinder_h_ #include "SAlgorithms/ISAlgorithm.h" //! Simple algo for finding peaks in waveforms. class SPeakFinder : public ISAlgorithm { private: //! Number of examples to save (waveoform + peak positions). uint m_nSaveExamples; uint m_nExamplesSaved; std::vector h_examples; //! Total number of peaks found. long long m_nPeaksFound; //! Total number of waveforms scanned. long long m_nWaveformsScanned; //! See threshold() double m_threshold; //! See integralRange() int m_integralRange; //! Short integral range (includes some of the rising edge). int m_shortIntegralRange; //! Samples to integrate before peak max. int m_nSamplesRisingEdge; public: SPeakFinder(SDetector * dtr, SClipboard * cb); ~SPeakFinder(); void findPeaks(SWaveform * wf, SChannel * chan); void saveExample(SWaveform * wf, std::vector * wf_peaks); SPeak * makePeak(SWaveform * wf, SChannel * chan, int iSample, std::vector::iterator iSamp); void initialize(); void execute(); void finalize(); // Setters and getters _______________________________________________________ //! Integral range. int integralRange() {return m_integralRange;} //! Peak amplitude threshold. double threshold() {return m_threshold;} }; #endif /* SPeakFinder_h_ */