//////////////////////////////////////////////////////////////////////// /// \namespace RAT::PeakFinder /// /// \brief Namespace for set of peak-finding utility functions. /// /// \author Jose Maneira /// /// REVISION HISTORY:\n /// 2013-11: J.Maneira - First Revision, new file. \n /// 2014-10-07: G. Prior - added return values.\n /// - bug correction while retrieving TH1 bins /// 2015-09-07: R. Stainforth - added new PeakFindNarrow method which uses /// the absolute SOCPMT hit-times instead of /// a timing histogram. /// 2016-07-20: M. Mottram - Update for ROOT6 compatibility /// /// \details Algorithms to find peaks in 1-D histograms.\n /// Initially adapted by M. Boulay for SNO, from \n /// Numerical Recipes. Readapted/improved for SNO+ by JM. /// //////////////////////////////////////////////////////////////////////// #ifndef __RAT_PeakFinder_hh__ #define __RAT_PeakFinder_hh__ #include class TH1F; namespace RAT { namespace PeakFinder { /// This method finds a peak in the histogram over a wide window, it /// calculates the position, RMS, counts in the peak. /// /// @param[in] th1 histogram to find a peak in /// @param[out] tPeak location of the peak /// @param[out] tRMS RMS of the peak /// @param[out] peakCount count of hits in the peak /// @param[in] nSigmas width of peak to count /// @returns status code indicating success DS::SOCPMT::EPeakFindStatus PeakFindWide( const TH1F *th1, float &tPeak, float &tRMS, float &peakCount, const float nSigmas = 2.5 ); /// This method finds a peak in the histogram over a narrow window, it /// calculates the position, RMS, counts in the peak. /// /// @param[in] th1 histogram to find a peak in /// @param[out] tPeak location of the peak /// @param[out] tRMS RMS of the peak /// @param[out] peakCount count of hits in the peak /// @param[in] tWindow position /// @returns status code indicating success DS::SOCPMT::EPeakFindStatus PeakFindNarrow( const TH1F *th1, float &tPeak, float &tRMS, float &peakCount, const float tWindow = 4.0 ); /// This method finds a peak in the histogram over a narrow window, it /// calculates the position, RMS, counts in the peak. This uses the direct PMT /// hit times on the SOCPMT instead of using a histogram (as above) /// /// @param[in] SOC PMT to find peak in /// @param[out] tPeak location of the peak /// @param[out] tRMS RMS of the peak /// @param[out] peakCount count of hits in the peak /// @param[in] global timing offset /// @param[in] tWindow position /// @returns status code indicating success DS::SOCPMT::EPeakFindStatus PeakFindNarrow( DS::SOCPMT& socPMT, float &tPeak, float &tRMS, float &peakCount, const float globalOffset, const float tWindow = 4.0 ); /// Find the peak in a sliding window /// /// @param[in] th1 histogram to find a peak in /// @param[out] tPeak location of the peak /// @param[out] tRMS RMS of the peak /// @param[out] peakCount count of hits in the peak /// @param[in] tWindow position /// @returns true on success bool PeakFindSlidingWindow( TH1F* const th1, float &tPeak, float &tRMS, float &peakCount, const float tWindow = 7.0 ); } // namespace PeakFinder } // namespace RAT #endif //__RAT_PeakFinder_hh__