Skip to content

Commit f7a8f7c

Browse files
committed
Add missing track->resetCov before refit for revertexing
Skip tracks with ill-defined cov. matrix
1 parent 45df7ad commit f7a8f7c

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

Detectors/GlobalTrackingWorkflow/study/src/CheckResid.cxx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,7 @@ bool CheckResidSpec::processITSTrack(const o2::its::TrackITS& iTrack, const o2::
318318
auto inv2d = [](float s00, float s11, float s01) -> std::array<float, 3> {
319319
auto det = s00 * s11 - s01 * s01;
320320
if (det < 1e-16) {
321+
LOGP(error, "Singular det {}, input: {} {} {}", det, s00, s11, s01);
321322
return {0.f, 0.f, 0.f};
322323
}
323324
det = 1.f / det;
@@ -329,11 +330,11 @@ bool CheckResidSpec::processITSTrack(const o2::its::TrackITS& iTrack, const o2::
329330
LOGP(debug, "Failed to propagateToDCA, {}", trFitOut.asString());
330331
return false;
331332
}
332-
float cosAlp, sinAlp;
333-
pvAlpha = trFitOut.getAlpha();
334-
o2::math_utils::sincos(trFitOut.getAlpha(), sinAlp, cosAlp); // vertex position rotated to track frame
335333
o2::BaseCluster<float> bcPV;
336334
if (params.addPVAsCluster) {
335+
float cosAlp, sinAlp;
336+
pvAlpha = trFitOut.getAlpha();
337+
o2::math_utils::sincos(trFitOut.getAlpha(), sinAlp, cosAlp); // vertex position rotated to track frame
337338
bcPV.setXYZ(pv.getX() * cosAlp + pv.getY() * sinAlp, -pv.getX() * sinAlp + pv.getY() * cosAlp, pv.getZ());
338339
bcPV.setSigmaY2(0.5 * (pv.getSigmaX2() + pv.getSigmaY2()));
339340
bcPV.setSigmaZ2(pv.getSigmaZ2());
@@ -400,7 +401,7 @@ bool CheckResidSpec::processITSTrack(const o2::its::TrackITS& iTrack, const o2::
400401
auto wInw = inv2d(tInw.getSigmaY2(), tInw.getSigmaZ2(), tInw.getSigmaZY());
401402
auto wOut = inv2d(tOut.getSigmaY2(), tOut.getSigmaZ2(), tOut.getSigmaZY());
402403
if (wInw[0] == 0.f || wOut[0] == 0.f) {
403-
return -1;
404+
return false;
404405
}
405406
std::array<float, 3> wTot = {wInw[0] + wOut[0], wInw[1] + wOut[1], wInw[2] + wOut[2]};
406407
auto cTot = inv2d(wTot[0], wTot[1], wTot[2]);
@@ -481,6 +482,8 @@ bool CheckResidSpec::refitITStrack(o2::track::TrackParCov& track, GTrackID gid)
481482
const auto& params = CheckResidConfig::Instance();
482483
auto pid = track.getPID();
483484
track = trkITS.getParamOut();
485+
track.resetCovariance();
486+
track.setCov(track.getQ2Pt() * track.getQ2Pt() * track.getCov()[14], 14);
484487
track.setPID(pid);
485488
auto nCl = trkITS.getNumberOfClusters();
486489
auto geom = o2::its::GeometryTGeo::Instance();

0 commit comments

Comments
 (0)