OscCalcPMNSOpt.h
Go to the documentation of this file.
1 #ifndef OSC_OSCCALCULATORPMNSOPT_H
2 #define OSC_OSCCALCULATORPMNSOPT_H
3 
4 //////////////////////////////////////////////////////////////////////////
5 // //
6 // \file OscCalcPMNSOpt.h //
7 // //
8 // Adapt the PMNSOpt calculator to standard interface //
9 // <c.backhouse@ucl.ac.uk> //
10 // //
11 //////////////////////////////////////////////////////////////////////////
12 
13 #include "OscLib/IOscCalc.h"
14 #include "OscLib/PMNSOpt.h"
15 
16 #include <cassert>
17 #include <unordered_map>
18 
19 namespace osc
20 {
21  /// \brief Optimized version of \ref OscCalcPMNS
22  ///
23  /// Adapt the \ref PMNSOpt calculator to standard interface
24  template <typename T>
25  class _OscCalcPMNSOpt: public _IOscCalcAdjustable<T>
26  {
27  public:
28  using _IOscCalc<T>::P;
30  virtual ~_OscCalcPMNSOpt();
31 
32  _IOscCalcAdjustable<T>* Copy() const override;
33 
34  T P(int flavBefore, int flavAfter, double E) override;
35 
36  void SetL (double L ) override {++fLRIdx; this->fL = L;}
37  void SetRho (double rho ) override {++fLRIdx; this->fRho = rho;}
38  void SetDmsq21(const T& dmsq21) override {++fDmIdx; this->fDmsq21 = dmsq21;}
39  void SetDmsq32(const T& dmsq32) override {++fDmIdx; this->fDmsq32 = dmsq32;}
40  void SetTh13 (const T& th13 ) override {++fMixIdx; this->fTh13 = th13;}
41  void SetTh12 (const T& th12 ) override {++fMixIdx; this->fTh12 = th12;}
42  void SetTh23 (const T& th23 ) override {++fMixIdx; this->fTh23 = th23;}
43  void SetdCP (const T& dCP ) override {++fMixIdx; this->fdCP = dCP;}
44 
45  TMD5* GetParamsHash() const override
46  {
48  }
49 
50  protected:
51  // How many times the mixing parameters and splittings have been set
52  long fMixIdx;
53  long fDmIdx;
54  long fLRIdx;
55 
56  struct Val_t
57  {
58  Val_t() : mixIdx(-1), dmIdx(-1), lrIdx(-1), pmns(0) {}
59 
60  // How many times the mixing parameters and splittings had been set when
61  // 'pmns' was last updated. If too small then 'pmns' must be updated
62  // before use.
63  long mixIdx;
64  long dmIdx;
65  long lrIdx;
66  T P[3][3]; ///< Cache of oscillation probabilities
67  _PMNSOpt<T>* pmns; ///< The calculator itself
68  };
69 
70  std::unordered_map<double, Val_t> fPMNSOpt[2]; // [anti][E]
71  };
73 
74 } // namespace
75 
76 #endif
void SetTh13(const T &th13) override
_OscCalcPMNSOpt< double > OscCalcPMNSOpt
void SetL(double L) override
double th23
Definition: runWimpSim.h:98
Optimized version of PMNS.
Definition: PMNSOpt.h:50
double th12
Definition: runWimpSim.h:98
TMD5 * GetParamsHashDefault(const std::string &txt) const
This is only a safe implementation if your calculator only depends on these eight parameters...
Definition: IOscCalc.cxx:44
TMD5 * GetParamsHash() const override
Use to check two calculators are in the same state.
static constexpr double L
Float_t E
Definition: plot.C:20
double dCP
Optimized version of OscCalcPMNS.
Definition: StanTypedefs.h:31
T P(int flavBefore, int flavAfter, double E) override
E in GeV; flavors as PDG codes (so, neg==>antinu)
void SetTh23(const T &th23) override
_IOscCalcAdjustable< T > * Copy() const override
void SetDmsq21(const T &dmsq21) override
Oscillation probability calculators.
Definition: Calcs.h:5
void SetDmsq32(const T &dmsq32) override
virtual T P(int flavBefore, int flavAfter, double E)=0
E in GeV; flavors as PDG codes (so, neg==>antinu)
double dmsq32
void SetdCP(const T &dCP) override
T P[3][3]
Cache of oscillation probabilities.
void SetTh12(const T &th12) override
std::unordered_map< double, Val_t > fPMNSOpt[2]
double T
Definition: Xdiff_gwt.C:5
_PMNSOpt< T > * pmns
The calculator itself.
double th13
Definition: runWimpSim.h:98
void SetRho(double rho) override