OscProb
PMNS_Base.h
Go to the documentation of this file.
1
16
17#ifndef PMNS_BASE_H
18#define PMNS_BASE_H
19
20#include <unordered_set>
21
22#include "EigenPoint.h"
23
24namespace OscProb {
25
26 class PMNS_Base {
27 public:
28 PMNS_Base(int numNus = 3);
29 virtual ~PMNS_Base();
30
31 // Get the oscillation probability
32 virtual double Prob(
33 vectorC nu_in,
34 int flvf);
35 virtual double Prob(vectorC nu_in, int flvf,
36 double E);
38 virtual double Prob(vectorC nu_in, int flvf, double E,
39 double L);
41
42 // Get the oscillation probability
43 virtual double Prob(
44 int flvi,
45 int flvf);
46 virtual double Prob(int flvi, int flvf,
47 double E);
49 virtual double Prob(int flvi, int flvf, double E,
50 double L);
52
53 // Get the oscillation probability vector
54 virtual vectorD ProbVector(
55 vectorC nu_in);
57 virtual vectorD ProbVector(
58 vectorC nu_in,
59 double E);
61 virtual vectorD ProbVector(
62 vectorC nu_in, double E,
63 double L);
65
66 // Get the oscillation probability vector
67 virtual vectorD ProbVector(int flvi);
69 virtual vectorD ProbVector(
70 int flvi, double E);
72 virtual vectorD ProbVector(
73 int flvi, double E,
74 double L);
76
77 // Get the oscillation probability matrix
78 virtual matrixD ProbMatrix(int nflvi,
79 int nflvf);
80 virtual matrixD ProbMatrix(
81 int nflvi, int nflvf,
82 double E);
83 virtual matrixD ProbMatrix(int nflvi, int nflvf, double E,
84 double L);
86
87 // Get probability averaged over a bin
88 virtual double AvgProb(
89 vectorC nu_in, int flvf, double E,
90 double dE =
91 0);
92 virtual double AvgProbLoE(
93 vectorC nu_in, int flvf, double LoE,
94 double dLoE =
95 0);
96
97 // Get probability averaged over a bin
98 virtual double AvgProb(
99 int flvi, int flvf, double E,
100 double dE =
101 0);
102 virtual double AvgProbLoE(
103 int flvi, int flvf, double LoE,
104 double dLoE =
105 0);
106
107 // Get probability vector averaged over a bin
108 virtual vectorD AvgProbVector(
109 vectorC nu_in, double E,
110 double dE = 0);
113 vectorC nu_in, double LoE,
114 double dLoE =
115 0);
116
117 // Get probability vector averaged over a bin
118 virtual vectorD AvgProbVector(
119 int flvi, double E,
120 double dE = 0);
123 int flvi, double LoE,
124 double dLoE =
125 0);
126
127 // Get probability vector averaged over a bin
128 virtual matrixD AvgProbMatrix(
129 int nflvi, int nflvf, double E,
130 double dE = 0);
133 int nflvi, int nflvf, double LoE,
134 double dLoE =
135 0);
136
138 int mi);
139
140 // Set the oscillation parameters
141 virtual void SetAngle(int i, int j,
142 double th);
143 virtual void SetDelta(int i, int j,
144 double delta);
145 virtual void SetDm(int j,
146 double dm);
147
148 // Get the oscillation parameters
149 virtual double GetAngle(int i, int j);
150 virtual double GetDelta(int i, int j);
151 virtual double GetDm(int j);
152
153 // Get the effective oscillation parameters
154 virtual double GetDmEff(
155 int j);
156
157 // Set default oscillation parameters
158 virtual void SetStdPars();
159
160 // Set energy and anti-neutrino flag
161 virtual void SetEnergy(double E);
162 virtual void SetIsNuBar(bool isNuBar);
163
164 // Get energy and anti-neutrino flag
165 virtual double GetEnergy();
166 virtual bool GetIsNuBar();
167
168 // Set the neutrino path
169 virtual void SetPath(NuPath p);
170 virtual void SetPath(double length, double density, double zoa = 0.5,
171 int layer = 0);
172
173 virtual void SetPath(std::vector<NuPath> paths);
174
175 virtual void AddPath(NuPath p);
176 virtual void AddPath(double length, double density, double zoa = 0.5,
177 int layer = 0);
178
179 virtual void ClearPath();
180
181 virtual void SetLength(double L);
182 virtual void SetDensity(
183 double rho);
184 virtual void SetZoA(double zoa);
185
186 virtual void SetLength(vectorD L);
187 virtual void SetDensity(vectorD rho);
188 virtual void SetZoA(vectorD zoa);
189 virtual void SetLayers(
190 std::vector<int> lay);
191
192 // Set a default neutrino path
193 virtual void SetStdPath();
194
195 // Get the neutrino path
196 virtual std::vector<NuPath> GetPath();
197
199 virtual vectorD GetSamplePoints(double LoE, double dLoE);
200
201 // Setup the caching system
202 virtual void SetUseCache(bool u = true);
203 virtual void ClearCache();
204 virtual void SetMaxCache(int mc = 1e6);
205
207 virtual void SetAvgProbPrec(double prec);
208
209 protected:
210 // Some useful complex numbers
211 static const complexD zero;
212 static const complexD one;
213
214 // Unit conversion constants
215 static const double kKm2eV;
216 static const double kK2;
217 static const double kGeV2eV;
218 static const double kNA;
219
220 static const double kGf;
221
222 virtual void InitializeVectors();
224
225 // Internal caching functions
226 virtual bool TryCache();
227 virtual void FillCache();
228
229 // Auxiliary path functions
230 virtual void SetCurPath(
231 NuPath p);
232
233 virtual void SetAtt(double att,
234 int idx);
235 virtual void SetAtt(vectorD att,
236 int idx);
237
238 // Building and solving
239 virtual void RotateH(
240 int i, int j,
241 matrixC& Ham);
242 virtual void RotateState(
243 int i, int j);
244
245 virtual void BuildHms();
246
252 virtual void SolveHam() = 0;
254
255 // Resetting and propagating
256 virtual void ResetToFlavour(
257 int flv);
258 virtual void SetPureState(
259 vectorC nu_in);
260
261 virtual void PropagatePath(
262 NuPath p);
263 virtual void Propagate();
264
265 virtual double P(
266 int flv);
267 virtual vectorD GetProbVector();
269
270 virtual std::vector<int> GetSortedIndices(
271 const vectorD x);
272
273 virtual vectorD ConvertEtoLoE(double E, double dE);
274
275 // Attributes
276
278
282
285
288
291
292 double fEnergy;
293 bool fIsNuBar;
294
295 std::vector<NuPath> fNuPaths;
297
299 bool fGotES;
300
302 double fCachePrec;
304
306
307 std::unordered_set<EigenPoint> fMixCache;
309 };
310
312 struct IdxCompare {
315
317 bool operator()(int a, int b) const { return target[a] < target[b]; }
318
319 private:
322 };
323
324} // namespace OscProb
325
326#endif
Base class implementing general functions for computing neutrino oscillations.
Definition: PMNS_Base.h:26
virtual void Propagate()
Propagate neutrino through full path.
Definition: PMNS_Base.cxx:1018
static const complexD zero
zero in complex
Definition: PMNS_Base.h:211
double fCachePrec
Precision of cache matching.
Definition: PMNS_Base.h:302
virtual double P(int flv)
Return the probability of final state in flavour flv.
Definition: PMNS_Base.cxx:1058
bool fIsNuBar
Anti-neutrino flag.
Definition: PMNS_Base.h:293
virtual matrixD AvgProbMatrixLoE(int nflvi, int nflvf, double LoE, double dLoE=0)
Compute the average probability matrix over a bin of L/E.
Definition: PMNS_Base.cxx:1900
virtual vectorD ConvertEtoLoE(double E, double dE)
Definition: PMNS_Base.cxx:1516
virtual void SetZoA(double zoa)
Set Z/A value for single path.
Definition: PMNS_Base.cxx:413
virtual double AvgProbLoE(vectorC nu_in, int flvf, double LoE, double dLoE=0)
Compute the average probability over a bin of L/E.
Definition: PMNS_Base.cxx:1643
virtual vectorD AvgProbVectorLoE(vectorC nu_in, double LoE, double dLoE=0)
Compute the average probability vector over a bin of L/E.
Definition: PMNS_Base.cxx:1791
vectorC fNuState
The neutrino current state.
Definition: PMNS_Base.h:283
int fNumNus
Number of neutrino flavours.
Definition: PMNS_Base.h:277
std::vector< NuPath > fNuPaths
Vector of neutrino paths.
Definition: PMNS_Base.h:295
double fEnergy
Neutrino energy.
Definition: PMNS_Base.h:292
virtual vectorC GetMassEigenstate(int mi)
Get a neutrino mass eigenstate.
Definition: PMNS_Base.cxx:795
virtual void RotateH(int i, int j, matrixC &Ham)
Rotate the Hamiltonian by theta_ij and delta_ij.
Definition: PMNS_Base.cxx:822
virtual bool GetIsNuBar()
Get the anti-neutrino flag.
Definition: PMNS_Base.cxx:261
static const double kK2
mol/GeV^2/cm^3 to eV
Definition: PMNS_Base.h:216
std::unordered_set< EigenPoint > fMixCache
Caching set of eigensystems.
Definition: PMNS_Base.h:307
static const double kKm2eV
km to eV^-1
Definition: PMNS_Base.h:215
double fAvgProbPrec
AvgProb precision.
Definition: PMNS_Base.h:305
virtual void SetDm(int j, double dm)
Set the mass-splitting dm_j1 in eV^2.
Definition: PMNS_Base.cxx:674
virtual void SetDelta(int i, int j, double delta)
Set the CP phase delta_ij.
Definition: PMNS_Base.cxx:602
virtual void SetStdPars()
Set PDG 3-flavor parameters.
Definition: PMNS_Base.cxx:177
virtual double GetDmEff(int j)
Get the effective mass-splitting dm_j1 in eV^2.
Definition: PMNS_Base.cxx:732
virtual void PropagatePath(NuPath p)
Propagate neutrino through a single path.
Definition: PMNS_Base.cxx:983
virtual void SetLength(double L)
Set a single path lentgh in km.
Definition: PMNS_Base.cxx:391
matrixC fHms
matrix H*2E in eV^2
Definition: PMNS_Base.h:284
static const double kNA
Avogadro constant.
Definition: PMNS_Base.h:218
vectorC fBuffer
Buffer for neutrino state tranformations.
Definition: PMNS_Base.h:287
bool fGotES
Tag to avoid recalculating eigensystem.
Definition: PMNS_Base.h:299
virtual void SetIsNuBar(bool isNuBar)
Set the anti-neutrino flag.
Definition: PMNS_Base.cxx:243
virtual vectorD AvgProbVector(vectorC nu_in, double E, double dE=0)
Definition: PMNS_Base.cxx:1753
virtual double AvgProb(vectorC nu_in, int flvf, double E, double dE=0)
Compute the average probability over a bin of energy.
Definition: PMNS_Base.cxx:1568
int fMaxCache
Maximum cache size.
Definition: PMNS_Base.h:303
virtual void FillCache()
Cache the current eigensystem.
Definition: PMNS_Base.cxx:157
static const complexD one
one in complex
Definition: PMNS_Base.h:212
static const double kGf
G_F in units of GeV^-2.
Definition: PMNS_Base.h:220
matrixC fEvec
Eigenvectors of the Hamiltonian.
Definition: PMNS_Base.h:290
virtual double Prob(vectorC nu_in, int flvf)
Compute the probability of nu_in going to flvf.
Definition: PMNS_Base.cxx:1114
virtual matrixD AvgProbMatrix(int nflvi, int nflvf, double E, double dE=0)
Definition: PMNS_Base.cxx:1861
NuPath fPath
Current neutrino path.
Definition: PMNS_Base.h:296
virtual void SetLayers(std::vector< int > lay)
Set multiple path layer indices.
Definition: PMNS_Base.cxx:519
virtual ~PMNS_Base()
Destructor.
Definition: PMNS_Base.cxx:73
virtual void SolveHam()=0
virtual void AddPath(NuPath p)
Add a path to the sequence.
Definition: PMNS_Base.cxx:307
virtual void SetEnergy(double E)
Set the neutrino energy in GeV.
Definition: PMNS_Base.cxx:226
vectorD fEval
Eigenvalues of the Hamiltonian.
Definition: PMNS_Base.h:289
bool fBuiltHms
Tag to avoid rebuilding Hms.
Definition: PMNS_Base.h:298
PMNS_Base(int numNus=3)
Constructor.
Definition: PMNS_Base.cxx:47
virtual void SetUseCache(bool u=true)
Set caching on/off.
Definition: PMNS_Base.cxx:105
virtual void SetCurPath(NuPath p)
Set the path currently in use by the class.
Definition: PMNS_Base.cxx:274
vectorC fPhases
Buffer for oscillation phases.
Definition: PMNS_Base.h:286
EigenPoint fProbe
EigenpPoint to try.
Definition: PMNS_Base.h:308
vectorD fDm
m^2_i - m^2_1 in vacuum
Definition: PMNS_Base.h:279
virtual void SetPath(NuPath p)
Set a single path.
Definition: PMNS_Base.cxx:330
virtual void SetAvgProbPrec(double prec)
Set the AvgProb precision.
Definition: PMNS_Base.cxx:1962
virtual void SetAtt(double att, int idx)
Set one of the path attributes.
Definition: PMNS_Base.cxx:364
virtual bool TryCache()
Try to find a cached eigensystem.
Definition: PMNS_Base.cxx:134
virtual void ResetToFlavour(int flv)
Reset neutrino state to pure flavour flv.
Definition: PMNS_Base.cxx:1034
virtual void SetPureState(vectorC nu_in)
Set the initial state from a pure state.
Definition: PMNS_Base.cxx:1070
virtual void ClearCache()
Clear the cache.
Definition: PMNS_Base.cxx:111
matrixD fDelta
delta[i][j] CP violating phase
Definition: PMNS_Base.h:281
virtual void SetDensity(double rho)
Set single path density in g/cm^3.
Definition: PMNS_Base.cxx:402
virtual std::vector< NuPath > GetPath()
Get the neutrino path sequence.
Definition: PMNS_Base.cxx:300
virtual vectorD ProbVector(vectorC nu_in)
Definition: PMNS_Base.cxx:1250
virtual double GetEnergy()
Get the neutrino energy in GeV.
Definition: PMNS_Base.cxx:255
virtual void SetAngle(int i, int j, double th)
Set the mixing angle theta_ij.
Definition: PMNS_Base.cxx:539
virtual double GetAngle(int i, int j)
Get the mixing angle theta_ij.
Definition: PMNS_Base.cxx:570
virtual void BuildHms()
Build the matrix of masses squared.
Definition: PMNS_Base.cxx:955
virtual double GetDm(int j)
Get the mass-splitting dm_j1 in eV^2.
Definition: PMNS_Base.cxx:696
bool fUseCache
Flag for whether to use caching.
Definition: PMNS_Base.h:301
static const double kGeV2eV
GeV to eV.
Definition: PMNS_Base.h:217
virtual double GetDelta(int i, int j)
Get the CP phase delta_ij.
Definition: PMNS_Base.cxx:638
virtual void SetStdPath()
Set standard neutrino path.
Definition: PMNS_Base.cxx:205
virtual void InitializeVectors()
Definition: PMNS_Base.cxx:79
virtual void RotateState(int i, int j)
Rotate the neutrino state by theta_ij and delta_ij.
Definition: PMNS_Base.cxx:760
virtual void SetMaxCache(int mc=1e6)
Set max cache size.
Definition: PMNS_Base.cxx:128
virtual vectorD GetSamplePoints(double LoE, double dLoE)
Compute the sample points for a bin of L/E with width dLoE.
Definition: PMNS_Base.cxx:1985
virtual void ClearPath()
Clear the path vector.
Definition: PMNS_Base.cxx:287
virtual std::vector< int > GetSortedIndices(const vectorD x)
Get indices that sort a vector.
Definition: PMNS_Base.cxx:715
virtual matrixD ProbMatrix(int nflvi, int nflvf)
Compute the probability matrix.
Definition: PMNS_Base.cxx:1387
matrixD fTheta
theta[i][j] mixing angle
Definition: PMNS_Base.h:280
virtual vectorD GetProbVector()
Definition: PMNS_Base.cxx:1233
Some useful general definitions.
Definition: Absorption.h:6
std::complex< double > complexD
Definition: Definitions.h:21
std::vector< complexD > vectorC
Definition: Definitions.h:22
std::vector< double > vectorD
Definition: Definitions.h:18
std::vector< vectorD > matrixD
Definition: Definitions.h:19
std::vector< vectorC > matrixC
Definition: Definitions.h:23
Struct to organise eigensystems for caching.
Definition: EigenPoint.h:20
An index sorting comparator.
Definition: PMNS_Base.h:312
const vectorD target
Attribute to store the target vector.
Definition: PMNS_Base.h:321
bool operator()(int a, int b) const
Compare elements a and b of target vector.
Definition: PMNS_Base.h:317
IdxCompare(const vectorD &target)
Take in a target vector.
Definition: PMNS_Base.h:314
A struct representing a neutrino path segment.
Definition: NuPath.h:34