Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 6 additions & 29 deletions OscLib/OscCalcDecayEigen.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ namespace osc

//---------------------------------------------------------------------------

OscCalcDecayEigen::OscCalcDecayEigen() : fNumNus(3), fBuiltHms(false), fIsNuBar(false), fGotES(false)
OscCalcDecayEigen::OscCalcDecayEigen() : fNumNus(3), fBuiltHms(false), fIsNuBar(false)
{
this->SetStdPars();
this->ResetToFlavour(1);
Expand All @@ -36,7 +36,7 @@ namespace osc
}

//---------------------------------------------------------------------------
OscCalcDecayEigen::OscCalcDecayEigen(const OscCalcDecayEigen& calc) : fNumNus(3), fBuiltHms(false), fGotES(false)
OscCalcDecayEigen::OscCalcDecayEigen(const OscCalcDecayEigen& calc) : fNumNus(3), fBuiltHms(false)

{
fRho = calc.fRho;
Expand Down Expand Up @@ -77,8 +77,7 @@ namespace osc
fHd.setZero();
fBuffer.setZero();
fAlpha.setZero();
fEval.setZero();


}

void OscCalcDecayEigen::SaveTo(TDirectory* dir, const std::string& name) const
Expand Down Expand Up @@ -128,7 +127,6 @@ namespace osc

void OscCalcDecayEigen::SetIsNuBar(bool isNuBar)
{
fGotES = fGotES && (fIsNuBar == isNuBar);
fBuiltHms = fBuiltHms && (fIsNuBar == isNuBar);
fIsNuBar = isNuBar;
}
Expand Down Expand Up @@ -360,11 +358,9 @@ namespace osc
void OscCalcDecayEigen::BuildHms()
{

// Check if anything changed
// Check if anything changed
if(fBuiltHms) return;

// Tag to recompute eigensystem
fGotES = false;

for(int j=0; j<fNumNus; j++){
// Set mass splitting
fHms(j,j) = fDm(j);
Expand Down Expand Up @@ -408,21 +404,7 @@ namespace osc
fBuiltHms = true;

}
//---------------------------------------------------------------------------
////// Wrapper to solve non-hermitian matrix eigenvalues.
///
/// @param A - Input matrix
/// @param w - Output eigenvalues
///
void OscCalcDecayEigen::complexsolver(const Eigen::Matrix3cd& A, Eigen::Vector3d& w)
{
Eigen::ComplexEigenSolver<Eigen::Matrix3cd> eigensolver;
eigensolver.compute(A);
for (int t = 0; t < w.size(); t++) {
w(t) = eigensolver.eigenvalues()(t).real();
}
}
//
//---------------------------------------------------------------------------
//.............................................................................

void OscCalcDecayEigen::SolveHam(double E, double Ne)
Expand All @@ -445,11 +427,6 @@ namespace osc
fHam(0, 0) += kr2GNe;}
else{
fHam(0, 0) -= kr2GNe;}

// Solve Hamiltonian for eigenvalues using the Eigen library method
complexsolver(fHam, fEval);

fGotES = true;
}


Expand Down
13 changes: 4 additions & 9 deletions OscLib/OscCalcDecayEigen.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,7 @@ namespace osc
///Rotate the Hamiltonian by theta_ij and delta_ij
virtual void RotateH(int i, int j, Eigen::Matrix3cd& Ham);

/// Wrapper to solve non-hermitian matrix eigenvalues.
void complexsolver(const Eigen::Matrix3cd& A, Eigen::Vector3d& w);

/// Build Hms = H*2E, where H is the Hamiltonian in vacuum on flavour basis
/// Build Hms = H*2E, where H is the Hamiltonian in vacuum on flavour basis
/// and E is the neutrino energy. This is effectively the matrix of masses squared.
virtual void BuildHms();

Expand All @@ -120,12 +117,10 @@ namespace osc
double fCachedNe; ///Cached electron density
double fCachedE; ///Cached neutrino energy
bool fBuiltHms; ///Tag to avoid rebuilding Hms
bool fIsNuBar; /// anti-neutrino flag
bool fGotES; ///Tag to avoid recalculating eigensystem
bool fIsNuBar; /// anti-neutrino flag

Eigen::Vector3cd fBuffer; ///Buffer for neutrino state tranformations
Eigen::Vector3d fEval; ///Eigenvalues of the Hamiltonian
Eigen::Matrix3cd fHd; ///Decay hamiltonian
Eigen::Vector3cd fBuffer; ///Buffer for neutrino state tranformations
Eigen::Matrix3cd fHd; ///Decay hamiltonian
Eigen::Vector3d fDm; ///m^2_i - m^2_1 in vacuum
Eigen::Matrix3d fTheta; ///theta[i][j] mixing angle
Eigen::Matrix3d fDelta; ///delta[i][j] CP violating phase
Expand Down