From 898a8f843776896b47e66709b50e76fa22e28f55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20G=C3=BCnther?= <p.gunther@cern.ch> Date: Sat, 17 Sep 2022 16:27:03 +0200 Subject: [PATCH] more expressive names for variables --- Pr/PrMCTools/src/PrMCDebugForwardTool.cpp | 26 +++++++++++------------ 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/Pr/PrMCTools/src/PrMCDebugForwardTool.cpp b/Pr/PrMCTools/src/PrMCDebugForwardTool.cpp index 03c4aa9950a..9a2159d9766 100644 --- a/Pr/PrMCTools/src/PrMCDebugForwardTool.cpp +++ b/Pr/PrMCTools/src/PrMCDebugForwardTool.cpp @@ -33,15 +33,15 @@ namespace LHCb::Pr::Forward { // inherit standard constructors using extends::extends; - int check( int veloIndex = -1, int seedIndex = -1, const std::vector<int>& = {} ) const override; + int check( int track_index = -1, int index = -1, const std::vector<int>& = {} ) const override; void storeData( LHCb::span<const VariableDef>, std::string_view = "Tuple" ) const override; private: Gaudi::Property<float> m_matchFrac{this, "MatchFraction", 0.7}; - DataObjectReadHandle<LHCb::Tracks> m_veloTracks{this, "InputTracks", ""}; - DataObjectReadHandle<LHCb::LinksByKey> m_veloTrackLinks{this, "InputTrackLinks", ""}; + DataObjectReadHandle<LHCb::Tracks> m_inputTracks{this, "InputTracks", ""}; + DataObjectReadHandle<LHCb::LinksByKey> m_inputTrackLinks{this, "InputTrackLinks", ""}; DataObjectReadHandle<LHCb::LinksByKey> m_SciFiHitLinks{this, "SciFiHitLinks", ""}; DataObjectReadHandle<LHCb::MCParticles> m_mcparticles{this, "MCParticles", ""}; DataObjectReadHandle<LHCb::Pr::Hits<HitType::FT>> m_SciFiHits{this, "SciFiHits", ""}; @@ -67,15 +67,15 @@ namespace LHCb::Pr::Forward { } //============================================================================= - int PrMCDebugForwardTool::check( int veloIndex, int, const std::vector<int>& scifi_indices ) const { - assert( veloIndex >= 0 ); + int PrMCDebugForwardTool::check( int track_index, int, const std::vector<int>& scifi_indices ) const { + assert( track_index >= 0 ); - std::vector<const LHCb::MCParticle*> velo_mcps{}; - m_veloTrackLinks.get()->applyToLinks( veloIndex, [&]( auto /*veloIndex*/, auto mcKey, auto /*weight*/ ) { - velo_mcps.push_back( m_mcparticles.get()->operator()( mcKey ) ); + std::vector<const LHCb::MCParticle*> input_mcps{}; + m_inputTrackLinks.get()->applyToLinks( track_index, [&]( auto /*track_index*/, auto mcKey, auto /*weight*/ ) { + input_mcps.push_back( m_mcparticles.get()->operator()( mcKey ) ); } ); - if ( std::none_of( velo_mcps.begin(), velo_mcps.end(), [trackInfo = MCTrackInfo{*m_trackInfo.get()}]( auto mcp ) { + if ( std::none_of( input_mcps.begin(), input_mcps.end(), [trackInfo = MCTrackInfo{*m_trackInfo.get()}]( auto mcp ) { return trackInfo.hasVeloAndT( mcp ); } ) ) { return 0; @@ -86,8 +86,8 @@ namespace LHCb::Pr::Forward { std::transform( scifi_indices.begin(), scifi_indices.end(), std::back_inserter( lhcbids ), [hits = m_SciFiHits.get()]( auto idx ) { return hits->lhcbid( idx ); } ); - std::vector<int> match_counters( velo_mcps.size(), 0 ); - for ( size_t i{0}; i < velo_mcps.size(); ++i ) { + std::vector<int> match_counters( input_mcps.size(), 0 ); + for ( size_t i{0}; i < input_mcps.size(); ++i ) { for ( auto id : lhcbids ) { m_SciFiHitLinks.get()->applyToLinks( id.lhcbID(), [&]( auto /*FTChannelID*/, auto mcKey, auto /*weight*/ ) { const auto linked_mcp = m_mcparticles.get()->operator()( mcKey ); @@ -95,12 +95,12 @@ namespace LHCb::Pr::Forward { throw GaudiException( "SciFiHitLinks do not use the same underlying container as MCParticles!", this->name(), StatusCode::FAILURE ); } - if ( velo_mcps[i] == linked_mcp ) ++match_counters[i]; + if ( input_mcps[i] == linked_mcp ) ++match_counters[i]; } ); } } const auto best = std::max_element( match_counters.begin(), match_counters.end() ); - const auto best_mcp = velo_mcps[std::distance( match_counters.begin(), best )]; + const auto best_mcp = input_mcps[std::distance( match_counters.begin(), best )]; const auto matching_frac = static_cast<float>( *best ) / lhcbids.size(); const auto found = matching_frac >= m_matchFrac; if ( const auto pid = std::abs( best_mcp->particleID().pid() ); pid != 11 ) { -- GitLab