Jpp 21.0.0-rc.1
the software that should make you happy
Loading...
Searching...
No Matches
JHitR1.hh
Go to the documentation of this file.
1#ifndef __JTRIGGER__JHITR1__
2#define __JTRIGGER__JHITR1__
3
6
8
9#include "JTrigger/JHit.hh"
10#include "JTrigger/JHitL0.hh"
11#include "JTrigger/JHitL1.hh"
12
13
14
15/**
16 * \file
17 *
18 * Reduced data structure for L1 hit.
19 * \author mdejong
20 */
21namespace JTRIGGER {}
22namespace JPP { using namespace JTRIGGER; }
23
24namespace JTRIGGER {
25
29
30
31 /**
32 * Reduced data structure for L1 hit.
33 */
34 class JHitR1 :
36 public JPosition3D,
37 public JHit
38 {
39 public:
40 /**
41 * Default constructor.
42 */
45 JPosition3D (),
46 JHit(),
47 __n (0),
48 __w (0.0)
49 {}
50
51
52 /**
53 * Constructor.
54 *
55 * \param id module identifier
56 * \param pos position
57 */
59 const JPosition3D& pos) :
61 JPosition3D (pos),
62 JHit(),
63 __n (0),
64 __w (0.0)
65 {}
66
67
68 /**
69 * Constructor.
70 *
71 * \param id module identifier
72 * \param pos position
73 * \param hit hit
74 * \param weight weight
75 */
77 const JPosition3D& pos,
78 const JHit& hit,
79 const double weight = 1.0) :
81 JPosition3D (pos),
82 JHit(hit),
83 __n (1),
84 __w (weight)
85 {}
86
87
88 /**
89 * Constructor.
90 *
91 * \param hit hit
92 * \param weight weight
93 */
94 JHitR1(const JHitL0& hit,
95 const double weight = 1.0) :
98 JHit (hit.getHit()),
99 __n (1),
100 __w (weight)
101 {}
102
103
104 /**
105 * Constructor.
106 *
107 * \param hit hit
108 */
109 JHitR1(const JHitL1& hit) :
111 JPosition3D (hit.getPosition()),
112 JHit(hit.getT(), hit.getToT()),
113 __n (hit.size()),
114 __w (hit.getW())
115 {}
116
117
118 /**
119 * Set hit.
120 *
121 * Note that:
122 * - JHitR1::count is set to one;
123 * - JHitR1::weight is set to given <tt>weight</tt>;
124 *
125 * \param hit hit
126 * \param weight weight
127 */
128 void set(const JHit& hit,
129 const double weight = 1.0)
130 {
131 static_cast<JHit&>(*this) = hit;
132
133 this->__n = 1;
134 this->__w = weight;
135 }
136
137
138 /**
139 * Add hit.
140 *
141 * Note that:
142 * - time of this hit is set to the earliest leading edge of the two hits;
143 * - time over threshold is set to the difference between the latest trailing and earliest leading edge of two hits;
144 * - JHitR1::count is incremented by one;
145 * - JHitR1::weight is incremented by given <tt>weight</tt>;
146 *
147 * \param hit hit
148 * \param weight weight
149 * \return this hit
150 */
151 JHitR1& add(const JHit& hit,
152 const double weight = 1.0)
153 {
154 double t1 = this->t;
155 double t2 = this->t + this->tot;
156
157 if (t1 > hit.getT()) { t1 = hit.getT(); }
158 if (t2 < hit.getT() + hit.getToT()) { t2 = hit.getT() + hit.getToT(); }
159
160 this->t = t1;
161 this->tot = t2 - t1;
162 this->__n += 1;
163 this->__w += weight;
164
165 return static_cast<JHitR1&>(*this);
166 }
167
168
169 /**
170 * Get PMT identifier.
171 * Note that the PMT address is set to -1.
172 *
173 * \return PMT identifier
174 */
176 {
177 return JDAQPMTIdentifier(this->getModuleIdentifier(), -1);
178 }
179
180
181 /**
182 * Get count.
183 *
184 * \return count
185 */
186 inline int getN() const
187 {
188 return __n;
189 }
190
191
192 /**
193 * Get weight.
194 *
195 * \return weight
196 */
197 inline double getW() const
198 {
199 return __w;
200 }
201
202
203 /**
204 * Auxiliary data structure for sorting of hits.
205 */
206 static const struct compare {
207 /**
208 * Compare hits by module identifier and time.
209 *
210 * \param first first hit
211 * \param second second hit
212 * \return true if first before second; else false
213 */
214 bool operator()(const JHitR1& first, const JHitR1& second) const
215 {
216 if (first.getModuleID() == second.getModuleID())
217 return first.getT() < second.getT();
218 else
219 return first.getModuleID() < second.getModuleID();
220 }
222
223
224 protected:
225 int __n;
226 double __w;
227 };
228}
229
230#endif
Basic data structure for L0 hit.
Basic data structure for L1 hit.
Basic data structure for time and time over threshold information of hit.
Data structure for position in three dimensions.
const JPosition3D & getPosition() const
Get position.
Data structure for L0 hit.
Definition JHitL0.hh:31
Data structure for L1 hit.
Definition JHitL1.hh:37
Reduced data structure for L1 hit.
Definition JHitR1.hh:38
JHitR1()
Default constructor.
Definition JHitR1.hh:43
JHitR1(const JHitL0 &hit, const double weight=1.0)
Constructor.
Definition JHitR1.hh:94
JHitR1(const JDAQModuleIdentifier &id, const JPosition3D &pos)
Constructor.
Definition JHitR1.hh:58
double getW() const
Get weight.
Definition JHitR1.hh:197
JDAQPMTIdentifier getPMTIdentifier() const
Get PMT identifier.
Definition JHitR1.hh:175
void set(const JHit &hit, const double weight=1.0)
Set hit.
Definition JHitR1.hh:128
JHitR1 & add(const JHit &hit, const double weight=1.0)
Add hit.
Definition JHitR1.hh:151
static const struct JTRIGGER::JHitR1::compare compare
JHitR1(const JHitL1 &hit)
Constructor.
Definition JHitR1.hh:109
int getN() const
Get count.
Definition JHitR1.hh:186
JHitR1(const JDAQModuleIdentifier &id, const JPosition3D &pos, const JHit &hit, const double weight=1.0)
Constructor.
Definition JHitR1.hh:76
Hit data structure.
const JHit & getHit() const
Get hit.
double t
time of leading edge [ns]
double tot
time-over-threshold [ns]
double getToT() const
Get calibrated time over threshold of hit.
double getT() const
Get calibrated time of hit.
int getModuleID() const
Get module identifier.
const JDAQModuleIdentifier & getModuleIdentifier() const
Get Module identifier.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Auxiliary classes and methods for triggering.
Auxiliary data structure for sorting of hits.
Definition JHitR1.hh:206
bool operator()(const JHitR1 &first, const JHitR1 &second) const
Compare hits by module identifier and time.
Definition JHitR1.hh:214