#ifndef __JTRIGGER__JBUILD__ #define __JTRIGGER__JBUILD__ #include "JLang/JSharedPointer.hh" #include "km3net-dataformat/online/JDAQSuperFrame.hh" #include "JDetector/JModule.hh" #include "JTrigger/JSuperFrame2D.hh" #include "JTrigger/JPreprocessor.hh" #include "JTrigger/JDAQHitSelector.hh" #include "JTrigger/JMatch.hh" /** * \author mdejong */ namespace JTRIGGER {} namespace JPP { using namespace JTRIGGER; } namespace JTRIGGER { using KM3NETDAQ::JDAQSuperFrame; using JDETECTOR::JModule; /** * Auxiliary base class for hit building. * * This class provides for * - a configurable selection of DAQ hits; and * - a configurable method to pre-process consecutive hits. * * The underlying action is subsequently transferred to JSuperFrame2D. */ template struct JBuild { typedef JHit_t value_type; typedef JMatch match_type; typedef JDAQHitSelector selector_type; /** * Default constructor. * * The default corresponds to no pre-processing of hits. */ JBuild() : option(JPreprocessor::none_t), selector(new JDAQHitDefaultSelector()) {} /** * Set pre-processor of consecutive hits. * * \param option option * \param match match criterion */ void setPreprocessor(const JPreprocessor::JOption_t option, const match_type& match) { this->option = option; this->match.reset(match.clone()); } /** * Reset pre-processor of consecutive hits. */ void resetPreprocessor() { this->option = JPreprocessor::none_t; this->match.reset(); } /** * Set DAQ hit selector. * * \param selector DAQ hit selector */ void setDAQHitSelector(const JDAQHitSelector& selector) { this->selector.reset(selector.clone()); } /** * Reset DAQ hit selector. */ void resetDAQHitSelector() { this->selector.reset(new JDAQHitDefaultSelector()); } /** * Demultiplex and pre-process DAQ super frame. * * \param input DAQ super frame * \param module module data * \return 2D super frame */ JSuperFrame2D& demultiplex(const JDAQSuperFrame& input, const JModule& module) const { JSuperFrame2D& buffer = JSuperFrame2D::demultiplex(input, module, *selector); if (match.is_valid()) { buffer.preprocess(option, *match); } return buffer; } JPreprocessor::JOption_t option; //!< pre-processor option JLANG::JSharedPointer match; //!< pre-processor match criterion JLANG::JSharedPointer selector; //!< DAQ hit selector }; } #endif