#ifndef __JSIRENE__JPULSE__ #define __JSIRENE__JPULSE__ #include "km3net-dataformat/offline/Hit.hh" #include "JLang/JObjectID.hh" #include "JDetector/JTimeRange.hh" #include "JAAnet/JAAnetToolkit.hh" /** * \file * * Time-over-threshold (ToT) pulse from a PMT. * A ToT pulse is defined by a object identifier and a start and stop time. * \author mdejong */ namespace JSIRENE {} namespace JPP { using namespace JSIRENE; } namespace JSIRENE { using JLANG::JObjectID; using JAANET::getTime; using JDETECTOR::JTimeRange; /** * Auxiliary class for a time-over-threshold pulse from a PMT. * A ToT pulse is defined by a object identifier and a start and stop time. */ class JPulse : public JObjectID, public JTimeRange { public: /** * Default constructor. */ JPulse() : JObjectID(), JTimeRange() {} /** * Constructor. * * \param hit hit */ JPulse(const Hit& hit) : JObjectID(hit.pmt_id), JTimeRange(getTime(hit),getTime(hit)) {} /** * Constructor. * * \param first first hit * \param second second hit */ JPulse(const JPulse& first, const JPulse& second) : JObjectID(first.getID()), JTimeRange(first) { combine(second); } }; /** * Compare Monte Carlo hit times. * * \param first first hit * \param second second hit * \return true if first hit earlier than second; else false */ inline bool operator<(const JPulse& first, const JPulse& second) { return first.getLowerLimit() < second.getLowerLimit(); } /** * Compare Monte Carlo hit times. * * \param hit hit * \param t0 time [ns] * \return true if hit earlier than given time; else false */ inline bool operator<(const JPulse& hit, const double t0) { return hit.getLowerLimit() < t0; } } #endif