OscParameters.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <vector>
4 #include <iostream>
5 
6 #include <Eigen/Eigen>
7 using namespace Eigen;
8 
9 namespace osc {
10  template <typename T>
11  struct _OscParameters {
12  T Dmsq31() const { return dmsq32 + dmsq21; }
13  bool operator==(const _OscParameters<T> & rhs) const {
14  return dmsq21 == rhs.dmsq21 &&
15  dmsq32 == rhs.dmsq32 &&
16  th12 == rhs.th12 &&
17  th13 == rhs.th13 &&
18  th23 == rhs.th23 &&
19  deltacp == rhs.deltacp &&
20  L == rhs.L &&
21  rho == rhs.rho; }
22  // abuse (?) placement new to overwrite using default constructor
23  void reset() { new (this) _OscParameters<T>; }
24  T dmsq21 = 0;
25  T dmsq32 = 0;
26  T th12 = 0;
27  T th13 = 0;
28  T th23 = 0;
29  T deltacp = 0;
30  double L = 0;
31  double rho = 0;
32  };
34 
35  template <typename T>
36  inline std::ostream& operator << (std::ostream& os, _OscParameters<T> const & p)
37  {
38  os << "\tdelta m^2_{21}: " << p.dmsq21
39  << "\tdelta m^2_{32}: " << p.dmsq32
40  << "\tdelta m^2_{31}: " << p.Dmsq31()
41  << "\ttheta_{12}: " << p.th12
42  << "\ttheta_{13}: " << p.th13
43  << "\ttheta_{23}: " << p.th23
44  << "\tdelta CP: " << p.deltacp
45  << "\n";
46  return os;
47  }
48 
49  template <typename T>
50  struct _OscCache {
51  bool operator==(const _OscCache & rhs) const {
52  if(!(parameters == rhs.parameters)) return false;
53  for(unsigned int i = 0; i < energies.size(); i++)
54  if(energies[i] != rhs.energies[i]) return false;
55  return true;
56  }
57 
58  void clear() {
59  ENERGIES.resize(0);
60  probabilities.resize(0,0);
61  parameters.reset();
62  }
63  std::vector<double> energies;
64  ArrayXd ENERGIES;
65  Array<T,Dynamic,Dynamic> probabilities;
67  unsigned int iter = 0;
68  };
69 }
_OscParameters< double > OscParameters
Definition: OscParameters.h:33
double th23
Definition: runWimpSim.h:98
const char * p
Definition: xmltok.h:285
ArrayXd ENERGIES
Definition: OscParameters.h:64
Definition: StanUtils.h:6
double th12
Definition: runWimpSim.h:98
bool operator==(const _OscParameters< T > &rhs) const
Definition: OscParameters.h:13
static constexpr double L
Oscillation probability calculators.
Definition: Calcs.h:5
std::vector< double > energies
Definition: OscParameters.h:63
double dmsq32
bool operator==(const _OscCache &rhs) const
Definition: OscParameters.h:51
Array< T, Dynamic, Dynamic > probabilities
Definition: OscParameters.h:65
double T
Definition: Xdiff_gwt.C:5
double th13
Definition: runWimpSim.h:98
_OscParameters< T > parameters
Definition: OscParameters.h:66