Jpp  16.0.0
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JOscProbTable.hh
Go to the documentation of this file.
1 #ifndef __JOSCPROB__JOSCPROBTABLE__
2 #define __JOSCPROB__JOSCPROBTABLE__
3 
4 #include "Jeep/JMessage.hh"
5 
6 #include "JIO/JFileStreamIO.hh"
7 #include "JIO/JObjectBinaryIO.hh"
8 
9 #include "JTools/JRange.hh"
10 #include "JTools/JArray.hh"
11 #include "JTools/JDistance.hh"
12 #include "JTools/JToolsToolkit.hh"
13 #include "JTools/JMultiFunction.hh"
14 
16 
17 
18 /**
19  * \author bjung, mdejong
20  */
21 
22 namespace JOSCPROB {}
23 namespace JPP { using namespace JOSCPROB; }
24 
25 namespace JOSCPROB {
26 
27  using JEEP::JMessage;
28 
29  using JIO::JReader;
30  using JIO::JWriter;
31  using JIO::JSerialisable;
33 
34  using JTOOLS::JArray;
35  using JTOOLS::JRange;
37 
38 
39  /**
40  * Template definition of a multi-dimensional interpolation table for oscillation probabilities.
41  */
42  template<class JFunction1D_t,
43  class JMaplist_t,
45  struct JOscProbTable :
46  public JSerialisable,
47  public JMultiFunction<JFunction1D_t, JMaplist_t, JDistance_t>,
48  public JMessage< JOscProbTable <JFunction1D_t, JMaplist_t, JDistance_t> >,
49  public JObjectBinaryIO< JOscProbTable <JFunction1D_t, JMaplist_t, JDistance_t> >
50  {
53 
57 
59 
61 
65 
67 
68 
69  /**
70  * Constructor.
71  */
74  {}
75 
76 
77  /**
78  * Constructor.
79  *
80  * \param fileName oscillation probability table filename
81  */
82  JOscProbTable(const char* fileName) :
84  {
85  this->load(fileName);
86  }
87 
88 
89  /**
90  * Constructor.
91  *
92  * \param input multi-dimensional function
93  */
94  template<class JOscProb_t, class JOscProbMaplist_t, class JOscProbDistance_t>
96  multifunction_type(input)
97  {}
98 
99 
100  /**
101  * Load oscillation probability table from file.
102  *
103  * \param fileName oscillation probability table fileName
104  */
105  void load(const char* fileName)
106  {
107  using namespace std;
108  using namespace JPP;
109 
110  try {
111  NOTICE("loading " << NUMBER_OF_DIMENSIONS <<
112  "D oscillation probability table from file " << fileName << "... " << flush);
113 
115 
116  NOTICE("OK" << endl);
117  }
118  catch(const JException& error) {
119  FATAL(error.what() << endl);
120  }
121  }
122 
123 
124  /**
125  * Compresses OscProb table to given abscissa range.
126  *
127  * \param range abscissa range
128  */
130  {
131  for (super_iterator i = this->super_begin(); i != this->super_end(); ++i) {
132 
133  function_type& f1 = i.getValue();
134 
135  typename function_type::iterator p = f1.lower_bound(range.getLowerLimit());
136 
137  f1.function_type::container_type::erase(f1.begin(), p);
138 
139  typename function_type::iterator q = f1.lower_bound(range.getUpperLimit());
140 
141  f1.function_type::container_type::erase(++q, f1.end());
142  }
143 
144  this->compile();
145  }
146 
147 
148  /**
149  * Read from input.
150  *
151  * \param in reader
152  * \return reader
153  */
154  virtual JReader& read(JReader& in) override
155  {
156  in >> static_cast<multifunction_type&>(*this);
157 
158  this->compile();
159 
160  return in;
161  }
162 
163 
164  /**
165  * Write from input.
166  *
167  * \param out writer
168  * \return writer
169  */
170  virtual JWriter& write(JWriter& out) const override
171  {
172  out << static_cast<const multifunction_type&>(*this);
173 
174  return out;
175  }
176  };
177 
178 
179  /**
180  * Explicit template specialization for 6D interpolation table in:\n
181  * 1. \f$sin^2(\theta_{12})\f$
182  * 2. \f$\Delta m_{21}^2\f$
183  * 3. \f$sin^2(\theta_{13})\f$
184  * 4. \f$\Delta m_{31}^2\f$
185  * 5. \f$sin^2(\theta_{23})\f$
186  * 6. \f$\delta_{\text{CP}}\f$
187  */
188  template< class JDistance_t = JTOOLS::JDistance<typename JOscProbTable6D_t::argument_type> >
190  public JOscProbTable< typename JOscProbTable6D_t::JConstantFunction1D_t,
191  typename JOscProbTable6D_t::JMaplist6D_t,
192  JDistance_t >
193  {
196 
199 
203 
205 
207 
210 
211 
212  /**
213  * Default constructor.
214  */
217  {}
218 
219 
220  /**
221  * Constructor.
222  *
223  * \param input multi-dimensional function
224  */
225  template<class JOscProb_t, class JOscProbMaplist_t, class JOscProbDistance_t>
228  {}
229 
230 
231  /**
232  * Constructor.
233  *
234  * \param fileName 2D oscillation probability table filename
235  */
236  JOscProbTable6D(const char* fileName) :
238  {}
239  };
240 
241 
242  /**
243  * Explicit template specialization for 2D interpolation table in:\n
244  * 1. \f$log_{10}(E)\f$
245  * 2. \f$cos(\theta)\f$
246  */
247  template< class JDistance_t = JTOOLS::JDistance<typename JOscProbTable2D_t::JFunction2D_t::argument_type> >
249  public JOscProbTable< typename JOscProbTable2D_t::JFunction1D_t,
250  typename JOscProbTable2D_t::JMaplist1D_t,
251  JDistance_t>
252  {
255 
258 
262 
264 
266 
269 
271 
272 
273  /**
274  * Default constructor.
275  */
278  {}
279 
280 
281  /**
282  * Constructor.
283  *
284  * \param input multi-dimensional function
285  */
286  template<class JOscProb_t, class JOscProbMaplist_t, class JOscProbDistance_t>
289 
290  {}
291 
292 
293  /**
294  * Constructor.
295  *
296  * \param fileName 2D oscillation probability table filename
297  */
298  JOscProbTable2D(const char* fileName) :
300  {}
301 
302 
303  /**
304  * Constructor.
305  *
306  * \param table 6D oscillation probability table
307  */
309  const JOscParameters& parameters) :
311  {
312  using namespace std;
313  using namespace JPP;
314 
315  NOTICE("Extracting 2D interpolation table for:\n" << parameters.getProperties() << flush);
316 
317  typename JOscProbTable6D<JDistance_t>::result_type result = table(parameters.sinsqTh12,
318  parameters.dM21sq,
319  parameters.sinsqTh13,
320  parameters.dM31sq,
321  parameters.sinsqTh23,
322  parameters.deltaCP);
323 
324  copy(result, static_cast<multimap_type&>(*this));
325 
326  this->compile();
327 
328  NOTICE("OK" << endl);
329  }
330  };
331 
332 
333  /**
334  * Explicit template specialization for 8D interpolation table in:\n
335  * 1. \f$sin^2(\theta_{12})\f$
336  * 2. \f$\Delta m_{21}^2\f$
337  * 3. \f$sin^2(\theta_{13})\f$
338  * 4. \f$\Delta m_{31}^2\f$
339  * 5. \f$sin^2(\theta_{23})\f$
340  * 6. \f$\delta_{\text{CP}}\f$
341  * 7. \f$log_{10}(E)\f$
342  * 8. \f$cos(\theta)\f$
343  */
344  template< class JDistance_t = JTOOLS::JDistance<typename JOscProbTable8D_t::JFunction2D_t::argument_type> >
346  public JOscProbTable< typename JOscProbTable8D_t::JFunction2D_t,
347  typename JOscProbTable8D_t::JMaplist6D_t,
348  JDistance_t>
349  {
352 
355 
359 
361 
363 
366 
367 
368  /**
369  * Default constructor.
370  */
373  {}
374 
375 
376  /**
377  * Constructor.
378  *
379  * \param input multi-dimensional function
380  */
381  template<class JOscProb_t, class JOscProbMaplist_t, class JOscProbDistance_t>
384  {}
385 
386 
387  /**
388  * Constructor.
389  *
390  * \param fileName 2D oscillation probability table filename
391  */
392  JOscProbTable8D(const char* fileName) :
394  {}
395  };
396 
397 
398  /**
399  * Default debug-levels for oscillation probability tables.
400  */
401  template<>
402  int JMessage<typename JOscProbTable2D<>::table_type>::debug = (int) JEEP::notice_t;
403 
404  template<>
405  int JMessage<typename JOscProbTable6D<>::table_type>::debug = (int) JEEP::notice_t;
406 
407  template<>
408  int JMessage<typename JOscProbTable8D<>::table_type>::debug = (int) JEEP::notice_t;
409 }
410 
411 #endif
multifunction_type::argument_type argument_type
function_type::argument_type argument_type
static int debug
debug level (default is off).
Definition: JMessage.hh:45
void compile()
Compilation.
multifunction_type::multimap_type multimap_type
Interface for binary output.
T getLowerLimit() const
Get lower limit.
Definition: JRange.hh:202
multimap_type::super_iterator super_iterator
multifunction_type::value_type value_type
Auxiliary base class for storing and loading a single object to and from a binary file...
JOscProbTable< function_type, maplist_type, JDistance_t > table_type
Explicit template specialization for 6D interpolation table in: .
void compress(const JRange< typename function_type::argument_type > &range)
Compresses OscProb table to given abscissa range.
multimap_type::super_const_iterator super_const_iterator
JOscProbTable6D_t::JConstantFunction1D_t function_type
JOscProbTable8D_t::JMaplist6D_t maplist_type
Template class for distance evaluation.
Definition: JDistance.hh:24
JOscProbTable6D()
Default constructor.
multifunction_type::multimap_type multimap_type
multifunction_type::super_iterator super_iterator
Template definition of a multi-dimensional interpolation table for oscillation probabilities.
Explicit template specialization for 8D interpolation table in: .
notice
Definition: JMessage.hh:32
JMultiFunction< JFunction1D_t, JMaplist_t, JDistance_t > multifunction_type
multifunction_type::super_iterator super_iterator
void load(const char *fileName)
Load oscillation probability table from file.
Data structure for oscillation parameters.
multifunction_type::super_iterator super_iterator
*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
virtual JWriter & write(JWriter &out) const override
Write from input.
JOscProbTable2D_t::JFunction1D_t function_type
multifunction_type::argument_type argument_type
JOscProbTable< function_type, maplist_type, JDistance_t > table_type
multifunction_type::argument_type argument_type
double sinsqTh23
Squared sine of the PMNS mixing angle between the second and third neutrino mass eigenstates [-]...
JOscProbTable2D()
Default constructor.
JOscProbTable< JFunction1D_t, JMaplist_t, JDistance_t > table_type
multifunction_type::super_const_iterator super_const_iterator
multifunction_type::value_type value_type
JOscProbTable8D_t::JFunction2D_t function_type
JProperties getProperties(const JEquationParameters &equation=JOscParameters::getEquationParameters())
Get properties of this class.
multifunction_type::value_type value_type
JMultiMap< typename JFunction_t::argument_type, JFunction_t, JMaplist_t, JDistance_t > multimap_type
JOscProbTable2D(const char *fileName)
Constructor.
Forward declaration of binary output.
double deltaCP
PMNS phase angle [pi * rad].
double dM31sq
Squared mass difference between the first and third neutrino mass eigenstates [eV2].
JOscProbTable6D(const char *fileName)
Constructor.
Template implementation of function object in one dimension returning a constant value.
function_type::value_type value_type
double sinsqTh12
Squared sine of the PMNS mixing angle between the first and second neutrino mass eigenstates [-]...
Multidimensional interpolation method.
JOscProbTable2D_t::JMaplist1D_t maplist_type
Map list.
Definition: JMapList.hh:24
multifunction_type::argument_type argument_type
return result
Definition: JPolint.hh:743
double dM21sq
Squared mass difference between the first and second neutrino mass eigenstates [eV2].
T getUpperLimit() const
Get upper limit.
Definition: JRange.hh:213
This include file contains various recursive methods to operate on multi-dimensional collections...
#define NOTICE(A)
Definition: JMessage.hh:64
multifunction_type::function_type function_type
Interface for binary input.
JMultiFunction< function_type, maplist_type, JDistance_t > multifunction_type
multifunction_type::result_type result_type
One dimensional array of template objects with fixed length.
Definition: JArray.hh:40
Range of values.
Definition: JRange.hh:38
General purpose messaging.
multifunction_type::result_type result_type
#define FATAL(A)
Definition: JMessage.hh:67
z range($ZMAX-$ZMIN)< $MINIMAL_DZ." fi fi typeset -Z 4 STRING typeset -Z 2 FLOOR JPlot1D -f $
multimap_type::result_type result_type
JOscProbTable2D(const JOscProbTable6D< JDistance_t > &table, const JOscParameters &parameters)
Constructor.
Explicit template specialization for 2D interpolation table in: .
multifunction_type::super_iterator super_iterator
JMultiFunction< function_type, maplist_type, JDistance_t > multifunction_type
virtual JReader & read(JReader &in) override
Read from input.
Auxiliary class to define a range between two values.
JOscProbTable(const char *fileName)
Constructor.
JOscProbTable()
Constructor.
multifunction_type::result_type result_type
JOscProbTable8D(const char *fileName)
Constructor.
multifunction_type::super_const_iterator super_const_iterator
JOscProbTable(const JMultiFunction< JOscProb_t, JOscProbMaplist_t, JOscProbDistance_t > &input)
Constructor.
void copy(const Head &from, JHead &to)
Copy header from from to to.
Definition: JHead.cc:139
JOscProbTable6D(const JMultiFunction< JOscProb_t, JOscProbMaplist_t, JOscProbDistance_t > &input)
Constructor.
multifunction_type::super_const_iterator super_const_iterator
JOscProbTable8D(const JMultiFunction< JOscProb_t, JOscProbMaplist_t, JOscProbDistance_t > &input)
Constructor.
multifunction_type::result_type result_type
JOscProbTable6D_t::JMaplist6D_t maplist_type
JOscProbTable2D(const JMultiFunction< JOscProb_t, JOscProbMaplist_t, JOscProbDistance_t > &input)
Constructor.
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
Template class for polynomial interpolation in 1D.
Definition: JPolint.hh:982
JMultiFunction< function_type, maplist_type, JDistance_t > multifunction_type
Multidimensional map.
Definition: JMultiMap.hh:51
double sinsqTh13
Squared sine of the PMNS mixing angle between the first and third neutrino mass eigenstates [-]...
multifunction_type::multimap_type multimap_type
multifunction_type::super_const_iterator super_const_iterator
multifunction_type::value_type value_type
Auxiliary class for handling debug parameter within a class.
Definition: JMessage.hh:44
JOscProbTable< function_type, maplist_type, JDistance_t > table_type
JOscProbTable8D()
Default constructor.
multifunction_type::multimap_type multimap_type