Jpp 19.3.0-rc.3
the software that should make you happy
Loading...
Searching...
No Matches
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
11namespace JTRIGGER {}
12namespace JPP { using namespace JTRIGGER; }
13
14namespace JTRIGGER {
15
16
17 /**
18 * Match of two events considering overlap in time.
19 */
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
Match of two events considering overlap in time.
JEventOverlap(const double Tmax_ns)
Constructor.
static double getExtraTime()
Get extra time.
double getTmax() const
Get time window.
bool operator()(const JEvent &first, const JEvent &second) const
Match criterion.
Triggered event.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Auxiliary classes and methods for triggering.