#ifndef __JTRIGGER__JSUPERFRAME1D__ #define __JTRIGGER__JSUPERFRAME1D__ #include #include "km3net-dataformat/online/JDAQSuperFrame.hh" #include "JDetector/JModule.hh" #include "JTools/JMergeSort.hh" #include "JTrigger/JModuleHeader.hh" #include "JTrigger/JFrame_t.hh" #include "JTrigger/JSuperFrame2D.hh" /** * \author mdejong */ namespace JTRIGGER {} namespace JPP { using namespace JTRIGGER; } namespace JTRIGGER { using KM3NETDAQ::JDAQSuperFrame; using JDETECTOR::JModule; /** * 1-dimensional frame with time calibrated data from one optical module. * * This class can be used to merge the data from different PMTs contained in a JSuperFrame2D object.\n * The data will then be time sorted. * * The static data member JSuperFrame1D::multiplex can be used as an I/O buffer. */ template > class JSuperFrame1D : public JModuleHeader, public JFrame_t { public: typedef JFrame_t container_type; /** * Default constructor. */ JSuperFrame1D() {} /** * Constructor. * * \param chronometer DAQ chronometer * \param id module identifier * \param pos module position */ JSuperFrame1D(const JDAQChronometer& chronometer, const JDAQModuleIdentifier& id, const JPosition3D& pos) : JModuleHeader(chronometer, id, pos) {} /** * Constructor. * * \param input 2D super frame */ JSuperFrame1D(const JSuperFrame2D& input) : JModuleHeader(input.getModuleHeader()) { merge(input.begin(), input.end(), *this, this->getToolkit()); } /** * Process 2D super frame. * * The data are sorted in time and an appropriate end marker is added. * * \param input 2D super frame * \return this 1D super frame */ JSuperFrame1D& operator()(const JSuperFrame2D& input) { this->setModuleHeader(input.getModuleHeader()); merge(input.begin(), input.end(), static_cast&>(*this), this->getToolkit()); return *this; } /** * Process set of 2D super frame data. * * The data are sorted in time and an appropriate end marker is added. * Note that this method only updates the data in the container. * * \param __begin begin of 2D super frame data * \param __end end of 2D super frame data * \return this 1D super frame */ JSuperFrame1D& operator()(typename JSuperFrame2D::const_iterator __begin, typename JSuperFrame2D::const_iterator __end) { merge(__begin, __end, static_cast&>(*this), this->getToolkit()); return *this; } /** * Process DAQ super frame. * * The time calibration is applied, data are sorted in time and an appropriate end marker is added. * * \param input DAQ super frame * \param module module data * \return this 1D super frame */ JSuperFrame1D& operator()(const JDAQSuperFrame& input, const JModule& module) { return (*this)(buffer(input, module)); } /** * Multiplexer. */ static JSuperFrame1D multiplex; private: static JTOOLS::JMergeSort merge; static JSuperFrame2D buffer; }; /** * Internal merge method. */ template JTOOLS::JMergeSort JSuperFrame1D::merge; /** * Internal buffer. */ template JSuperFrame2D JSuperFrame1D::buffer; /** * Multiplexer. */ template JSuperFrame1D JSuperFrame1D::multiplex; } #endif