#ifndef __JSUPPORT__JRUNBYRUN__ #define __JSUPPORT__JRUNBYRUN__ #include "km3net-dataformat/online/JDAQSummaryslice.hh" #include "JSupport/JRandomSampler.hh" #include "JSupport/JMultipleFileSampler.hh" #include "JLang/JStringStream.hh" #include "Jeep/JProperties.hh" #include "JSystem/JStat.hh" /** * \author mdejong */ namespace JSUPPORT {} namespace JPP { using namespace JSUPPORT; } namespace JSUPPORT { using KM3NETDAQ::JDAQSummaryslice; /** * Auxiliary class to select summary data (KM3NETDAQ::JDAQSummaryslice) from the specified raw data file(s). * * The use case of this class primarily is for the run-by-run mode of JTriggerEfficiency.cc.\n * The two parameters of the JSUPPORT::JRandomSampler class should then be set * to sufficiently cover the contents of raw data file(s) and to minimise possible biases.\n * The values can also be tuned to reduce the overhead of accessing the data in the input file(s).\n */ struct JRunByRun : public JMultipleFileSampler { /** * Default constructor. */ JRunByRun() : JMultipleFileSampler() {} /** * Check validity of run by run options. * * \return true if okay; else false */ inline bool is_valid() const { return !(*this)->getFilelist().empty(); } /** * Read run by run options from input. * * \param in input stream * \param object run by run options * \return input stream */ friend inline std::istream& operator>>(std::istream& in, JRunByRun& object) { using namespace std; using namespace JPP; JStringStream is(in); if (getFileStatus(is.str().c_str())) { is.load(); } getProperties(object).read(is); return in; } /** * Write run by run options to output. * * \param out output stream * \param object run by run options * \return output stream */ friend inline std::ostream& operator<<(std::ostream& out, const JRunByRun& object) { return getProperties(object).write(out); } protected: /** * Get properties of this class. * * \return properties */ template static inline JProperties getProperties(T& object) { JProperties properties; properties["file"] = object.template get,true>(); properties["sampler"] = object.getSampler(); return properties; } }; } #endif