#ifndef __JTRIGGEREDHIT__ #define __JTRIGGEREDHIT__ #include #include "km3net-dataformat/online/JDAQPMTIdentifier.hh" #include "km3net-dataformat/online/JDAQTriggerMask.hh" #include "JTrigger/JHit.hh" /** * \author mdejong */ namespace JTRIGGER {} namespace JPP { using namespace JTRIGGER; } namespace JTRIGGER { using KM3NETDAQ::JDAQPMTIdentifier; using KM3NETDAQ::JDAQTriggerMask; /** * Data structure for triggered hit. */ class JTriggeredHit : public JDAQPMTIdentifier, public JHit, public JDAQTriggerMask { public: /** * Default constructor. */ JTriggeredHit() : JDAQPMTIdentifier(), JHit (), JDAQTriggerMask () {} /** * Constructor. * * \param pmt PMT identifier * \param hit hit * \param mask trigger mask */ JTriggeredHit(const JDAQPMTIdentifier& pmt, const JHit& hit, const JDAQTriggerMask& mask) : JDAQPMTIdentifier(pmt), JHit (hit), JDAQTriggerMask (mask) {} /** * Constructor. * * \param hit hit * \param mask trigger mask */ template JTriggeredHit(const JHit_t& hit, const JDAQTriggerMask& mask) : JDAQPMTIdentifier(hit.getPMTIdentifier()), JHit (hit.getHit()), JDAQTriggerMask (mask) {} }; /** * Less than operator for triggered hits. * * The less than operator is applied first to JTRIGGER::JHit and then to the KM3NETDAQ::JDAQPMTIdentifier. * Hence, the ordering by JTRIGGER::JHit is maintained. * This allows for the use of STL sort() and set_union() algorithms. * * \param first first hit * \param second second hit * \result true if first hit earlier or lower PMT identifier if equal; else false */ inline bool operator<(const JTriggeredHit& first, const JTriggeredHit& second) { if (std::equal_to()(first,second)) return std::less()(first,second); else return std::less ()(first,second); } /** * Equal operator for triggered hits. * * The equal operator is applied to JTRIGGER::JHit and to the KM3NETDAQ::JDAQPMTIdentifier. * * \param first first hit * \param second second hit * \result true if first hit equal second hit; else false */ inline bool operator==(const JTriggeredHit& first, const JTriggeredHit& second) { return (std::equal_to()(first,second) && std::equal_to ()(first,second)); } } #endif