Jpp test-rotations-old
the software that should make you happy
Loading...
Searching...
No Matches
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
15namespace JOSCPROB {}
16namespace JPP { using namespace JOSCPROB; }
17
18namespace 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 */
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 final
82 {
83 return true;
84 }
85 };
86
87
88 /**
89 * Template specialization for parameter grid.
90 */
91 template<>
92 struct JMassSquaredDifference<JGrid<double> > final :
93 public JOscParameter<JGrid<double> >
94 {
98
100
101
102 /**
103 * Default constructor.
104 */
107
108
109 /**
110 * Constructor.
111 *
112 * \param grid mass-squared difference parameter grid [eV2]
113 */
114 explicit JMassSquaredDifference(const JGrid_t& grid) :
115 JOscParameter(grid)
116 {
117 using namespace JPP;
118
119 if (!is_valid()) {
120 THROW(JValueOutOfRange, "JMassSquaredDifference::JMassSquaredDifference(): Invalid mass-squared difference grid " << grid);
121 }
122 }
123
124
125 /**
126 * Constructor.
127 *
128 * \param nx number of elements
129 * \param xmin lower limit [eV2]
130 * \param xmax upper limit [eV2]
131 */
133 const double xmin,
134 const double xmax) :
135 JOscParameter(JGrid_t(nx, xmin, xmax))
136 {}
137
138
139 /**
140 * Constructor.
141 *
142 * \param value value
143 */
144 explicit JMassSquaredDifference(const double value) :
145 JMassSquaredDifference(1, value, value)
146 {}
147
148
149 /**
150 * Assignment operator.
151 *
152 * \param grid mass-squared difference parameter grid [eV2]
153 * \return mass-squared difference
154 */
156 {
157 this->setValue(grid);
158
159 return *this;
160 }
161
162
163 /**
164 * Check validity of oscillation parameter.
165 *
166 * \return true if valid; else false
167 */
168 bool is_valid() const override final
169 {
170 return true;
171 }
172 };
173}
174
175#endif
Exceptions.
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Parameter class.
Definition JParameter.hh:36
Exception for accessing a value in a collection that is outside of its range.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
bool is_valid() const override final
Check validity of oscillation parameter.
JMassSquaredDifference(const int nx, const double xmin, const double xmax)
Constructor.
JMassSquaredDifference_t & operator=(const JGrid_t &grid)
Assignment operator.
Implementation of mass-squared difference.
JOscParameter_t::JParameter_t JParameter_t
JOscParameter_t::value_type value_type
bool is_valid() const override final
Check validity of oscillation parameter.
JMassSquaredDifference_t & operator=(const value_type &value)
Assignment operator.
JOscParameter_t::argument_type argument_type
JMassSquaredDifference< T > JMassSquaredDifference_t
JMassSquaredDifference(argument_type value)
Constructor.
Abstract base class for oscillation parameter.
void setValue(const value_type &value)
Set parameter.
JParameter_t::argument_type argument_type
JParameter_t::value_type value_type
Simple data structure for an abstract collection of equidistant abscissa values.
Definition JGrid.hh:40