64 for (
int i = 0; i <
fNumNus; i++) {
67 for (
int j = 0; j <
fNumNus; j++) {
124 double lenghtEV = L *
kKm2eV;
125 double bufK = lenghtEV * 0.5;
129 for (
int i = 0; i <
fNumNus; i++) {
132 for (
int l = 0; l <
fNumNus; l++) {
135 for (
int k = 0; k <
fNumNus; k++) {
139 Hms_kl = conj(
fHms[l][k]);
141 if (
fIsNuBar && k != l) Hms_kl = conj(Hms_kl);
143 buffer[l] += conj(
fEvec[k][i]) * Hms_kl;
147 for (
int j = 0; j <= i; j++) {
150 for (
int l = 0; l <
fNumNus; l++) {
158 double arg = (
fEval[i] -
fEval[j]) * lenghtEV;
186 for (
int j = 0; j <
fNumNus; j++) {
187 for (
int i = 0; i <= j; i++) {
208 bool ismin = (L2 <= 0 &&
fcosT < 0);
230 for (
int j = 0; j <
fNumNus; j++) {
231 for (
int k = 0; k <
fNumNus; k++) {
235 for (
int i = 0; i <
fNumNus; i++) {
237 for (
int k = 0; k <
fNumNus; k++) {
252 for (
int j = 0; j <
fNumNus; j++) {
253 for (
int k = 0; k <
fNumNus; k++) {
256 for (
int l = 0; l <
fNumNus; l++) {
261 for (
int i = 0; i <= j; i++) {
264 for (
int k = 0; k <
fNumNus; k++) {
289 for (
int j = 0; j <
fNumNus; j++) {
292 for (
int i = 0; i <
fNumNus; i++) {
295 for (
int k = 0; k <
fNumNus; k++) {
318 for (
int i = 0; i <
fNumNus; i++) {
321 for (
int l = 0; l <
fNumNus; l++) {
322 for (
int k = 0; k <
fNumNus; k++) {
327 for (
int j = 0; j <= i; j++) {
328 for (
int l = 0; l <
fNumNus; l++) {
332 if (i != j) { K[j][i] = conj(K[i][j]); }
343 for (
int i = 0; i < int(
fNuPaths.size()); i++) {
363 for (
int i = 0; i <
fNumNus; i++) {
364 double arg =
fEval[i] * LengthIneV;
410 double fEvalGLoBES[3];
414 zheevh3(K, fEvecGLoBES, fEvalGLoBES);
417 for (
int i = 0; i <
fNumNus; i++) {
418 lambda[i] = fEvalGLoBES[i];
419 for (
int j = 0; j <
fNumNus; j++) { V[i][j] = fEvecGLoBES[i][j]; }
447 for (
int i = 0; i <
fNumNus; i++) {
448 for (
int k = 0; k <
fNumNus; k++) {
455 for (
int n = 0; n <
fNumNus; n++) { buffer[n] = SV[n] * conj(V[flvi][n]); }
459 for (
int j = 0; j <
fNumNus; j++) {
462 for (
int i = 0; i < j; i++) {
463 double arg = (lambda[i] - lambda[j]) * dbin / 2;
464 sinc[i][j] = sin(arg) / arg;
465 sinc[j][i] = sinc[i][j];
471 for (
int j = 0; j <
fNumNus; j++) {
472 for (
int i = 0; i <
fNumNus; i++) {
473 P += buffer[i] * conj(buffer[j]) * sinc[j][i];
503 if (E <= 0)
return 0;
508 if (dE <= 0)
return Prob(flvi, flvf, E);
513 return AvgProbLoE(flvi, flvf, Ebin[0], Ebin[1]);
541 if (LoE <= 0)
return 0;
556 for (
int j = 1; j < int(samples.size()); j++) {
557 double w = 1. / pow(samples[j], 2);
559 avgprob += w *
AvgAlgo(flvi, flvf, samples[j], samples[0], L);
565 return avgprob / sumw;
583 double d1oE = dLoE / L;
626 if (cosT > 0)
return 0;
631 if (dcosT == 0)
return Prob(flvi, flvf, E);
638 for (
int j = 1; j < int(samples.size()); j++) {
639 avgprob +=
AvgAlgoCosT(flvi, flvf, E, samples[j], samples[0]);
643 return avgprob / (samples.size() - 1);
714 if (E <= 0)
return 0;
715 if (cosT > 0)
return 0;
720 if (dE <= 0 && dcosT == 0)
return Prob(flvi, flvf, E);
721 if (dE <= 0)
return AvgProb(flvi, flvf, E, cosT, dcosT);
722 if (dcosT == 0)
return AvgProb(flvi, flvf, E, dE);
726 return AvgProbLoE(flvi, flvf, Ebin[0], Ebin[1], cosT, dcosT);
759 double cosT,
double dcosT)
761 if (LoE <= 0)
return 0;
762 if (cosT > 0)
return 0;
767 if (dLoE <= 0 && dcosT == 0)
return Prob(flvi, flvf,
fPath.
length / LoE);
770 if (dcosT == 0)
return AvgProbLoE(flvi, flvf, LoE, dLoE);
776 int rows = samples.size();
777 int cols = samples[0].size();
783 for (
int k = 1; k < int(rows); k++) {
784 for (
int l = 1; l < int(cols); l++) {
785 double w = 1. / pow(real(samples[k][l]), 2);
788 w *
AvgAlgo(flvi, flvf, real(samples[k][l]), real(samples[0][0]),
789 imag(samples[k][l]), imag(samples[0][0]));
796 return avgprob / ((sumw));
814 double cosT,
double dcosT)
876 for (
int i = 0; i <
fNumNus; i++) {
877 for (
int j = 0; j <
fNumNus; j++) {
878 for (
int k = 0; k <
fNumNus; k++) {
887 for (
int i = 0; i <
fNumNus; i++) {
888 for (
int j = i; j <
fNumNus; j++) {
890 for (
int k = 0; k <
fNumNus; k++) {
911 for (
int j = 0; j <
fNumNus; j++) {
912 for (
int i = 0; i < j; i++) {
913 double arg = (lambda[i] - lambda[j]) * dbin;
914 sinc[i][j] = sin(arg) / arg;
916 sinc[j][i] = sinc[i][j];
920 for (
int i = 0; i <
fNumNus; i++) { sinc[i][i] = 1; }
922 for (
int j = 0; j <
fNumNus; j++) {
923 for (
int i = 0; i <
fNumNus; i++) {
943 int n_div = ceil(3 * pow(dLoE / LoE, 0.8) * pow(LoE, 0.3) /
950 Samples.push_back(dLoE / n_div);
953 for (
int k = 0; k < n_div; k++) {
955 double bctr = LoE - dLoE / 2 + (k + 0.5) * dLoE / n_div;
957 Samples.push_back(bctr);
980 int n_div = ceil(35 * pow(E, -0.4) * pow(abs(dcosT / cosT), 0.8) /
987 Samples.push_back(dcosT / n_div);
990 for (
int k = 0; k < n_div; k++) {
992 double bctr = cosT - dcosT / 2 + (k + 0.5) * dcosT / n_div;
994 Samples.push_back(bctr);
1020 int n_divCosT = ceil(380 * pow(InvE, 0.5) * pow(abs(dcosT / cosT), 0.8) /
1022 int n_divE = ceil(260 * pow(dInvE / InvE, 0.8) * pow(InvE, 0.6) /
1029 Samples[0][0] =
complexD(dInvE / n_divE, dcosT / n_divCosT);
1032 for (
int k = 0; k < n_divE; k++) {
1034 double bctr_InvE = InvE - dInvE / 2 + (k + 0.5) * dInvE / n_divE;
1036 for (
int l = 0; l < n_divCosT; l++) {
1038 double bctr_CosT = cosT - dcosT / 2 + (l + 0.5) * dcosT / n_divCosT;
1040 Samples[k + 1][l + 1] =
complexD(bctr_InvE, bctr_CosT);
1073 for (
int i = 0; i <
fNumNus; i++) {
1074 for (
int k = 0; k <
fNumNus; k++) {
1081 for (
int n = 0; n <
fNumNus; n++) { buffer[n] = SV[n] * conj(V[flvi][n]); }
1085 for (
int j = 0; j <
fNumNus; j++) {
1086 for (
int i = 0; i <
fNumNus; i++) {
1087 double arg = (lambda[j] - lambda[i]) * dbin;
1088 expo[j][i] = exp(
complexD(0.0, arg));
1094 for (
int j = 0; j <
fNumNus; j++) {
1095 for (
int i = 0; i <
fNumNus; i++) {
1096 P += buffer[i] * conj(buffer[j]) * expo[j][i];
virtual std::vector< NuPath > GetNuPath()
double fdInvE
Bin's width for the inverse of energy in GeV-1.
vectorD flambdaCosT
Eigenvectors of K_cosTheta.
virtual double AvgProbLoE(int flvi, int flvf, double LoE, double dLoE)
matrixC fKflavor
K matrix in flavor basis for one layer.
virtual double ExtrapolationProbLoE(int flvi, int flvf, double LoE, double dLoE)
virtual double AvgAlgoCosT(int flvi, int flvf, double E, double cosT, double dcosT)
matrixC fVcosT
Eigenvalues of K_cosTheta.
virtual void SetwidthBin(double dE, double dcosT)
virtual void PropagateTaylor()
Propagate neutrino through full path.
virtual void PropagatePathTaylor(NuPath p)
Propagate neutrino through a single path.
virtual void rotateS()
Rotate the S matrix.
matrixC fevolutionMatrixS
matrixC fdensityMatrix
The neutrino density matrix state.
matrixC fVInvE
Eigenvalues of K_invE.
double fcosT
Cosine of neutrino angle.
double fdcosT
Bin's width for angle.
virtual void BuildKE(double L)
build K matrix for the inverse of energy in mass basis
virtual void rotateK()
Rotate one K matrix.
virtual void InitializeTaylorsVectors()
virtual double ExtrapolationProb(int flvi, int flvf, double E, double dE)
virtual void MultiplicationRuleK(complexD K[3][3])
Product between two K matrices.
virtual void SolveK(complexD K[3][3], vectorD &lambda, matrixC &V)
Solve the K matrix.
virtual void RotateDensityM(bool to_basis, matrixC V)
Apply rotation to the density matrix.
virtual void HadamardProduct(vectorD lambda, double dbin)
to the density matrix
virtual void MultiplicationRuleS()
Product between two S matrices.
virtual double AvgAlgo(int flvi, int flvf, double LoE, double dLoE, double L)
matrixC fSflavor
S matrix for one layer.
virtual vectorD GetSamplePoints(double LoE, double dLoE)
matrixC fKmass
K matrix in mass basis for one layer.
virtual double LnDerivative()
virtual double AvgFormulaExtrapolation(int flvi, int flvf, double dbin, vectorD flambda, matrixC fV)
Formula for the extrapolation of probability.
virtual void SetCosT(double cosT)
Set neutrino angle.
virtual double AvgFormula(int flvi, int flvf, double dbin, vectorD flambda, matrixC fV)
virtual void BuildKcosT(double L)
build K matrix for angle in flavor basis
virtual ~PMNS_Avg()
Destructor.
complexD fKcosT[3][3]
K matrix for neutrino angle for the entire path.
virtual double AlgorithmDensityMatrix(int flvi, int flvf)
virtual double ExtrapolationProbCosT(int flvi, int flvf, double cosT, double dcosT)
virtual void SetPremModel(OscProb::PremModel &prem)
virtual double AvgProb(int flvi, int flvf, double E, double dE)
vectorD flambdaInvE
Eigenvectors of K_invE.
virtual double P(int flv)
Return the probability of final state in flavour flv.
bool fIsNuBar
Anti-neutrino flag.
virtual vectorD ConvertEtoLoE(double E, double dE)
int fNumNus
Number of neutrino flavours.
std::vector< NuPath > fNuPaths
Vector of neutrino paths.
static const double kKm2eV
km to eV^-1
double fAvgProbPrec
AvgProb precision.
matrixC fHms
matrix H*2E in eV^2
matrixC fEvec
Eigenvectors of the Hamiltonian.
virtual double Prob(vectorC nu_in, int flvf)
Compute the probability of nu_in going to flvf.
NuPath fPath
Current neutrino path.
virtual void SetEnergy(double E)
Set the neutrino energy in GeV.
vectorD fEval
Eigenvalues of the Hamiltonian.
virtual void SetCurPath(NuPath p)
Set the path currently in use by the class.
vectorC fPhases
Buffer for oscillation phases.
virtual void SetPath(NuPath p)
Set a single path.
virtual void SetAvgProbPrec(double prec)
Set the AvgProb precision.
static const double kGeV2eV
GeV to eV.
Implementation of oscillations of neutrinos in matter in a three-neutrino framework.
virtual void UpdateHam()
Build the full Hamiltonian.
virtual void SolveHam()
Solve the full Hamiltonian for eigenvectors and eigenvalues.
complexD fHam[3][3]
The full hamiltonian.
Implements an earth model with spherical shells.
virtual double GetDetRadius()
virtual void LoadModel(std::string filename)
Load an earth model from a file.
int FillPath(double cosT, double phi=0)
Fill the path sequence in a vector.
virtual std::vector< PremLayer > GetPremLayers()
Some useful general definitions.
std::complex< double > complexD
std::vector< complexD > vectorC
std::vector< double > vectorD
NuPath AvgPath(NuPath &p1, NuPath &p2)
Get the average of two paths.
std::vector< vectorC > matrixC
A struct representing a neutrino path segment.
double length
The length of the path segment in km.
int zheevh3(std::complex< double > A[3][3], std::complex< double > Q[3][3], double w[3])