#ifndef __JTRIGGER__JDAQHITTOTSELECTOR__ #define __JTRIGGER__JDAQHITTOTSELECTOR__ #include #include #include #include "km3net-dataformat/online/JDAQHit.hh" #include "JTrigger/JDAQHitSelector.hh" #include "JTools/JRange.hh" /** * \author mdejong */ namespace JTRIGGER {} namespace JPP { using namespace JTRIGGER; } namespace JTRIGGER { using JTOOLS::JRange; /** * Auxiliary class to select DAQ hits based on time-over-treshold value. */ struct JDAQHitToTSelector : public JClonable, public JRange { typedef JDAQHit::JTOT_t JTOT_t; typedef JTOOLS::JRange range_type; /** * Default constructor. */ JDAQHitToTSelector() : range_type(0, std::numeric_limits::max()) {} /** * Constructor. * * \param tot_min minimal time-over-threshold * \param tot_max maximal time-over-threshold */ JDAQHitToTSelector(const JTOT_t tot_min, const JTOT_t tot_max) : range_type(tot_min, tot_max) {} /** * DAQ hit selection. * * \param hit DAQ hit * \return true to select; else false */ virtual bool operator()(const JDAQHit& hit) const override { return static_cast(*this)(hit.getToT()); } /** * Read selector from input. * * \param in * \param selector selector * \return reader */ friend inline std::istream& operator>>(std::istream& in, JDAQHitToTSelector& selector) { int first, second; in >> first; in >> second; selector.first = static_cast(first ); selector.second = static_cast(second); return in; } /** * Write selector to output. * * \param out writer * \param selector selector * \return writer */ friend inline std::ostream& operator<<(std::ostream& out, const JDAQHitToTSelector& selector) { out << static_cast(selector.first); out << " "; out << static_cast(selector.second); return out; } }; } #endif