Jpp 20.0.0-195-g190c9e876
the software that should make you happy
Loading...
Searching...
No Matches
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
70
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 JDetectorMechanics mechanics; // mechanical model data
79 JFitParameters parameters; // fit parameters
80 size_t threads; // number of parallel threads
81 int debug;
82
83 try {
84
85 JParser<> zap("Application to fit position calibration model to acoustic data.");
86
87 zap['f'] = make_field(inputFile, "output of JAcousticEventBuilder[.sh]");
88 zap['n'] = make_field(numberOfEvents) = JLimit::max();
89 zap['a'] = make_field(detectorFile);
90 zap['@'] = make_field(parameters) = JPARSER::initialised();
91 zap['V'] = make_field(V, "sound velocity") = JPARSER::initialised();
92 zap['T'] = make_field(tripods, "tripod data");
93 zap['Y'] = make_field(transmitters, "transmitter data") = JPARSER::initialised();
94 zap['H'] = make_field(hydrophones, "hydrophone data") = JPARSER::initialised();
95 zap['M'] = make_field(mechanics, "mechanics data") = JPARSER::initialised();
96 zap['N'] = make_field(threads, "number of threads") = 1;
97 zap['d'] = make_field(debug) = 1;
98
99 zap(argc, argv);
100 }
101 catch(const exception &error) {
102 FATAL(error.what() << endl);
103 }
104
105 ROOT::EnableThreadSafety();
106
108
109 try {
110 load(detectorFile, detector);
111 }
112 catch(const JException& error) {
113 FATAL(error);
114 }
115
117
118 for (tripods_container::const_iterator i = tripods.begin(); i != tripods.end(); ++i) {
119 {
120 emitters[i->getID()] = JEmitter(i->getID(),
121 i->getUTMPosition() - detector.getUTMPosition());
122 }
123 }
124
125 for (transmitters_container::const_iterator i = transmitters.begin(); i != transmitters.end(); ++i) {
126 try {
127 emitters[i->getID()] = JEmitter(i->getID(),
128 i->getPosition() + detector.getModule(i->getLocation()).getPosition());
129 }
130 catch(const exception&) {} // if no module available, discard transmitter
131 }
132
133 V.set(detector.getUTMZ()); // sound velocity at detector depth
134
135 JGeometry geometry(detector, mechanics, hydrophones);
136
139
140 try {
141 JPlatypus platypus(geometry, emitters, V, parameters, inputFile, threads);
142 }
143 catch(const exception& error) {
144 FATAL("main " << error.what());
145 }
146
147 JFileOutputStream(3) << SCIENTIFIC(1,10) << JPlatypus::Q.getMean(numeric_limits<float>::max()) << endl;
148}
#define FATAL(A)
Definition JMessage.hh:67
int debug
debug level
Definition JSirene.cc:74
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition JParser.hh:2142
Thread pool for global fits using super events.
static JMATH::JQuantile_t Q
chi2/NDF
Detector data structure.
Definition JDetector.hh:96
General exception.
Definition JException.hh:24
Streaming of output.
Utility class to parse command line options.
Definition JParser.hh:1698
Object reading from a list of files.
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
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.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Detector file.
Definition JHead.hh:227
Auxiliary data structure for mechanical model parameters with commented data.
Definition JMechanics.hh:38
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.
Auxiliary wrapper for I/O of container with optional comment (see JComment).
Definition JContainer.hh:42
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