80 JLimit_t& numberOfEvents = inputFile.getLimit();
86 disable_container disable;
88 bool& squash = JFremantle::squash;
93 JParser<> zap(
"Application to fit position calibration model to acoustic data.");
95 zap[
'f'] =
make_field(inputFile,
"output of JAcousticEventBuilder[.sh]");
97 zap[
'n'] =
make_field(numberOfEvents) = JLimit::max();
101 zap[
'T'] =
make_field(tripods,
"tripod data");
106 zap[
'N'] =
make_field(threads,
"number of threads") = 1;
107 zap[
's'] =
make_field(squash,
"squash transmissions in output");
112 catch(
const exception &error) {
113 FATAL(error.what() << endl);
116 ROOT::EnableThreadSafety();
130 for (JDetector::const_iterator i =
detector.begin(); i !=
detector.end(); ++i) {
131 receivers[i->getID()] = i->getLocation();
134 for (tripods_container::const_iterator i = tripods.begin(); i != tripods.end(); ++i) {
135 emitters[i->getID()] =
JEmitter(i->getID(), i->getUTMPosition() -
detector.getUTMPosition());
138 for (transmitters_container::const_iterator i = transmitters.begin(); i != transmitters.end(); ++i) {
140 emitters[i->getID()] =
JEmitter(i->getID(), i->getPosition() +
detector.getModule(i->getLocation()).getPosition());
142 catch(
const exception&) {}
155 if (inputFile.size() > 1u) {
159 for (
const string& file_name : inputFile) {
165 const JEvent* evt = in.next();
168 FATAL(
"Invalid detector identifier " << evt->
getDetectorID() <<
" != " << JFremantle::detid << endl);
172 zmap[evt->begin()->getToE()] = file_name;
181 inputFile.push_back(i->second);
199 JFremantle fremantle(geometry, V, parameters, threads, 2 * threads);
205 STATUS(inputFile.getFilename() <<
'\r');
DEBUG(endl);
209 for (
const string file_name = inputFile.getFilename(); inputFile.hasNext() && file_name == inputFile.getFilename(); ) {
211 const JEvent* evt = inputFile.next();
213 if (!evt->empty() && emitters.
has(evt->
getID())) {
214 zbuf.push_back(*evt);
218 sort(zbuf.begin(), zbuf.end());
220 for (buffer_type::iterator p = zbuf.begin(), q; p != zbuf.end(); p = q) {
222 for (q = p; ++q != zbuf.end() && q->begin()->getToE() <= p->rbegin()->getToE() + parameters.
Tmax_s; ) {}
224 if (q == zbuf.end()) {
226 if (inputFile.hasNext()) {
228 zbuf.erase(zbuf.begin(), p);
242 for (buffer_type::iterator evt = p; evt != q; ++evt) {
251 for (JEvent::const_iterator i = evt->begin(); i != __end; ++i) {
256 if (receivers.
has(i->getID()) && geometry.hasLocation(receivers[i->getID()]) && i->getQ() >= parameters.
Qmin * (parameters.
Qmin <= 1.0 ? i->getW() : 1.0)) {
260 receivers[i->getID()],
270 fremantle.enqueue(
data);
277 catch(
const exception& error) {
278 FATAL(
"main " << error.what());
#define DEBUG(A)
Message macros.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
std::vector< T >::difference_type distance(typename std::vector< T >::const_iterator first, typename PhysicsEvent::const_iterator< T > second)
Specialisation of STL distance.
Thread pool for global fits.
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.
double getWeight(T __begin, T __end)
Get total weight of data points.
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.
static JDetectorMechanics getMechanics
Function object to get string mechanics.
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
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.
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).
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.
Auxiliary data structure for floating point format specification.