316{
319
321
323 JLimit_t& numberOfEvents = inputFile.getLimit();
324
325 struct {
326 int factoryLimit = 100000;
327 int numberOfHits = 0;
328 double Q = 0.0;
329 double TMax_s = 0.0;
330 double DMax_m = 500.0;
331 double ZMax_m = 200.0;
334 double gridAngle_deg = 10.0;
335 } parameters;
336
345
346 try {
347
349
359
360 JParser<> zap(
"Main program to trigger acoustic data.");
361
373
375 }
376 catch(const exception &error) {
378 }
379
381
382 try {
384 }
387 }
388
390
392
394
395 if (parameters.TMax_s < parameters.DMax_m /
v0) {
396
397 parameters.TMax_s = parameters.DMax_m /
v0;
398
399 NOTICE(
"Set maximal time [s] " <<
FIXED(7,3) << parameters.TMax_s <<
endl);
400 }
401
402 const JMatch3D match3D(
v0, parameters.DMax_m, parameters.TMaxExtra_s);
403 const JMatch1D match1D(
v0, parameters.DMax_m, parameters.ZMax_m, parameters.TMaxExtra_s);
404
406
407 const JCheck check(X, Y, Z,
v0, parameters.TMaxVertex_s, parameters.numberOfHits);
408
411
412
414
416
418
419 if (
module->getFloor() != 0) {
420
421 receivers[module->getID()] = JReceiver(module->getID(),
422 module->getPosition() + getPiezoPosition() - center,
423 module->getT0() * 1.0e-9);
424 }
425 }
426
427 TH1D h0(
"h0",
NULL, 21, -0.5, 20.5);
428
430
431 for (size_t i = 2; i <= 5; ++i) {
433 }
434
436
439 }
440
442
443
444
446
448
449 while (inputFile.hasNext()) {
450
451 if (inputFile.getCounter()%1000 == 0) {
453 }
454
455 const JToA* p = inputFile.next();
456
459 }
460
462
464
466
467 const double toa = p->
TOA_S();
468
475
477 }
478 }
479 }
481
482
484
485
488
489 const chrono::steady_clock::time_point t0 = chrono::steady_clock::now();
490
491 size_t trigger_counter = 0;
492
493 for (buffer_type::const_iterator p =
data.begin(), q = p; p !=
data.end(); ++p) {
494
496
497
498 const chrono::steady_clock::time_point t1 = chrono::steady_clock::now();
499
502 <<
FIXED(8,1) << p->getToA() <<
" [s]" <<
' '
503 <<
setw(6) << chrono::duration_cast<chrono::seconds>(t1 - t0).count() <<
" [s]" <<
' '
504 <<
setw(6) << trigger_counter <<
endl);
505 }
506
507 h0.Fill(0.0);
508
509 while (q !=
data.end() && q->getToA() - p->getToA() <= parameters.TMax_s) { ++q; }
510
511 if (
distance(p,q) >= parameters.numberOfHits) {
512
513 h0.Fill(1.0);
514
515 if (
distance(p,q) < parameters.factoryLimit) {
516
517 h0.Fill(2.0);
518
519 buffer_type::iterator
root = buffer.begin();
520 buffer_type::iterator __p = buffer.begin();
521 buffer_type::iterator
__q = buffer.begin();
522
524
525 ++__p;
527
528 for (buffer_type::const_iterator i = p; ++i != q; ) {
529 if (match3D(*
root,*i)) {
531 }
532 }
533
535
537
538 h0.Fill(3.0);
539
541
543
545
546 h0.Fill(4.0);
547
548 const double W = 1.0 / (
double) rotator.size();
549
551
552 for (buffer_type::iterator i =
root; i !=
__q; ++i) {
553 i->rotate(R);
554 }
555
557
559
561
562 h0.Fill(5.0, W);
563
565
567
569
570 h0.Fill(6.0, W);
571
572 if (!check.is_valid() || check(*
root, __p, __z)) {
573
574 trigger_counter += 1;
575
576 h0.Fill(7.0, W);
577
579
580 break;
581 }
582 }
583 }
584 }
585 }
586 }
587
588 } else {
589
590 trigger_counter += 1;
591
593 }
594
595 if (!out[1].empty()) {
596
597 if (out[0].empty()) {
598
599 out[0] = out[1];
600
601 }
else if (
overlap(out[0],out[1])) {
602
603 out[0].
merge(out[1]);
604
605 } else {
606
608
610
611 out[0] = out[1];
612 }
613 }
614
615 out[1].clear();
616 }
617 }
618
619 if (!out[0].empty()) {
620
622
624 }
626
628
632 }
633 }
634
636
638
640}
#define DEBUG(A)
Message macros.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
#define MAKE_CSTRING(A)
Make C-string.
#define gmake_property(A)
macros to convert (template) parameter to JPropertiesElement object
3D match criterion for acoustic signals.
Utility class to parse parameter values.
Data structure for angles in three dimensions.
Direction set covering (part of) solid angle.
Data structure for position in three dimensions.
const JPosition3D & getPosition() const
Get position.
Template definition of a multi-dimensional oscillation probability interpolation table.
static const JSoundVelocity getSoundVelocity(1541.0, -17.0e-3, -2000.0)
Function object for velocity of sound.
std::ostream & print(std::ostream &out, const JTestSummary &summary, T __begin, T __end, const bool useColors=true, const JFormat_t &formatting=JFormat_t(18, 3, std::ios::fixed))
Print test summary.
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
JComparator< JResult_t T::*, JComparison::lt > make_comparator(JResult_t T::*member)
Helper method to create comparator between values of data member.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
std::vector< JHitW0 > buffer_type
hits
JBinder2nd< JHit_t > JBind2nd(const JMatch< JHit_t > &match, const JHit_t &second)
Auxiliary method to create JBinder2nd object.
JHitIterator_t clusterize(JHitIterator_t __begin, JHitIterator_t __end, const JMatch_t &match, const int Nmin=1)
Partition data according given binary match operator.
Auxiliary data structure for floating point format specification.
Auxiliary data structure for final check on event.
Match of two events considering overlap in time and position.
void merge(const JEvent &event)
Merge event.
double getT(const double t_s) const
Get corrected time.
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.
uint32_t QUALITYFACTOR
The ticks (16ns) part of the DAQ frame timestamp.
uint32_t QUALITYNORMALISATION
A measure of how good the waveform match was to the signal.
int32_t WAVEFORMID
DOM unique identifeir.
int32_t RUN
detector identifier
double TOA_S() const
Time of Arrival, expressed in seconds relative to Unix epoch (1 January 1970 00:00:00 UTC)
Transmission with position.
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.