1#ifndef __JACOUSTICS__JACOUSTICSTOOLKIT__
2#define __JACOUSTICS__JACOUSTICSTOOLKIT__
7#include "km3net-dataformat/online/JDAQChronometer.hh"
9#include "JLang/JException.hh"
10#include "JLang/JPredicate.hh"
12#include "JGeometry3D/JVector3D.hh"
26 using JLANG::JValueOutOfRange;
27 using JLANG::JPredicate;
28 using JGEOMETRY3D::JVector3D;
54 public std::map<int, size_t>
64 min(std::numeric_limits<size_t>::max())
66 for (T i = __begin; i != __end; ++i) {
67 (*this)[i->getID()] += 1;
70 for (const_iterator i = this->begin(); i != this->end(); ++i) {
71 if (i->second <
min) {
110 const_iterator p = this->find(
id);
112 if (p != this->end())
113 return (
double)
min / (double) p->second;
115 THROW(JValueOutOfRange,
"Invalid identifier " <<
id);
131 static bool unify =
true;
148 template<
class T,
class JTypename_t,
class JComparator_t>
151 const JPredicate<JTypename_t, JComparator_t>& predicate)
153 T p = std::find_if(__begin, __end, predicate);
156 return p->getPosition();
158 THROW(JValueOutOfRange,
"No element in container which corresponds to given predicate.");
171 template<
class T,
class JTypename_t,
class JComparator_t>
174 const JPredicate<JTypename_t, JComparator_t>& predicate,
175 const JVector3D& position)
180 catch(
const std::exception&) {
192 inline double getUNIXTime(
const KM3NETDAQ::JDAQChronometer& chronometer)
194 return chronometer.getTimesliceStart().getTimeNanoSecond() * 1.0e-9;
Auxiliary classes and methods for acoustic position calibration.
int getWaveformID(int id)
Get waveform identifier.
double getUNIXTime(const KM3NETDAQ::JDAQChronometer &chronometer)
Get UNIX time of given DAQ object.
JVector3D getPosition(T __begin, T __end, const JPredicate< JTypename_t, JComparator_t > &predicate)
Get position from element in data which corresponds to given predicate.
Auxiliary data structure to unify weights of acoustics data according to the number of pings per emit...
double operator()(const int id) const
Get weight.
static bool & get_unify()
Get option to unify weights.
static bool getUnify()
Get option to unify weights.
JWeight(T __begin, T __end)
Constructor.
static void setUnify(const bool unify)
Set option to unify weights.