#ifndef __JTRIGGER__JTRIGGERINPUT__ #define __JTRIGGER__JTRIGGERINPUT__ #include #include #include "km3net-dataformat/online/JDAQChronometer.hh" #include "JTrigger/JTimeslice.hh" #include "JTrigger/JHitR1.hh" #include "JTrigger/JHitToolkit.hh" #include "JGeometry3D/JPosition3D.hh" /** * \author mdejong */ namespace JTRIGGER {} namespace JPP { using namespace JTRIGGER; } namespace JTRIGGER { using KM3NETDAQ::JDAQChronometer; /** * Data structure for input to trigger algorithm. * * The input data for the trigger are time ordered and contain an end marker. * The member methods size() and end() refer to the position before the end marker. */ class JTriggerInput : public JDAQChronometer, public std::vector, public JHitToolkit { public: /** * Constructor. * * \param input input data */ template JTriggerInput(const JTimeslice& input) : JDAQChronometer(input.getDAQChronometer()), std::vector() { size_t n = 0; for (typename JTimeslice::const_iterator frame = input.begin(); frame != input.end(); ++frame) { n += frame->size(); } this->reserve(n + 1); // reserve space for end marker this->resize (n + 0); // reserve space for data std::vector::iterator out = this->begin(); for (typename JTimeslice::const_iterator frame = input.begin(); frame != input.end(); ++frame) { const JDAQModuleIdentifier& id = frame->getModuleID(); const JPosition3D& pos = frame->getPosition(); for (typename JFrame::const_iterator i = frame->begin(); i != frame->end(); ++i, ++out) { *out = JHitR1(id, pos, getJHit(*i)); } } *out = JHitR1(JDAQPMTIdentifier(), JPosition3D(), getEndMarker()); std::sort(this->begin(), this->end(), getToolkit()); } }; } #endif