Jpp test-rotations-old
the software that should make you happy
Loading...
Searching...
No Matches
JDAQKeyHit.hh
Go to the documentation of this file.
1#ifndef __JDAQKEYHIT__
2#define __JDAQKEYHIT__
3
8
9
10/**
11 * \author mdejong
12 */
13
14namespace KM3NETDAQ {
15
16 /**
17 * DAQ key hit
18 */
19 class JDAQKeyHit :
21 public JDAQHit
22 {
23 public:
24
25 friend size_t getSizeof<JDAQKeyHit>();
27 friend JWriter& operator<<(JWriter&, const JDAQKeyHit&);
28
29 /**
30 * Default constructor.
31 */
36
37
38 /**
39 * Constructor.
40 *
41 * \param id module identifier
42 * \param hit PMT hit
43 */
45 const JDAQHit& hit) :
47 JDAQHit(hit)
48 {}
49
50
51 /**
52 * Virtual destructor.
53 */
54 virtual ~JDAQKeyHit()
55 {}
56
57
58 /**
59 * Type conversion operator.
60 *
61 * \return axis
62 */
63 operator JDAQPMTIdentifier () const
64 {
65 return JDAQPMTIdentifier(this->getModuleID(), this->getPMT());
66 }
67
68
70 };
71
72
73
74 /**
75 * Less than operator for DAQ hits.
76 *
77 * The less than operator is applied first to the module idientifier then to the PMT channel and then to the time of the hits.
78 *
79 * \param first hit
80 * \param second hit
81 * \result true if first hit before than second; else false
82 */
83 inline bool operator<(const JDAQKeyHit& first,
84 const JDAQKeyHit& second)
85 {
86 if (first.getModuleID() == second.getModuleID()) {
87 if (first.getPMT() == second.getPMT())
88 return first.getT() < second.getT();
89 else
90 return first.getPMT() < second.getPMT();
91 } else
92 return first.getModuleID() < second.getModuleID();
93 }
94
95
96
97 /**
98 * Equal operator for DAQ hits.
99 *
100 * The equal operator is applied to the module idientifier, to the PMT channel and to the time of the hits.
101 *
102 * \param first hit
103 * \param second hit
104 * \result t rue if first hit equal to second; else false
105 */
106 inline bool operator==(const JDAQKeyHit& first,
107 const JDAQKeyHit& second)
108 {
109 return (first.getModuleID() == second.getModuleID() &&
110 first.getPMT() == second.getPMT() &&
111 first.getT() == second.getT());
112 }
113
114
115 /**
116 * Not-equal operator for DAQ hits.
117 *
118 * \param first hit
119 * \param second hit
120 * \result true if first hit not equal to second; else false
121 */
122 inline bool operator!=(const JDAQKeyHit& first,
123 const JDAQKeyHit& second)
124 {
125 return !(first == second);
126 }
127}
128
129#endif
Interface for binary input.
Interface for binary output.
Hit data structure.
Definition JDAQHit.hh:35
JPMT_t getPMT() const
Get PMT.
Definition JDAQHit.hh:75
JTDC_t getT() const
Get time.
Definition JDAQHit.hh:86
friend JWriter & operator<<(JWriter &, const JDAQKeyHit &)
Write JDAQKeyHit to output.
JDAQKeyHit(const JDAQModuleIdentifier &id, const JDAQHit &hit)
Constructor.
Definition JDAQKeyHit.hh:44
friend JReader & operator>>(JReader &, JDAQKeyHit &)
Read JDAQKeyHit from input.
JDAQKeyHit()
Default constructor.
Definition JDAQKeyHit.hh:32
virtual ~JDAQKeyHit()
Virtual destructor.
Definition JDAQKeyHit.hh:54
ClassDef(JDAQKeyHit, 1)
int getModuleID() const
Get module identifier.
bool operator==(const Head &first, const Head &second)
Equal operator.
Definition JHead.hh:1801
bool operator<(const Head &first, const Head &second)
Less than operator.
Definition JHead.hh:1817
bool operator!=(const JTag &first, const JTag &second)
Not equal operator for JTag.
Definition JTag.hh:291
KM3NeT DAQ data structures and auxiliaries.
Definition DataQueue.cc:39
size_t getSizeof< JDAQKeyHit >()
Get size of type.