Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[12.4.X] Option to make track covariance Pos-def in packedcandidate #40556

Merged
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
code formatting
  • Loading branch information
vlimant authored and mmusich committed Jan 18, 2023
commit b08f78a01aeb09905e2d9c72b37c8f0b3b0adcb9
11 changes: 5 additions & 6 deletions DataFormats/PatCandidates/src/PackedCandidate.cc
Original file line number Diff line number Diff line change
@@ -113,10 +113,9 @@ void pat::PackedCandidate::unpackCovariance(bool forcePosDef) const {
// std::cout<<"unpacking enforcing positive-definite cov matrix"<<std::endl;
//calculate the determinant and verify positivity
double det = 0;
bool notPosDef = (!m->Sub<AlgebraicSymMatrix22>(0, 0).Det(det) || det<0)
|| (!m->Sub<AlgebraicSymMatrix33>(0, 0).Det(det) || det<0)
|| (!m->Sub<AlgebraicSymMatrix44>(0, 0).Det(det) || det<0)
|| (!m->Det(det) || det<0);
bool notPosDef = (!m->Sub<AlgebraicSymMatrix22>(0, 0).Det(det) || det < 0) ||
(!m->Sub<AlgebraicSymMatrix33>(0, 0).Det(det) || det < 0) ||
(!m->Sub<AlgebraicSymMatrix44>(0, 0).Det(det) || det < 0) || (!m->Det(det) || det < 0);
// std::cout<<"during unpacking, the determinant is: "<<det<<std::endl;
if (notPosDef) {
//if not positive-definite, alter values to allow for pos-def
@@ -125,7 +124,7 @@ void pat::PackedCandidate::unpackCovariance(bool forcePosDef) const {
for (int j = 0; j < 5; j++) {
if (std::isnan((*m)(i, j)) || std::isinf((*m)(i, j)))
eigenCov(i, j) = 1e-6;
else
else
eigenCov(i, j) = (*m)(i, j);
}
}
@@ -138,7 +137,7 @@ void pat::PackedCandidate::unpackCovariance(bool forcePosDef) const {
(*m)(i, i) += delta - minEigenValue;
}

// computed_ = m->Det(det);
// computed_ = m->Det(det);
// std::cout<<" the determinant of the corrected covariance matrix is: "<<det<<std::endl;
}
}