#ifndef __JDETECTOR__JPMTCHANNEL__ #define __JDETECTOR__JPMTCHANNEL__ #include #include #include "JLang/JComparable.hh" #include "JDetector/JLocation.hh" #include "JDetector/JPMTReadoutAddress.hh" /** * \file * * Data structure to uniquely identify PMT readout channel. * \author mdejong */ namespace JDETECTOR {} namespace JPP { using namespace JDETECTOR; } namespace JDETECTOR { using JLANG::JComparable; /** * Auxiliary class to uniquely identify PMT readout channel. */ class JPMTChannel : public JLocation, public JPMTReadoutAddress { public: /** * Default constructor. */ JPMTChannel() : JLocation(), JPMTReadoutAddress() {} /** * Constructor. * * \param location module location * \param tdc PMT readout address */ JPMTChannel(const JLocation& location, const JPMTReadoutAddress& tdc) : JLocation (location), JPMTReadoutAddress(tdc) {} /** * Less than method. * * \param channel PMT channel * \result true if first channel before second channel; else false */ bool less(const JPMTChannel& channel) const { if (this->getLocation() == channel.getLocation()) return this->getTDC() < channel.getTDC(); else return this->getLocation() < channel.getLocation(); } /** * Read PMT channel. * * \param in input stream * \param object PMT channel * \return input stream */ friend inline std::istream& operator>>(std::istream& in, JPMTChannel& object) { in >> static_cast (object); in >> static_cast(object); return in; } /** * Write PMT channel. * * \param out output stream * \param object PMT channel * \return output stream */ friend inline std::ostream& operator<<(std::ostream& out, const JPMTChannel& object) { out << static_cast (object) << ' '; out << static_cast(object); return out; } }; } #endif