68{
71
76
79 string detectorFile;
80 JLimit_t& numberOfEvents = inputFile.getLimit();
87 disable_container disable;
88 size_t threads;
91
92 try {
93
94 JParser<> zap(
"Application to fit position calibration model to acoustic data.");
95
96 zap[
'f'] =
make_field(inputFile,
"output of JAcousticEventBuilder[.sh]");
102 zap[
'T'] =
make_field(tripods,
"tripod data");
107 zap[
'N'] =
make_field(threads,
"number of threads") = 1;
108 zap[
's'] =
make_field(squash,
"squash transmissions in output");
110
111 zap(argc, argv);
112 }
113 catch(const exception &error) {
114 FATAL(error.what() << endl);
115 }
116
117 ROOT::EnableThreadSafety();
118
120
121 try {
123 }
126 }
127
130
131 for (JDetector::const_iterator i =
detector.begin(); i !=
detector.end(); ++i) {
132 receivers[i->getID()] = i->getLocation();
133 }
134
135 for (tripods_container::const_iterator i = tripods.begin(); i != tripods.end(); ++i) {
136 emitters[i->getID()] =
JEmitter(i->getID(), i->getUTMPosition() -
detector.getUTMPosition());
137 }
138
139 for (transmitters_container::const_iterator i = transmitters.begin(); i != transmitters.end(); ++i) {
140 try {
141 emitters[i->getID()] =
JEmitter(i->getID(), i->getPosition() +
detector.getModule(i->getLocation()).getPosition());
142 }
143 catch(const exception&) {}
144 }
145
147
150
152
155
156 if (inputFile.size() > 1u) {
157
159
160 for (const string& file_name : inputFile) {
161
163
165
166 const JEvent* evt = in.next();
167
170 }
171
172 if (!evt->empty()) {
173 zmap[evt->begin()->getToE()] = file_name;
174 }
175 }
176 }
178
179 inputFile.clear();
180
182 inputFile.push_back(i->second);
183 }
184 }
185
188
190
192 }
193
194
195
196
197
198 try {
199
200 JFremantle fremantle(geometry, V, parameters, threads, 2 * threads);
201
203
205
206 STATUS(inputFile.getFilename() <<
'\r');
DEBUG(endl);
207
208
209
210 for (const string file_name = inputFile.getFilename(); inputFile.hasNext() && file_name == inputFile.getFilename(); ) {
211
212 const JEvent* evt = inputFile.next();
213
214 if (!evt->empty() && emitters.
has(evt->
getID())) {
215 zbuf.push_back(*evt);
216 }
217 }
218
219 sort(zbuf.begin(), zbuf.end());
220
221 for (buffer_type::iterator p = zbuf.begin(), q; p != zbuf.end(); p = q) {
222
223 for (q = p; ++q != zbuf.end() && q->begin()->getToE() <= p->rbegin()->getToE() + parameters.
Tmax_s; ) {}
224
225 if (q == zbuf.end()) {
226
227 if (inputFile.hasNext()) {
228
229 zbuf.erase(zbuf.begin(), p);
230
231 break;
232 }
233 }
234
236
238
240
242
243 for (buffer_type::iterator evt = p; evt != q; ++evt) {
244
246
248
251
252 for (JEvent::const_iterator i = evt->begin(); i != __end; ++i) {
253
256
257 if (receivers.
has(i->getID()) && geometry.hasLocation(receivers[i->getID()]) && i->getQ() >= parameters.
Qmin * (parameters.
Qmin <= 1.0 ? i->getW() : 1.0)) {
258
261 receivers[i->getID()],
262 i->getToA(),
264 weight));
265 }
266 }
267 }
268 }
269
271 fremantle.enqueue(data);
272 }
273 }
274 }
275 }
277 }
278 catch(const exception& error) {
279 FATAL(
"main " << error.what());
280 }
281
282
283
284
285
287
289}
#define DEBUG(A)
Message macros.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Thread pool for global fits.
static output_type * output
optional output
static JMATH::JQuantile_t Q
chi2/NDF
static int detid
detector identifier
static bool squash
squash transmissions in output
Utility class to parse command line options.
General purpose class for object reading from a list of file names.
Object reading from a list of files.
virtual bool hasNext() override
Check availability of next element.
size_t getMinimumNumberOfEmitters(T __begin, T __end)
Get minimum number of emitters for any string in data.
JContainer< std::vector< JTripod > > tripods_container
JContainer< std::vector< JTransmitter > > transmitters_container
JContainer< std::vector< JHydrophone > > hydrophones_container
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.
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.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
std::vector< JHitW0 > buffer_type
hits
JRECONSTRUCTION::JWeight getWeight
Auxiliary data structure for mechanical model parameters with commented data.
int getID() const
Get emitter identifier.
const int getDetectorID() const
Get detector identifier.
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]
Global fit of prameterised detector geometry to acoustics data.
Template definition of fit function of acoustic model.
Implementation for depth dependend velocity of sound.
JSoundVelocity & set(const double z0)
Set depth.
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).
double getMean() const
Get mean value.
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Auxiliary class for defining the range of iterations of objects.
static counter_type max()
Get maximum counter value.
Auxiliary data structure for floating point format specification.