#ifndef __JDETECTOR__JMODULEGEOMETRY__ #define __JDETECTOR__JMODULEGEOMETRY__ #include "JIO/JSerialisable.hh" #include "JDAQ/JDAQUTCExtendedIO.hh" #include "JDetector/JModuleIdentifier.hh" #include "JGeometry3D/JPosition3D.hh" #include "JGeometry3D/JEulerAngle3D.hh" /** * \author mdejong */ namespace JDETECTOR {} namespace JPP { using namespace JDETECTOR; } namespace JDETECTOR { using JIO::JReader; using JIO::JWriter; using KM3NETDAQ::JDAQUTCExtended; using JGEOMETRY3D::JPosition3D; using JGEOMETRY3D::JEulerAngle3D; /** * Module geometry. */ class JModuleGeometry : public JDAQUTCExtended, public JModuleIdentifier, public JPosition3D, public JEulerAngle3D { public: /** * Default constructor. */ JModuleGeometry() : JDAQUTCExtended (), JModuleIdentifier(), JPosition3D (), JEulerAngle3D () {} /** * Constructor. * * \param utc UTC * \param id module identifier * \param pos module position * \param angle module orientation */ JModuleGeometry(const JDAQUTCExtended& utc, const JModuleIdentifier& id, const JPosition3D& pos, const JEulerAngle3D& angle) : JDAQUTCExtended (utc), JModuleIdentifier(id), JPosition3D (pos), JEulerAngle3D (angle) {} /** * Read module geometry from input. * * \param in input stream * \param geometry module geometry * \return input stream */ friend inline std::istream& operator>>(std::istream& in, JModuleGeometry& geometry) { in >> static_cast (geometry); in >> static_cast(geometry); in >> static_cast (geometry); in >> static_cast (geometry); return in; } /** * Write module geometry to output. * * \param out output stream * \param geometry module geometry * \return output stream */ friend inline std::ostream& operator<<(std::ostream& out, const JModuleGeometry& geometry) { out << static_cast (geometry); out << ' '; out << static_cast(geometry); out << ' '; out << static_cast (geometry); out << ' '; out << static_cast (geometry); return out; } /** * Read module geometry from input. * * \param in reader * \param geometry module geometry * \return reader */ friend inline JReader& operator>>(JReader& in, JModuleGeometry& geometry) { in >> static_cast (geometry); in >> static_cast(geometry); in >> static_cast (geometry); in >> static_cast (geometry); return in; } /** * Write module geometry to output. * * \param out writer * \param geometry module geometry * \return writer */ friend inline JWriter& operator<<(JWriter& out, const JModuleGeometry& geometry) { out << static_cast (geometry); out << static_cast(geometry); out << static_cast (geometry); out << static_cast (geometry); return out; } }; /** * Auxiliary class for distance beteen UTC times. */ struct JUTCDistance { /** * Get distance between UTC. * * \param first first value * \param second second value * \return time difference [ns] */ inline double operator()(const JDAQUTCExtended& first, const JDAQUTCExtended& second) const { return second.getTimeNanoSecond() - first.getTimeNanoSecond(); } }; } #endif