#ifndef __JOSCPROB__JOSCPROBHELPER__ #define __JOSCPROB__JOSCPROBHELPER__ #include "JLang/JException.hh" #include "JLang/JSharedPointer.hh" #include "JOscProb/JOscProb.hh" #include "JOscProb/JOscChannel.hh" /** * \author bjung */ namespace JOSCPROB { using JLANG::JSharedPointer; using JLANG::JNullPointerException; /** * Helper class for oscillation probabilities. */ struct JOscProbHelper : public JSharedPointer { using JSharedPointer::is_valid; /** * Default constructor. */ JOscProbHelper() {} /** * Constructor. * * \param oscProb oscillation probability function */ JOscProbHelper(const JOscProb& oscProb) { configure(oscProb); } /** * Configure oscillation probability function. * * \param oscProb oscillation probability function */ virtual void configure(const JOscProb& oscProb) { reset(oscProb.clone()); } /** * Get oscillation probability corresponding to given oscillation channel, * neutrino energy and zenith angle. * * \param oscChannel oscillation channel * \param energy neutrino energy [GeV] * \param costh cosine zenith angle * \return oscillation probability */ virtual double getOscProb(const JOscChannel& oscChannel, const double energy, const double costh) const { if (is_valid()) { return get()->getOscProb(oscChannel, energy, costh); } else { THROW(JNullPointerException, "JOscProbHelper::getOscProb(): Unspecified oscillation probability function."); } } }; } #endif