#ifndef __JOSCPROB__JOSCPROBFUNCTION__ #define __JOSCPROB__JOSCPROBFUNCTION__ #include "JLang/JClonable.hh" #include "JOscProb/JOscChannel.hh" #include "JOscProb/JOscParameters.hh" #include "JOscProb/JOscProbInterface.hh" /** * \author bjung */ namespace JOSCPROB {} namespace JPP { using namespace JOSCPROB; } namespace JOSCPROB { using JLANG::JClonable; /** * Implementation of oscillation probability function interface. * * The template argument refers to a function of which the copy constuctor needs to be defined\n * and which must contain the methods `setParameters(const JOscParameters&)` and `getP(const JOscChannel&, const double, const double)`. */ template struct JOscProbFunction : public JClonable > { typedef typename JOscProbInterface::JOscParameters_t JOscParameters_t; /** * Constructor. * * \param function oscillation probability function */ JOscProbFunction(const JFunction_t& function) : function(function) {} /** * Set oscillation parameters. * * \param parameters oscillation parameters */ void setParameters(const JOscParameters_t& parameters) const { function.setParameters(parameters); } /** * Get cosine zenith angle for a given baseline. * * \param L baseline [km] * \return cosine zenith angle */ double getCosth(const double L) const override { return function.getCosth(L); } /** * Get baseline for a given cosine zenith angle. * * \param costh cosine zenith angle * \return baseline [km] */ double getBaseline(const double costh) const override { return function.getBaseline(costh); } /** * Get oscillation probability for given oscillation channel. * * \param channel oscillation channel * \param energy neutrino energy [GeV] * \param costh cosine zenith angle * \return oscillation probability */ double getP(const JOscChannel& channel, const double energy, const double costh) const override { return function.getP(channel, energy, costh); } private: JFunction_t function; //!< oscillation probability function }; /** * Auxiliary method for creating an interface to an oscillation probability function. * * \param function oscillation probability function object * \return oscillation probability function interface */ template inline JOscProbFunction make_oscProbFunction(const JFunction_t& function) { return JOscProbFunction(function); } } #endif