82{
85
87
91
93 JLimit_t& numberOfEvents = inputFile.getLimit();
97 string detectorFile;
101 double precision;
103
104 try {
105
106 JParser<> zap(
"Main program to trigger events in acoustic data.");
107
108 zap[
'f'] =
make_field(inputFile,
"output of JToA");
110 zap[
'@'] =
make_field(parameters,
"trigger parameters");
113 zap[
'a'] =
make_field(detectorFile,
"detector file");
114 zap[
'T'] =
make_field(tripods,
"tripod data");
118 zap[
'p'] =
make_field(precision,
"precision time-of-arrival") = 1.0e-6;
120
121 zap(argc, argv);
122 }
123 catch(const exception &error) {
124 FATAL(error.what() << endl);
125 }
126
127
129
130 try {
132 }
135 }
136
138
141
142 for (JDetector::const_iterator i =
detector.begin(); i !=
detector.end(); ++i) {
143
146
148
149 if (i->getFloor() == 0) {
150
151 try {
153 hydrophones.end(),
155 }
156 catch(const exception&) {
157 continue;
158 }
159 }
160
161 receivers[i->getID()] =
JReceiver(i->getID(),
162 i->getPosition() + pos,
163 i->getT0() * 1.0e-9);
164 }
165 }
166
167 for (tripods_container::const_iterator i = tripods.begin(); i != tripods.end(); ++i) {
168 emitters[i->getID()] =
JEmitter(i->getID(),
169 i->getUTMPosition() -
detector.getUTMPosition());
170 }
171
172 for (transmitters_container::const_iterator i = transmitters.begin(); i != transmitters.end(); ++i) {
173 try {
174 emitters[i->getID()] =
JEmitter(i->getID(),
175 i->getPosition() +
detector.getModule(i->getLocation()).getPosition());
176 }
177 catch(const exception&) {
178 continue;
179 }
180 }
181
183
186 }
187
190
191
192 map_type number_of_entries;
193 map_type number_of_aliens;
194 map_type number_of_misses;
195 map_type number_of_triggers;
196 map_type number_of_events;
197
198
199
201
203
205
208 }
209
210 JToA* parameters = inputFile.
next();
211
213 FATAL(
"Invalid detector identifier " << parameters->
DETID <<
" != " <<
detector.getID() << endl);
214 }
215
216 try {
217
219
220 number_of_entries[parameters->
WAVEFORMID].put(1);
221
222 if (emitters.
has(
id)) {
223
224 if (receivers.
has(parameters->
DOMID)) {
225
227
228 f1[transceiver.emitter.getID()][transceiver.receiver.getID()].push_back(transceiver.getTransmission(*parameters, V));
229 }
230
231 } else {
232 number_of_misses[id].put(1);
233 }
234 }
235 catch(const exception&) {
236 number_of_aliens[parameters->
WAVEFORMID].put(1);
237 }
238 }
240
241 for (map_type::const_iterator i = number_of_entries.begin(); i != number_of_entries.end(); ++i) {
242 STATUS(
"number of entries: " << setw(3) << i->first <<
' ' << setw(8) << i->second.getCount() << endl);
243 }
244
245 for (map_type::const_iterator i = number_of_aliens.begin(); i != number_of_aliens.end(); ++i) {
246 STATUS(
"number of aliens: " << setw(3) << i->first <<
' ' << setw(8) << i->second.getCount() << endl);
247 }
248
249 for (map_type::const_iterator i = number_of_misses.begin(); i != number_of_misses.end(); ++i) {
250 STATUS(
"number of misses: " << setw(3) << i->first <<
' ' << setw(8) << i->second.getCount() << endl);
251 }
252
254
256
257 const double Q = parameters[i->first].Q;
258 const int numberOfHits = parameters[i->first].numberOfHits;
259 const double TMax_s = parameters[i->first].TMax_s;
260
262
264
265
266
268
269 buffer_type::iterator __end = unique(receiver->second.begin(), receiver->second.end(),
JTransmission::equals(precision));
270
271
272
273 for (buffer_type::const_iterator p = receiver->second.begin(); p != __end; ++p) {
274 if (p->getQ() >= Q * (Q <= 1.0 ? p->
getW() : 1.0)) {
275 buffer.push_back(*p);
276 }
277 }
278 }
279
280 sort(buffer.begin(), buffer.end());
281
284
285 for (buffer_type::const_iterator p = buffer.begin(); p != buffer.end(); ++p) {
286
287 buffer_type::const_iterator q = p;
288
289
290
291 while (++q != buffer.end() && q->getToE() - p->getToE() <= TMax_s) {}
292
294
295 if (
distance(p,q) >= numberOfHits) {
296
297 JEvent event(
detector.getID(), number_of_triggers.sum(), i->first, p, q);
298
299 number_of_triggers[i->first].put(event.size());
300
301 DEBUG(
"trigger: " << endl << event);
302
303 if (out.empty()) {
304
305 out = event;
306
307 } else if (match(out, event)) {
308
310
311 } else {
312
314
315 number_of_events[out.
getID()].put(out.size());
316
317 out = event;
318 }
319 }
320 }
321
322 if (!out.empty()) {
323
325
326 number_of_events[out.
getID()].put(out.size());
327 }
328
329 STATUS(
"number of toes: " << setw(3) << i->first <<
' ' << setw(8) << buffer.size());
334 }
336 }
338
339 for (map_type::const_iterator i = number_of_triggers.begin(); i != number_of_triggers.end(); ++i) {
340 STATUS(
"number of triggers: " << setw(3) << i->first <<
' ' << setw(8) << i->second.getCount() << endl);
341 }
342
343 for (map_type::const_iterator i = number_of_events.begin(); i != number_of_events.end(); ++i) {
344 STATUS(
"number of events: " << setw(3) << i->first <<
' ' << setw(8) << i->second.getCount() <<
' ' <<
FIXED(7,3) << i->second.getMean() << endl);
345 }
346
348
350
352
353 return 0;
354}
#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.
Utility class to parse command line options.
General purpose class for object reading from a list of file names.
virtual bool hasNext() override
Check availability of next element.
counter_type getCounter() const
Get counter.
virtual const pointer_type & next() override
Get next element.
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);.
double getW(const Trk &track, const size_t index, const double value)
Get track information.
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.
Auxiliary wrapper for I/O of container with optional comment (see JComment).
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.