#ifndef __JACOUSTICS__JHIT__ #define __JACOUSTICS__JHIT__ #include #include "JDetector/JLocation.hh" #include "JLang/JManip.hh" #include "JAcoustics/JEmitter.hh" #include "JAcoustics/JCounter.hh" #include "JAcoustics/JEKey.hh" /** * \file * * Acoustic hit. * \author mdejong */ namespace JACOUSTICS {} namespace JPP { using namespace JACOUSTICS; } namespace JACOUSTICS { using JDETECTOR::JLocation; using JGEOMETRY3D::JVector3D; /** * Acoustics hit. */ struct JHit : public JEmitter, public JCounter, public JLocation { /** * Default constructor. */ JHit() {} /** * Constructor. * * \param emitter emitter * \param counter counter * \param location receiver location * \param toa_s time-of-arrival [s] * \param sigma_s resolution [s] * \param weight weight */ JHit(const JEmitter& emitter, const JCounter& counter, const JLocation& location, const double toa_s, const double sigma_s, const double weight) : JEmitter(emitter), JCounter(counter), JLocation(location), toa(toa_s), sigma(sigma_s), weight(weight) {} /** * Get emitter hash key of this hit. * * \return hash key */ JEKey getEKey() const { return JEKey(getID(), getCounter()); } /** * Get expectation value of time-of-arrival. * * \return time-of-arrival [s] */ double getValue() const { return toa; } /** * Get resolution of time-of-arrival. * * \return resulution [s] */ double getSigma() const { return sigma; } /** * Get weight. * * \return weight */ double getWeight() const { return weight; } /** * Write hit to output stream. * * \param out output stream * \param hit hit * \return output stream */ friend inline std::ostream& operator<<(std::ostream& out, const JHit& hit) { using namespace std; using namespace JPP; out << setw(3) << hit.getID() << ' ' << setw(3) << hit.getCounter() << ' ' << getLabel(hit.getLocation()) << FIXED(20,5) << hit.getValue() << ' ' << FIXED(9,6) << hit.getSigma() << ' ' << FIXED(6,2) << hit.getWeight(); return out; } protected: double toa; double sigma; double weight; }; } #endif