Skip to content

Commit

Permalink
Merge branch 'main' into ci/update-exatrkx-images-v43
Browse files Browse the repository at this point in the history
  • Loading branch information
kodiakhq[bot] authored Oct 19, 2023
2 parents 2e54b45 + 35ec532 commit 45e6a7d
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,11 @@ ActsExamples::ProcessCode ActsExamples::CKFPerformanceWriter::writeT(
const auto& particles = m_inputParticles(ctx);
const auto& hitParticlesMap = m_inputMeasurementParticlesMap(ctx);

std::map<ActsFatras::Barcode, std::size_t> particleTruthHitCount;
for (const auto& [_, pid] : hitParticlesMap) {
particleTruthHitCount[pid]++;
}

// Counter of truth-matched reco tracks
std::map<ActsFatras::Barcode, std::vector<RecoTrackInfo>> matched;
// Counter of truth-unmatched reco tracks
Expand Down Expand Up @@ -183,7 +188,7 @@ ActsExamples::ProcessCode ActsExamples::CKFPerformanceWriter::writeT(
identifyContributingParticles(hitParticlesMap, traj, trackTip,
particleHitCounts);
if (particleHitCounts.empty()) {
ACTS_WARNING(
ACTS_DEBUG(
"No truth particle associated with this trajectory with entry "
"index = "
<< trackTip);
Expand All @@ -198,15 +203,26 @@ ActsExamples::ProcessCode ActsExamples::CKFPerformanceWriter::writeT(

// Check if the trajectory is matched with truth.
// If not, it will be classified as 'fake'
const bool recoMatched =
static_cast<float>(nMajorityHits) / trajState.nMeasurements >=
m_cfg.truthMatchProbMin;
const bool truthMatched =
static_cast<float>(nMajorityHits) /
particleTruthHitCount.at(majorityParticleId) >=
m_cfg.truthMatchProbMin;

bool isFake = false;
if (nMajorityHits * 1. / trajState.nMeasurements >=
m_cfg.truthMatchProbMin) {
if (not m_cfg.doubleMatching and recoMatched) {
matched[majorityParticleId].push_back(
{nMajorityHits, fittedParameters});
} else if (m_cfg.doubleMatching and recoMatched and truthMatched) {
matched[majorityParticleId].push_back(
{nMajorityHits, fittedParameters});
} else {
isFake = true;
unmatched[majorityParticleId]++;
}

// Fill fake rate plots
m_fakeRatePlotTool.fill(m_fakeRatePlotCache, fittedParameters, isFake);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ class CKFPerformanceWriter final : public WriterT<TrajectoriesContainer> {
DuplicationPlotTool::Config duplicationPlotToolConfig;
TrackSummaryPlotTool::Config trackSummaryPlotToolConfig;

/// Whether to do double matching or not
bool doubleMatching = false;

/// Min reco-truth matching probability
double truthMatchProbMin = 0.5;

Expand Down

0 comments on commit 45e6a7d

Please sign in to comment.