#ifndef __JHIT__ #define __JHIT__ namespace JTRIGGER { /** * Hit data structure. */ class JHit { public: /** * Default constructor. */ JHit() : t(0.0) {} /** * Constructor. * * \param t_ns calibrated time of hit [ns] */ JHit(const double t_ns) : t(t_ns) {} /** * Get hit. * * \return hit */ const JHit& getHit() const { return static_cast(*this); } /** * Type conversion. * * \return time [ns] */ inline operator double() const { return t; } /** * Get calibrated time of hit. * * \return time [ns] */ inline double getT() const { return t; } protected: double t; }; /** * Less than operator for hits. * * \param first hit * \param second hit * \result true if first hit earlier; else false */ inline bool operator<(const JHit& first, const JHit& second) { return first.getT() < second.getT(); } /** * Less than operator for hits. * * \param hit hit * \param t time [ns] * \result true if hit earlier than t; else false */ inline bool operator<(const JHit& hit, const double t) { return hit.getT() < t; } /** * Equal operator for hits. * * \param first hit * \param second hit * \result true if first hit time equal to second hit time; else false */ inline bool operator==(const JHit& first, const JHit& second) { return first.getT() == second.getT(); } } #endif