#ifndef __JOSCPROB__JMASSSQUAREDDIFFERENCE__ #define __JOSCPROB__JMASSSQUAREDDIFFERENCE__ #include "JLang/JException.hh" #include "JTools/JGrid.hh" #include "JOscProb/JOscParameter.hh" /** * \author bjung, mdejong */ namespace JOSCPROB {} namespace JPP { using namespace JOSCPROB; } namespace JOSCPROB { using JTOOLS::JGrid; /** * Implementation of mass-squared difference. */ template struct JMassSquaredDifference final : public JOscParameter { typedef JMassSquaredDifference JMassSquaredDifference_t; typedef JOscParameter JOscParameter_t; typedef typename JOscParameter_t::JParameter_t JParameter_t; typedef typename JOscParameter_t::argument_type argument_type; typedef typename JOscParameter_t::value_type value_type; /** * Default constructor. */ JMassSquaredDifference() : JOscParameter_t() {} /** * Constructor. * * \param value mass-squared difference value [eV2] */ explicit JMassSquaredDifference(argument_type value) : JOscParameter_t(value) { using namespace JPP; if (!is_valid()) { THROW(JValueOutOfRange, "JMassSquaredDifference::JMassSquaredDifference(): Invalid mass-squared difference " << value); } } /** * Assignment operator. * * \param value mass-squared difference value [eV2] * \return mass-squared difference */ JMassSquaredDifference_t& operator=(const value_type& value) { this->setValue(value); return *this; } /** * Check validity of oscillation parameter. * * \return true if valid; else false */ bool is_valid() const override final { return true; } /** * Auxiliary function to create an mass-squared difference parameter grid. * * \param value mass-squared difference value [eV2] * \return mass-squared difference parameter */ static JMassSquaredDifference_t make_parameter(argument_type value) { return JMassSquaredDifference_t(value); } }; /** * Template specialization for parameter grid. */ template<> struct JMassSquaredDifference > final : public JOscParameter > { typedef JGrid JGrid_t; typedef JMassSquaredDifference JMassSquaredDifference_t; typedef JOscParameter JOscParameter_t; typedef typename JOscParameter_t::JParameter_t JParameter_t; /** * Default constructor. */ JMassSquaredDifference() {} /** * Constructor. * * \param grid mass-squared difference parameter grid [eV2] */ explicit JMassSquaredDifference(const JGrid_t& grid) : JOscParameter(grid) { using namespace JPP; if (!is_valid()) { THROW(JValueOutOfRange, "JMassSquaredDifference::JMassSquaredDifference(): Invalid mass-squared difference grid " << grid); } } /** * Constructor. * * \param nx number of elements * \param xmin lower limit [eV2] * \param xmax upper limit [eV2] */ JMassSquaredDifference(const int nx, const double xmin, const double xmax) : JOscParameter(JGrid_t(nx, xmin, xmax)) {} /** * Constructor. * * \param value value */ explicit JMassSquaredDifference(const double value) : JMassSquaredDifference(1, value, value) {} /** * Assignment operator. * * \param grid mass-squared difference parameter grid [eV2] * \return mass-squared difference */ JMassSquaredDifference_t& operator=(const JGrid_t& grid) { this->setValue(grid); return *this; } /** * Check validity of oscillation parameter. * * \return true if valid; else false */ bool is_valid() const override final { return true; } /** * Auxiliary function to create an mass-squared difference parameter grid. * * \param value mass-squared difference value [eV2] * \return mass-squared difference parameter */ static JMassSquaredDifference_t make_parameter(const double value) { return JMassSquaredDifference_t(value); } }; } #endif