#ifndef __JCALIBRATE_JPARAMETERS__ #define __JCALIBRATE_JPARAMETERS__ #include #include /** * \author acreusot */ namespace JCALIBRATE {} namespace JPP { using namespace JCALIBRATE; } namespace JCALIBRATE { /** * Auxiliary class for PMT parameters including threshold */ struct JParameters { /** * Write parameters to output stream. * * \param out output stream * \param parameters parameters * \return output stream */ friend inline std::ostream& operator<<(std::ostream& out, const JParameters& parameters) { return out << parameters.runId << ' ' << parameters.domId << ' ' << parameters.pmtId << ' ' << parameters.threshold << ' ' << parameters.noise << ' ' << parameters.signal << ' ' << parameters.badChannel; } /** * Read parameters from input stream. * * \param in input stream * \param parameters parameters * \return input stream */ friend inline std::istream& operator>>(std::istream& in, JParameters& parameters) { return in >> parameters.runId >> parameters.domId >> parameters.pmtId >> parameters.threshold >> parameters.noise >> parameters.signal >> parameters.badChannel; } /** * Less-than operator. * * \param parameters parameters * \return true if perameters less than given parameters; else false */ inline bool operator<(const JParameters& parameters) const { if (domId < parameters.domId) { return true; } else if (domId == parameters.domId) { if (pmtId < parameters.pmtId) { return true; } else if (pmtId == parameters.pmtId) { if (threshold < parameters.threshold) { return true; } } } return false; } /** * Default constructor. */ JParameters() : runId(0), domId(0), pmtId(0), threshold(0), noise(0), signal(0), badChannel(false) {} /** * Constructor. * * \param runId run number * \param domId module identifier * \param pmtId PMT number * \param threshold threshold * \param noise noise * \param signal signal * \param badChannel badness of channel */ JParameters(int runId, int domId, int pmtId, double threshold, double noise, double signal, bool badChannel) : runId(runId), domId(domId), pmtId(pmtId), threshold(threshold), noise(noise), signal(signal), badChannel(badChannel) {} int runId; int domId; int pmtId; double threshold; double noise; double signal; bool badChannel; }; } #endif