#ifndef __JDETECTOR__JPMTDEFAULTSIMULATORINTERFACE__ #define __JDETECTOR__JPMTDEFAULTSIMULATORINTERFACE__ #include "km3net-dataformat/definitions/pmt_status.hh" #include "JDetector/JPMTSimulator.hh" #include "JDetector/JPMTSignalProcessorInterface.hh" /** * \author mdejong */ namespace JDETECTOR {} namespace JPP { using namespace JDETECTOR; } namespace JDETECTOR { /** * Default PMT simulation interface. * * This class implements the JPMTSimulator interface by transferring * the PMT simulation to the PMT signal processor interface. */ class JPMTDefaultSimulatorInterface : public JPMTSimulator { public: /** * Process hits. * * \param id PMT identifier * \param calibration PMT calibration * \param status PMT status * \param input PMT signals * \param output PMT hits */ virtual void processHits(const JPMTIdentifier& id, const JCalibration& calibration, const JStatus& status, const JPMTData& input, JPMTData& output) const override { if (getPMTStatus(id, getTimeRange(input), status)) { const JPMTSignalProcessorInterface& cpu = getPMTSignalProcessor(id); cpu(calibration, input, output); } } /** * Get PMT status. * * \param id PMT identifier * \param window time range * \param status PMT status * \return status */ virtual bool getPMTStatus(const JPMTIdentifier& id, const JTimeRange& window, const JStatus& status) const { return !status.has(PMT_DISABLE); } /** * Get PMT signal processor. * * \param pmt PMT identifier * \return PMT signal processor */ virtual const JPMTSignalProcessorInterface& getPMTSignalProcessor(const JPMTIdentifier& pmt) const { static const JPMTSignalProcessorInterface cpu; return cpu; } }; } #endif