Jpp  18.3.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 = double>
28  public JOscParameter<T>
29  {
32 
35 
36 
37  /**
38  * Default constructor.
39  */
42  {}
43 
44 
45  /**
46  * Constructor.
47  *
48  * \param value mass-squared difference value [eV2]
49  */
51  JOscParameter_t(value)
52  {
53  using namespace JPP;
54 
55  if (!is_valid()) {
56  THROW(JValueOutOfRange, "JMassSquaredDifference::JMassSquaredDifference(): Invalid mass-squared difference " << value);
57  }
58  }
59 
60 
61  /**
62  * Assignment operator.
63  *
64  * \param value mass-squared difference value [eV2]
65  * \return mass-squared difference
66  */
68  {
69  this->setValue(value);
70 
71  return *this;
72  }
73 
74 
75  /**
76  * Check validity of oscillation parameter.
77  *
78  * \return true if valid; else false
79  */
80  bool is_valid() const override
81  {
82  return true;
83  }
84 
85 
86  /**
87  * Auxiliary function to create an mass-squared difference parameter grid.
88  *
89  * \param value mass-squared difference value [eV2]
90  * \return mass-squared difference parameter
91  */
93  {
94  return JMassSquaredDifference_t(value);
95  }
96  };
97 
98 
99  /**
100  * Template specialization for parameter grid.
101  */
102  template<>
103  struct JMassSquaredDifference<JGrid<double> > :
104  public JOscParameter<JGrid<double> >
105  {
109 
112 
114 
115 
116  /**
117  * Default constructor.
118  */
120  {}
121 
122 
123  /**
124  * Constructor.
125  *
126  * \param grid mass-squared difference parameter grid [eV2]
127  */
129  JOscParameter(grid)
130  {
131  using namespace JPP;
132 
133  if (!is_valid()) {
134  THROW(JValueOutOfRange, "JMassSquaredDifference::JMassSquaredDifference(): Invalid mass-squared difference grid " << grid);
135  }
136  }
137 
138 
139  /**
140  * Constructor.
141  *
142  * \param nx number of elements
143  * \param Xmin lower limit [eV2]
144  * \param Xmax upper limit [eV2]
145  */
147  const abscissa_type& xmin,
148  const abscissa_type& xmax) :
149  JOscParameter(JGrid_t(nx, xmin, xmax))
150  {}
151 
152 
153  /**
154  * Constructor.
155  *
156  * \param value value
157  */
158  explicit JMassSquaredDifference(const abscissa_type& value) :
159  JMassSquaredDifference(1, value, value)
160  {}
161 
162 
163  /**
164  * Assignment operator.
165  *
166  * \param value mass-squared difference parameter grid [eV2]
167  * \return mass-squared difference
168  */
170  {
171  this->setValue(grid);
172 
173  return *this;
174  }
175 
176 
177  /**
178  * Check validity of oscillation parameter.
179  *
180  * \return true if valid; else false
181  */
182  bool is_valid() const override
183  {
184  const abscissa_type mindM2 = this->getValue().getXmin();
185  const abscissa_type maxdM2 = this->getValue().getXmax();
186 
187  return this->isDefined() ? !(mindM2 < 0.0 || maxdM2 < 0.0) : true;
188  }
189 
190 
191  /**
192  * Auxiliary function to create an mass-squared difference parameter grid.
193  *
194  * \param value mass-squared difference value [eV2]
195  * \return mass-squared difference parameter
196  */
198  {
199  return JMassSquaredDifference_t(value);
200  }
201  };
202 }
203 
204 #endif
const double xmax
Definition: JQuadrature.cc:24
Abstract base class for oscillation parameter.
static JMassSquaredDifference_t make_parameter(const abscissa_type &value)
Auxiliary function to create an mass-squared difference parameter grid.
Exceptions.
static JMassSquaredDifference_t make_parameter(argument_type value)
Auxiliary function to create an mass-squared difference parameter grid.
JMassSquaredDifference_t & operator=(argument_type grid)
Assignment operator.
JMassSquaredDifference(const abscissa_type &value)
Constructor.
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
JMassSquaredDifference_t & operator=(argument_type value)
Assignment operator.
JOscParameter_t::argument_type argument_type
JMassSquaredDifference< T > JMassSquaredDifference_t
JMassSquaredDifference(const int nx, const abscissa_type &xmin, const abscissa_type &xmax)
Constructor.
void setValue(argument_type value)
Set parameter.
const bool isDefined() const
Get status of parameter.
Definition: JParameter.hh:137
JParameter_t::argument_type argument_type
JMassSquaredDifference(argument_type value)
Constructor.
JMassSquaredDifference()
Default constructor.
Implementation of mass-squared difference.
bool is_valid() const override
Check validity of oscillation parameter.
JClass< T >::argument_type argument_type
Definition: JParameter.hh:39
const double xmin
Definition: JQuadrature.cc:23
JAbstractCollection< JAbscissa_t >::abscissa_type abscissa_type
Definition: JGrid.hh:41
Simple data structure for an abstract collection of equidistant abscissa values.
Definition: JGrid.hh:38
const T & getValue() const
Get value of parameter.
Definition: JParameter.hh:81
Exception for accessing a value in a collection that is outside of its range.
Definition: JException.hh:178
bool is_valid() const override
Check validity of oscillation parameter.