#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #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" /** * \file * * Application to make a global fit of the detector geometry to acoustic data.\n * \author mdejong */ int main(int argc, char **argv) { using namespace std; using namespace JPP; typedef JContainer< vector > tripods_container; typedef JContainer< vector > transmitters_container; typedef JContainer< vector > hydrophones_container; JSingleFileScanner inputFile; string detectorFile; JLimit_t& numberOfEvents = inputFile.getLimit(); JSoundVelocity V = getSoundVelocity; // default sound velocity tripods_container tripods; // tripods transmitters_container transmitters; // transmitters hydrophones_container hydrophones; // hydrophones JFitParameters parameters; // fit parameters size_t threads; // number of parallel threads int debug; try { JParser<> zap("Application to fit position calibration model to acoustic data."); zap['f'] = make_field(inputFile, "output of JAcousticEventBuilder[.sh]"); zap['n'] = make_field(numberOfEvents) = JLimit::max(); zap['a'] = make_field(detectorFile); zap['@'] = make_field(parameters) = JPARSER::initialised(); zap['V'] = make_field(V, "sound velocity") = JPARSER::initialised(); zap['T'] = make_field(tripods, "tripod data"); zap['Y'] = make_field(transmitters, "transmitter data") = JPARSER::initialised(); zap['H'] = make_field(hydrophones, "hydrophone data") = JPARSER::initialised(); zap['M'] = make_field(getMechanics, "mechanics data") = JPARSER::initialised(); zap['N'] = make_field(threads, "number of threads") = 1; zap['d'] = make_field(debug) = 1; zap(argc, argv); } catch(const exception &error) { FATAL(error.what() << endl); } ROOT::EnableThreadSafety(); JDetector detector; try { load(detectorFile, detector); } catch(const JException& error) { FATAL(error); } JHashMap emitters; for (tripods_container::const_iterator i = tripods.begin(); i != tripods.end(); ++i) { { emitters[i->getID()] = JEmitter(i->getID(), i->getUTMPosition() - detector.getUTMPosition()); } } for (transmitters_container::const_iterator i = transmitters.begin(); i != transmitters.end(); ++i) { try { emitters[i->getID()] = JEmitter(i->getID(), i->getPosition() + detector.getModule(i->getLocation()).getPosition()); } catch(const exception&) {} // if no module available, discard transmitter } V.set(detector.getUTMZ()); // sound velocity at detector depth JGeometry geometry(detector, hydrophones); JKatoomba::debug = debug; JKatoomba::MAXIMUM_ITERATIONS = 10000; try { JPlatypus platypus(geometry, emitters, V, parameters, inputFile, threads); } catch(const exception& error) { FATAL("main " << error.what()); } JFileOutputStream(3) << SCIENTIFIC(1,10) << JPlatypus::Q.getMean(numeric_limits::max()) << endl; }