Jpp  15.0.0
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JTrigger/JEventOverlap.hh
Go to the documentation of this file.
1 #ifndef __JTRIGGER__JEVENTOVERLAP__
2 #define __JTRIGGER__JEVENTOVERLAP__
3 
4 #include "JTrigger/JEvent.hh"
5 
6 
7 /**
8  * \author mdejong
9  */
10 
11 namespace JTRIGGER {}
12 namespace JPP { using namespace JTRIGGER; }
13 
14 namespace JTRIGGER {
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_ns maximal time difference between two consecutive events [ns]
26  */
27  JEventOverlap(const double Tmax_ns) :
28  tmax_ns(Tmax_ns)
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()->getT() >= second. begin()->getT() - tmax_ns - getExtraTime() &&
45  first. begin()->getT() <= second.rbegin()->getT() + tmax_ns + getExtraTime());
46  }
47 
48 
49  /**
50  * Get time window.
51  *
52  * \return maximal time difference between two consecutive events [ns]
53  */
54  double getTmax() const
55  {
56  return tmax_ns;
57  }
58 
59 
60  /**
61  * Get extra time.
62  *
63  * The extra time is used to accomodate small time gaps (sub-ns) due to numerical precision.
64  *
65  * \return extra time [ns]
66  */
67  static inline double getExtraTime()
68  {
69  return 0.1;
70  }
71 
72  protected:
73  double tmax_ns;
74  };
75 }
76 
77 #endif
then echo The file $DIR KM3NeT_00000001_00000000 root already please rename or remove it first
Match of two events considering overlap in time.
bool operator()(const JEvent &first, const JEvent &second) const
Match criterion.
static double getExtraTime()
Get extra time.
double getTmax() const
Get time window.
JEventOverlap(const double Tmax_ns)
Constructor.
Triggered event.