Jpp
software
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
JTRIGGER::JEventOverlap::getExtraTime
static double getExtraTime()
Get extra time.
Definition:
JEventOverlap.hh:67
JTRIGGER::JEvent
Triggered event.
Definition:
JEvent.hh:31
JTRIGGER::JEventOverlap::getTmax
double getTmax() const
Get time window.
Definition:
JEventOverlap.hh:54
JPP
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Definition:
JAAnetToolkit.hh:37
JTRIGGER::JEventOverlap::JEventOverlap
JEventOverlap(const double Tmax_ns)
Constructor.
Definition:
JEventOverlap.hh:27
JTRIGGER::JEventOverlap::tmax_ns
double tmax_ns
Definition:
JEventOverlap.hh:73
JTRIGGER::JEventOverlap::operator()
bool operator()(const JEvent &first, const JEvent &second) const
Match criterion.
Definition:
JEventOverlap.hh:39
JTRIGGER
Checksum.
Definition:
JSupport/JSupport.hh:35
JTRIGGER::JEventOverlap
Match of two events considering overlap in time.
Definition:
JEventOverlap.hh:20
JEvent.hh
Generated by
1.8.16