OscCalc.h
Go to the documentation of this file.
1 #ifndef OSCCALCULATOR_H
2 #define OSCCALCULATOR_H
3 
4 //////////////////////////////////////////////////////////////////////////
5 // //
6 // \file OscCalc.h //
7 // //
8 // \brief Class with methods for calculating all things //
9 // related to oscillation probabilities. //
10 // \author <rbpatter@caltech.edu> //
11 // //
12 //////////////////////////////////////////////////////////////////////////
13 
14 #include "OscLib/IOscCalc.h"
15 
16 class TF1;
17 
18 namespace osc
19 {
20 
21  class OscCalc : public IOscCalcAdjustable
22  {
23  public:
24  OscCalc();
25  virtual ~OscCalc();
26  using IOscCalc::P;
27  virtual IOscCalcAdjustable* Copy() const override;
28 
29  /// E in GeV; flavors as PDG codes (so, neg==>antinu)
30  double P(int flavBefore, int flavAfter, double E) override;
31 
32  double P_me(double E, bool antinu=false);
33  double P_mm(double E, bool antinu=false);
34  double P_mt(double E, bool antinu=false);
35  double P_ee(double E, bool antinu=false);
36  double P_em(double E, bool antinu=false);
37  double P_et(double E, bool antinu=false);
38  double P_te(double E, bool antinu=false);
39  double P_tm(double E, bool antinu=false);
40  double P_tt(double E, bool antinu=false);
41 
42  double P_null(double, bool) { return 0; }
43 
44  void SetL (double L ) override { fL = L; fUpdated = false; }
45  void SetRho (double rho ) override { fRho = rho ? rho : 1e-10; fUpdated = false;}
46  void SetDmsq21(const double& dmsq21) override { fDmsq21 = dmsq21; fUpdated = false; }
47  void SetDmsq32(const double& dmsq32) override { fDmsq32 = dmsq32; fUpdated = false; }
48  void SetTh12 (const double& th12 ) override { fTh12 = th12; fUpdated = false; }
49  void SetTh13 (const double& th13 ) override { fTh13 = th13; fUpdated = false; }
50  void SetTh23 (const double& th23 ) override { fTh23 = th23; fUpdated = false; }
51  void SetdCP (const double& dCP ) override { fdCP = dCP; fUpdated = false; }
52 
53  // Get a TF1 for a give channel's P(E). Reconfigurations of
54  // the osc parameters do not require a new TF1. (The TF1 just
55  // accesses the same underlying functions.) Thus, you need
56  // a new OscCalc if you want two configurations for
57  // the same channel. Having multiple channels (TF1s) from a
58  // single OscCalc is fine, though.
59  //
60  // NOTE: It's up to you to delete the returned object.
61  TF1 *GetTF1(int flavBefore, int flavAfter);
62 
63  // You shouldn't call this ever. It needs to be public, though,
64  // so TF1 can access it.
65  double P_wrapper(double *x, double *p);
66 
67  virtual TMD5* GetParamsHash() const override
68  {
70  }
71 
72  private:
73  // Update derived parameters when required
74  void UpdateBasic();
75  void UpdateEDep(double E, bool antinu, bool fliptime);
76 
77  double P_internal_ee(double E, bool antinu, bool fliptime);
78  double P_internal_me(double E, bool antinu, bool fliptime);
79  double P_internal_te(double E, bool antinu, bool fliptime);
80  double P_internal_mt(double E, bool antinu, bool fliptime);
81 
82  // Flags
83  bool fUpdated;
84 
85  // Calculated from user parameters once (non-E-dependent)
86  double fDmsq31;
87  double fsin_th12;
88  double fsin_th13;
89  double fsin_th23;
90  double fcos_th12;
91  double fcos_th13;
92  double fcos_th23;
93  double fsin_2th12;
94  double fsin_2th13;
95  double fsin_2th23;
96  double fcos_2th12;
97  double fcos_2th13;
98  double fcos_2th23;
99  double fsin_sq_th12;
100  double fsin_sq_th13;
101  double fsin_sq_th23;
102  double fcos_sq_th12;
103  double fcos_sq_th13;
104  double fcos_sq_th23;
111  double falpha;
112  double fV;
113 
114  // Calculated from user parameters every time (E-dependent)
115  double fA;
116  double fD;
117  double fC12;
118  double fC13;
119  double fdCPproxy;
122 
123  };
124 
125 }
126 
127 #endif
double fsin_2th13
Definition: OscCalc.h:94
double P_mt(double E, bool antinu=false)
Definition: OscCalc.cxx:75
double P_tm(double E, bool antinu=false)
Definition: OscCalc.cxx:78
double P_ee(double E, bool antinu=false)
Definition: OscCalc.cxx:69
double P_internal_te(double E, bool antinu, bool fliptime)
Definition: OscCalc.cxx:262
void SetdCP(const double &dCP) override
Definition: OscCalc.h:51
double fcos_sq_2th13
Definition: OscCalc.h:109
void SetTh23(const double &th23) override
Definition: OscCalc.h:50
double th23
Definition: runWimpSim.h:98
double fsin_sq_th23
Definition: OscCalc.h:101
double P_te(double E, bool antinu=false)
Definition: OscCalc.cxx:77
double P_internal_me(double E, bool antinu, bool fliptime)
Definition: OscCalc.cxx:192
const char * p
Definition: xmltok.h:285
double falpha
Definition: OscCalc.h:111
double P_tt(double E, bool antinu=false)
Definition: OscCalc.cxx:79
double fsin_sq_th13
Definition: OscCalc.h:100
double fcos_sq_th23
Definition: OscCalc.h:104
double fcos_sq_th13
Definition: OscCalc.h:103
double fcos_dCPproxy
Definition: OscCalc.h:121
double fcos_sq_th12
Definition: OscCalc.h:102
double fD
Definition: OscCalc.h:116
double fsin_sq_th12
Definition: OscCalc.h:99
double fcos_th13
Definition: OscCalc.h:91
double fsin_th23
Definition: OscCalc.h:89
void UpdateBasic()
Definition: OscCalc.cxx:119
double fcos_th23
Definition: OscCalc.h:92
double th12
Definition: runWimpSim.h:98
double fsin_sq_2th23
Definition: OscCalc.h:107
double fcos_sq_2th12
Definition: OscCalc.h:108
void SetL(double L) override
Definition: OscCalc.h:44
TMD5 * GetParamsHashDefault(const std::string &txt) const
This is only a safe implementation if your calculator only depends on these eight parameters...
double fcos_th12
Definition: OscCalc.h:90
double fcos_2th12
Definition: OscCalc.h:96
double fC13
Definition: OscCalc.h:118
double P_me(double E, bool antinu=false)
Definition: OscCalc.cxx:73
static constexpr double L
void SetTh13(const double &th13) override
Definition: OscCalc.h:49
Float_t E
Definition: plot.C:20
double fsin_th12
Definition: OscCalc.h:87
double dCP
double P_et(double E, bool antinu=false)
Definition: OscCalc.cxx:71
void UpdateEDep(double E, bool antinu, bool fliptime)
Definition: OscCalc.cxx:166
double fsin_2th12
Definition: OscCalc.h:93
double P_null(double, bool)
Definition: OscCalc.h:42
double fsin_sq_2th12
Definition: OscCalc.h:105
void SetRho(double rho) override
Definition: OscCalc.h:45
TF1 * GetTF1(int flavBefore, int flavAfter)
Definition: OscCalc.cxx:82
double fsin_2th23
Definition: OscCalc.h:95
void SetTh12(const double &th12) override
Definition: OscCalc.h:48
double fA
Definition: OscCalc.h:115
double fdCPproxy
Definition: OscCalc.h:119
Oscillation probability calculators.
Definition: Calcs.h:5
virtual T P(int flavBefore, int flavAfter, double E)=0
E in GeV; flavors as PDG codes (so, neg==>antinu)
double fcos_2th13
Definition: OscCalc.h:97
bool fUpdated
Definition: OscCalc.h:83
double fDmsq31
Definition: OscCalc.h:86
double fsin_sq_2th13
Definition: OscCalc.h:106
double P_internal_ee(double E, bool antinu, bool fliptime)
Definition: OscCalc.cxx:332
void SetDmsq21(const double &dmsq21) override
Definition: OscCalc.h:46
double dmsq32
void SetDmsq32(const double &dmsq32) override
Definition: OscCalc.h:47
double P_em(double E, bool antinu=false)
Definition: OscCalc.cxx:70
virtual ~OscCalc()
Definition: OscCalc.cxx:39
double fC12
Definition: OscCalc.h:117
double fsin_dCPproxy
Definition: OscCalc.h:120
double fsin_th13
Definition: OscCalc.h:88
virtual IOscCalcAdjustable * Copy() const override
Definition: OscCalc.cxx:44
double fV
Definition: OscCalc.h:112
double P_wrapper(double *x, double *p)
Definition: OscCalc.cxx:92
double P(int flavBefore, int flavAfter, double E) override
E in GeV; flavors as PDG codes (so, neg==>antinu)
Definition: OscCalc.cxx:50
Float_t e
Definition: plot.C:35
double P_internal_mt(double E, bool antinu, bool fliptime)
Definition: OscCalc.cxx:377
double fcos_2th23
Definition: OscCalc.h:98
double th13
Definition: runWimpSim.h:98
virtual TMD5 * GetParamsHash() const override
Use to check two calculators are in the same state.
Definition: OscCalc.h:67
double fcos_sq_2th23
Definition: OscCalc.h:110
double P_mm(double E, bool antinu=false)
Definition: OscCalc.cxx:74