Jpp  18.6.0-rc.1
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JMassSquaredDifference.hh
Go to the documentation of this file.
1 #ifndef __JOSCPROB__JMASSSQUAREDDIFFERENCE__
2 #define __JOSCPROB__JMASSSQUAREDDIFFERENCE__
3 
4 #include "JLang/JException.hh"
5 
6 #include "JTools/JGrid.hh"
7 
9 
10 
11 /**
12  * \author bjung, mdejong
13  */
14 
15 namespace JOSCPROB {}
16 namespace JPP { using namespace JOSCPROB; }
17 
18 namespace JOSCPROB {
19 
20  using JTOOLS::JGrid;
21 
22 
23  /**
24  * Implementation of mass-squared difference.
25  */
26  template<class T>
28  public JOscParameter<T>
29  {
32 
36 
37 
38  /**
39  * Default constructor.
40  */
43  {}
44 
45 
46  /**
47  * Constructor.
48  *
49  * \param value mass-squared difference value [eV2]
50  */
52  JOscParameter_t(value)
53  {
54  using namespace JPP;
55 
56  if (!is_valid()) {
57  THROW(JValueOutOfRange, "JMassSquaredDifference::JMassSquaredDifference(): Invalid mass-squared difference " << value);
58  }
59  }
60 
61 
62  /**
63  * Assignment operator.
64  *
65  * \param value mass-squared difference value [eV2]
66  * \return mass-squared difference
67  */
69  {
70  this->setValue(value);
71 
72  return *this;
73  }
74 
75 
76  /**
77  * Check validity of oscillation parameter.
78  *
79  * \return true if valid; else false
80  */
81  bool is_valid() const override
82  {
83  return true;
84  }
85 
86 
87  /**
88  * Auxiliary function to create an mass-squared difference parameter grid.
89  *
90  * \param value mass-squared difference value [eV2]
91  * \return mass-squared difference parameter
92  */
94  {
95  return JMassSquaredDifference_t(value);
96  }
97  };
98 
99 
100  /**
101  * Template specialization for parameter grid.
102  */
103  template<>
104  struct JMassSquaredDifference<JGrid<double> > :
105  public JOscParameter<JGrid<double> >
106  {
110 
112 
113 
114  /**
115  * Default constructor.
116  */
118  {}
119 
120 
121  /**
122  * Constructor.
123  *
124  * \param grid mass-squared difference parameter grid [eV2]
125  */
126  explicit JMassSquaredDifference(const JGrid_t& grid) :
127  JOscParameter(grid)
128  {
129  using namespace JPP;
130 
131  if (!is_valid()) {
132  THROW(JValueOutOfRange, "JMassSquaredDifference::JMassSquaredDifference(): Invalid mass-squared difference grid " << grid);
133  }
134  }
135 
136 
137  /**
138  * Constructor.
139  *
140  * \param nx number of elements
141  * \param xmin lower limit [eV2]
142  * \param xmax upper limit [eV2]
143  */
145  const double xmin,
146  const double xmax) :
147  JOscParameter(JGrid_t(nx, xmin, xmax))
148  {}
149 
150 
151  /**
152  * Constructor.
153  *
154  * \param value value
155  */
156  explicit JMassSquaredDifference(const double value) :
157  JMassSquaredDifference(1, value, value)
158  {}
159 
160 
161  /**
162  * Assignment operator.
163  *
164  * \param grid mass-squared difference parameter grid [eV2]
165  * \return mass-squared difference
166  */
168  {
169  this->setValue(grid);
170 
171  return *this;
172  }
173 
174 
175  /**
176  * Check validity of oscillation parameter.
177  *
178  * \return true if valid; else false
179  */
180  bool is_valid() const override
181  {
182  return true;
183  }
184 
185 
186  /**
187  * Auxiliary function to create an mass-squared difference parameter grid.
188  *
189  * \param value mass-squared difference value [eV2]
190  * \return mass-squared difference parameter
191  */
192  static JMassSquaredDifference_t make_parameter(const double value)
193  {
194  return JMassSquaredDifference_t(value);
195  }
196  };
197 }
198 
199 #endif
const double xmax
Definition: JQuadrature.cc:24
JOscParameter_t::value_type value_type
Abstract base class for oscillation parameter.
Exceptions.
static JMassSquaredDifference_t make_parameter(argument_type value)
Auxiliary function to create an mass-squared difference parameter grid.
Parameter class.
Definition: JParameter.hh:34
JOscParameter_t::JParameter_t JParameter_t
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition: JException.hh:712
JOscParameter_t::argument_type argument_type
JMassSquaredDifference< T > JMassSquaredDifference_t
JParameter_t::argument_type argument_type
JParameter_t::value_type value_type
JMassSquaredDifference(argument_type value)
Constructor.
JMassSquaredDifference()
Default constructor.
Implementation of mass-squared difference.
bool is_valid() const override
Check validity of oscillation parameter.
JMassSquaredDifference(const int nx, const double xmin, const double xmax)
Constructor.
JClass< T >::argument_type argument_type
Definition: JParameter.hh:39
void setValue(const value_type &value)
Set parameter.
const double xmin
Definition: JQuadrature.cc:23
Simple data structure for an abstract collection of equidistant abscissa values.
Definition: JGrid.hh:38
JMassSquaredDifference_t & operator=(const value_type &value)
Assignment operator.
Exception for accessing a value in a collection that is outside of its range.
Definition: JException.hh:178
JClass< T >::value_type value_type
Definition: JParameter.hh:40
static JMassSquaredDifference_t make_parameter(const double value)
Auxiliary function to create an mass-squared difference parameter grid.
JMassSquaredDifference_t & operator=(const JGrid_t &grid)
Assignment operator.
bool is_valid() const override
Check validity of oscillation parameter.