11 #include <type_traits>
67 int main(
int argc,
char **argv)
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();
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();
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) {
142 catch(
const exception&) {}
155 if (inputFile.size() > 1
u) {
159 for (
const string& file_name : inputFile) {
168 FATAL(
"Invalid detector identifier " << evt->
getDetectorID() <<
" != " << JFremantle::detid << endl);
172 zmap[evt->begin()->getToE()] = file_name;
181 inputFile.push_back(
i->second);
203 for (buffer_type zbuf; inputFile.hasNext(); ) {
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) {
248 const JEmitter& emitter = emitters [evt->getID()];
249 const double weight =
getWeight(evt->getID());
251 for (JEvent::const_iterator
i = evt->begin();
i != __end; ++
i) {
258 data.push_back(
JHit(emitter,
260 receivers[
i->getID()],
277 catch(
const exception& error) {
278 FATAL(
"main " << error.what());
Fit function of acoustic model.
Utility class to parse command line options.
Q(UTCMax_s-UTCMin_s)-livetime_s
const int getDetectorID() const
Get detector identifier.
int main(int argc, char *argv[])
JComparator< JResult_t T::*, JComparison::lt > make_comparator(JResult_t T::*member)
Helper method to create comparator between values of data member.
double getWeight(T __begin, T __end)
Get total weight of data points.
size_t getMinimumNumberOfEmitters(T __begin, T __end)
Get minimum number of emitters for any string in data.
JContainer< std::vector< JTransmitter > > transmitters_container
static JDetectorMechanics getMechanics
Function object to get string mechanics.
std::vector< T >::difference_type distance(typename std::vector< T >::const_iterator first, typename PhysicsEvent::const_iterator< T > second)
Specialisation of STL distance.
Auxiliary data structure to unify weights of acoustics data according to the number of pings per emit...
General purpose class for hash map of unique elements.
ROOT TTree parameter settings.
Recording of objects on file according a format that follows from the file name extension.
*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)...
void enqueue(input_type &data)
Queue data.
V(JDAQEvent-JTriggerReprocessor)*1.0/(JDAQEvent+1.0e-10)
Data structure for detector geometry and calibration.
std::vector< JHitW0 > buffer_type
hits
Global fit of prameterised detector geometry to acoustics data.
Data structure for hydrophone.
size_t getNumberOfEmitters(T __begin, T __end)
Get number of emitters.
Scanning of objects from a single file according a format that follows from the extension of each fil...
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.
JContainer< std::vector< JHydrophone > > hydrophones_container
Data structure for transmitter.
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.
JContainer< std::vector< JTripod > > tripods_container
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...
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.
then fatal The output file must have the wildcard in the e g root fi 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
Utility class to parse command line options.
Acoustic transmission identifier.
Thread pool for global fits.
bool hasLocation(const JLocation &location) const
Check if this detector has given location.
Object reading from a list of files.
const JLimit & getLimit() const
Get limit.
do set_variable DETECTOR_TXT $WORKDIR detector
int getID() const
Get emitter identifier.
Data structure for tripod.
Acoustic transmission identifier.
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.