Thread pool for global fits.
More...
#include <JFremantle_t.hh>
|
| static int | detid = -1 |
| | detector identifier
|
| |
| static JMATH::JQuantile_t | Q |
| | chi2/NDF
|
| |
| static bool | squash = false |
| | squash transmissions in output
|
| |
| static output_type * | output = NULL |
| | optional output
|
| |
Thread pool for global fits.
Definition at line 33 of file JFremantle_t.hh.
◆ input_type
◆ output_type
◆ JFremantle()
| JACOUSTICS::JFremantle::JFremantle |
( |
const JGeometry & | geometry, |
|
|
const JSoundVelocity & | velocity, |
|
|
const JFitParameters & | parameters, |
|
|
const size_t | ns, |
|
|
const size_t | backlog = std::numeric_limits<size_t>::max() ) |
|
inline |
Constructor.
- Parameters
-
| geometry | detector geometry |
| velocity | sound velocity |
| parameters | parameters |
| ns | number of threads |
| backlog | backlog |
Definition at line 49 of file JFremantle_t.hh.
53 :
56 {
57 using namespace std;
59
61
62 for (size_t i = 0; i < ns; ++i) {
63
64 thread worker([this, geometry, velocity, parameters]() {
65
67
68 for (
JGlobalfit katoomba(geometry, velocity, parameters); ; ) {
69
70 {
71 unique_lock<mutex> lock(
in);
72
73 cv.wait(lock, [
this]() {
return stop || !
input.empty(); });
74
76 return;
77 }
78
79 data.swap(
input.front());
80
82 }
83
85
86 const auto result = katoomba(data.begin(), data.end());
87
88 if (result.chi2 / result.ndf <= katoomba.parameters.chi2perNDF) {
89
90 {
91 unique_lock<mutex> lock(
out);
92
93 Q.put(result.chi2 / result.ndf);
94
97 result.getTimeRange(),
98 data .size(),
99 result.size(),
100 result.value.getN(),
101 result.ndf,
102 result.chi2,
103 katoomba.gandalf.numberOfIterations),
104 result.value,
105 result.begin,
107 }
108 }
109 }
110 }
111 });
112
113 workers.emplace_back(std::move(worker));
114 }
115 }
static output_type * output
optional output
std::condition_variable cw
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
static bool squash
squash transmissions in output
std::queue< input_type > input
Global fit of prameterised detector geometry to acoustics data.
Auxiliary data structure to convert model to super event.
◆ ~JFremantle()
| JACOUSTICS::JFremantle::~JFremantle |
( |
| ) |
|
|
inline |
Destructor.
Definition at line 121 of file JFremantle_t.hh.
122 {
123 using namespace std;
124
125 {
126 unique_lock<mutex> lock(
in);
127
129 }
130
132
134 worker.join();
135 }
136 }
◆ enqueue()
| void JACOUSTICS::JFremantle::enqueue |
( |
input_type & | data | ) |
|
|
inline |
Queue data.
- Parameters
-
Definition at line 144 of file JFremantle_t.hh.
145 {
146 using namespace std;
147
148 {
149 unique_lock<mutex> lock(
in);
150
152
154 throw runtime_error("The thread pool has been stopped.");
155 }
156
157 input.emplace(std::move(data));
158 }
159
161 }
◆ detid
| int JACOUSTICS::JFremantle::detid = -1 |
|
static |
| JMATH::JQuantile_t JACOUSTICS::JFremantle::Q |
|
static |
◆ squash
| bool JACOUSTICS::JFremantle::squash = false |
|
static |
◆ output
◆ workers
| std::vector<std::thread> JACOUSTICS::JFremantle::workers |
|
private |
◆ input
| std::queue<input_type> JACOUSTICS::JFremantle::input |
|
private |
◆ in
| std::mutex JACOUSTICS::JFremantle::in |
|
private |
◆ out
| std::mutex JACOUSTICS::JFremantle::out |
|
private |
◆ cv
| std::condition_variable JACOUSTICS::JFremantle::cv |
|
private |
◆ cw
| std::condition_variable JACOUSTICS::JFremantle::cw |
|
private |
◆ stop
| bool JACOUSTICS::JFremantle::stop |
|
private |
◆ backlog
| size_t JACOUSTICS::JFremantle::backlog |
|
private |
The documentation for this class was generated from the following files: