#ifndef __JDETECTOR__JK40DEFAULTSIMULATOR__ #define __JDETECTOR__JK40DEFAULTSIMULATOR__ #include #include #include "JLang/JCC.hh" #include "JPhysics/JK40Rates.hh" #include "JPhysics/KM3NeT.hh" #include "JDetector/JK40DefaultSimulatorInterface.hh" /** * \author mdejong */ namespace JDETECTOR {} namespace JPP { using namespace JDETECTOR; } namespace JDETECTOR { using JPHYSICS::JK40Rates; using JPHYSICS::JRateL0_t; using JPHYSICS::JRateL1_t; /** * Default implementation of the simulation of K40 background. * This class implements the JK40Simulator interface. */ class JK40DefaultSimulator : public JK40DefaultSimulatorInterface, public JK40Rates { public: /** * Default constructor. */ JK40DefaultSimulator() : JK40Rates() {} /** * Constructor. * * \param rates K40 rates [Hz] */ JK40DefaultSimulator(const JK40Rates& rates) : JK40Rates(rates) {} /** * Get reference to unique instance of this class object. * * This method returns an object with default values. * The singles and multiples rates are taken from %KM3NeT * internal note "Detector simulations for KM3NeT". * * \return reference to this class object */ static JK40DefaultSimulator& getInstance() { static JK40DefaultSimulator k40Simulator(KM3NET::getK40Rates()); return k40Simulator; } /** * Get singles rate as a function of PMT. * * \param pmt PMT identifier * \return rate [Hz] */ virtual double getSinglesRate(const JPMTIdentifier& pmt) const override { return JK40Rates::getSinglesRate(); } /** * Get multiples rate as a function of optical module. * * \param module optical module identifier * \param M multiplicity (M >= 2) * \return rate [Hz] */ virtual double getMultiplesRate(const JModuleIdentifier& module, const int M) const override { return JK40Rates::getMultiplesRate(M); } /** * Get probability of coincidence. * * \param ct cosine space angle between PMT axes * \return probability */ virtual double getProbability(const double ct) const override { return exp(ct * (p1() + ct * (p2() + ct * (p3() + ct*p4())))); } /** * Read K40 simulator from input. * * \param in input stream * \param object K40 simulator * \return input stream */ friend inline std::istream& operator>>(std::istream& in, JK40DefaultSimulator& object) { const double rateL0 = object.rateL0; if (in >> object.rateL0) { object.rateL1.clear(); for (double x; in >> x; ) { object.rateL1.push_back(x); } } else { object.rateL0 = rateL0; } return in; } /** * Write K40 simulator to output. * * \param out output stream * \param object K40 simulator * \return output stream */ friend inline std::ostream& operator<<(std::ostream& out, const JK40DefaultSimulator& object) { out << object.rateL0; for (JRateL1_t::const_iterator i = object.rateL1.begin(); i != object.rateL1.end(); ++i) { out << ' ' << *i; } return out; } protected: /** * Parameters for probability of coincidence as a function of * the cosine of space angle between PMT axes. * Values are provided by V.Kulikovski. */ static double p1() { return 3.0767; } static double p2() { return -1.2078; } static double p3() { return 0.9905; } static double p4() { return 0.9379; } }; } #endif