Jpp  16.0.3
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JOscParameters.hh
Go to the documentation of this file.
1 #ifndef __JOSCPROB__JOSCPARAMETERS__
2 #define __JOSCPROB__JOSCPARAMETERS__
3 
4 #include <istream>
5 #include <ostream>
6 #include <iomanip>
7 
8 #include "Jeep/JPrint.hh"
9 #include "Jeep/JProperties.hh"
10 
11 
12 /**
13  * \author bjung, mdejong
14  */
15 
16 namespace JOSCPROB {}
17 namespace JPP { using namespace JOSCPROB; }
18 
19 namespace JOSCPROB {
20 
22 
23 
24  /**
25  * Data structure for oscillation parameters.
26  */
28  {
29  /**
30  * Default constructor.\n
31  * \n
32  * Values taken from the NuFIT three-flavour global analysis best fit values in:\n
33  * https://arxiv.org/abs/2111.03086?context=hep-ex\n
34  * for normal ordering including the Super-Kamiokande atmospheric data.
35  */
37  sinsqTh12(0.304),
38  dM21sq (7.42e-5),
39  sinsqTh13(0.02246),
40  dM31sq (2.510e-3),
41  sinsqTh23(0.450),
42  deltaCP (1.28)
43  {}
44 
45 
46  /**
47  * Constructor.
48  *
49  * \param sinsqTh12 Squared sine of the PMNS mixing angle between the first and second neutrino mass eigenstates [-]
50  * \param dM21sq Squared mass difference between the first and second neutrino mass eigenstates [eV2]
51  * \param sinsqTh13 Squared sine of the PMNS mixing angle between the first and third neutrino mass eigenstates [-]
52  * \param dM31sq Squared mass difference between the first and third neutrino mass eigenstates [eV2]
53  * \param sinsqTh23 Squared sine of the PMNS mixing angle between the second and third neutrino mass eigenstates [-]
54  * \param deltaCP PMNS phase angle [rad]
55  */
56  JOscParameters(const double sinsqTh12,
57  const double dM21sq,
58  const double sinsqTh13,
59  const double dM31sq,
60  const double sinsqTh23,
61  const double deltaCP) :
62  sinsqTh12(sinsqTh12),
63  dM21sq (dM21sq),
64  sinsqTh13(sinsqTh13),
65  dM31sq (dM31sq),
66  sinsqTh23(sinsqTh23),
67  deltaCP (deltaCP)
68  {}
69 
70 
71  /**
72  * Get oscillation parameters.
73  *
74  * \return oscillation parameters
75  */
77  {
78  return static_cast<const JOscParameters&>(*this);
79  }
80 
81 
82  /**
83  * Set oscillation parameters.
84  *
85  * \param parameters oscillation parameters
86  */
88  {
89  static_cast<JOscParameters&>(*this) = parameters;
90  }
91 
92 
93  /**
94  * Check validity of oscillation parameters.
95  *
96  * \return true if valid; else false
97  */
98  bool is_valid() const
99  {
100  if (this->sinsqTh12 < 0.0 ||
101  this->dM21sq < 0.0 ||
102  this->sinsqTh13 < 0.0 ||
103  this->dM31sq < 0.0 ||
104  this->sinsqTh23 < 0.0) {
105  return false;
106  }
107 
108  return true;
109  }
110 
111 
112  /**
113  * Stream input of oscillation parameters.
114  *
115  * \param in input stream
116  * \param object oscillation parameters
117  * \return input stream
118  */
119  friend inline std::istream& operator>>(std::istream& in, JOscParameters& object)
120  {
121  JProperties properties(object.getProperties());
122 
123  in >> properties;
124 
125  object.setProperties(properties);
126 
127  return in;
128  }
129 
130 
131  /**
132  * Stream output of oscillation parameters.
133  *
134  * \param out output stream
135  * \param object oscillation parameters
136  * \return output stream
137  */
138  friend inline std::ostream& operator<<(std::ostream& out, const JOscParameters& object)
139  {
140  return out << object.getProperties();
141  }
142 
143 
144  /**
145  * Get equation parameters.
146  *
147  * \return equation parameters
148  */
150  {
151  static JEquationParameters equation("=", "\n\r;,", "./", "#");
152 
153  return equation;
154  }
155 
156 
157  /**
158  * Set equation parameters.
159  *
160  * \param equation equation parameters
161  */
162  static inline void setEquationParameters(const JEquationParameters& equation)
163  {
164  getEquationParameters() = equation;
165  }
166 
167 
168  /**
169  * Get properties of this class.
170  *
171  * \param equation equation parameters
172  */
174  {
175  return JOscParametersHelper(*this, equation);
176  }
177 
178 
179  /**
180  * Get properties of this class.
181  *
182  * \param equation equation parameters
183  */
185  {
186  return JOscParametersHelper(*this, equation);
187  }
188 
189 
190  /**
191  * Set properties of this class
192  *
193  * \param properties properties
194  */
195  void setProperties(const JProperties& properties)
196  {
197  this->sinsqTh12 = properties.getValue<double>("sinsqTh12");
198  this->dM21sq = properties.getValue<double>("dM21sq");
199  this->sinsqTh13 = properties.getValue<double>("sinsqTh13");
200  this->dM31sq = properties.getValue<double>("dM31sq");
201  this->sinsqTh23 = properties.getValue<double>("sinsqTh23");
202  this->deltaCP = properties.getValue<double>("deltaCP");
203  }
204 
205 
206  double sinsqTh12; //!< Squared sine of the PMNS mixing angle between the first and second neutrino mass eigenstates [-]
207  double dM21sq; //!< Squared mass difference between the first and second neutrino mass eigenstates [eV2]
208  double sinsqTh13; //!< Squared sine of the PMNS mixing angle between the first and third neutrino mass eigenstates [-]
209  double dM31sq; //!< Squared mass difference between the first and third neutrino mass eigenstates [eV2]
210  double sinsqTh23; //!< Squared sine of the PMNS mixing angle between the second and third neutrino mass eigenstates [-]
211  double deltaCP; //!< PMNS phase angle [pi * rad]
212 
213  private:
214  /**
215  * Auxiliary class for I/O of oscillation parameters.
216  */
218  public JProperties
219  {
220  /**
221  * Constructor.
222  *
223  * \param object oscillation parameters
224  * \param equation equation parameters
225  */
226  template<class JOscParameters_t>
227  JOscParametersHelper(JOscParameters_t& object,
228  const JEquationParameters& equation) :
229  JProperties(equation, 1)
230  {
231  this->insert(gmake_property(object.sinsqTh12));
232  this->insert(gmake_property(object.dM21sq));
233  this->insert(gmake_property(object.sinsqTh13));
234  this->insert(gmake_property(object.dM31sq));
235  this->insert(gmake_property(object.sinsqTh23));
236  this->insert(gmake_property(object.deltaCP));
237  }
238  };
239  };
240 }
241 
242 #endif
JOscParameters(const double sinsqTh12, const double dM21sq, const double sinsqTh13, const double dM31sq, const double sinsqTh23, const double deltaCP)
Constructor.
JOscParametersHelper(JOscParameters_t &object, const JEquationParameters &equation)
Constructor.
#define gmake_property(A)
macro to convert (template) parameter to JPropertiesElement object
Utility class to parse parameter values.
Definition: JProperties.hh:496
Data structure for oscillation parameters.
*fatal Wrong number of arguments esac JCookie sh typeset Z DETECTOR typeset Z SOURCE_RUN typeset Z TARGET_RUN set_variable PARAMETERS_FILE $WORKDIR parameters
Definition: diff-Tuna.sh:38
friend std::istream & operator>>(std::istream &in, JOscParameters &object)
Stream input of oscillation parameters.
Simple data structure to support I/O of equations (see class JLANG::JEquation).
double sinsqTh23
Squared sine of the PMNS mixing angle between the second and third neutrino mass eigenstates [-]...
Utility class to parse parameter values.
JProperties getProperties(const JEquationParameters &equation=JOscParameters::getEquationParameters())
Get properties of this class.
JOscParameters()
Default constructor.
double deltaCP
PMNS phase angle [pi * rad].
const T & getValue(const std::string &key) const
Get value.
Definition: JProperties.hh:974
double dM31sq
Squared mass difference between the first and third neutrino mass eigenstates [eV2].
I/O formatting auxiliaries.
void setOscParameters(const JOscParameters &parameters)
Set oscillation parameters.
double sinsqTh12
Squared sine of the PMNS mixing angle between the first and second neutrino mass eigenstates [-]...
void setProperties(const JProperties &properties)
Set properties of this class.
double dM21sq
Squared mass difference between the first and second neutrino mass eigenstates [eV2].
static void setEquationParameters(const JEquationParameters &equation)
Set equation parameters.
bool is_valid() const
Check validity of oscillation parameters.
static JEquationParameters & getEquationParameters()
Get equation parameters.
friend std::ostream & operator<<(std::ostream &out, const JOscParameters &object)
Stream output of oscillation parameters.
const JOscParameters & getOscParameters() const
Get oscillation parameters.
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable INPUT_FILE $argv[2] eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY source JAcoustics sh $DETECTOR_ID CHECK_EXIT_CODE typeset A TRIPODS get_tripods $WORKDIR tripod txt TRIPODS for EMITTER in
Definition: JCanberra.sh:42
JProperties getProperties(const JEquationParameters &equation=JOscParameters::getEquationParameters()) const
Get properties of this class.
double sinsqTh13
Squared sine of the PMNS mixing angle between the first and third neutrino mass eigenstates [-]...
Auxiliary class for I/O of oscillation parameters.