Jpp 20.0.0-rc.9-29-gccc23c492-D
the software that should make you happy
Loading...
Searching...
No Matches
Functions
JPlatypus.cc File Reference

Application to make a global fit of the detector geometry to acoustic data. More...

#include <string>
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <map>
#include <deque>
#include <algorithm>
#include <limits>
#include <type_traits>
#include <functional>
#include <future>
#include <mutex>
#include <thread>
#include <queue>
#include "TROOT.h"
#include "TFile.h"
#include "JLang/JPredicate.hh"
#include "JLang/JComparator.hh"
#include "JLang/JComparison.hh"
#include "JLang/JFileStream.hh"
#include "JDetector/JDetector.hh"
#include "JDetector/JDetectorToolkit.hh"
#include "JDetector/JTripod.hh"
#include "JDetector/JTransmitter.hh"
#include "JDetector/JModule.hh"
#include "JDetector/JHydrophone.hh"
#include "JTools/JHashMap.hh"
#include "JTools/JRange.hh"
#include "JTools/JQuantile.hh"
#include "JSupport/JSingleFileScanner.hh"
#include "JAcoustics/JSoundVelocity.hh"
#include "JAcoustics/JEmitter.hh"
#include "JAcoustics/JAcousticsToolkit.hh"
#include "JAcoustics/JHit.hh"
#include "JAcoustics/JFitParameters.hh"
#include "JAcoustics/JKatoomba_t.hh"
#include "JAcoustics/JSuperEvt.hh"
#include "JAcoustics/JSuperEvtToolkit.hh"
#include "JAcoustics/JSupport.hh"
#include "JAcoustics/JPlatypus_t.hh"
#include "Jeep/JContainer.hh"
#include "Jeep/JParser.hh"
#include "Jeep/JMessage.hh"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Application to make a global fit of the detector geometry to acoustic data.


Author
mdejong

Definition in file JPlatypus.cc.

Function Documentation

◆ main()

int main ( int argc,
char ** argv )

Definition at line 62 of file JPlatypus.cc.

63{
64 using namespace std;
65 using namespace JPP;
66
67 typedef JContainer< vector<JTripod> > tripods_container;
68 typedef JContainer< vector<JTransmitter> > transmitters_container;
69 typedef JContainer< vector<JHydrophone> > hydrophones_container;
70
71 JSingleFileScanner<JSuperEvt> inputFile;
72 string detectorFile;
73 JLimit_t& numberOfEvents = inputFile.getLimit();
74 JSoundVelocity V = getSoundVelocity; // default sound velocity
75 tripods_container tripods; // tripods
76 transmitters_container transmitters; // transmitters
77 hydrophones_container hydrophones; // hydrophones
78 JFitParameters parameters; // fit parameters
79 size_t threads; // number of parallel threads
80 int debug;
81
82 try {
83
84 JParser<> zap("Application to fit position calibration model to acoustic data.");
85
86 zap['f'] = make_field(inputFile, "output of JAcousticEventBuilder[.sh]");
87 zap['n'] = make_field(numberOfEvents) = JLimit::max();
88 zap['a'] = make_field(detectorFile);
89 zap['@'] = make_field(parameters) = JPARSER::initialised();
90 zap['V'] = make_field(V, "sound velocity") = JPARSER::initialised();
91 zap['T'] = make_field(tripods, "tripod data");
92 zap['Y'] = make_field(transmitters, "transmitter data") = JPARSER::initialised();
93 zap['H'] = make_field(hydrophones, "hydrophone data") = JPARSER::initialised();
94 zap['M'] = make_field(getMechanics, "mechanics data") = JPARSER::initialised();
95 zap['N'] = make_field(threads, "number of threads") = 1;
96 zap['d'] = make_field(debug) = 1;
97
98 zap(argc, argv);
99 }
100 catch(const exception &error) {
101 FATAL(error.what() << endl);
102 }
103
104 ROOT::EnableThreadSafety();
105
106 JDetector detector;
107
108 try {
109 load(detectorFile, detector);
110 }
111 catch(const JException& error) {
112 FATAL(error);
113 }
114
115 JHashMap<int, JEmitter> emitters;
116
117 for (tripods_container::const_iterator i = tripods.begin(); i != tripods.end(); ++i) {
118 {
119 emitters[i->getID()] = JEmitter(i->getID(),
120 i->getUTMPosition() - detector.getUTMPosition());
121 }
122 }
123
124 for (transmitters_container::const_iterator i = transmitters.begin(); i != transmitters.end(); ++i) {
125 try {
126 emitters[i->getID()] = JEmitter(i->getID(),
127 i->getPosition() + detector.getModule(i->getLocation()).getPosition());
128 }
129 catch(const exception&) {} // if no module available, discard transmitter
130 }
131
132 V.set(detector.getUTMZ()); // sound velocity at detector depth
133
134 JGeometry geometry(detector, hydrophones);
135
138
139 try {
140 JPlatypus platypus(geometry, emitters, V, parameters, inputFile, threads);
141 }
142 catch(const exception& error) {
143 FATAL("main " << error.what());
144 }
145
146 JFileOutputStream(3) << SCIENTIFIC(1,10) << JPlatypus::Q.getMean(numeric_limits<float>::max()) << endl;
147}
Thread pool for global fits using super events.
JContainer< std::vector< JTripod > > tripods_container
Definition JSydney.cc:79
JContainer< std::vector< JTransmitter > > transmitters_container
Definition JSydney.cc:81
JContainer< std::vector< JHydrophone > > hydrophones_container
Definition JSydney.cc:80
Acoustic emitter.
Definition JEmitter.hh:30
Template definition of fit function of acoustic model.
Implementation for depth dependend velocity of sound.
JSoundVelocity & set(const double z0)
Set depth.