#ifndef __JACOUSTICS__JEVENTOVERLAP__ #define __JACOUSTICS__JEVENTOVERLAP__ #include "JAcoustics/JEvent.hh" /** * \author mdejong */ namespace JACOUSTICS {} namespace JPP { using namespace JACOUSTICS; } namespace JACOUSTICS { /** * Match of two events considering overlap in time. */ class JEventOverlap { public: /** * Constructor. * * \param Tmax_s maximal time difference between two consecutive events [s] */ JEventOverlap(const double Tmax_s) : tmax_s(Tmax_s) {} /** * Match criterion. * * \param first first event * \param second second event * \return true if two events overlap in time; else false */ bool operator()(const JEvent& first, const JEvent& second) const { if (first .empty()) return false; if (second.empty()) return false; return (first.rbegin()->getToE() >= second. begin()->getToE() - tmax_s && first. begin()->getToE() <= second.rbegin()->getToE() + tmax_s); } /** * Get time window. * * \return maximal time difference between two consecutive events [s] */ double getTmax() const { return tmax_s; } protected: double tmax_s; }; } #endif