#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 final : 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 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 final { 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