Jpp  18.6.0-rc.1
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | Public Attributes | Protected Attributes | List of all members
JACOUSTICS::JEventOverlap Class Reference

Match of two events considering overlap in time. More...

#include <JEventOverlap.hh>

Public Types

typedef JRange< double > time_range
 Type definition of time range. More...
 

Public Member Functions

 JEventOverlap (const double Tmax_s=0.0)
 Constructor. More...
 
bool operator() (const JEvent &first, const JEvent &second) const
 Match criterion. More...
 
 JEventOverlap (const double Tmax_s)
 Constructor. More...
 
bool operator() (const JEvent &first, const JEvent &second) const
 Match criterion. More...
 
double getTmax () const
 Get time window. More...
 

Public Attributes

const time_range range
 

Protected Attributes

double tmax_s
 

Detailed Description

Match of two events considering overlap in time.

Definition at line 132 of file JAcousticsTriggerProcessor.cc.

Member Typedef Documentation

Type definition of time range.

Definition at line 134 of file JAcousticsTriggerProcessor.cc.

Constructor & Destructor Documentation

JACOUSTICS::JEventOverlap::JEventOverlap ( const double  Tmax_s = 0.0)
inline

Constructor.

Parameters
Tmax_smaximal time difference between two consecutive events [s]

Definition at line 141 of file JAcousticsTriggerProcessor.cc.

141  :
142  range(-Tmax_s, +Tmax_s)
143  {}
JACOUSTICS::JEventOverlap::JEventOverlap ( const double  Tmax_s)
inline

Constructor.

Parameters
Tmax_smaximal time difference between two consecutive events [s]

Definition at line 27 of file JAcoustics/JEventOverlap.hh.

27  :
28  tmax_s(Tmax_s)
29  {}

Member Function Documentation

bool JACOUSTICS::JEventOverlap::operator() ( const JEvent first,
const JEvent second 
) const
inline

Match criterion.

Parameters
firstfirst event
secondsecond event
Returns
true if two events overlap in time; else false

Definition at line 153 of file JAcousticsTriggerProcessor.cc.

154  {
155  using namespace JPP;
156 
157  if (first .empty()) return false;
158  if (second.empty()) return false;
159 
160  time_range r1(make_array(first .begin(), first .end(), &JTransmission::getToA));
161  time_range r2(make_array(second.begin(), second.end(), &JTransmission::getToA));
162 
163  r1.add(range);
164  r2.add(range);
165 
166  return overlap(r1, r2);
167  }
const array_type< JValue_t > & make_array(const JValue_t(&array)[N])
Method to create array of values.
Definition: JVectorize.hh:54
JRange< double > time_range
Type definition of time range.
double getToA() const
Get calibrated time of arrival.
bool overlap(const JRange< T, JComparator_t > &first, const JRange< T, JComparator_t > &second)
Test overlap between ranges.
Definition: JRange.hh:641
bool JACOUSTICS::JEventOverlap::operator() ( const JEvent first,
const JEvent second 
) const
inline

Match criterion.

Parameters
firstfirst event
secondsecond event
Returns
true if two events overlap in time; else false

Definition at line 39 of file JAcoustics/JEventOverlap.hh.

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  }
double JACOUSTICS::JEventOverlap::getTmax ( ) const
inline

Get time window.

Returns
maximal time difference between two consecutive events [s]

Definition at line 54 of file JAcoustics/JEventOverlap.hh.

55  {
56  return tmax_s;
57  }

Member Data Documentation

const time_range JACOUSTICS::JEventOverlap::range

Definition at line 169 of file JAcousticsTriggerProcessor.cc.

double JACOUSTICS::JEventOverlap::tmax_s
protected

Definition at line 61 of file JAcoustics/JEventOverlap.hh.


The documentation for this class was generated from the following files: