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

switch mkFit state conversion to use the curvilinear covariance on CMSSW side #28

Merged
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
13 changes: 6 additions & 7 deletions RecoTracker/MkFit/plugins/MkFitOutputConverter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -294,24 +294,23 @@ TrackCandidateCollection MkFitOutputConverter::convertCandidates(const MkFitOutp

// state
auto state = cand.state(); // copy because have to modify
state.convertFromCCSToCartesian();
state.convertFromCCSToGlbCurvilinear();
const auto& param = state.parameters;
const auto& err = state.errors;
AlgebraicSymMatrix66 cov;
for (int i = 0; i < 6; ++i) {
for (int j = i; j < 6; ++j) {
AlgebraicSymMatrix55 cov;
for (int i = 0; i < 5; ++i) {
for (int j = i; j < 5; ++j) {
cov[i][j] = err.At(i, j);
}
}

auto fts = FreeTrajectoryState(
GlobalTrajectoryParameters(
GlobalPoint(param[0], param[1], param[2]), GlobalVector(param[3], param[4], param[5]), state.charge, &mf),
CartesianTrajectoryError(cov));
CurvilinearTrajectoryError(cov));
if (!fts.curvilinearError().posDef()) {
edm::LogWarning("MkFitOutputConverter") << "Curvilinear error not pos-def\n"
<< fts.curvilinearError().matrix() << "\noriginal 6x6 covariance matrix\n"
<< cov << "\ncandidate ignored";
<< fts.curvilinearError().matrix();
continue;
}

Expand Down
11 changes: 5 additions & 6 deletions RecoTracker/MkFit/plugins/MkFitSeedConverter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -111,17 +111,16 @@ mkfit::TrackVec MkFitSeedConverter::convertSeeds(const edm::View<TrajectorySeed>
SVector3 pos(gpos.x(), gpos.y(), gpos.z());
SVector3 mom(gmom.x(), gmom.y(), gmom.z());

const auto cartError = tsos.cartesianError(); // returns a temporary, so can't chain with the following line
const auto& cov = cartError.matrix();
SMatrixSym66 err;
for (int i = 0; i < 6; ++i) {
for (int j = i; j < 6; ++j) {
const auto& cov = tsos.curvilinearError().matrix();
SMatrixSym66 err; //fill a sub-matrix, mkfit::TrackState will convert internally
for (int i = 0; i < 5; ++i) {
for (int j = i; j < 5; ++j) {
err.At(i, j) = cov[i][j];
}
}

mkfit::TrackState state(tsos.charge(), pos, mom, err);
state.convertFromCartesianToCCS();
state.convertFromGlbCurvilinearToCCS();
ret.emplace_back(state, 0, seed_index, 0, nullptr);
LogTrace("MkFitSeedConverter") << "Inserted seed with index " << seed_index;

Expand Down