Jpp test-rotations-old
the software that should make you happy
Loading...
Searching...
No Matches
JAcousticsTriggerProcessor.cc
Go to the documentation of this file.
1#include <string>
2#include <iostream>
3#include <iomanip>
4#include <vector>
5#include <set>
6#include <map>
7#include <algorithm>
8
9#include "TROOT.h"
10#include "TFile.h"
11#include "TH1D.h"
12#include "TGraph.h"
13
17
18#include "JLang/JClonable.hh"
19#include "JLang/JPredicate.hh"
20#include "JLang/JComparator.hh"
21
22#include "JTools/JRange.hh"
23#include "JTools/JHashMap.hh"
24
25#include "JROOT/JManager.hh"
26#include "JROOT/JGraph.hh"
27
30#include "JSupport/JMeta.hh"
31
32#include "JAcoustics/JToA.hh"
40#include "JAcoustics/JEvent.hh"
42
47
48#include "Jeep/JContainer.hh"
49#include "Jeep/JProperties.hh"
50#include "Jeep/JPrint.hh"
51#include "Jeep/JParser.hh"
52#include "Jeep/JMessage.hh"
53
54#include "JTrigger/JMatch.hh"
56
57
58namespace JACOUSTICS {
59
63 using JTRIGGER::JMatch;
64 using JLANG::JClonable;
65 using JTOOLS::JRange;
67
68
69 /**
70 * Acoustic hit.
71 */
72 struct hit_type :
73 public JPosition3D,
74 public JTransmission
75 {
76 /**
77 * Default constructor.
78 */
80 {}
81
82
83 /**
84 * Constructor.
85 *
86 * \param position position
87 * \param transmission transmission
88 */
89 hit_type(const JPosition3D& position, const JTransmission& transmission) :
90 JPosition3D (position),
91 JTransmission(transmission)
92 {}
93 };
94
95
96 /**
97 * 3D match criterion for acoustic signals.
98 */
99 class JMatch3D :
100 public JClonable< JMatch<hit_type>, JMatch3D>
101 {
102 public:
103 /**
104 * Constructor.
105 *
106 * \param V sound velocity
107 * \param Tmax_s maximal extra time [s]
108 */
109 JMatch3D(const JAbstractSoundVelocity& V, const double Tmax_s = 0.0) :
110 V(V),
112 {}
113
114
115 /**
116 * Match operator.
117 *
118 * \param first hit
119 * \param second hit
120 * \return match result
121 */
122 virtual bool operator()(const hit_type& first, const hit_type& second) const override
123 {
124 using namespace JPP;
125
126 const double t1 = V.getTime(getDistance(first.getPosition(), second.getPosition()),
127 first .getZ(),
128 second.getZ());
129 const double dt = fabs(first.getToA() - second.getToA());
130
131 return dt <= t1 + Tmax_s;
132 }
133
134
136 const double Tmax_s;
137 };
138
139
140 /**
141 * Event.
142 */
143 struct event_type :
144 public JEvent,
145 public JVertex3D
146 {
147 /**
148 * Default constructor.
149 */
151 JEvent(),
152 JVertex3D()
153 {}
154
155
156 /**
157 * Constructor.
158 *
159 * \param event event
160 * \param vertex vertex
161 */
162 event_type(const JEvent& event, const JVertex3D& vertex = JVertex3D()) :
163 JEvent(event),
164 JVertex3D(vertex)
165 {}
166
167
168 /**
169 * Get event.
170 *
171 * \return event
172 */
173 const JEvent& getEvent() const
174 {
175 return static_cast<const JEvent&>(*this);
176 }
177
178
179 /**
180 * Get vertex.
181 *
182 * \return vertex
183 */
184 const JVertex3D& getVertex() const
185 {
186 return static_cast<const JVertex3D&>(*this);
187 }
188 };
189
190
191 /**
192 * Match of two events considering overlap in time and position.
193 */
194 struct JEventOverlap {
195 /**
196 * Constructor.
197 *
198 * \param Tmax_s maximal time difference between two events [s]
199 * \param Dmax_m maximal distance between two events [m]
200 */
201 JEventOverlap(const double Tmax_s, const double Dmax_m = std::numeric_limits<double>::max()) :
202 Tmax_s(Tmax_s),
204 {}
205
206
207 /**
208 * Match criterion.
209 *
210 * \param first first event
211 * \param second second event
212 * \return true if two events overlap; else false
213 */
214 bool operator()(const event_type& first, const event_type& second) const
215 {
216 using namespace JPP;
217
218 return fabs(first.getT() - second.getT()) <= Tmax_s && getDistance(first.getPosition(), second.getPosition()) <= Dmax_m;
219 }
220
221 const double Tmax_s;
222 const double Dmax_m;
223 };
224
225
226 /**
227 * Vertex.
228 */
229 struct vertex_type :
230 public JVertex3D
231 {
232 /**
233 * Default constructor.
234 */
236 JVertex3D(),
237 N(0),
238 Q(0.0)
239 {}
240
241
242 /**
243 * Constructor.
244 *
245 * \param p0 position
246 * \param t0 time
247 * \param n0 number of hits
248 * \param q0 total quality
249 */
250 vertex_type(const JVector3D& p0, const double t0, const int n0, const double q0) :
251 JVertex3D(p0, t0),
252 N(n0),
253 Q(q0)
254 {}
255
256
257 /**
258 * Get vertex.
259 *
260 * \return vertex
261 */
262 const JVertex3D& getVertex() const
263 {
264 return static_cast<const JVertex3D&>(*this);
265 }
266
267 int N; //!< number of hits
268 double Q; //!< total quality
269 };
270
271
272 /**
273 * Vertex locator.
274 */
275 struct JVelo :
276 public std::vector<JPosition3D>
277 {
278 /**
279 * Constructor.
280 *
281 * \param V sound velocity
282 * \param center center for generation of vertices
283 * \param RMax_m radius for generation of vertices [m]
284 * \param Xv_m step size for generation of vertices [m]
285 * \param factor multiplication factor for corresponding time window
286 */
288 const JVector3D& center,
289 const double RMax_m,
290 const double Xv_m,
291 const double factor = 1.0) :
292 V(V),
293 Tmax_s(factor * Xv_m / V())
294 {
295 this->push_back(center);
296
297 if (RMax_m > 0.0 && Xv_m > 0.0) {
298 for (double x = 0.5*Xv_m; x <= RMax_m; x += Xv_m) {
299 for (double y = 0.5*Xv_m; y <= RMax_m; y += Xv_m) {
300 if (x*x + y*y <= RMax_m*RMax_m) {
301 this->push_back(JVector3D(center.getX() - x, center.getY() + y, center.getZ()));
302 this->push_back(JVector3D(center.getX() + x, center.getY() + y, center.getZ()));
303 this->push_back(JVector3D(center.getX() - x, center.getY() - y, center.getZ()));
304 this->push_back(JVector3D(center.getX() + x, center.getY() - y, center.getZ()));
305 }
306 }
307 }
308 }
309 }
310
311
312 /**
313 * Check vertex.
314 *
315 * \param vx vertex
316 * \param __begin begin of data
317 * \param __end end of data
318 * \return number of hits
319 */
320 template<class T>
321 inline int operator()(const JVertex3D& vx, T __begin, T __end) const
322 {
323 const JPosition3D& p0 = vx.getPosition();
324 const double t0 = vx.getT();
325
326 int n0 = 0;
327 double q0 = 0.0;
328
329 for (T p = __begin; p != __end; ++p) {
330
331 const double t1 = p->getToA() - V.getTime(p0.getDistance(p->getPosition()), p0.getZ(), p->getZ());
332
333 if (fabs(t1 - t0) <= Tmax_s) {
334 n0 += 1;
335 q0 += p->getQ();
336 }
337 }
338
339 return n0;
340 }
341
342
343 /**
344 * Update vertex at given position.
345 *
346 * \param position position
347 * \param root root hit
348 * \param __begin begin of data
349 * \param __end end of data
350 * \return vertex
351 */
352 template<class T>
353 inline vertex_type operator()(const JPosition3D& position, const hit_type& root, T __begin, T __end) const
354 {
355 const JPosition3D& p0 = position;
356 const double t0 = root.getToA() - V.getTime(p0.getDistance(root.getPosition()), p0.getZ(), root.getZ());
357
358 int n0 = 1;
359 double q0 = root.getQ();
360
361 for (T p = __begin; p != __end; ++p) {
362
363 const double t1 = p->getToA() - V.getTime(p0.getDistance(p->getPosition()), p0.getZ(), p->getZ());
364
365 if (fabs(t1 - t0) <= Tmax_s) {
366 n0 += 1;
367 q0 += p->getQ();
368 }
369 }
370
371 return vertex_type(p0, t0, n0, q0);
372 }
373
374
375 /**
376 * Locate vertex.
377 *
378 * \param root root hit
379 * \param __begin begin of data
380 * \param __end end of data
381 * \param numberOfHits number of hits
382 * \return vertex
383 */
384 template<class T>
385 inline vertex_type operator()(const hit_type& root, T __begin, T __end, const int numberOfHits = 0) const
386 {
387 vertex_type vertex;
388
389 for (const_iterator i = this->cbegin(); i != this->cend(); ++i) {
390
391 const JPosition3D& p0 = *i;
392 const double t0 = root.getToA() - V.getTime(p0.getDistance(root.getPosition()), p0.getZ(), root.getZ());
393
394 int n0 = 1;
395 double q0 = root.getQ();
396
397 for (T p = __begin; p != __end && n0 + distance(p, __end) >= numberOfHits && n0 + distance(p, __end) >= vertex.N; ++p) {
398
399 const double t1 = p->getToA() - V.getTime(p0.getDistance(p->getPosition()), p0.getZ(), p->getZ());
400
401 if (fabs(t1 - t0) <= Tmax_s) {
402 n0 += 1;
403 q0 += p->getQ();
404 }
405 }
406
407 if (q0 > vertex.Q) {
408 vertex = vertex_type(p0, t0, n0, q0);
409 }
410 }
411
412 return vertex;
413 }
414
416 const double Tmax_s;
417 };
418
419
420 /**
421 * Get average quality.
422 *
423 * \param evt event
424 * \return quality
425 */
426 inline double getQuality(const JEvent& evt)
427 {
428 double Q = 0.0;
429
430 if (!evt.empty()) {
431
432 for (const auto& i : evt) {
433 Q += i.getQ();
434 }
435
436 Q /= evt.size();
437 }
438
439 return Q;
440 }
441}
442
443
444/**
445 * \file
446 *
447 * Main program to trigger acoustic data.
448 *
449 * An acoustic event is based on coincidences between times of arrival.\n
450 * If the number of coincident times of arrival exceeds a preset minimum,
451 * the event is triggered and subsequently stored in the output file.
452 * \author mdejong
453 */
454int main(int argc, char **argv)
455{
456 using namespace std;
457 using namespace JPP;
458
460
462
464 JLimit_t& numberOfEvents = inputFile.getLimit();
465 JTriggerParameters parameters;
466 int factoryLimit = 10000;
467 double TMaxExtra_s = 500.0e-6;
468 double RMax_m = 0.0;
469 double DMax_m = 0.0;
470 double Xv_m = 0.0;
471 double factor = 2.0;
472 double Z_m = 0.0; // z-position of emitters
473 double fraction = 0.75; // fraction of working modules
475 JSoundVelocity V = getSoundVelocity; // default sound velocity
476 string detectorFile;
477 hydrophones_container hydrophones; // hydrophones
478 double precision;
479 set<int> ID;
480 int debug;
481
482 try {
483
484 JProperties properties;
485
486 properties.insert(gmake_property(parameters.Q));
487 properties.insert(gmake_property(parameters.TMax_s));
488 properties.insert(gmake_property(parameters.numberOfHits));
489 properties.insert(gmake_property(fraction));
490 properties.insert(gmake_property(factoryLimit));
491 properties.insert(gmake_property(TMaxExtra_s));
492 properties.insert(gmake_property(RMax_m));
493 properties.insert(gmake_property(DMax_m));
494 properties.insert(gmake_property(Xv_m));
495 properties.insert(gmake_property(factor));
496 properties.insert(gmake_property(Z_m));
497
498 JParser<> zap("Main program to trigger acoustic data.");
499
500 zap['f'] = make_field(inputFile, "output of JToA");
501 zap['n'] = make_field(numberOfEvents) = JLimit::max();
502 zap['@'] = make_field(properties, "trigger parameters");
503 zap['o'] = make_field(outputFile, "output file") = "event.root";
504 zap['V'] = make_field(V, "sound velocity") = JPARSER::initialised();
505 zap['a'] = make_field(detectorFile, "detector file");
506 zap['H'] = make_field(hydrophones, "hydrophone data") = JPARSER::initialised();
507 zap['p'] = make_field(precision, "precision time-of-arrival") = 1.0e-6;
508 zap['W'] = make_field(ID) = JPARSER::initialised();
509 zap['d'] = make_field(debug) = 1;
510
511 zap(argc, argv);
512 }
513 catch(const exception &error) {
514 FATAL(error.what() << endl);
515 }
516
517
519
520 try {
521 load(detectorFile, detector);
522 }
523 catch(const JException& error) {
524 FATAL(error);
525 }
526
527 V.set(detector.getUTMZ());
528
529 const JCylinder3D cylinder(detector.begin(), detector.end());
530
531 const JConstantSoundVelocity V0 = V(cylinder.getZmax());
532
533 const JVelo velo(V0, JVector3D(cylinder.getX(), cylinder.getY(), Z_m), RMax_m, Xv_m, factor);
534
535 const JMatch3D match(V0, TMaxExtra_s);
536 const JEventOverlap overlap2D(parameters.TMax_s, DMax_m);
537 const JEventOverlap overlap1D(parameters.TMax_s);
538
539 JHashMap<int, JReceiver> receivers;
540
541 for (JDetector::const_iterator i = detector.begin(); i != detector.end(); ++i) {
542
543 JPosition3D pos(0.0, 0.0, 0.0);
544
545 if (i->getFloor() == 0) { // get relative position of hydrophone
546
547 try {
548 pos = getPosition(hydrophones.begin(),
549 hydrophones.end(),
550 make_predicate(&JHydrophone::getString, i->getString()));
551 }
552 catch(const exception&) {
553 continue; // if no position available, discard hydrophone
554 }
555 }
556
557 receivers[i->getID()] = JReceiver(i->getID(),
558 i->getPosition() + pos,
559 i->getT0() * 1.0e-9);
560 }
561
562 // monitoring
563
564 JManager<int, TH1D> M1(new TH1D("M1[%]", NULL, 2001, -0.5, 2000.5));
565 JManager<int, TH1D> M2(new TH1D("M2[%]", NULL, 2001, -0.5, 2000.5));
566 JManager<int, TH1D> M3(new TH1D("M3[%]", NULL, 2001, -0.5, 2000.5));
567 JManager<int, TH1D> M4(new TH1D("M4[%]", NULL, 2001, -0.5, 2000.5));
568 JManager<int, TH1D> M5(new TH1D("M5[%]", NULL, 2001, -0.5, 2000.5));
569
571
572 outputFile.open();
573
574 if (!outputFile.is_open()) {
575 FATAL("Error opening file " << outputFile << endl);
576 }
577
578 outputFile.put(JMeta(argc, argv));
579 outputFile.put(parameters);
580
581
582 // input data
583
584 typedef vector<hit_type> buffer_type; // data type
585
586 map<int, map<int, buffer_type> > f1; // emitter -> receiver -> data
587
588 set<int> ids; // working receivers
589
590 static double TOA_s = numeric_limits<double>::max();
591
592 while (inputFile.hasNext()) {
593
594 if (inputFile.getCounter()%100000 == 0) {
595 STATUS("counter: " << setw(8) << inputFile.getCounter() << '\r' << flush); DEBUG(endl);
596 }
597
598 JToA* parameters = inputFile.next();
599
600 if (detector.getID() != parameters->DETID) { // consistency check
601 FATAL("Invalid detector identifier " << parameters->DETID << " != " << detector.getID() << endl);
602 }
603
604 if (receivers.has(parameters->DOMID)) {
605
606 ids.insert(parameters->DOMID);
607
608 const JReceiver& receiver = receivers[parameters->DOMID];
609 const double toa_s = parameters->TOA_S();
610
611 if (toa_s < TOA_s) {
612 TOA_s = toa_s;
613 }
614
615 const JTransmission transmission(parameters->RUN,
616 parameters->DOMID,
617 parameters->QUALITYFACTOR,
618 parameters->QUALITYNORMALISATION,
619 receiver.getT(toa_s),
620 receiver.getT(toa_s));
621
622 if (ID.empty() || ID.count(getWaveformID(parameters->WAVEFORMID)) != 0) {
623 f1[getWaveformID(parameters->WAVEFORMID)][receiver.getID()].push_back(hit_type(receiver.getPosition(), transmission));
624 }
625 }
626 }
627 STATUS(endl);
628
629 if (parameters.numberOfHits == 0) {
630
631 parameters.numberOfHits = (int) (ids.size() * fraction);
632
633 STATUS("Number of hits " << parameters.numberOfHits << endl);
634 }
635
636 vector<event_type> queue;
637
638 for (map<int, map<int, buffer_type> >::iterator i = f1.begin(); i != f1.end(); ++i) {
639
640 buffer_type data;
641
642 for (map<int, buffer_type>::iterator receiver = i->second.begin(); receiver != i->second.end(); ++receiver) {
643
644 // filter similar hits
645
646 sort(receiver->second.begin(), receiver->second.end(), JTransmission::compare(precision));
647
648 buffer_type::iterator __end = unique(receiver->second.begin(), receiver->second.end(), JTransmission::equals(precision));
649
650 // selection based on quality
651
652 for (buffer_type::const_iterator p = receiver->second.begin(); p != __end; ++p) {
653 if (p->getQ() >= parameters.Q * (parameters.Q <= 1.0 ? p->getW() : 1.0)) {
654 data.push_back(*p);
655 }
656 }
657 }
658
659 if (!data.empty()) {
660
661 sort(data.begin(), data.end(), make_comparator(&hit_type::getToA, JComparison::lt())); // sort according time-of-arrival
662
663 double t0 = TOA_s;
664
665 buffer_type buffer(factoryLimit); // local buffer of hits
666 event_type out[2]; // FIFO of events
667
668 TH1D* h1 = M1[i->first];
669 TH1D* h2 = M2[i->first];
670 TH1D* h3 = M3[i->first];
671 TH1D* h4 = M4[i->first];
672 TH1D* h5 = M5[i->first];
673
674 for (buffer_type::const_iterator p = data.begin(); p != data.end(); ++p) {
675
676 if (distance(data.cbegin(), p)%100 == 0) {
677 STATUS("processed: " << setw(3) << i->first << ' ' << FIXED(9,3) << p->getToA() - data.begin()->getToA() << " [s]" << '\r' << flush); DEBUG(endl);
678 }
679
680 buffer_type::const_iterator q = p;
681
682 while (++q != data.end() && q->getToA() - p->getToA() <= parameters.TMax_s) {}
683
684 h1->Fill(distance(p,q));
685
686 if (distance(p,q) >= parameters.numberOfHits) {
687
688 if (distance(p,q) < factoryLimit) {
689
690 if ((int) out[1].size() >= parameters.numberOfHits && velo(out[1].getVertex(), p, q) >= parameters.numberOfHits) {
691
692 // ?
693
694 } else {
695
696 buffer_type::iterator root = buffer.begin();
697 buffer_type::iterator __p = buffer.begin();
698 buffer_type::iterator __q = buffer.begin();
699
700 *root = *p;
701
702 ++__p;
703 ++__q;
704
705 for (buffer_type::const_iterator i = p; ++i != q; ) {
706 if (match(*p,*i)) {
707 *__q = *i;
708 ++__q;
709 }
710 }
711
712 h2->Fill(distance(root,__q));
713
714 if (distance(root,__q) >= parameters.numberOfHits) {
715
716 __q = clusterize(__p, __q, match);
717
718 h3->Fill(distance(root,__q));
719
720 if (distance(root,__q) >= parameters.numberOfHits) {
721
722 const vertex_type vx = velo(*root, __p, __q, parameters.numberOfHits);
723
724 h4->Fill(vx.N);
725
726 if (vx.N >= parameters.numberOfHits) {
727 out[1] = event_type(JEvent(detector.getID(), out[0].getCounter() + 1, i->first, root, __q), vx.getVertex());
728 }
729 }
730 }
731 }
732
733 } else {
734
735 out[1] = event_type(JEvent(detector.getID(), out[0].getCounter() + 1, i->first, p, q));
736 }
737
738 if (!out[1].empty()) {
739
740 if (out[0].empty()) {
741
742 out[0] = out[1]; // shift
743
744 } else if (overlap2D(out[0],out[1])) {
745
746 out[0].merge(out[1]); // merge
747
748 } else {
749
750 const double t1 = out[0].begin()->getToA();
751
752 STATUS(endl);
753 STATUS("trigger: "
754 << setw(3) << i->first << ' '
755 << FIXED(9,3) << t1 - t0 << " [s]" << ' '
756 << setw(4) << out[0].size() << ' '
757 << FIXED(9,2) << getQuality(out[0]) << ' '
758 << out[0].getPosition() << endl);
759
760 //t0 = t1;
761
762 h5->Fill(out[0].size());
763
764 queue.push_back(out[0]); // store
765
766 out[0] = out[1]; // shift
767 }
768
769 out[1].clear();
770 }
771 }
772 }
773
774 if (!out[0].empty()) {
775
776 queue.push_back(out[0]); // store
777 }
778 STATUS(endl);
779 }
780 }
781
782 if (!queue.empty()) {
783
784 struct time_t {
785
786 void operator=(const double t0) { this->t0 = t0; }
787
788 operator double() const { return this->t0; }
789
790 double t0 = TOA_s;
791 };
792
794
795 sort(queue.begin(), queue.end());
796
797 for (vector<event_type>::iterator p = queue.begin(); p != queue.end(); ) {
798
801
802 // select event with highest quality
803
804 while (++q != queue.end() && overlap1D(*p,*q)) {
805 if (getQuality(*q) > getQuality(*r)) {
806 r = q;
807 }
808 }
809
810 const double t0 = ts[r->getID()];
811 const double t1 = r->begin()->getToA();
812
813 STATUS("event: "
814 << setw(3) << r->getID() << ' '
815 << FIXED(9,3) << t1 - t0 << " [s]" << ' '
816 << setw(4) << r->size() << ' '
817 << FIXED(9,2) << getQuality(*r) << ' '
818 << r->getPosition() << endl);
819
820 //ts[r->getID()] = t1;
821
822 outputFile.put(*r);
823
824 p = q;
825
826 G2[r->getID()].put(r->getX(), r->getY());
827 }
828 }
829
830 JMultipleFileScanner<JMeta> io(inputFile);
831
832 io >> outputFile;
833
834 for (const auto M : { &M1, &M2, &M3, &M4, &M5 }){
835 for (const auto& i : *M) {
836 outputFile.put(*i.second);
837 }
838 }
839
840 for (map<int, JGraph_t>::const_iterator i = G2.begin(); i != G2.end(); ++i) {
841 outputFile.put(JGraph(i->second, MAKE_CSTRING("G[" << FILL(2,'0') << i->first << "]")));
842 }
843
844 outputFile.close();
845}
Acoustics support kit.
Acoustics toolkit.
int main(int argc, char **argv)
Acoustic event.
ROOT TTree parameter settings.
Acoustic trigger parameters.
Algorithms for hit clustering and sorting.
Container I/O.
string outputFile
Data structure for detector geometry and calibration.
Recording of objects on file according a format that follows from the file name extension.
General purpose class for hash map of unique elements.
Data structure for hydrophone.
Dynamic ROOT object management.
Base class for match operations for cluster and hit-preprocessing methods.
General purpose messaging.
#define DEBUG(A)
Message macros.
Definition JMessage.hh:62
#define STATUS(A)
Definition JMessage.hh:63
#define FATAL(A)
Definition JMessage.hh:67
int debug
debug level
Definition JSirene.cc:72
ROOT I/O of application specific meta data.
Scanning of objects from multiple files according a format that follows from the extension of each fi...
Utility class to parse command line options.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition JParser.hh:2142
I/O formatting auxiliaries.
#define MAKE_CSTRING(A)
Make C-string.
Definition JPrint.hh:72
Utility class to parse parameter values.
#define gmake_property(A)
macros to convert (template) parameter to JPropertiesElement object
Auxiliary class to define a range between two values.
Acoustic receiver.
Sound velocity.
Acoustic event.
Acoustic transmission.
std::vector< T >::difference_type distance(typename std::vector< T >::const_iterator first, typename PhysicsEvent::const_iterator< T > second)
Specialisation of STL distance.
3D match criterion for acoustic signals.
Definition JBillabong.cc:96
const JAbstractSoundVelocity & V
virtual bool operator()(const hit_type &first, const hit_type &second) const override
Match operator.
JMatch3D(const JAbstractSoundVelocity &V, const double Tmax_s=0.0)
Constructor.
Detector data structure.
Definition JDetector.hh:96
int getString() const
Get string number.
Definition JLocation.hh:135
Utility class to parse parameter values.
double getY() const
Get y position.
Definition JVector2D.hh:74
double getX() const
Get x position.
Definition JVector2D.hh:63
double getZmax() const
Get maximal z position.
Data structure for position in three dimensions.
const JPosition3D & getPosition() const
Get position.
Data structure for vector in three dimensions.
Definition JVector3D.hh:36
double getY() const
Get y position.
Definition JVector3D.hh:104
double getDistance(const JVector3D &pos) const
Get distance to point.
Definition JVector3D.hh:270
double getZ() const
Get z position.
Definition JVector3D.hh:115
double getX() const
Get x position.
Definition JVector3D.hh:94
double getT(const JVector3D &pos) const
Get arrival time of Cherenkov light at given position.
Definition JVertex3D.hh:147
JVertex3D()
Default constructor.
Definition JVertex3D.hh:49
General exception.
Definition JException.hh:24
int getID() const
Get identifier.
Definition JObjectID.hh:50
Utility class to parse command line options.
Definition JParser.hh:1698
Auxiliary class to manage set of compatible ROOT objects (e.g. histograms) using unique keys.
Definition JManager.hh:47
Object writing to file.
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.
bool has(const T &value) const
Test whether given value is present.
Range of values.
Definition JRange.hh:42
Function object interface for hit matching.
Definition JMatch.hh:27
JVertex3D getVertex(const Trk &track)
Get vertex.
JPosition3D getPosition(const Vec &pos)
Get position.
Auxiliary classes and methods for acoustic position calibration.
int getWaveformID(int id)
Get waveform identifier.
double getQuality(const JEvent &evt)
Get average quality.
JContainer< std::vector< JHydrophone > > hydrophones_container
Definition JSydney.cc:80
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.
JComparator< JResult_t T::*, JComparison::lt > make_comparator(JResult_t T::*member)
Helper method to create comparator between values of data member.
double getDistance(const JFirst_t &first, const JSecond_t &second)
Get distance between objects.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
std::vector< JHitW0 > buffer_type
hits
Definition JPerth.cc:70
JFIT::JEvent JEvent
Definition JHistory.hh:404
JHitIterator_t clusterize(JHitIterator_t __begin, JHitIterator_t __end, const JMatch_t &match, const int Nmin=1)
Partition data according given binary match operator.
Definition JAlgorithm.hh:38
Definition root.py:1
Auxiliary data structure for sequence of same character.
Definition JManip.hh:330
Auxiliary data structure for floating point format specification.
Definition JManip.hh:448
Detector file.
Definition JHead.hh:227
Interface for depth dependend velocity of sound.
virtual double getTime(const double D_m, const double z1, const double z2) const =0
Get propagation time of sound.
Implementation for depth independend velocity of sound.
int getCounter() const
Get counter.
Match of two events considering overlap in time and position.
JEventOverlap(const double Tmax_s, const double Dmax_m=std::numeric_limits< double >::max())
Constructor.
bool operator()(const event_type &first, const event_type &second) const
Match criterion.
void merge(const JEvent &event)
Merge event.
Acoustic receiver.
Definition JReceiver.hh:30
double getT(const double t_s) const
Get corrected time.
Definition JReceiver.hh:72
Implementation for depth dependend velocity of sound.
JSoundVelocity & set(const double z0)
Set depth.
Time-of-arrival data from acoustic piezo sensor or hydrophone.
Definition JToA.hh:28
uint32_t DOMID
DAQ run number.
Definition JToA.hh:34
uint32_t QUALITYFACTOR
The ticks (16ns) part of the DAQ frame timestamp.
Definition JToA.hh:39
uint32_t QUALITYNORMALISATION
A measure of how good the waveform match was to the signal.
Definition JToA.hh:40
int32_t WAVEFORMID
DOM unique identifeir.
Definition JToA.hh:35
int32_t DETID
Definition JToA.hh:32
int32_t RUN
detector identifier
Definition JToA.hh:33
double TOA_S() const
Time of Arrival, expressed in seconds relative to Unix epoch (1 January 1970 00:00:00 UTC)
Definition JToAImp.cc:40
Auxiliary class to compare transmissions.
Auxiliary class to compare transmissions.
Acoustic transmission.
double getToA() const
Get calibrated time of arrival.
double Q
minimal quality if larger than one; else minimal normalised quality
double TMax_s
maximal difference between times of emission [s]
int numberOfHits
minimal number of hits to trigger event
int operator()(const JVertex3D &vx, T __begin, T __end) const
Check vertex.
vertex_type operator()(const JPosition3D &position, const hit_type &root, T __begin, T __end) const
Update vertex at given position.
const JAbstractSoundVelocity & V
JVelo(const JAbstractSoundVelocity &V, const JVector3D &center, const double RMax_m, const double Xv_m, const double factor=1.0)
Constructor.
vertex_type operator()(const hit_type &root, T __begin, T __end, const int numberOfHits=0) const
Locate vertex.
const JVertex3D & getVertex() const
Get vertex.
const JEvent & getEvent() const
Get event.
event_type(const JEvent &event, const JVertex3D &vertex=JVertex3D())
Constructor.
Acoustic hit.
Definition JBillabong.cc:70
hit_type(const JPosition3D &position, const JTransmission &transmission)
Constructor.
const JVertex3D & getVertex() const
Get vertex.
vertex_type(const JVector3D &p0, const double t0, const int n0, const double q0)
Constructor.
Auxiliary wrapper for I/O of container with optional comment (see JComment).
Definition JContainer.hh:42
Template class for object cloning.
Definition JClonable.hh:59
Type list.
Definition JTypeList.hh:23
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Definition JParser.hh:68
Auxiliary data structure to build TGraph.
Definition JGraph.hh:44
Auxiliary class for defining the range of iterations of objects.
Definition JLimit.hh:45
static counter_type max()
Get maximum counter value.
Definition JLimit.hh:128
Auxiliary class for ROOT I/O of application specific meta data.
Definition JMeta.hh:72
General purpose class for hash map of unique keys.
Definition JHashMap.hh:75