OscCalcDMP.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <complex>
4 #include <vector>
5 #include <iostream>
6 
7 #include <Eigen/Eigen>
8 
9 #include "OscLib/OscParameters.h"
10 #include "OscLib/IOscCalc.h"
11 
12 using namespace Eigen;
13 
14  // Unit conversion constants
15  //static const double kKm2eV = 5.06773103202e+09; ///< km to eV^-1
16  //static const double kK2 = 4.62711492217e-09; ///< mole/GeV^2/cm^3 to eV
17  //static const double kGeV2eV = 1.0e+09; ///< GeV to eV
18  //static const double kGf = 1.166371e-5; //G_F in units of GeV^-2
19  //static const double eVsqkm_to_GeV = 1e-9 / 1.973269681602260e-7 * 1e3; // HS this is more like value in OscLib
20  //static const double YerhoE2a = 1.52e-4;
21 
22 
23 
24 namespace osc
25 {
26  /// \brief Helper struct for the cache. Might not need this
27 
28  /// \brief Struct of the cache
29 
30 
31  /// \brief A DMP based implementation of \ref OscCalcPMNS
32  ///
33  /// Uses DMP
34  template <typename T>
35  class _OscCalcDMP : public _IOscCalcAdjustable<T>
36  {
37  public:
39  _OscCalcDMP(std::vector<double> energies) {
40  this->SetCachedEnergies(energies);
41  }
42  ~_OscCalcDMP() = default;
43 
44  _IOscCalcAdjustable<T> * Copy() const override;
45 
46  T P(int flavBefore, int flavAfter, double E) override;
47  T P(int flavBefore, int flavAfter, double E, bool fast_and_loose);
48 
49  Array<T,Dynamic,Dynamic> P() {return this->fCache.probabilities;}
50  Array<T,Dynamic,1> P(int flavBefore, int flavAfter, const std::vector<double> &E) override;
52 
53  void SetL (double L ) override {SaveLastParams(); this->fL = L;}
54  void SetRho (double rho ) override {SaveLastParams(); this->fRho = rho;}
55  void SetDmsq21(const T& dmsq21) override {SaveLastParams(); this->fDmsq21 = dmsq21;}
56  void SetDmsq32(const T& dmsq32) override {SaveLastParams(); this->fDmsq32 = dmsq32;}
57  void SetTh12 (const T& th12 ) override {SaveLastParams(); this->fTh12 = th12;}
58  void SetTh13 (const T& th13 ) override {SaveLastParams(); this->fTh13 = th13;}
59  void SetTh23 (const T& th23 ) override {SaveLastParams(); this->fTh23 = th23;}
60  void SetdCP (const T& dCP ) override {SaveLastParams(); this->fdCP = dCP;}
61 
62  void InvalidateCache() override { this->fCache.clear(); }
63 
64  std::string Name() const{ return name;}
65 
66  private:
67  void FillCache(std::vector<double> const & energies); // move back to private
68  _OscCache<T> fCache; // move back to private
69 
70  TMD5* GetParamsHash() const override;
71 
72  int ChannelCacheIdx(int flavBefore, int flavAfter) const;
73 
74  std::string name = "OscCalcDMP";
75  // Fill the cache at the current parameter values
76  virtual void FillCache();
77 
78  // update fLastParams with the current parameters before changing them
79  void SaveLastParams();
80  void SetCachedEnergies(std::vector<double> const & energies);
81  bool ParamsAreCached();
83  };
84 
86 }
const XML_Char * name
Definition: expat.h:151
_OscCalcDMP(std::vector< double > energies)
Definition: OscCalcDMP.h:39
Array< T, Dynamic, Dynamic > P()
Definition: OscCalcDMP.h:49
void SetdCP(const T &dCP) override
Definition: OscCalcDMP.h:60
void SetDmsq32(const T &dmsq32) override
Definition: OscCalcDMP.h:56
void InvalidateCache() override
Invalidate any caching used internally by the calculator.
Definition: OscCalcDMP.h:62
double th23
Definition: runWimpSim.h:98
void SetRho(double rho) override
Definition: OscCalcDMP.h:54
Helper struct for the cache. Might not need this.
Definition: StanTypedefs.h:25
Definition: StanUtils.h:6
_OscParameters< T > fLastParams
Definition: OscCalcDMP.h:82
double th12
Definition: runWimpSim.h:98
#define P(a, b, c, d, e, x)
void SetTh13(const T &th13) override
Definition: OscCalcDMP.h:58
void SetL(double L) override
Definition: OscCalcDMP.h:53
_OscCalcDMP< double > OscCalcDMP
Definition: OscCalcDMP.h:85
static constexpr double L
Float_t E
Definition: plot.C:20
double dCP
std::string Name() const
Definition: OscCalcDMP.h:64
_OscCache< T > fCache
Definition: OscCalcDMP.h:68
Oscillation probability calculators.
Definition: Calcs.h:5
double dmsq32
void SetTh23(const T &th23) override
Definition: OscCalcDMP.h:59
General interface to any calculator that lets you set the parameters.
double T
Definition: Xdiff_gwt.C:5
void SetDmsq21(const T &dmsq21) override
Definition: OscCalcDMP.h:55
double th13
Definition: runWimpSim.h:98
void SetTh12(const T &th12) override
Definition: OscCalcDMP.h:57
enum BeamMode string