62{
65
67
71
73 JLimit_t& numberOfEvents = inputFile.getLimit();
81 double precision;
83
84 try {
85
86 JParser<> zap(
"Main program to trigger events in acoustic data.");
87
98 zap[
'p'] =
make_field(precision,
"precision time-of-arrival") = 1.0e-6;
100
102 }
103 catch(const exception &error) {
105 }
106
107
109
110 try {
112 }
115 }
116
118
121
122 for (JDetector::const_iterator i =
detector.begin(); i !=
detector.end(); ++i) {
123
126
128
129 if (i->getFloor() == 0) {
130
131 try {
133 hydrophones.end(),
135 }
136 catch(const exception&) {
137 continue;
138 }
139 }
140
141 receivers[i->getID()] =
JReceiver(i->getID(),
142 i->getPosition() + pos,
143 i->getT0() * 1.0e-9);
144 }
145 }
146
147 for (tripods_container::const_iterator i = tripods.begin(); i != tripods.end(); ++i) {
149 i->getUTMPosition() -
detector.getUTMPosition());
150 }
151
152 for (transmitters_container::const_iterator i = transmitters.begin(); i != transmitters.end(); ++i) {
153 try {
155 i->getPosition() +
detector.getModule(i->getLocation()).getPosition());
156 }
157 catch(const exception&) {
158 continue;
159 }
160 }
161
163
166 }
167
170
171
172
173 struct map_type :
174 public map<int, JStats>
175 {
176 long long int sum() const
177 {
178 long long int count = 0;
179
180 for (const_iterator i = this->begin(); i != this->end(); ++i) {
181 count += i->second.getCount();
182 }
183
184 return count;
185 }
186 };
187
188 map_type number_of_entries;
193
194
195
197
199
200 while (inputFile.hasNext()) {
201
202 if (inputFile.getCounter()%10000 == 0) {
204 }
205
206 JToA* parameters = inputFile.next();
207
210 }
211
212 try {
213
215
216 number_of_entries[parameters->
WAVEFORMID].put(1);
217
219
220 if (receivers.has(parameters->
DOMID)) {
221
223
225 }
226
227 } else {
229 }
230 }
231 catch(const exception&) {
233 }
234 }
236
237 for (map_type::const_iterator i = number_of_entries.begin(); i != number_of_entries.end(); ++i) {
238 STATUS(
"number of entries: " <<
setw(3) << i->first <<
' ' <<
setw(8) << i->second.getCount() <<
endl);
239 }
240
242 STATUS(
"number of aliens: " <<
setw(3) << i->first <<
' ' <<
setw(8) << i->second.getCount() <<
endl);
243 }
244
246 STATUS(
"number of misses: " <<
setw(3) << i->first <<
' ' <<
setw(8) << i->second.getCount() <<
endl);
247 }
248
250
252
254
256
257
258
260
262
263
264
265 for (buffer_type::const_iterator p = receiver->second.begin(); p != __end; ++p) {
266 if (p->getQ() >= parameters.Q * (parameters.Q <= 1.0 ? p->getW() : 1.0)) {
267 buffer.push_back(*p);
268 }
269 }
270 }
271
272 sort(buffer.begin(), buffer.end());
273
276
277 for (buffer_type::const_iterator p = buffer.begin(); p != buffer.end(); ++p) {
278
279 buffer_type::const_iterator q = p;
280
281
282
283 while (++q != buffer.end() && q->getToE() - p->getToE() <= parameters.TMax_s) {}
284
286
287 if (
distance(p,q) >= parameters.numberOfHits) {
288
290
292
294
295 if (out.empty()) {
296
297 out = event;
298
299 } else if (match(out, event)) {
300
302
303 } else {
304
306
308
309 out = event;
310 }
311 }
312 }
313
314 if (!out.empty()) {
315
317
319 }
320
321 STATUS(
"number of toes: " <<
setw(3) << i->first <<
' ' <<
setw(8) << buffer.size());
326 }
328 }
330
332 STATUS(
"number of triggers: " <<
setw(3) << i->first <<
' ' <<
setw(8) << i->second.getCount() <<
endl);
333 }
334
336 STATUS(
"number of events: " <<
setw(3) << i->first <<
' ' <<
setw(8) << i->second.getCount() <<
' ' <<
FIXED(7,3) << i->second.getMean() <<
endl);
337 }
338
340
342
344
345 return 0;
346}
#define DEBUG(A)
Message macros.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
int getString() const
Get string number.
Data structure for position in three dimensions.
Template definition of a multi-dimensional oscillation probability interpolation table.
static const int HYDROPHONE_DISABLE
Enable (disable) use of hydrophone if this status bit is 0 (1);.
static const int PIEZO_DISABLE
Enable (disable) use of piezo if this status bit is 0 (1);.
JPosition3D getPosition(const Vec &pos)
Get position.
static JEmitterID getEmitterID
Function object for emitter identification.
JContainer< std::vector< JTripod > > tripods_container
JContainer< std::vector< JTransmitter > > transmitters_container
JContainer< std::vector< JHydrophone > > hydrophones_container
static const JSoundVelocity getSoundVelocity(1541.0, -17.0e-3, -2000.0)
Function object for velocity of sound.
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
JPosition3D getPiezoPosition()
Get relative position of piezo in optical module.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
std::vector< JHitW0 > buffer_type
hits
Auxiliary data structure for floating point format specification.
Match of two events considering overlap in time and position.
void merge(const JEvent &event)
Merge event.
int getID() const
Get emitter identifier.
Implementation for depth dependend velocity of sound.
JSoundVelocity & set(const double z0)
Set depth.
Time-of-arrival data from acoustic piezo sensor or hydrophone.
uint32_t DOMID
DAQ run number.
int32_t WAVEFORMID
DOM unique identifeir.
Auxiliary class to compare transmissions.
Auxiliary class to compare transmissions.
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Auxiliary class for defining the range of iterations of objects.
static counter_type max()
Get maximum counter value.