1#ifndef __JACOUSTICS__JFREMANTLE_T__
2#define __JACOUSTICS__JFREMANTLE_T__
15#include "JLang/JObjectOutput.hh"
17#include "JMath/JQuantile_t.hh"
53 const size_t backlog = std::numeric_limits<size_t>::max()) :
62 for (
size_t i = 0; i < ns; ++i) {
64 thread worker([
this, geometry, velocity, parameters]() {
68 for (
JGlobalfit katoomba(geometry, velocity, parameters); ; ) {
71 unique_lock<mutex> lock(
in);
73 cv.wait(lock, [
this]() {
return stop || !
input.empty(); });
79 data.swap(
input.front());
86 const auto result = katoomba(data.begin(), data.end());
88 if (result.chi2 / result.ndf <= katoomba.parameters.chi2perNDF) {
91 unique_lock<mutex> lock(
out);
93 Q.put(result.chi2 / result.ndf);
97 result.getTimeRange(),
103 katoomba.gandalf.numberOfIterations),
113 workers.emplace_back(std::move(worker));
126 unique_lock<mutex> lock(
in);
149 unique_lock<mutex> lock(
in);
154 throw runtime_error(
"The thread pool has been stopped.");
157 input.emplace(std::move(data));
164 static JMATH::JQuantile_t
Q;
173 std::condition_variable
cv;
174 std::condition_variable
cw;
Fit function of acoustic model.
Thread pool for global fits.
static output_type * output
optional output
std::condition_variable cw
JLANG::JObjectOutput< JSuperEvt > output_type
void enqueue(input_type &data)
Queue data.
std::vector< std::thread > workers
std::vector< JHit > input_type
static JMATH::JQuantile_t Q
chi2/NDF
std::condition_variable cv
static int detid
detector identifier
JFremantle(const JGeometry &geometry, const JSoundVelocity &velocity, const JFitParameters ¶meters, const size_t ns, const size_t backlog=std::numeric_limits< size_t >::max())
Constructor.
static bool squash
squash transmissions in output
std::queue< input_type > input
Auxiliary classes and methods for acoustic position calibration.
Global fit of prameterised detector geometry to acoustics data.
Implementation for depth dependend velocity of sound.
Auxiliary data structure to convert model to super event.