#ifndef __JTRIGGER__JPMTSELECTOR__ #define __JTRIGGER__JPMTSELECTOR__ #include #include #include #include #include #include "JTrigger/JPMTIdentifier_t.hh" /** * \author rgruiz */ namespace JTRIGGER {} namespace JPP { using namespace JTRIGGER; } namespace JTRIGGER { /** * Auxiliary data structure for set of PMT identifiers. */ struct JPMTSelector : public std::vector, public TObject { /** * Default constructor. */ JPMTSelector() {} /** * Virtual destructor. */ virtual ~JPMTSelector() {} /** * Test match with given PMT. * * \param pmt PMT * \return true if match; else false */ bool operator()(const JPMTIdentifier_t& pmt) const { for (const_iterator i = this->begin(); i != this->end(); ++i) { if (JPMTIdentifier_t::compare(*i, pmt)) { return true; } } return false; } /** * Read vector of PMT identifiers from input. * * \param in input stream * \param object PMT identifiers * \return input stream */ friend inline std::istream& operator>>(std::istream& in, JPMTSelector& object) { object.clear(); for (JPMTIdentifier_t pmt; in >> pmt; ) { object.push_back(pmt); } return in; } /** * Write vector of PMT identifiers to output. * * \param out output stream * \param object PMT identifiers * \return output stream */ friend inline std::ostream& operator<<(std::ostream& out, const JPMTSelector& object) { for (JPMTSelector::const_iterator i = object.begin(); i != object.end(); ++i) { out << ' ' << i->getModuleID() << ' ' << i->getPMTAddress(); } return out; } ClassDef(JPMTSelector, 1); }; } #endif