Skip to content

Commit

Permalink
Add quiet predictedChi2 call
Browse files Browse the repository at this point in the history
  • Loading branch information
mconcas committed Sep 28, 2024
1 parent 1de0de3 commit aba23ea
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,16 +93,17 @@ class TrackParametrizationWithError : public TrackParametrization<value_T>
GPUd() bool propagateToDCA(const o2::dataformats::VertexBase& vtx, value_t b, o2::dataformats::DCA* dca = nullptr, value_t maxD = 999.f);
GPUd() void invert();
GPUd() value_t getPredictedChi2(const dim2_t& p, const dim3_t& cov) const;
GPUd() value_t getPredictedChi2Unchecked(const dim2_t& p, const dim3_t& cov) const;
GPUd() value_t getPredictedChi2Quiet(const dim2_t& p, const dim3_t& cov) const;
GPUd() value_t getPredictedChi2(const value_t* p, const value_t* cov) const;
GPUd() value_t getPredictedChi2Unchecked(const value_t* p, const value_t* cov) const;
GPUd() value_t getPredictedChi2Quiet(const value_t* p, const value_t* cov) const;

template <typename T>
GPUd() value_t getPredictedChi2(const BaseCluster<T>& p) const;

void buildCombinedCovMatrix(const TrackParametrizationWithError& rhs, MatrixDSym5& cov) const;
value_t getPredictedChi2(const TrackParametrizationWithError& rhs, MatrixDSym5& covToSet) const;
GPUd() value_t getPredictedChi2(const TrackParametrizationWithError& rhs) const;
GPUd() value_t getPredictedChi2Quiet(const TrackParametrizationWithError& rhs) const;
bool update(const TrackParametrizationWithError& rhs, const MatrixDSym5& covInv);
bool update(const TrackParametrizationWithError& rhs);

Expand Down Expand Up @@ -322,9 +323,9 @@ GPUdi() auto TrackParametrizationWithError<value_T>::getPredictedChi2(const dim2

//______________________________________________
template <typename value_T>
GPUdi() auto TrackParametrizationWithError<value_T>::getPredictedChi2Unchecked(const dim2_t& p, const dim3_t& cov) const -> value_t
GPUdi() auto TrackParametrizationWithError<value_T>::getPredictedChi2Quiet(const dim2_t& p, const dim3_t& cov) const -> value_t
{
return getPredictedChi2Unchecked(p.data(), cov.data());
return getPredictedChi2Quiet(p.data(), cov.data());
}

//______________________________________________
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -736,7 +736,7 @@ GPUd() auto TrackParametrizationWithError<value_T>::getPredictedChi2(const value

//______________________________________________
template <typename value_T>
GPUd() auto TrackParametrizationWithError<value_T>::getPredictedChi2Unchecked(const value_t* p, const value_t* cov) const -> value_t
GPUd() auto TrackParametrizationWithError<value_T>::getPredictedChi2Quiet(const value_t* p, const value_t* cov) const -> value_t
{
// Estimate the chi2 of the space point "p" with the cov. matrix "cov"
auto sdd = static_cast<double>(getSigmaY2()) + static_cast<double>(cov[0]);
Expand Down Expand Up @@ -786,6 +786,14 @@ GPUd() auto TrackParametrizationWithError<value_T>::getPredictedChi2(const Track
return getPredictedChi2(rhs, cov);
}

//______________________________________________
template <typename value_T>
GPUd() auto TrackParametrizationWithError<value_T>::getPredictedChi2Quiet(const TrackParametrizationWithError<value_T>& rhs) const -> value_t
{
MatrixDSym5 cov; // perform matrix operations in double!
return getPredictedChi2(rhs, cov);
}

//______________________________________________
template <typename value_T>
GPUd() auto TrackParametrizationWithError<value_T>::getPredictedChi2(const TrackParametrizationWithError<value_T>& rhs, MatrixDSym5& covToSet) const -> value_t
Expand Down
12 changes: 6 additions & 6 deletions Detectors/ITSMFT/ITS/tracking/src/TrackerTraits.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ void TrackerTraits::computeLayerCells(const int iteration)
break;
}

auto predChi2{track.getPredictedChi2(trackingHit.positionTrackingFrame, trackingHit.covarianceTrackingFrame)};
auto predChi2{track.getPredictedChi2Quiet(trackingHit.positionTrackingFrame, trackingHit.covarianceTrackingFrame)};
if (!track.o2::track::TrackParCov::update(trackingHit.positionTrackingFrame, trackingHit.covarianceTrackingFrame)) {
break;
}
Expand Down Expand Up @@ -438,7 +438,7 @@ void TrackerTraits::findCellsNeighbours(const int iteration)
!nextCellSeed.propagateTo(currentCellSeed.getX(), getBz())) {
continue;
}
float chi2 = currentCellSeed.getPredictedChi2(nextCellSeed); /// TODO: switch to the chi2 wrt cluster to avoid correlation
float chi2 = currentCellSeed.getPredictedChi2Quiet(nextCellSeed); /// TODO: switch to the chi2 wrt cluster to avoid correlation

#ifdef OPTIMISATION_OUTPUT
bool good{mTimeFrame->getCellsLabel(iLayer)[iCell] == mTimeFrame->getCellsLabel(iLayer + 1)[iNextCell]};
Expand Down Expand Up @@ -536,7 +536,7 @@ void TrackerTraits::processNeighbours(int iLayer, int iLevel, const std::vector<
}
}

auto predChi2{seed.getPredictedChi2(trHit.positionTrackingFrame, trHit.covarianceTrackingFrame)};
auto predChi2{seed.getPredictedChi2Quiet(trHit.positionTrackingFrame, trHit.covarianceTrackingFrame)};
if ((predChi2 > mTrkParams[0].MaxChi2ClusterAttachment) || predChi2 < 0.f) {
CA_DEBUGGER(failed[3]++);
continue;
Expand Down Expand Up @@ -781,7 +781,7 @@ void TrackerTraits::findShortPrimaries()
float pvRes{mTrkParams[0].PVres / o2::gpu::CAMath::Sqrt(float(pvs[iV].getNContributors()))};
const float posVtx[2]{0.f, pvs[iV].getZ()};
const float covVtx[3]{pvRes, 0.f, pvRes};
float chi2 = temporaryTrack.getPredictedChi2(posVtx, covVtx);
float chi2 = temporaryTrack.getPredictedChi2Quiet(posVtx, covVtx);
if (chi2 < bestChi2) {
if (!temporaryTrack.track::TrackParCov::update(posVtx, covVtx)) {
continue;
Expand Down Expand Up @@ -837,7 +837,7 @@ bool TrackerTraits::fitTrack(TrackITSExt& track, int start, int end, int step, f
}
}

auto predChi2{track.getPredictedChi2(trackingHit.positionTrackingFrame, trackingHit.covarianceTrackingFrame)};
auto predChi2{track.getPredictedChi2Quiet(trackingHit.positionTrackingFrame, trackingHit.covarianceTrackingFrame)};
if ((nCl >= 3 && predChi2 > chi2clcut) || predChi2 < 0.f) {
return false;
}
Expand Down Expand Up @@ -932,7 +932,7 @@ bool TrackerTraits::trackFollowing(TrackITSExt* track, int rof, bool outward, co
continue;
}

auto predChi2{tbuParams.getPredictedChi2(trackingHit.positionTrackingFrame, trackingHit.covarianceTrackingFrame)};
auto predChi2{tbuParams.getPredictedChi2Quiet(trackingHit.positionTrackingFrame, trackingHit.covarianceTrackingFrame)};
if (predChi2 >= track->getChi2() * mTrkParams[iteration].NSigmaCut) {
continue;
}
Expand Down

0 comments on commit aba23ea

Please sign in to comment.