11 #include <type_traits>
79 for (
size_t i = 0; i <
ns; ++i) {
81 thread worker([
this, katoomba]() {
88 unique_lock<mutex> lock(
in);
90 cv.wait(lock, [
this]() {
return stop || !input.empty(); });
92 if (
stop && input.empty()) {
100 for (JSuperEvt::rx_type::const_iterator hit = evt.
rx.begin(); hit != evt.
rx.end(); ++hit) {
102 data.push_back(
JHit(emitters[hit->id],
115 const double chi2 = platypus (data.begin(), data.end()) / platypus.estimator->getRho(1.0);
116 const double ndf =
getWeight(data.begin(), data.end()) - platypus.value.getN();
119 unique_lock<mutex> lock(out);
126 workers.emplace_back(move(worker));
139 unique_lock<mutex> lock(
in);
146 for (
auto& worker : workers) {
162 unique_lock<mutex> lock(
in);
179 unique_lock<mutex> lock(
in);
182 throw runtime_error(
"The thread pool has been stopped.");
194 static::JHashMap<int, JEmitter> emitters;
199 queue <JSuperEvt> input;
202 condition_variable cv;
219 int main(
int argc,
char **argv)
233 transmitters_container transmitters;
234 hydrophones_container hydrophones;
240 JParser<> zap(
"Application to fit position calibration model to acoustic data.");
242 zap[
'f'] =
make_field(inputFile,
"output of JAcousticEventBuilder[.sh]");
243 zap[
'n'] =
make_field(numberOfEvents) = JLimit::max();
251 zap[
'N'] =
make_field(jobs,
"number of parallel jobs") = 1;
256 catch(
const exception &error) {
257 FATAL(error.what() << endl);
260 ROOT::EnableThreadSafety();
262 const int sleep_us = 100;
273 for (tripods_container::const_iterator i =
tripods.begin(); i !=
tripods.end(); ++i) {
274 JPlatypus::emitters[i->getID()] =
JEmitter(i->getID(),
275 i->getUTMPosition() -
detector.getUTMPosition());
278 for (transmitters_container::const_iterator i = transmitters.begin(); i != transmitters.end(); ++i) {
280 JPlatypus::emitters[i->getID()] =
JEmitter(i->getID(),
283 catch(
const exception&) {
300 JPlatypus platypus(katoomba, jobs);
302 while (inputFile.hasNext()) {
304 STATUS(
"event: " << setw(8) << inputFile.getCounter() <<
'\r');
DEBUG(endl);
308 while (platypus.backlog() > jobs) {
309 this_thread::sleep_for(chrono::microseconds(sleep_us));
312 platypus.enqueue(*evt);
316 catch(
const exception& error) {
317 FATAL(
"main " << error.what());
Worker class for complete fit procedure of acoustic model.
Utility class to parse command line options.
Q(UTCMax_s-UTCMin_s)-livetime_s
int main(int argc, char *argv[])
JKatoomba< JEstimator > estimator
double getWeight(T __begin, T __end)
Get total weight of data points.
static JDetectorMechanics getMechanics
Function object to get string mechanics.
General purpose class for hash map of unique elements.
ROOT TTree parameter settings.
*fatal Wrong number of arguments esac JCookie sh typeset Z DETECTOR typeset Z SOURCE_RUN typeset Z TARGET_RUN set_variable PARAMETERS_FILE $WORKDIR parameters
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
V(JDAQEvent-JTriggerReprocessor)*1.0/(JDAQEvent+1.0e-10)
Data structure for detector geometry and calibration.
Data structure for hydrophone.
then usage $script[port]< option > nPossible stop
Auxiliary class for defining the range of iterations of objects.
static const JSoundVelocity getSoundVelocity(1541.0,-17.0e-3,-2000.0)
Function object for velocity of sound.
Template specialisation of fit function of acoustic model based on JGandalf minimiser.
Data structure for transmitter.
Logical location of module.
Auxiliary wrapper for I/O of container with optional comment (see JComment).
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
JPosition3D getPosition(const Vec &pos)
Get position.
JMODEL::JString getModel(const JFit &fit)
Get model parameters of string.
General purpose messaging.
Implementation for depth dependend velocity of sound.
Scanning of objects from multiple files according a format that follows from the extension of each fi...
Acoustic super event fit.
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
Auxiliary class to define a range between two values.
General purpose class for object reading from a list of file names.
Utility class to parse command line options.
then if[[!-f $DETECTOR]] then JDetector sh $DETECTOR fi cat $WORKDIR trigger_parameters txt<< EOFtrigger3DMuon.enabled=1;trigger3DMuon.numberOfHits=5;trigger3DMuon.gridAngle_deg=1;ctMin=0.0;TMaxLocal_ns=15.0;EOF set_variable TRIGGEREFFICIENCY_TRIGGERED_EVENTS_ONLY INPUT_FILES=() for((i=1;$i<=$NUMBER_OF_RUNS;++i));do JSirene.sh $DETECTOR $JPP_DATA/genhen.km3net_wpd_V2_0.evt.gz $WORKDIR/sirene_ ${i}.root JTriggerEfficiency.sh $DETECTOR $DETECTOR $WORKDIR/sirene_ ${i}.root $WORKDIR/trigger_efficiency_ ${i}.root $WORKDIR/trigger_parameters.txt $JPP_DATA/PMT_parameters.txt INPUT_FILES+=($WORKDIR/trigger_efficiency_ ${i}.root) done for ANGLE_DEG in $ANGLES_DEG[*];do set_variable SIGMA_NS 3.0 set_variable OUTLIERS 3 set_variable OUTPUT_FILE $WORKDIR/matrix\[${ANGLE_DEG}\deg\].root $JPP_DIR/examples/JReconstruction-f"$INPUT_FILES[*]"-o $OUTPUT_FILE-S ${SIGMA_NS}-A ${ANGLE_DEG}-O ${OUTLIERS}-d ${DEBUG}--!fiif[[$OPTION=="plot"]];then if((0));then for H1 in h0 h1;do JPlot1D-f"$WORKDIR/matrix["${^ANGLES_DEG}" deg].root:${H1}"-y"1 2e3"-Y-L TR-T""-\^"number of events [a.u.]"-> o chi2
const JLimit & getLimit() const
Get limit.
Fit functions of acoustic model.
JMEstimator * getMEstimator(const int type)
Get M-Estimator.
do set_variable DETECTOR_TXT $WORKDIR detector
Data structure for tripod.
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable INPUT_FILE $argv[2] eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY JAcoustics sh $DETECTOR_ID source JAcousticsToolkit sh CHECK_EXIT_CODE typeset A EMITTERS get_tripods $WORKDIR tripod txt EMITTERS get_transmitters $WORKDIR transmitter txt EMITTERS for EMITTER in
Auxiliary data structure for floating point format specification.
Template definition of fit function of acoustic model.
#define DEBUG(A)
Message macros.
Data structure for optical module.