Jpp 20.0.0-195-g190c9e876
the software that should make you happy
Loading...
Searching...
No Matches
JSydney.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 <algorithm>
7#include <limits>
8#include <sys/stat.h>
9
10#include <type_traits>
11#include <functional>
12#include <future>
13#include <mutex>
14#include <thread>
15#include <vector>
16#include <queue>
17
18#include "TROOT.h"
19#include "TFile.h"
20
22
23#include "JLang/JPredicate.hh"
24#include "JLang/JComparator.hh"
25#include "JLang/JComparison.hh"
29
30#include "JSystem/JStat.hh"
31
34#include "JDetector/JTripod.hh"
36#include "JDetector/JModule.hh"
39
40#include "JFit/JGradient.hh"
41
42#include "JTools/JHashMap.hh"
43#include "JTools/JRange.hh"
44
45#include "JMath/JQuantile_t.hh"
46
48
52#include "JAcoustics/JHit.hh"
55#include "JAcoustics/JEvent.hh"
62
63#include "Jeep/JTimer.hh"
64#include "Jeep/JeepToolkit.hh"
65#include "Jeep/JContainer.hh"
66#include "Jeep/JParser.hh"
67#include "Jeep/JMessage.hh"
68
69
70namespace JACOUSTICS {
71
73 using JEEP::JContainer;
75
76 using namespace JDETECTOR;
77
78
82
83
84 /**
85 * Script commands.
86 */
87 static const char skip_t = '#'; //!< skip line
88 static const std::string initialise_t = "initialise"; //!< initialise
89 static const std::string fix_t = "fix"; //!< fix objects
90 static const std::string string_t = "string"; //!< string
91 static const std::string tripod_t = "tripod"; //!< tripod
92 static const std::string stage_t = "stage"; //!< fit stage
93
94
95 /**
96 * Auxiliary data structure for handling of file names.
97 */
98 struct JFilenames {
99 /**
100 * Strip leading and trailing white spaces.
101 *
102 * \return file names
103 */
113
114 std::string detector; //!< detector
115 std::string tripod; //!< tripod
116 std::string hydrophone; //!< hydrophone
117 std::string transmitter; //!< transmitter
118 };
119
120
121 /**
122 * Auxiliary data structure for setup of complete system.
123 */
124 struct JSetup {
125 JDetector detector; //!< detector
126 JDetectorMechanics_t mechanics; //!< mechanical model
128 struct :
130 {
131 /**
132 * Check if there is a hydrophone on given string.
133 *
134 * \param id string identifier
135 * \return true if hydrophone present; else false
136 */
137 bool hasString(const int id) const
138 {
139 using namespace std;
140
141 return (find_if(this->begin(), this->end(), make_predicate(&JHydrophone::getString, id)) != this->end());
142 }
143 } hydrophones; //!< hydrophones
145 };
146
147
148 /**
149 * Main class for pre-calibration using acoustics data.
150 */
151 struct JSydney {
152
153 static constexpr double RADIUS_M = 1.0; //!< maximal horizontal distance between T-bar and emitter/hydrophone
154
155 /**
156 * List of object identifiers.
157 */
158 struct ids_t :
159 public std::set<int>
160 {
161 /**
162 * Default constructor.
163 */
165 {}
166
167
168 /**
169 * Copy constructor.
170 *
171 * \param buffer list of identifiers
172 */
173 ids_t(const std::vector<int>& buffer) :
174 std::set<int>(buffer.begin(), buffer.end())
175 {}
176
177
178 /**
179 * Difference constructor.
180 * Make list of all object identifiers in A that are not in B.
181 *
182 * \param A list of identifiers
183 * \param B list of identifiers
184 */
185 ids_t(const ids_t& A,
186 const ids_t& B)
187 {
188 std::set_difference(A.begin(), A.end(), B.begin(), B.end(), std::inserter(*this, this->begin()));
189 }
190
191
192 /**
193 * Fix.
194 * Keep list of object identifiers that are not in B.
195 *
196 * \param B list of identifiers
197 */
198 void fix(const ids_t& B)
199 {
200 ids_t A;
201
202 this->swap(A);
203
204 std::set_difference(A.begin(), A.end(), B.begin(), B.end(), std::inserter(*this, this->begin()));
205 }
206
207
208 /**
209 * Read identifiers from input stream
210 *
211 * \param in input stream
212 * \param object identifiers
213 * \return input stream
214 */
215 friend inline std::istream& operator>>(std::istream& in, ids_t& object)
216 {
217 for (int id; in >> id; ) {
218 object.insert(id);
219 }
220
221 if (!in.bad()) {
222 in.clear();
223 }
224
225 return in;
226 }
227
228
229 /**
230 * Write identifiers to output stream
231 *
232 * \param out output stream
233 * \param object identifiers
234 * \return output stream
235 */
236 friend inline std::ostream& operator<<(std::ostream& out, const ids_t& object)
237 {
238 for (const int id : object) {
239 out << ' ' << id;
240 }
241
242 return out;
243 }
244 };
245
246
247 /**
248 * Auxiliary data structure for group of lists of identifiers of to-be-fitted objects.
249 */
250 struct fits_t {
251 /**
252 * Default constructor.
253 */
255 {}
256
257
258 /**
259 * Initialise.
260 *
261 * \param setup setup
262 */
264 {
265 using namespace JPP;
266
267 strings = make_array(setup.detector .begin(), setup.detector .end(), &JModule ::getString);
268 tripods = make_array(setup.tripods .begin(), setup.tripods .end(), &JTripod ::getID);
269 hydrophones = make_array(setup.hydrophones .begin(), setup.hydrophones .end(), &JHydrophone ::getString);
270 transmitters = make_array(setup.transmitters.begin(), setup.transmitters.end(), &JTransmitter::getString);
271 }
272
273 ids_t strings; //!< identifiers of strings
274 ids_t tripods; //!< identifiers of tripods
275 ids_t hydrophones; //!< identifiers of strings with hydrophone
276 ids_t transmitters; //!< identifiers of strings with transmitter
277 };
278
279
280 /**
281 * Auxiliary class to edit (z) position of module.
282 */
284 public JParameter_t
285 {
286 /**
287 * Constructor.
288 *
289 * \param module module
290 */
295
296
297 /**
298 * Constructor.
299 *
300 * \param module module
301 * \param direction direction
302 */
307
308
309 /**
310 * Apply step.
311 *
312 * \param step step
313 */
314 virtual void apply(const double step) override
315 {
316 using namespace JPP;
317
318 module.add(direction * step);
319 }
320
321 private:
324 };
325
326
327 /**
328 * Auxiliary class to edit (x,y,z) position of string.
329 */
331 public JParameter_t
332 {
333 /**
334 * Constructor.
335 *
336 * The option <tt>true</tt> and <tt>false</tt> correspond to all modules and optical modules only, respectively.
337 *
338 * \param setup setup
339 * \param id string number
340 * \param direction direction
341 * \param option option
342 */
343 JStringEditor(JSetup& setup, const int id, const JVector3D& direction, const bool option) :
346 {
347 for (size_t i = 0; i != detector.size(); ++i) {
348 if (detector[i].getString() == id && (detector[i].getFloor() != 0 || option)) {
349 index.push_back(i);
350 }
351 }
352 }
353
354
355 /**
356 * Apply step.
357 *
358 * \param step step
359 */
360 virtual void apply(const double step) override
361 {
362 for (const auto i : index) {
363 detector[i].add(direction * step);
364 }
365 }
366
367 private:
371 };
372
373
374 /**
375 * Auxiliary class to edit length of Dyneema ropes.
376 */
378 public JParameter_t
379 {
380 /**
381 * Constructor.
382 *
383 * \param setup setup
384 * \param id string number
385 * \param z0 reference position
386 */
387 JDyneemaEditor(JSetup& setup, const int id, const double z0 = 0.0) :
389 z0 (z0)
390 {
391 for (size_t i = 0; i != detector.size(); ++i) {
392 if (detector[i].getString() == id && detector[i].getFloor() != 0) {
393 index.push_back(i);
394 }
395 }
396 }
397
398
399 /**
400 * Apply step.
401 *
402 * \param step step
403 */
404 virtual void apply(const double step) override
405 {
406 for (const auto i : index) {
407
408 JModule& module = detector[i];
409
410 if (step > 0.0)
411 module.set(JVector3D(module.getX(), module.getY(), z0 + (module.getZ() - z0) * (1.0 + step)));
412 else if (step < 0.0)
413 module.set(JVector3D(module.getX(), module.getY(), z0 + (module.getZ() - z0) / (1.0 - step)));
414 }
415 }
416
417 private:
419 double z0;
421 };
422
423
424 /**
425 * Auxiliary class to edit (x,y,z) position of tripod.
426 */
428 public JParameter_t
429 {
430 /**
431 * Constructor.
432 *
433 * \param setup setup
434 * \param id tripod identifier
435 * \param direction direction
436 */
437 JTripodEditor(JSetup& setup, const int id, const JVector3D& direction) :
440 {
441 using namespace std;
442 using namespace JPP;
443
444 index = distance(tripods.begin(), find_if(tripods.begin(), tripods.end(), make_predicate(&JTripod::getID, id)));
445 }
446
447
448 /**
449 * Apply step.
450 *
451 * \param step step
452 */
453 virtual void apply(const double step) override
454 {
455 tripods[index].add(direction * step);
456 }
457
458 private:
461 size_t index;
462 };
463
464
465 /**
466 * Auxiliary class to edit orientation of anchor.
467 */
469 public JParameter_t
470 {
471 /**
472 * Constructor.
473 *
474 * \param setup setup
475 * \param id string identifier
476 */
477 JAnchorEditor(JSetup& setup, const int id) :
480 {
481 using namespace std;
482 using namespace JPP;
483
484 index[0] = distance(hydrophones .begin(), find_if(hydrophones .begin(), hydrophones .end(), make_predicate(&JHydrophone ::getString, id)));
485 index[1] = distance(transmitters.begin(), find_if(transmitters.begin(), transmitters.end(), make_predicate(&JTransmitter::getString, id)));
486 }
487
488
489 /**
490 * Apply step.
491 *
492 * \param step step
493 */
494 virtual void apply(const double step) override
495 {
496 using namespace JPP;
497
498 const JRotation3Z R(step);
499
500 if (index[0] != hydrophones .size()) { hydrophones [index[0]].rotate(R); }
501 if (index[1] != transmitters.size()) { transmitters[index[1]].rotate(R); }
502 }
503
504 private:
507 size_t index[2];
508 };
509
510
511 /**
512 * Extended data structure for parameters of stage.
513 */
515 public JFitParameters
516 {
517 /**
518 * Default constuctor.
519 */
521 Nmax (std::numeric_limits<size_t>::max()),
522 Nextra (0),
523 epsilon(1.0e-4),
524 debug (3)
525 {}
526
527
528 /**
529 * Read parameters from input stream
530 *
531 * \param in input stream
532 * \param object parameters
533 * \return input stream
534 */
535 friend inline std::istream& operator>>(std::istream& in, JParameters_t& object)
536 {
537 object = JParameters_t();
538
539 in >> object.option
540 >> object.mestimator
541 >> object.sigma_s
542 >> object.stdev
543 >> object.Nextra;
544
545 if (in) {
546
547 for (double value; in >> value; ) {
548 object.steps.push_back(value);
549 }
550
551 if (!in.bad()) {
552 in.clear();
553 }
554 }
555
556 return in;
557 }
558
559
560 /**
561 * Write parameters to output stream
562 *
563 * \param out output stream
564 * \param object parameters
565 * \return output stream
566 */
567 friend inline std::ostream& operator<<(std::ostream& out, const JParameters_t& object)
568 {
569 using namespace std;
570
571 out << setw(2) << object.option << ' '
572 << setw(2) << object.mestimator << ' '
573 << SCIENTIFIC(9,3) << object.sigma_s << ' '
574 << SCIENTIFIC(9,3) << object.stdev << ' '
575 << setw(3) << object.Nextra;
576
577 for (const double value : object.steps) {
578 out << ' ' << FIXED(9,5) << value;
579 }
580
581 return out;
582 }
583
584 size_t Nmax;
585 size_t Nextra;
586 double epsilon;
587 int debug;
589 };
590
591
592 /**
593 * Constructor.
594 *
595 * \param filenames file names
596 * \param mechanics mechanical model parameters
597 * \param V sound velocity
598 * \param threads threads
599 * \param debug debug
600 */
602 const JDetectorMechanics_t& mechanics,
603 const JSoundVelocity& V,
604 const size_t threads,
605 const int debug) :
607 V(V),
609 debug(debug)
610 {
612
613 setup.mechanics = mechanics;
615
616 if (filenames.hydrophone != "") { setup.hydrophones .load(filenames.hydrophone .c_str()); }
618
619 for (JDetector::const_iterator i = setup.detector.begin(); i != setup.detector.end(); ++i) {
620 receivers[i->getID()] = i->getLocation();
621 }
622
623 // detach PMTs
624
626
627 for (JDetector::iterator module = setup.detector.begin(); module != setup.detector.end(); ++module) {
628 module->clear();
629 }
630
632
634
635 this->V.set(setup.detector.getUTMZ()); // sound velocity at detector depth
636
639
641
642 ROOT::EnableThreadSafety();
643 }
644
645
646 /**
647 * Auxiliary data structure for decomposed string.
648 */
649 struct string_type :
650 public std::vector<JModule> // optical modules
651 {
652 /**
653 * Add module.
654 *
655 * \param module module
656 */
657 void push_back(const JModule& module)
658 {
659 if (module.getFloor() == 0)
660 this->base = module;
661 else
663 }
664
665 JModule base; // base module
666 };
667
668
669 /**
670 * Auxiliary data structure for detector with decomposed strings.
671 */
673 public std::map<int, string_type>
674 {
675 /**
676 * Add module.
677 *
678 * \param module module
679 */
680 void push_back(const JModule& module)
681 {
682 (*this)[module.getString()].push_back(module);
683 }
684 };
685
686
687 /**
688 * Fit procedure to determine the positions of tripods and transmitters using strings that are fixed.
689 *
690 * \param parameters parameters
691 */
693 {
694 using namespace std;
695 using namespace JPP;
696
697 this->parameters = parameters;
698
699 JDetector A; // old strings
700 detector_type B; // new strings with transmitter -> fit only base module
701 JDetector C; // new strings w/o transmitter -> discard completely from fit
702
703 for (JDetector::iterator module = setup.detector.begin(); module != setup.detector.end(); ++module) {
704
705 if (fits.strings .count(module->getString()) == 0)
706 A.push_back(*module);
707 else if (fits.transmitters.count(module->getString()) != 0)
708 B.push_back(*module);
709 else
710 C.push_back(*module);
711 }
712
713 setup.detector.swap(A);
714
715 for (const auto& element : B) {
716 setup.detector.push_back(element.second.base);
717 }
718
720
721 JGradient fit(parameters.Nmax, parameters.Nextra, parameters.epsilon, parameters.debug);
722
723 for (const int i : fits.tripods) {
724 fit.push_back(JModifier_t(MAKE_STRING(LEFT(16) << "tripod.x: " << RIGHT(4) << i), new JTripodEditor(setup, i, JVector3X_t), parameters.steps[0]));
725 fit.push_back(JModifier_t(MAKE_STRING(LEFT(16) << "tripod.y: " << RIGHT(4) << i), new JTripodEditor(setup, i, JVector3Y_t), parameters.steps[0]));
726 fit.push_back(JModifier_t(MAKE_STRING(LEFT(16) << "tripod.z: " << RIGHT(4) << i), new JTripodEditor(setup, i, JVector3Z_t), parameters.steps[0]));
727 }
728
729 for (const int i : fits.transmitters) {
730 fit.push_back(JModifier_t(MAKE_STRING(LEFT(16) << "transmitter.x: " << RIGHT(4) << i), new JStringEditor(setup, i, JVector3X_t, true), parameters.steps[0]));
731 fit.push_back(JModifier_t(MAKE_STRING(LEFT(16) << "transmitter.y: " << RIGHT(4) << i), new JStringEditor(setup, i, JVector3Y_t, true), parameters.steps[0]));
732 fit.push_back(JModifier_t(MAKE_STRING(LEFT(16) << "transmitter.z: " << RIGHT(4) << i), new JStringEditor(setup, i, JVector3Z_t, true), parameters.steps[0]));
733 }
734
735 const double chi2 = fit(*this);
736
737 for (auto& element : B) {
738
739 const JModule& base = setup.detector.getModule(router->getAddress(JLocation(element.second.base.getString(),0)));
740 const JVector3D pos = base.getPosition() - element.second.base.getPosition();
741
742 for (string_type::iterator module = element.second.begin(); module != element.second.end(); ++module) {
743
744 module->add(pos);
745
746 setup.detector.push_back(*module);
747 }
748 }
749
750 copy(C.begin(), C.end(), back_inserter(setup.detector));
751
752 sort(setup.detector.begin(), setup.detector.end(), make_comparator(&JModule::getLocation));
753
755
756 STATUS("detector: " << FIXED(9,4) << chi2 << endl);
757 }
758
759
760 /**
761 * Fit procedure to determine the positions of the strings and tripods.
762 *
763 * \param parameters parameters
764 */
766 {
767 using namespace std;
768 using namespace JPP;
769
770 this->parameters = parameters;
771
772 JGradient fit(parameters.Nmax, parameters.Nextra, parameters.epsilon, parameters.debug);
773
774 for (const int i : fits.strings) {
775 fit.push_back(JModifier_t(MAKE_STRING(LEFT(16) << "string.x: " << RIGHT(4) << i), new JStringEditor(setup, i, JVector3X_t, true), parameters.steps[0]));
776 fit.push_back(JModifier_t(MAKE_STRING(LEFT(16) << "string.y: " << RIGHT(4) << i), new JStringEditor(setup, i, JVector3Y_t, true), parameters.steps[0]));
777 fit.push_back(JModifier_t(MAKE_STRING(LEFT(16) << "string.z: " << RIGHT(4) << i), new JStringEditor(setup, i, JVector3Z_t, false), parameters.steps[0]));
778 }
779
780 for (const int i : fits.tripods) {
781 fit.push_back(JModifier_t(MAKE_STRING(LEFT(16) << "tripod.x: " << RIGHT(4) << i), new JTripodEditor(setup, i, JVector3X_t), parameters.steps[1]));
782 fit.push_back(JModifier_t(MAKE_STRING(LEFT(16) << "tripod.y: " << RIGHT(4) << i), new JTripodEditor(setup, i, JVector3Y_t), parameters.steps[1]));
783 fit.push_back(JModifier_t(MAKE_STRING(LEFT(16) << "tripod.z: " << RIGHT(4) << i), new JTripodEditor(setup, i, JVector3Z_t), parameters.steps[1]));
784 }
785
786 for (const int i : ids_t(fits.hydrophones, fits.transmitters)) {
787 fit.push_back(JModifier_t(MAKE_STRING(LEFT(16) << "anchor.R: " << RIGHT(4) << i), new JAnchorEditor(setup, i), parameters.steps[0] / RADIUS_M));
788 }
789
790 for (const int i : fits.transmitters) {
791
792 JModule& module = setup.detector.getModule(router->getAddress(JLocation(i,0)));
793
794 fit.push_back(JModifier_t(MAKE_STRING(LEFT(16) << "anchor.R: " << RIGHT(4) << i), new JAnchorEditor(setup, i), parameters.steps[0] / RADIUS_M));
795 fit.push_back(JModifier_t(MAKE_STRING(LEFT(16) << "anchor.z: " << RIGHT(4) << i), new JModuleEditor(module), parameters.steps[0]));
796 }
797
798 const double chi2 = fit(*this);
799
800 STATUS("detector: " << FIXED(9,4) << chi2 << endl);
801 }
802
803
804 /**
805 * Fit procedure to determine the stretching and z-positions of individual strings.
806 *
807 * \param parameters parameters
808 */
810 {
811 using namespace std;
812 using namespace JPP;
813
814 this->parameters = parameters;
815
816 map<int, JDetector> buffer;
817
818 double z0 = 0.0;
819
820 for (JDetector::iterator module = setup.detector.begin(); module != setup.detector.end(); ++module) {
821
822 buffer[module->getString()].push_back(*module);
823
824 if (module->getZ() > z0) {
825 z0 = module->getZ();
826 }
827 }
828
829 JDetector tx;
830
831 for (transmitters_container::iterator i = setup.transmitters.begin(); i != setup.transmitters.end(); ++i) {
832 try {
833 tx.push_back(router->getModule(i->getLocation()));
834 }
835 catch(const exception&) {}
836 }
837
838 for (const int i : fits.strings) {
839
840 setup.detector.swap(buffer[i]);
841
842 copy(tx.begin(), tx.end(), back_inserter(setup.detector));
843
845
846 JGradient fit(parameters.Nmax, parameters.Nextra, parameters.epsilon, parameters.debug);
847
848 fit.push_back(JModifier_t(MAKE_STRING(LEFT(16) << "string.M: " << RIGHT(4) << i), new JDyneemaEditor(setup, i, z0), parameters.steps[0]));
849 fit.push_back(JModifier_t(MAKE_STRING(LEFT(16) << "string.z: " << RIGHT(4) << i), new JStringEditor (setup, i, JVector3Z_t, false), parameters.steps[1]));
850
851 const double chi2 = fit(*this);
852
853 STATUS("string: " << setw(4) << i << ' ' << FIXED(9,4) << chi2 << endl);
854
855 buffer[i].clear();
856
857 copy_if(setup.detector.begin(), setup.detector.end(), back_inserter(buffer[i]), make_predicate(&JModule::getString, i));
858 }
859
860 setup.detector.clear();
861
862 for (const auto& element : buffer) {
863 copy(element.second.begin(), element.second.end(), back_inserter(setup.detector));
864 }
865
867 }
868
869
870 /**
871 * Fit procedure to determine the z-positions of the modules.
872 *
873 * \param parameters parameters
874 */
876 {
877 using namespace std;
878 using namespace JPP;
879
880 this->parameters = parameters;
881
882 JGradient fit(parameters.Nmax, parameters.Nextra, parameters.epsilon, parameters.debug);
883
884 for (JDetector::iterator module = setup.detector.begin(); module != setup.detector.end(); ++module) {
885 if (fits.strings.count(module->getString()) != 0 && module->getFloor() != 0) {
886 fit.push_back(JModifier_t(MAKE_STRING(LEFT(16) << "module.z: " << right << module->getLocation()), new JModuleEditor(*module), parameters.steps[0]));
887 }
888 }
889
890 const double chi2 = fit(*this);
891
892 STATUS("detector: " << FIXED(9,4) << chi2 << endl);
893 }
894
895
896 /**
897 * Fit procedure to determine the z-positions of anchors.
898 *
899 * \param parameters parameters
900 */
902 {
903 using namespace std;
904 using namespace JPP;
905
906 this->parameters = parameters;
907
908 JGradient fit(parameters.Nmax, parameters.Nextra, parameters.epsilon, parameters.debug);
909
910 for (JDetector::iterator module = setup.detector.begin(); module != setup.detector.end(); ++module) {
911 if (fits.strings.count(module->getString()) != 0 && module->getFloor() == 0) {
912 fit.push_back(JModifier_t(MAKE_STRING(LEFT(16) << "module.z: " << right << module->getLocation()), new JModuleEditor(*module), parameters.steps[0]));
913 }
914 }
915
916 const double chi2 = fit(*this);
917
918 STATUS("detector: " << FIXED(9,4) << chi2 << endl);
919 }
920
921
922 /**
923 * Fit procedure to determine the (x,y,z) positions of the modules.
924 * This procedure should be considered unorthodox - it can be used to modify the detector file in such a way
925 * to accommodate anomalies in the shapes of a string (e.g. entanglement of string in D0ORCA018).
926 *
927 * \param parameters parameters
928 */
930 {
931 using namespace std;
932 using namespace JPP;
933
934 this->parameters = parameters;
935
936 JGradient fit(parameters.Nmax, parameters.Nextra, parameters.epsilon, parameters.debug);
937
938 for (JDetector::iterator module = setup.detector.begin(); module != setup.detector.end(); ++module) {
939 if (fits.strings.count(module->getString()) != 0 && module->getFloor() != 0) {
940 fit.push_back(JModifier_t(MAKE_STRING(LEFT(16) << "module.x: " << right << module->getLocation()), new JModuleEditor(*module, JVector3X_t), parameters.steps[0]));
941 fit.push_back(JModifier_t(MAKE_STRING(LEFT(16) << "module.y: " << right << module->getLocation()), new JModuleEditor(*module, JVector3Y_t), parameters.steps[0]));
942 fit.push_back(JModifier_t(MAKE_STRING(LEFT(16) << "module.z: " << right << module->getLocation()), new JModuleEditor(*module, JVector3Z_t), parameters.steps[0]));
943 }
944 }
945
946 const double chi2 = fit(*this);
947
948 STATUS("detector: " << FIXED(9,4) << chi2 << endl);
949 }
950
951
952 /**
953 * Get chi2.
954 *
955 * \param option option
956 * \return chi2/NDF
957 */
958 double operator()(const int option) const
959 {
960 using namespace std;
961 using namespace JPP;
962
964
966
967 for (tripods_container::const_iterator i = setup.tripods.begin(); i != setup.tripods.end(); ++i) {
968 {
969 emitters[i->getID()] = JEmitter(i->getID(), i->getUTMPosition() - setup.detector.getUTMPosition());
970 }
971 }
972
973 for (transmitters_container::const_iterator i = setup.transmitters.begin(); i != setup.transmitters.end(); ++i) {
974 try {
975 emitters[i->getID()] = JEmitter(i->getID(), i->getPosition() + router->getModule(i->getLocation()).getPosition());
976 }
977 catch(const exception&) {} // if no module available, discard transmitter
978 }
979
980 if (option == 0 || // step wise improvement of the chi2
981 option == 1) { // evaluation of the chi2 before the determination of the gradient of the chi2
982
983 this->output.clear();
984
985 JSTDObjectWriter<JSuperEvt> out(this->output); // write data for subsequent use
986
987 JFremantle::output = (option == 1 ? &out : NULL);
988
989 {
990 JFremantle fremantle(geometry, V, parameters, threads, 2 * threads);
991
992 for (const input_type& superevt : input) {
993
994 const JWeight getWeight(superevt.begin(), superevt.end());
995
996 vector<JHit> data;
997
998 for (input_type::const_iterator evt = superevt.begin(); evt != superevt.end(); ++evt) {
999
1000 if (emitters.has(evt->getID())) {
1001
1002 const JEmitter& emitter = emitters [evt->getID()];
1003 const double weight = getWeight(evt->getID());
1004
1005 for (JEvent::const_iterator i = evt->begin(); i != evt->end(); ++i) {
1006
1007 if (geometry.hasLocation(receivers[i->getID()])) {
1008
1009 data.push_back(JHit(emitter,
1010 distance(superevt.begin(), evt),
1011 receivers[i->getID()],
1012 i->getToA(),
1014 weight));
1015 }
1016 }
1017 }
1018 }
1019
1020 if (getMinimumNumberOfEmitters(data.begin(), data.end()) >= parameters.Nmin) {
1021 fremantle.enqueue(data);
1022 }
1023 }
1024 }
1025
1026 return JFremantle::Q.getMean(numeric_limits<float>::max());
1027
1028 } else if (option == 2) { // evaluation of the derivative of the chi2 to each fit parameter
1029
1030 {
1032
1033 JPlatypus platypus(geometry, emitters, V, parameters, in, threads);
1034 }
1035
1036 return JPlatypus::Q.getMean(numeric_limits<float>::max());
1037
1038 } else {
1039
1040 return numeric_limits<float>::max();
1041 }
1042 }
1043
1044
1045 /**
1046 * Run.
1047 *
1048 * \param script steering script
1049 */
1050 void run(const std::string& script)
1051 {
1052 using namespace std;
1053 using namespace JPP;
1054
1055 ifstream in(script.c_str());
1056
1057 while (in) {
1058
1059 string buffer, key;
1060
1061 if (getline(in, buffer)) {
1062
1063 if (buffer.empty() || buffer[0] == skip_t) {
1064 continue;
1065 }
1066
1067 istringstream is(buffer);
1068
1069 is >> key;
1070
1071 if (key == initialise_t) { // set object identifiers
1072
1074
1075 } else if (key == fix_t) { // fix object identifiers
1076
1077 string type; // type of object
1078 ids_t id; // identifiers
1079
1080 if (is >> type >> id) {
1081 if (type == string_t) {
1082 fits.strings .fix(id);
1083 fits.hydrophones .fix(id);
1084 fits.transmitters.fix(id);
1085 } else if (type == tripod_t) {
1086 fits.tripods .fix(id);
1087 } else {
1088 THROW(JValueOutOfRange, "Invalid type <" << type << ">");
1089 }
1090 }
1091
1092 } else if (key == stage_t) { // stage
1093
1094 string stage;
1096
1097 if (is >> stage >> input) {
1098
1099 STATUS("stage " << setw(3) << stage << " {" << input << "}" << endl);
1100
1101 JTimer timer;
1102
1103 timer.start();
1104
1105 ofstream out(MAKE_CSTRING("stage-" << stage << ".log"));
1106
1107 {
1108 JRedirectStream redirect(cout, out);
1109
1110 switch (stage[stage.size() - 1]) {
1111
1112 case '0':
1113 stage_0(input);
1114 break;
1115
1116 case 'a':
1117 case 'A':
1118 stage_a(input);
1119 break;
1120
1121 case 'b':
1122 case 'B':
1123 stage_b(input);
1124 break;
1125
1126 case 'c':
1127 case 'C':
1128 stage_c(input);
1129 break;
1130
1131 case 'd':
1132 case 'D':
1133 stage_d(input);
1134 break;
1135
1136 case 'x':
1137 case 'X':
1138 stage_x(input);
1139 break;
1140
1141 default:
1142 THROW(JValueOutOfRange, "Invalid stage <" << stage << ">");
1143 break;
1144 }
1145 }
1146
1147 out.close();
1148
1149 store(stage);
1150 store();
1151
1152 timer.stop();
1153
1154 STATUS("Elapsed time " << FIXED(12,3) << timer.usec_wall * 1.0e-6 << " s." << endl);
1155 }
1156
1157 } else {
1158 THROW(JValueOutOfRange, "Invalid key <" << key << ">");
1159 }
1160 }
1161 }
1162
1163 in.close();
1164 }
1165
1166
1167 /**
1168 * Store data in given directory.
1169 *
1170 * \param dir directory
1171 */
1172 void store(const std::string& dir = ".")
1173 {
1174 using namespace JPP;
1175
1176 if (getFileStatus(dir.c_str()) || (mkdir(dir.c_str(), S_IRWXU | S_IRWXG) != -1)) {
1177
1178 // attach PMTs
1179
1180 for (JDetector::iterator module = detector.begin(); module != detector.end(); ++module) {
1181 module->set(router->getModule(module->getLocation()).getPosition());
1182 }
1183
1185
1187
1188 if (filenames.hydrophone != "") { setup.hydrophones .store(getFilename(dir, filenames.hydrophone) .c_str()); }
1190
1191 } else {
1192
1193 THROW(JValueOutOfRange, "Invalid directory <" << dir << ">");
1194 }
1195 }
1196
1197
1198 /**
1199 * Get list of identifiers of receivers.
1200 *
1201 * \return list of identifiers
1202 */
1204 {
1205 ids_t buffer;
1206
1207 for (JDetector::const_iterator i = setup.detector.begin(); i != setup.detector.end(); ++i) {
1208 if ((i->getFloor() != 0 && !i->has(PIEZO_DISABLE)) || (setup.hydrophones.hasString(i->getString()) && !i->has(HYDROPHONE_DISABLE))) {
1209 buffer.insert(i->getID());
1210 }
1211 }
1212
1213 return buffer;
1214 }
1215
1216
1217 /**
1218 * Get list of identifiers of emitters.
1219 *
1220 * \return list of identifiers
1221 */
1223 {
1224 using namespace std;
1225
1226 ids_t buffer;
1227
1228 for (tripods_container::const_iterator i = setup.tripods.begin(); i != setup.tripods.end(); ++i) {
1229 buffer.insert(i->getID());
1230 }
1231
1232 for (transmitters_container::const_iterator i = setup.transmitters.begin(); i != setup.transmitters.end(); ++i) {
1233
1234 try {
1235
1236 const JModule& module = router->getModule(i->getLocation());
1237
1238 if (!module.has(TRANSMITTER_DISABLE)) {
1239 buffer.insert(i->getID());
1240 }
1241 }
1242 catch(const exception&) {}
1243 }
1244
1245 return buffer;
1246 }
1247
1248
1251 size_t threads;
1255
1257 std::unique_ptr<JLocationRouter> router;
1258
1261
1262 private:
1264
1267 };
1268}
1269
1270
1271/**
1272 * \file
1273 *
1274 * Application to perform acoustic pre-calibration.
1275 * \author mdejong
1276 */
1277int main(int argc, char **argv)
1278{
1279 using namespace std;
1280 using namespace JPP;
1281
1282 typedef JContainer< std::set<JTransmission_t> > disable_container;
1283
1285 JLimit_t& numberOfEvents = inputFile.getLimit();
1286 JFilenames filenames; // file names
1287 JFitParameters parameters; // fit parameters
1288 string script; // script file
1289 JSoundVelocity V = getSoundVelocity; // default sound velocity
1290 JDetectorMechanics mechanics; // mechanical model data
1291 disable_container disable; // disable tansmissions
1292 size_t threads; // number of threads
1293 int debug;
1294
1295 try {
1296
1297 JParser<> zap("Application to perform acoustic pre-calibration.");
1298
1299 zap['f'] = make_field(inputFile, "output of JAcousticEventBuilder[.sh]");
1300 zap['n'] = make_field(numberOfEvents) = JLimit::max();
1301 zap['a'] = make_field(filenames.detector);
1302 zap['@'] = make_field(parameters) = JPARSER::initialised();
1303 zap['s'] = make_field(script, "steering script");
1304 zap['V'] = make_field(V, "sound velocity") = JPARSER::initialised();
1305 zap['T'] = make_field(filenames.tripod, "tripod file");
1306 zap['Y'] = make_field(filenames.transmitter, "transmitter file") = JPARSER::initialised();
1307 zap['H'] = make_field(filenames.hydrophone, "hydrophone file") = JPARSER::initialised();
1308 zap['M'] = make_field(mechanics, "mechanics data") = JPARSER::initialised();
1309 zap['!'] = make_field(disable, "disable transmission") = JPARSER::initialised();
1310 zap['N'] = make_field(threads, "number of threads") = 1;
1311 zap['d'] = make_field(debug) = 1;
1312
1313 zap(argc, argv);
1314 }
1315 catch(const exception &error) {
1316 FATAL(error.what() << endl);
1317 }
1318
1319 if (threads == 0) {
1320 FATAL("Invalid number of threads " << threads << endl);
1321 }
1322
1323 JSydney sydney(filenames.strip(), mechanics, V, threads, debug);
1324
1325 const JSydney::ids_t receivers = sydney.getReceivers();
1326 const JSydney::ids_t emitters = sydney.getEmitters();
1327
1329
1330 buffer_type zbuf;
1331
1332 while (inputFile.hasNext()) {
1333
1334 const JEvent* evt = inputFile.next();
1335
1336 if (emitters.count(evt->getID())) {
1337 zbuf.push_back(*evt);
1338 }
1339 }
1340
1341 sort(zbuf.begin(), zbuf.end()); // sort according first time-of-emission
1342
1343 for (buffer_type::iterator p = zbuf.begin(), q; p != zbuf.end(); p = q) {
1344
1345 for (q = p; ++q != zbuf.end() && q->begin()->getToE() <= p->rbegin()->getToE() + parameters.Tmax_s; ) {}
1346
1347 JEvent::overlap(p, q, parameters.deadTime_s); // empty overlapping events
1348
1349 JSydney::input_type buffer;
1350
1351 for (buffer_type::iterator evt = p; evt != q; ++evt) {
1352
1353 sort(evt->begin(), evt->end(), JKatoomba<>::compare);
1354
1355 JEvent::iterator __end = unique(evt->begin(), evt->end(), make_comparator(&JTransmission::getID, JComparison::eq()));
1356
1357 for (JEvent::iterator i = evt->begin(); i != __end; ) {
1358
1359 if (disable.count(JTransmission_t(evt->getID(), i->getID())) == 0 &&
1360 disable.count(JTransmission_t(-1, i->getID())) == 0) {
1361
1362 if (receivers.count(i->getID()) && i->getQ() >= parameters.Qmin * (parameters.Qmin <= 1.0 ? i->getW() : 1.0)) {
1363 ++i; continue;
1364 }
1365 }
1366
1367 iter_swap(i, --__end);
1368 }
1369
1370 buffer.push_back(JEvent(evt->getDetectorID(), buffer.size(), evt->getID(), evt->begin(), __end));
1371 }
1372
1373 if (getNumberOfEmitters(buffer.begin(), buffer.end()) >= parameters.Nmin) {
1374 sydney.input.push_back(buffer);
1375 }
1376 }
1377
1378 sydney.run(script);
1379}
Acoustics toolkit.
Acoustic event.
Acoustic hit.
ROOT TTree parameter settings.
Container I/O.
Data structure for detector geometry and calibration.
Acoustic emitter.
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Acoustic fit parameters.
General purpose class for hash map of unique elements.
Data structure for hydrophone.
Fit functions of acoustic model.
Direct access to location in detector data structure.
General purpose messaging.
#define STATUS(A)
Definition JMessage.hh:63
#define FATAL(A)
Definition JMessage.hh:67
int debug
debug level
Definition JSirene.cc:74
Data structure for optical module.
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
#define MAKE_CSTRING(A)
Make C-string.
Definition JPrint.hh:72
#define MAKE_STRING(A)
Make string.
Definition JPrint.hh:63
Auxiliary class to define a range between two values.
Sound velocity.
File status.
Acoustic super event fit toolkit.
Acoustic event fit.
int main(int argc, char **argv)
Definition JSydney.cc:1277
Acoustic transmission identifier.
Data structure for transmitter.
Data structure for tripod.
Auxiliary methods for handling file names, type names and environment.
std::vector< T >::difference_type distance(typename std::vector< T >::const_iterator first, typename PhysicsEvent::const_iterator< T > second)
Specialisation of STL distance.
Thread pool for global fits.
static output_type * output
optional output
void enqueue(input_type &data)
Queue data.
static JMATH::JQuantile_t Q
chi2/NDF
Thread pool for global fits using super events.
static JMATH::JQuantile_t Q
chi2/NDF
Detector data structure.
Definition JDetector.hh:96
const JModule & getModule(const JModuleAddress &address) const
Get module parameters.
Definition JDetector.hh:270
Router for direct addressing of location data in detector data structure.
Logical location of module.
Definition JLocation.hh:40
int getFloor() const
Get floor number.
Definition JLocation.hh:146
int getString() const
Get string number.
Definition JLocation.hh:135
Data structure for a composite optical module.
Definition JModule.hh:76
bool has(const int bit) const
Test PMT status.
Definition JStatus.hh:198
Auxiliary class for CPU timing and usage.
Definition JTimer.hh:33
unsigned long long usec_wall
Definition JTimer.hh:238
void stop()
Stop timer.
Definition JTimer.hh:127
void start()
Start timer.
Definition JTimer.hh:106
const JPosition3D & getPosition() const
Get position.
Rotation around Z-axis.
Data structure for vector in three dimensions.
Definition JVector3D.hh:36
This class can be used to temporarily redirect one output (input) stream to another output (input) st...
Implementation of object output from STD container.
Exception for accessing a value in a collection that is outside of its range.
Utility class to parse command line options.
Definition JParser.hh:1698
General purpose class for object reading from a list of file names.
virtual bool hasNext() override
Check availability of next element.
virtual const pointer_type & next() override
Get next element.
bool has(const T &value) const
Test whether given value is present.
double getUTMZ() const
Get UTM Z.
const JUTMPosition & getUTMPosition() const
Get UTM position.
static const int HYDROPHONE_DISABLE
Enable (disable) use of hydrophone if this status bit is 0 (1);.
static const int TRANSMITTER_DISABLE
Enable (disable) use of transmitter if this status bit is 0 (1);.
static const int PIEZO_DISABLE
Enable (disable) use of piezo if this status bit is 0 (1);.
void copy(const Head &from, JHead &to)
Copy header from from to to.
Definition JHead.cc:163
Auxiliary classes and methods for acoustic position calibration.
static const std::string string_t
string
Definition JSydney.cc:90
size_t getMinimumNumberOfEmitters(T __begin, T __end)
Get minimum number of emitters for any string in data.
static const std::string tripod_t
tripod
Definition JSydney.cc:91
JContainer< std::vector< JTripod > > tripods_container
Definition JSydney.cc:79
JContainer< std::vector< JTransmitter > > transmitters_container
Definition JSydney.cc:81
static const std::string initialise_t
initialise
Definition JSydney.cc:88
JContainer< std::vector< JHydrophone > > hydrophones_container
Definition JSydney.cc:80
static const char skip_t
Script commands.
Definition JSydney.cc:87
static const std::string stage_t
fit stage
Definition JSydney.cc:92
JMODEL::JString getString(const JFit &fit)
Get model parameters of string.
static const std::string fix_t
fix objects
Definition JSydney.cc:89
size_t getNumberOfEmitters(T __begin, T __end)
Get number of emitters.
static const JSoundVelocity getSoundVelocity(1541.0, -17.0e-3, -2000.0)
Function object for velocity of sound.
file Auxiliary data structures and methods for detector calibration.
Definition JAnchor.hh:12
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
void store(const std::string &file_name, const JDetector &detector)
Store detector to output file.
std::string getFilename(const std::string &file_name)
Get file name part, i.e. part after last JEEP::PATHNAME_SEPARATOR if any.
std::string strip(const std::string &file_name)
Strip leading and trailing white spaces from file name.
Auxiliary classes and methods for 3D geometrical objects and operations.
Definition JAngle3D.hh:19
static const JVector3D JVector3X_t(1, 0, 0)
unit x-vector
static const JVector3D JVector3Y_t(0, 1, 0)
unit y-vector
static const JVector3D JVector3Z_t(0, 0, 1)
unit z-vector
JComparator< JResult_t T::*, JComparison::lt > make_comparator(JResult_t T::*member)
Helper method to create comparator between values of data member.
JPredicate< JResult_t T::*, JComparison::eq > make_predicate(JResult_t T::*member, const JResult_t value)
Helper method to create predicate for data member.
const array_type< JValue_t > & make_array(const JValue_t(&array)[N])
Method to create array of values.
Definition JVectorize.hh:54
std::istream & getline(std::istream &in, JString &object)
Read string from input stream until end of line.
Definition JString.hh:478
@ LEFT
Definition JTwosome.hh:18
@ RIGHT
Definition JTwosome.hh:18
static const double C
Physics constants.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
std::vector< JHitW0 > buffer_type
hits
Definition JPerth.cc:74
JRECONSTRUCTION::JWeight getWeight
JFIT::JEvent JEvent
Definition JHistory.hh:454
static JStat getFileStatus
Function object for file status.
Definition JStat.hh:173
Auxiliary data structure for floating point format specification.
Definition JManip.hh:448
Detector file.
Definition JHead.hh:227
Auxiliary data structure for mechanical model parameters of strings in a given detector.
Auxiliary data structure for mechanical model parameters with commented data.
Definition JMechanics.hh:38
Acoustic emitter.
Definition JEmitter.hh:30
int getID() const
Get emitter identifier.
Auxiliary data structure for handling of file names.
Definition JSydney.cc:98
std::string transmitter
transmitter
Definition JSydney.cc:117
JFilenames & strip()
Strip leading and trailing white spaces.
Definition JSydney.cc:104
std::string detector
detector
Definition JSydney.cc:114
std::string hydrophone
hydrophone
Definition JSydney.cc:116
std::string tripod
tripod
Definition JSydney.cc:115
double Qmin
minimal quality transmission
double deadTime_s
dead time between events [s]
size_t Nmin
minimum number of emitters
double sigma_s
time-of-arrival resolution [s]
double Tmax_s
time window to combine events [s]
bool hasLocation(const JLocation &location) const
Check if this detector has given location.
Definition JGeometry.hh:614
Acoustics hit.
Template definition of fit function of acoustic model.
Auxiliary data structure for setup of complete system.
Definition JSydney.cc:124
tripods_container tripods
tripods
Definition JSydney.cc:127
hydrophones
hydrophones
JDetectorMechanics_t mechanics
mechanical model
Definition JSydney.cc:126
transmitters_container transmitters
transmitters
Definition JSydney.cc:144
JDetector detector
detector
Definition JSydney.cc:125
Implementation for depth dependend velocity of sound.
JSoundVelocity & set(const double z0)
Set depth.
Auxiliary class to edit orientation of anchor.
Definition JSydney.cc:470
virtual void apply(const double step) override
Apply step.
Definition JSydney.cc:494
JAnchorEditor(JSetup &setup, const int id)
Constructor.
Definition JSydney.cc:477
std::vector< JTransmitter > & transmitters
Definition JSydney.cc:506
std::vector< JHydrophone > & hydrophones
Definition JSydney.cc:505
Auxiliary class to edit length of Dyneema ropes.
Definition JSydney.cc:379
JDyneemaEditor(JSetup &setup, const int id, const double z0=0.0)
Constructor.
Definition JSydney.cc:387
std::vector< size_t > index
Definition JSydney.cc:420
virtual void apply(const double step) override
Apply step.
Definition JSydney.cc:404
Auxiliary class to edit (z) position of module.
Definition JSydney.cc:285
virtual void apply(const double step) override
Apply step.
Definition JSydney.cc:314
JModuleEditor(JModule &module, const JVector3D &direction)
Constructor.
Definition JSydney.cc:303
JModuleEditor(JModule &module)
Constructor.
Definition JSydney.cc:291
Extended data structure for parameters of stage.
Definition JSydney.cc:516
JParameters_t()
Default constuctor.
Definition JSydney.cc:520
friend std::ostream & operator<<(std::ostream &out, const JParameters_t &object)
Write parameters to output stream.
Definition JSydney.cc:567
std::vector< double > steps
Definition JSydney.cc:588
friend std::istream & operator>>(std::istream &in, JParameters_t &object)
Read parameters from input stream.
Definition JSydney.cc:535
Auxiliary class to edit (x,y,z) position of string.
Definition JSydney.cc:332
std::vector< size_t > index
Definition JSydney.cc:370
JStringEditor(JSetup &setup, const int id, const JVector3D &direction, const bool option)
Constructor.
Definition JSydney.cc:343
virtual void apply(const double step) override
Apply step.
Definition JSydney.cc:360
Auxiliary class to edit (x,y,z) position of tripod.
Definition JSydney.cc:429
JTripodEditor(JSetup &setup, const int id, const JVector3D &direction)
Constructor.
Definition JSydney.cc:437
virtual void apply(const double step) override
Apply step.
Definition JSydney.cc:453
std::vector< JTripod > & tripods
Definition JSydney.cc:459
Auxiliary data structure for detector with decomposed strings.
Definition JSydney.cc:674
void push_back(const JModule &module)
Add module.
Definition JSydney.cc:680
Auxiliary data structure for group of lists of identifiers of to-be-fitted objects.
Definition JSydney.cc:250
ids_t transmitters
identifiers of strings with transmitter
Definition JSydney.cc:276
ids_t tripods
identifiers of tripods
Definition JSydney.cc:274
void initialise(const JSetup &setup)
Initialise.
Definition JSydney.cc:263
ids_t hydrophones
identifiers of strings with hydrophone
Definition JSydney.cc:275
fits_t()
Default constructor.
Definition JSydney.cc:254
ids_t strings
identifiers of strings
Definition JSydney.cc:273
List of object identifiers.
Definition JSydney.cc:160
ids_t(const ids_t &A, const ids_t &B)
Difference constructor.
Definition JSydney.cc:185
friend std::istream & operator>>(std::istream &in, ids_t &object)
Read identifiers from input stream.
Definition JSydney.cc:215
friend std::ostream & operator<<(std::ostream &out, const ids_t &object)
Write identifiers to output stream.
Definition JSydney.cc:236
void fix(const ids_t &B)
Fix.
Definition JSydney.cc:198
ids_t()
Default constructor.
Definition JSydney.cc:164
ids_t(const std::vector< int > &buffer)
Copy constructor.
Definition JSydney.cc:173
Auxiliary data structure for decomposed string.
Definition JSydney.cc:651
void push_back(const JModule &module)
Add module.
Definition JSydney.cc:657
Main class for pre-calibration using acoustics data.
Definition JSydney.cc:151
double operator()(const int option) const
Get chi2.
Definition JSydney.cc:958
void stage_x(const JParameters_t &parameters)
Fit procedure to determine the (x,y,z) positions of the modules.
Definition JSydney.cc:929
ids_t getReceivers() const
Get list of identifiers of receivers.
Definition JSydney.cc:1203
JFilenames filenames
Definition JSydney.cc:1249
std::unique_ptr< JLocationRouter > router
Definition JSydney.cc:1257
JTOOLS::JHashMap< int, JLocation > receivers
Definition JSydney.cc:1256
void run(const std::string &script)
Run.
Definition JSydney.cc:1050
static constexpr double RADIUS_M
maximal horizontal distance between T-bar and emitter/hydrophone
Definition JSydney.cc:153
JDetector detector
PMTs.
Definition JSydney.cc:1265
void store(const std::string &dir=".")
Store data in given directory.
Definition JSydney.cc:1172
ids_t getEmitters() const
Get list of identifiers of emitters.
Definition JSydney.cc:1222
JSoundVelocity V
Definition JSydney.cc:1250
std::vector< input_type > input
Definition JSydney.cc:1260
void stage_c(const JParameters_t &parameters)
Fit procedure to determine the z-positions of the modules.
Definition JSydney.cc:875
std::vector< JSuperEvt > output
Definition JSydney.cc:1263
JFitParameters parameters
Definition JSydney.cc:1266
JSydney(const JFilenames &filenames, const JDetectorMechanics_t &mechanics, const JSoundVelocity &V, const size_t threads, const int debug)
Constructor.
Definition JSydney.cc:601
void stage_0(const JParameters_t &parameters)
Fit procedure to determine the positions of tripods and transmitters using strings that are fixed.
Definition JSydney.cc:692
std::vector< JEvent > input_type
Definition JSydney.cc:1259
void stage_d(const JParameters_t &parameters)
Fit procedure to determine the z-positions of anchors.
Definition JSydney.cc:901
void stage_b(const JParameters_t &parameters)
Fit procedure to determine the stretching and z-positions of individual strings.
Definition JSydney.cc:809
void stage_a(const JParameters_t &parameters)
Fit procedure to determine the positions of the strings and tripods.
Definition JSydney.cc:765
Acoustic transmission identifier.
int getID() const
Get identifier.
Auxiliary data structure to unify weights of acoustics data according to the number of pings per emit...
Auxiliary wrapper for I/O of container with optional comment (see JComment).
Definition JContainer.hh:42
Conjugate gradient fit.
Definition JGradient.hh:75
Auxiliary data structure for editable parameter.
Definition JGradient.hh:49
Auxiliary data structure for fit parameter.
Definition JGradient.hh:28
void store(const char *file_name) const
Store to output file.
void load(const char *file_name)
Load from input file.
Implementation of object iteration from STD container.
double getMean() const
Get mean value.
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Definition JParser.hh:68
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
General purpose class for hash map of unique keys.
Definition JHashMap.hh:75
Auxiliary data structure for floating point format specification.
Definition JManip.hh:488