#ifndef __JACOUSTICS__JTRANSCEIVER__ #define __JACOUSTICS__JTRANSCEIVER__ #include "JDB/JToAshort.hh" #include "JAcoustics/JEmitter.hh" #include "JAcoustics/JReceiver.hh" #include "JAcoustics/JSoundVelocity.hh" #include "JAcoustics/JTransmission.hh" /** * \file * * Acoustic transceiver. * \author mdejong */ namespace JACOUSTICS {} namespace JPP { using namespace JACOUSTICS; } namespace JACOUSTICS { using JDATABASE::JToAshort; /** * Acoustic transceiver. */ struct JTransceiver : public JEmitter, public JReceiver { /** * Default constructor. */ JTransceiver() : emitter (), receiver() {} /** * Constructor. * * \param emitter emitter * \param receiver receiver */ JTransceiver(const JEmitter& emitter, const JReceiver& receiver) : emitter (emitter), receiver(receiver) {} /** * Get transmission. * * \param data time-of-arrival * \param V sound velocity * \return transmission */ JTransmission getTransmission(const JToAshort& data, const JAbstractSoundVelocity& V) const { const double toa = data.UNIXTIMEBASE + receiver.getT(data.TOA_S); const double t1 = V.getTime(this->getDistance(), this->emitter .getZ(), this->receiver.getZ()); return JTransmission(data.RUNNUMBER, this->receiver.getID(), data.QUALITYFACTOR, data.QUALITYNORMALISATION, toa, toa - t1); } /** * Get distance between emitter and receiver. * * \return distance */ inline double getDistance() const { return emitter.getDistance(receiver); } JEmitter emitter; JReceiver receiver; }; } #endif