Skip to content

Commit

Permalink
switch mkFit to converters GlbCurvilinear <-> CCS
Browse files Browse the repository at this point in the history
  • Loading branch information
slava77devel authored and makortel committed Jun 23, 2021
1 parent f92e841 commit 5846953
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
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

0 comments on commit 5846953

Please sign in to comment.