#ifndef __JTRIGGER__JK40RUNBYRUNSIMULATOR__ #define __JTRIGGER__JK40RUNBYRUNSIMULATOR__ #include "km3net-dataformat/online/JDAQSummaryFrame.hh" #include "JPhysics/JK40Rates.hh" #include "JDetector/JK40DefaultSimulator.hh" #include "JTrigger/JSummaryRouter.hh" #include "JTrigger/JTriggerToolkit.hh" /** * \author mdejong */ namespace JTRIGGER {} namespace JPP { using namespace JTRIGGER; } namespace JTRIGGER { using KM3NETDAQ::JDAQSummaryFrame; using JPHYSICS::JK40Rates; using JDETECTOR::JK40DefaultSimulator; using JDETECTOR::JPMTIdentifier; /** * K40 simulation based on run-by-run information. * * This class overwrites the method JK40DefaultSimulator::getSinglesRate. * The actual singles rate is obtained from summary data. */ class JK40RunByRunSimulator : public JK40DefaultSimulator { public: /** * Constructor. * * \param router summary router * \param rates K40 rates [Hz] */ JK40RunByRunSimulator(const JSummaryRouter& router, const JK40Rates& rates) : JK40DefaultSimulator(rates), summary_router(router) {} /** * Get singles rate as a function of PMT. * * \param pmt PMT identifier * \return rate [Hz] */ virtual double getSinglesRate(const JPMTIdentifier& pmt) const override { if (summary_router.hasSummaryFrame(pmt.getModuleID())) { const JDAQSummaryFrame& frame = summary_router.getSummaryFrame(pmt.getModuleID()); return getRate(frame, pmt.getPMTAddress()); } return 0.0; } protected: const JSummaryRouter& summary_router; }; } #endif