Jpp  master_rocky-37-gf0c5bc59d
the software that should make you happy
JAcoustics/JEventOverlap.hh
Go to the documentation of this file.
1 #ifndef __JACOUSTICS__JEVENTOVERLAP__
2 #define __JACOUSTICS__JEVENTOVERLAP__
3 
4 #include "JAcoustics/JEvent.hh"
5 
6 
7 /**
8  * \author mdejong
9  */
10 
11 namespace JACOUSTICS {}
12 namespace JPP { using namespace JACOUSTICS; }
13 
14 namespace JACOUSTICS {
15 
16 
17  /**
18  * Match of two events considering overlap in time.
19  */
20  class JEventOverlap {
21  public:
22  /**
23  * Constructor.
24  *
25  * \param Tmax_s maximal time difference between two consecutive events [s]
26  */
27  JEventOverlap(const double Tmax_s) :
28  tmax_s(Tmax_s)
29  {}
30 
31 
32  /**
33  * Match criterion.
34  *
35  * \param first first event
36  * \param second second event
37  * \return true if two events overlap in time; else false
38  */
39  bool operator()(const JEvent& first, const JEvent& second) const
40  {
41  if (first .empty()) return false;
42  if (second.empty()) return false;
43 
44  return (first.rbegin()->getToE() >= second. begin()->getToE() - tmax_s &&
45  first. begin()->getToE() <= second.rbegin()->getToE() + tmax_s);
46  }
47 
48 
49  /**
50  * Get time window.
51  *
52  * \return maximal time difference between two consecutive events [s]
53  */
54  double getTmax() const
55  {
56  return tmax_s;
57  }
58 
59 
60  protected:
61  double tmax_s;
62  };
63 }
64 
65 #endif
Acoustic event.
Auxiliary classes and methods for acoustic position calibration.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Match of two events considering overlap in time.
bool operator()(const JEvent &first, const JEvent &second) const
Match criterion.
double getTmax() const
Get time window.
JEventOverlap(const double Tmax_s)
Constructor.