From 5fbda1511ba8a439a2aedd8056bb2ba078438256 Mon Sep 17 00:00:00 2001 From: decianm Date: Fri, 2 May 2025 10:50:12 +0200 Subject: [PATCH 1/4] also log ghost prob values if there is not fit, and add counter for retention of ghost prob cut --- Tr/TrackUtils/src/TrackBestTrackCreator.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Tr/TrackUtils/src/TrackBestTrackCreator.cpp b/Tr/TrackUtils/src/TrackBestTrackCreator.cpp index c9b1ea66cb2..8a39aa70b82 100644 --- a/Tr/TrackUtils/src/TrackBestTrackCreator.cpp +++ b/Tr/TrackUtils/src/TrackBestTrackCreator.cpp @@ -154,6 +154,7 @@ namespace LHCb { mutable CounterSet> m_chisqProbSumCounters{ this, "chisqProbSum" }; mutable CounterSet> m_ghostProbCounters{ this, "ghostProbability" }; + mutable CounterSet> m_ghostProbRetentionCounters{ this, "ghostProbability cut retention" }; mutable CounterSet> m_numOutliersCounters{ this, "numOutliers" }; mutable CounterSet> m_fitFailedCounters{ this, "FitFailed" }; @@ -270,6 +271,9 @@ LHCb::TrackBestTrackCreator::operator()( Gaudi::Functional::vector_of_const_execute( tracksToFit ).ignore(); + std::for_each(tracksToFit.begin(), tracksToFit.end(), [&](const LHCb::Track* track){ m_ghostProbCounters( track->type() ) += track->ghostProbability(); + m_ghostProbRetentionCounters( track->type() ) += (track->ghostProbability() < m_maxGhostProb); + }); } // take a vector of "references" which is much easier to sort (because less @@ -412,6 +416,7 @@ void LHCb::TrackBestTrackCreator::fitAndUpdateCounters( TrackData& td, IGeometry m_flipChargeCounters( track.type() ) += bool( td.qOverP() * track.firstState().qOverP() < 0 ); m_numOutliersCounters( track.type() ) += nMeasurementsRemoved( track ); m_ghostProbCounters( track.type() ) += track.ghostProbability(); + m_ghostProbRetentionCounters( track.type() ) += (track.ghostProbability() < m_maxGhostProb); } else { track.setFlag( Track::Flags::Invalid, true ); fitfailed = true; -- GitLab From 18ff67e8d85a33b54d48a9bdc4f9240441f3e90e Mon Sep 17 00:00:00 2001 From: Gitlab CI Date: Fri, 2 May 2025 08:50:55 +0000 Subject: [PATCH 2/4] pre-commit fixes patch generated by https://gitlab.cern.ch/lhcb/Rec/-/jobs/55332843 --- Tr/TrackUtils/src/TrackBestTrackCreator.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Tr/TrackUtils/src/TrackBestTrackCreator.cpp b/Tr/TrackUtils/src/TrackBestTrackCreator.cpp index 8a39aa70b82..468ba8f4398 100644 --- a/Tr/TrackUtils/src/TrackBestTrackCreator.cpp +++ b/Tr/TrackUtils/src/TrackBestTrackCreator.cpp @@ -154,7 +154,8 @@ namespace LHCb { mutable CounterSet> m_chisqProbSumCounters{ this, "chisqProbSum" }; mutable CounterSet> m_ghostProbCounters{ this, "ghostProbability" }; - mutable CounterSet> m_ghostProbRetentionCounters{ this, "ghostProbability cut retention" }; + mutable CounterSet> m_ghostProbRetentionCounters{ + this, "ghostProbability cut retention" }; mutable CounterSet> m_numOutliersCounters{ this, "numOutliers" }; mutable CounterSet> m_fitFailedCounters{ this, "FitFailed" }; @@ -271,9 +272,10 @@ LHCb::TrackBestTrackCreator::operator()( Gaudi::Functional::vector_of_const_execute( tracksToFit ).ignore(); - std::for_each(tracksToFit.begin(), tracksToFit.end(), [&](const LHCb::Track* track){ m_ghostProbCounters( track->type() ) += track->ghostProbability(); - m_ghostProbRetentionCounters( track->type() ) += (track->ghostProbability() < m_maxGhostProb); - }); + std::for_each( tracksToFit.begin(), tracksToFit.end(), [&]( const LHCb::Track* track ) { + m_ghostProbCounters( track->type() ) += track->ghostProbability(); + m_ghostProbRetentionCounters( track->type() ) += ( track->ghostProbability() < m_maxGhostProb ); + } ); } // take a vector of "references" which is much easier to sort (because less @@ -416,7 +418,7 @@ void LHCb::TrackBestTrackCreator::fitAndUpdateCounters( TrackData& td, IGeometry m_flipChargeCounters( track.type() ) += bool( td.qOverP() * track.firstState().qOverP() < 0 ); m_numOutliersCounters( track.type() ) += nMeasurementsRemoved( track ); m_ghostProbCounters( track.type() ) += track.ghostProbability(); - m_ghostProbRetentionCounters( track.type() ) += (track.ghostProbability() < m_maxGhostProb); + m_ghostProbRetentionCounters( track.type() ) += ( track.ghostProbability() < m_maxGhostProb ); } else { track.setFlag( Track::Flags::Invalid, true ); fitfailed = true; -- GitLab From 5b34bc8111b7aec0345b79daa920bb1c0ef4f6c3 Mon Sep 17 00:00:00 2001 From: decianm Date: Sat, 3 May 2025 17:50:27 +0200 Subject: [PATCH 3/4] put GP counter in GP tool --- Tr/TrackTools/src/GhostProbabilityTool.cpp | 3 +++ Tr/TrackUtils/src/TrackBestTrackCreator.cpp | 8 +++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Tr/TrackTools/src/GhostProbabilityTool.cpp b/Tr/TrackTools/src/GhostProbabilityTool.cpp index 1415ecd2cdb..0c410ac37fd 100644 --- a/Tr/TrackTools/src/GhostProbabilityTool.cpp +++ b/Tr/TrackTools/src/GhostProbabilityTool.cpp @@ -44,6 +44,7 @@ public: auto output = m_model->model()->evaluate( invec ); auto out_arr = SIMDWrapper::to_array( output( 0 ) ); track.setGhostProbability( std::isnan( out_arr[0] ) ? 1. : 1. - out_arr[0] ); + m_ghostProbCounter += track.ghostProbability(); return StatusCode::SUCCESS; }; @@ -51,6 +52,7 @@ public: // save output in track (assumes it classifies tracks (vs ghosts) not the other way around) auto save_output = [&]( LHCb::Track* track, LHCb::span output ) -> void { track->setGhostProbability( std::isnan( output[0] ) ? 1. : 1. - output[0] ); + m_ghostProbCounter += track->ghostProbability(); }; // runs on one type of track @@ -90,6 +92,7 @@ private: if ( parse( m_tracktype, m_trktypesprop ).isFailure() ) m_tracktype = LHCb::Track::Types::Unknown; } }; + mutable Gaudi::Accumulators::AveragingCounter m_ghostProbCounter{ this, "ghostProbability" }; private: std::unique_ptr m_model; diff --git a/Tr/TrackUtils/src/TrackBestTrackCreator.cpp b/Tr/TrackUtils/src/TrackBestTrackCreator.cpp index 468ba8f4398..50c81f33724 100644 --- a/Tr/TrackUtils/src/TrackBestTrackCreator.cpp +++ b/Tr/TrackUtils/src/TrackBestTrackCreator.cpp @@ -272,10 +272,6 @@ LHCb::TrackBestTrackCreator::operator()( Gaudi::Functional::vector_of_const_execute( tracksToFit ).ignore(); - std::for_each( tracksToFit.begin(), tracksToFit.end(), [&]( const LHCb::Track* track ) { - m_ghostProbCounters( track->type() ) += track->ghostProbability(); - m_ghostProbRetentionCounters( track->type() ) += ( track->ghostProbability() < m_maxGhostProb ); - } ); } // take a vector of "references" which is much easier to sort (because less @@ -363,6 +359,9 @@ int LHCb::TrackBestTrackCreator::fitAndSelect( TrackData& td, IGeometryInfo cons td.setAccepted( chi2.chi2PerDoF() < m_maxChi2DoF && chi2T.chi2PerDoF() < m_maxChi2DoFT && chi2Velo.chi2PerDoF() < m_maxChi2DoFVelo && chi2MatchAndUT.chi2PerDoF() < m_maxChi2DoFMatchAndUT && ( !m_addGhostProb || track.ghostProbability() < m_maxGhostProb ) ); + + m_ghostProbRetentionCounters( track.type() ) += ( track.ghostProbability() < m_maxGhostProb ); + } if ( msgLevel( MSG::DEBUG ) ) { @@ -418,7 +417,6 @@ void LHCb::TrackBestTrackCreator::fitAndUpdateCounters( TrackData& td, IGeometry m_flipChargeCounters( track.type() ) += bool( td.qOverP() * track.firstState().qOverP() < 0 ); m_numOutliersCounters( track.type() ) += nMeasurementsRemoved( track ); m_ghostProbCounters( track.type() ) += track.ghostProbability(); - m_ghostProbRetentionCounters( track.type() ) += ( track.ghostProbability() < m_maxGhostProb ); } else { track.setFlag( Track::Flags::Invalid, true ); fitfailed = true; -- GitLab From f7f6df925a6d437363a26e01ac3b284193d9fe44 Mon Sep 17 00:00:00 2001 From: Gitlab CI Date: Sat, 3 May 2025 16:19:30 +0000 Subject: [PATCH 4/4] pre-commit fixes patch generated by https://gitlab.cern.ch/lhcb/Rec/-/jobs/55374497 --- Tr/TrackTools/src/GhostProbabilityTool.cpp | 4 ++-- Tr/TrackUtils/src/TrackBestTrackCreator.cpp | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Tr/TrackTools/src/GhostProbabilityTool.cpp b/Tr/TrackTools/src/GhostProbabilityTool.cpp index 0c410ac37fd..3dd9e15ab0c 100644 --- a/Tr/TrackTools/src/GhostProbabilityTool.cpp +++ b/Tr/TrackTools/src/GhostProbabilityTool.cpp @@ -87,8 +87,8 @@ private: Gaudi::Property m_weightsfilename{ this, "WeightsFileName", {}, "locations of weights files, to be read with ParamFileSvc" }; - LHCb::Track::Types m_tracktype; - Gaudi::Property m_trktypesprop{ this, "TrackType", "", [&]( auto& ) { + LHCb::Track::Types m_tracktype; + Gaudi::Property m_trktypesprop{ this, "TrackType", "", [&]( auto& ) { if ( parse( m_tracktype, m_trktypesprop ).isFailure() ) m_tracktype = LHCb::Track::Types::Unknown; } }; diff --git a/Tr/TrackUtils/src/TrackBestTrackCreator.cpp b/Tr/TrackUtils/src/TrackBestTrackCreator.cpp index 50c81f33724..87b85fdd296 100644 --- a/Tr/TrackUtils/src/TrackBestTrackCreator.cpp +++ b/Tr/TrackUtils/src/TrackBestTrackCreator.cpp @@ -361,7 +361,6 @@ int LHCb::TrackBestTrackCreator::fitAndSelect( TrackData& td, IGeometryInfo cons ( !m_addGhostProb || track.ghostProbability() < m_maxGhostProb ) ); m_ghostProbRetentionCounters( track.type() ) += ( track.ghostProbability() < m_maxGhostProb ); - } if ( msgLevel( MSG::DEBUG ) ) { -- GitLab