From 907e2f9bf74943aa8fe2bc26731f6902d442beb4 Mon Sep 17 00:00:00 2001 From: gifrau Date: Mon, 5 Jul 2021 15:03:45 +0200 Subject: [PATCH 01/14] new algorithm for matching --- .../src/ProbeAndLongMatcher.cpp | 165 ++++++++++++++++++ 1 file changed, 165 insertions(+) create mode 100644 Phys/ParticleCombiners/src/ProbeAndLongMatcher.cpp diff --git a/Phys/ParticleCombiners/src/ProbeAndLongMatcher.cpp b/Phys/ParticleCombiners/src/ProbeAndLongMatcher.cpp new file mode 100644 index 000000000..9a284e2a1 --- /dev/null +++ b/Phys/ParticleCombiners/src/ProbeAndLongMatcher.cpp @@ -0,0 +1,165 @@ +/*****************************************************************************\ + * (c) Copyright 2000-2019 CERN for the benefit of the LHCb Collaboration * + * * + * This software is distributed under the terms of the GNU General Public * + * Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". * + * * + * In applying this licence, CERN does not waive the privileges and immunities * + * granted to it by virtue of its status as an Intergovernmental Organization * + * or submit itself to any jurisdiction. * +\*****************************************************************************/ + +#include "Event/Particle.h" +#include "GaudiAlg/Transformer.h" +#include "Kernel/HeaderMapping.h" +#include "Kernel/HashIDs.h" +#include "Kernel/LHCbID.h" + +/**** @ class ProbeAndLongMatcher + * + * Function to match the probe daughter of Jpsi composite to a long track + * by comparing the hits in sub-detector + * Needed in the study of Tracking efficiency + * + * @ author Giulia Frau, Peilian LI + * @ date 2021-06-01 + * + */ + +class ProbeAndLongMatcher + : public Gaudi::Functional::MultiTransformerFilter( + LHCb::Particle::Range const&, LHCb::Particle::Range const& )>{ + + +public: + ProbeAndLongMatcher( const std::string& name, ISvcLocator* pSvcLocator ); + + std::tuple + operator()( LHCb::Particle::Range const& composites, LHCb::Particle::Range const& longparts ) const override; + + +private: + + //properties are members of the class + //need to specify owner, name, default value, doc + Gaudi::Property m_thresMuon{this, "MinMuonFrac", 0.4}; //overlap threshold of Muon stations + Gaudi::Property m_thresVP{this, "MinVPFrac", 0.4}; //overlap threshold of VP + Gaudi::Property m_thresUT{this, "MinUTFrac", 0.4}; //overlap threshold of UT + Gaudi::Property m_thresFT{this, "MinFTFrac", 0.4}; //overlap threshold of FT + + Gaudi::Property p_checkMuon{this, "checkMuon", false}; + Gaudi::Property p_checkVP{this, "checkVP", false}; + Gaudi::Property p_checkUT{this, "checkUT", false}; + Gaudi::Property p_checkFT{this, "checkFT", false}; + + mutable Gaudi::Accumulators::StatCounter m_all {this, "#Input composites"}; //Number of JPsi candidates + mutable Gaudi::Accumulators::StatCounter m_matched {this, "#Matched composites"}; //Number of JPsi candidates with a matched probe track + // mutable Gaudi::Accumulators::BinomialCounter m_efficiency {this, "Efficiency"}; //Matching efficiency +}; + +DECLARE_COMPONENT( ProbeAndLongMatcher ) + +//Implementation +ProbeAndLongMatcher::ProbeAndLongMatcher( const std::string& name, ISvcLocator* pSvcLocator ) + : MultiTransformerFilter ( name, pSvcLocator, + { KeyValue{"TwoBodyComposites", ""}, KeyValue{"LongTracks", ""} }, + { KeyValue{"MatchedComposites", ""}, KeyValue{"MatchedLongTracks", ""}} ) {} + +std::tuple ProbeAndLongMatcher::operator() //we use a mulitransformer to define multiple outputs + ( LHCb::Particle::Range const& composites, LHCb::Particle::Range const& longparts ) const{ + + //initialize counter + m_all += composites.size(); + + //output containers + auto results = std::tuple{}; + auto& [filter_passed, selectedComp, selectedLong] = results; + + for (const auto composite : composites){ + + const SmartRefVector daughters = composite->daughters(); //define composite daughters + + for (const auto daughter : daughters){ + + const LHCb::ProtoParticle* proto = daughter->proto(); + const LHCb::Track* track = proto->track(); + const auto lhcbids = track->lhcbIDs(); + + + // Sanity check from Particle_to_Particle.cpp + if ( proto == nullptr ) { + Warning( "Charged ProtoParticle with no Track found. Ignoring." ).ignore(); + continue; + } + if ( track->states().empty() ) { + Warning( "Track has empty states. This is likely to be a bug" ).ignore(); + continue; + } + + bool hasVELO = false; + bool hasUT = false; + bool hasFT = false; + for ( auto const id : lhcbids ) { + if ( id.isVP() ) hasVELO = true; + if ( id.isUT() ) hasUT = true; + if ( id.isFT() ) hasFT = true; + } + + //remove the tag track from the daughters + //we check for the presence of hits in the UT for the tag track only if the UT tracking eff is tested + if ( (!p_checkUT && hasVELO && hasFT) || (p_checkUT && hasVELO && hasUT && hasFT) ) continue; + + const LHCb::Particle* tmp_long = nullptr; + double tmp_frac = 0; + + for (const auto longpart : longparts){ + + if ( daughter->charge() != longpart->charge()) continue; + + //define LHCbIDs and muonPID for the long track + const LHCb::ProtoParticle* longproto = longpart->proto(); + const LHCb::Track* longtrack = longproto->track(); + const auto longIDs = longtrack->lhcbIDs(); + const auto muonpid = longproto->muonPID(); + std::vector muonids; + muonids.reserve( 10 ); + LHCb::HashIDs::lhcbIDs( muonpid, muonids ); + + //evaluate the overlap + std::pair fracVP( 0., 0. ), fracUT( 0., 0. ), fracFT( 0., 0. ), fracMuon( 0., 0. ); + if ( p_checkVP ) fracVP = LHCb::HashIDs::overlap( lhcbids, longIDs, LHCb::LHCbID::channelIDtype::VP ); + if ( p_checkUT ) fracUT = LHCb::HashIDs::overlap( lhcbids, longIDs, LHCb::LHCbID::channelIDtype::UT ); + if ( p_checkFT ) fracFT = LHCb::HashIDs::overlap( lhcbids, longIDs, LHCb::LHCbID::channelIDtype::FT ); + if ( p_checkMuon ) fracMuon = LHCb::HashIDs::overlap( lhcbids, muonids, LHCb::LHCbID::channelIDtype::Muon ); + + if ( p_checkVP ) debug() << "match fraction of VP hits " << fracVP.first << " " << fracVP.second << endmsg; + if ( p_checkUT ) debug() << "match fraction of UT hits " << fracUT.first << " " << fracUT.second << endmsg; + if ( p_checkFT ) debug() << "match fraction of FT hits " << fracFT.first << " " << fracFT.second << endmsg; + if ( p_checkMuon ) debug() << "match fraction of muon hits " << fracMuon.first << " " << fracMuon.second << endmsg; + + if ( p_checkVP && fracVP.first < m_thresVP.value() ) continue; + if ( p_checkUT && fracUT.first < m_thresUT.value() ) continue; + if ( p_checkFT && fracFT.first < m_thresFT.value() ) continue; + if ( p_checkMuon && fracMuon.first < m_thresMuon.value() ) continue; + + double frac = fracVP.first + fracUT.first + fracFT.first + fracMuon.first; + + if ( tmp_frac < frac ){ + tmp_frac = frac; + tmp_long = longpart; + } + + } //end loop over long tracks + + if ( tmp_frac > 0 ){ + selectedComp.insert( composite ); + selectedLong.insert( tmp_long ); + } + } //end loop over daughters + } //end loop over composites + filter_passed = selectedComp.size() > 0; + m_matched += selectedComp.size(); + return results; + +} + -- GitLab From 69b991bbc705fe0f991b6af61b6dd75b86c87dae Mon Sep 17 00:00:00 2001 From: gifrau Date: Fri, 16 Jul 2021 10:01:44 +0200 Subject: [PATCH 02/14] update --- Phys/ParticleCombiners/src/ProbeAndLongMatcher.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Phys/ParticleCombiners/src/ProbeAndLongMatcher.cpp b/Phys/ParticleCombiners/src/ProbeAndLongMatcher.cpp index 9a284e2a1..3cd9dd579 100644 --- a/Phys/ParticleCombiners/src/ProbeAndLongMatcher.cpp +++ b/Phys/ParticleCombiners/src/ProbeAndLongMatcher.cpp @@ -84,8 +84,7 @@ std::tuple ProbeAndL const LHCb::ProtoParticle* proto = daughter->proto(); const LHCb::Track* track = proto->track(); const auto lhcbids = track->lhcbIDs(); - - + // Sanity check from Particle_to_Particle.cpp if ( proto == nullptr ) { Warning( "Charged ProtoParticle with no Track found. Ignoring." ).ignore(); @@ -127,6 +126,7 @@ std::tuple ProbeAndL //evaluate the overlap std::pair fracVP( 0., 0. ), fracUT( 0., 0. ), fracFT( 0., 0. ), fracMuon( 0., 0. ); + if ( p_checkVP ) fracVP = LHCb::HashIDs::overlap( lhcbids, longIDs, LHCb::LHCbID::channelIDtype::VP ); if ( p_checkUT ) fracUT = LHCb::HashIDs::overlap( lhcbids, longIDs, LHCb::LHCbID::channelIDtype::UT ); if ( p_checkFT ) fracFT = LHCb::HashIDs::overlap( lhcbids, longIDs, LHCb::LHCbID::channelIDtype::FT ); @@ -147,8 +147,7 @@ std::tuple ProbeAndL if ( tmp_frac < frac ){ tmp_frac = frac; tmp_long = longpart; - } - + } } //end loop over long tracks if ( tmp_frac > 0 ){ @@ -157,6 +156,7 @@ std::tuple ProbeAndL } } //end loop over daughters } //end loop over composites + filter_passed = selectedComp.size() > 0; m_matched += selectedComp.size(); return results; -- GitLab From a6257ed39092f6a046f4cdff53e0ed1ba2cd4454 Mon Sep 17 00:00:00 2001 From: gifrau Date: Fri, 16 Jul 2021 10:07:33 +0200 Subject: [PATCH 03/14] moving alg to RelInfoTool directory --- .../src/ProbeAndLongMatcher.cpp | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Phys/{ParticleCombiners => RelatedInfoTools}/src/ProbeAndLongMatcher.cpp (100%) diff --git a/Phys/ParticleCombiners/src/ProbeAndLongMatcher.cpp b/Phys/RelatedInfoTools/src/ProbeAndLongMatcher.cpp similarity index 100% rename from Phys/ParticleCombiners/src/ProbeAndLongMatcher.cpp rename to Phys/RelatedInfoTools/src/ProbeAndLongMatcher.cpp -- GitLab From 3e31b558f1ad5f2a87b1731b0ac6e7a60737dd82 Mon Sep 17 00:00:00 2001 From: gifrau Date: Fri, 16 Jul 2021 10:17:02 +0200 Subject: [PATCH 04/14] update --- Phys/RelatedInfoTools/src/ProbeAndLongMatcher.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Phys/RelatedInfoTools/src/ProbeAndLongMatcher.cpp b/Phys/RelatedInfoTools/src/ProbeAndLongMatcher.cpp index 3cd9dd579..57b0c8137 100644 --- a/Phys/RelatedInfoTools/src/ProbeAndLongMatcher.cpp +++ b/Phys/RelatedInfoTools/src/ProbeAndLongMatcher.cpp @@ -43,18 +43,17 @@ private: //properties are members of the class //need to specify owner, name, default value, doc Gaudi::Property m_thresMuon{this, "MinMuonFrac", 0.4}; //overlap threshold of Muon stations - Gaudi::Property m_thresVP{this, "MinVPFrac", 0.4}; //overlap threshold of VP - Gaudi::Property m_thresUT{this, "MinUTFrac", 0.4}; //overlap threshold of UT - Gaudi::Property m_thresFT{this, "MinFTFrac", 0.4}; //overlap threshold of FT + Gaudi::Property m_thresVP{this, "MinVPFrac", 0.4}; //overlap threshold of VP + Gaudi::Property m_thresUT{this, "MinUTFrac", 0.4}; //overlap threshold of UT + Gaudi::Property m_thresFT{this, "MinFTFrac", 0.4}; //overlap threshold of FT Gaudi::Property p_checkMuon{this, "checkMuon", false}; Gaudi::Property p_checkVP{this, "checkVP", false}; Gaudi::Property p_checkUT{this, "checkUT", false}; Gaudi::Property p_checkFT{this, "checkFT", false}; - mutable Gaudi::Accumulators::StatCounter m_all {this, "#Input composites"}; //Number of JPsi candidates + mutable Gaudi::Accumulators::StatCounter m_all {this, "#Input composites"}; //Number of JPsi candidates mutable Gaudi::Accumulators::StatCounter m_matched {this, "#Matched composites"}; //Number of JPsi candidates with a matched probe track - // mutable Gaudi::Accumulators::BinomialCounter m_efficiency {this, "Efficiency"}; //Matching efficiency }; DECLARE_COMPONENT( ProbeAndLongMatcher ) -- GitLab From 4d60e801e92cb029ce454a9ab5f7b73cf8fc0dd7 Mon Sep 17 00:00:00 2001 From: gifrau Date: Fri, 16 Jul 2021 11:11:07 +0200 Subject: [PATCH 05/14] update --- Phys/RelatedInfoTools/src/ProbeAndLongMatcher.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Phys/RelatedInfoTools/src/ProbeAndLongMatcher.cpp b/Phys/RelatedInfoTools/src/ProbeAndLongMatcher.cpp index 57b0c8137..d7b03f9c7 100644 --- a/Phys/RelatedInfoTools/src/ProbeAndLongMatcher.cpp +++ b/Phys/RelatedInfoTools/src/ProbeAndLongMatcher.cpp @@ -103,8 +103,7 @@ std::tuple ProbeAndL if ( id.isFT() ) hasFT = true; } - //remove the tag track from the daughters - //we check for the presence of hits in the UT for the tag track only if the UT tracking eff is tested + // to remove the tag tracks from the daughters (maybe come up with a better way / flag or label? to identify the probe track??) if ( (!p_checkUT && hasVELO && hasFT) || (p_checkUT && hasVELO && hasUT && hasFT) ) continue; const LHCb::Particle* tmp_long = nullptr; -- GitLab From 2446b8e3f4e62977e4fb392763a1b3724ece444b Mon Sep 17 00:00:00 2001 From: gifrau Date: Fri, 16 Jul 2021 11:37:43 +0200 Subject: [PATCH 06/14] adding ProbeAndLongMatcher to CMakeLists --- Phys/RelatedInfoTools/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/Phys/RelatedInfoTools/CMakeLists.txt b/Phys/RelatedInfoTools/CMakeLists.txt index f71a3106b..1084efab3 100644 --- a/Phys/RelatedInfoTools/CMakeLists.txt +++ b/Phys/RelatedInfoTools/CMakeLists.txt @@ -22,6 +22,7 @@ gaudi_add_module(RelatedInfoTools src/RelInfoCylVariables.cpp src/RelInfoPFVariables.cpp src/RelInfoVertexIsolation.cpp + src/ProbeAndLongMatcher.cpp LINK Boost::headers Gaudi::GaudiAlgLib -- GitLab From 38f39d7c1ff09b26ca9ce9c602d2079752235ca2 Mon Sep 17 00:00:00 2001 From: Gitlab CI Date: Mon, 6 Sep 2021 15:43:03 +0000 Subject: [PATCH 07/14] Fixed formatting patch generated by https://gitlab.cern.ch/lhcb/Phys/-/jobs/16131734 --- .../src/ProbeAndLongMatcher.cpp | 182 +++++++++--------- 1 file changed, 90 insertions(+), 92 deletions(-) diff --git a/Phys/RelatedInfoTools/src/ProbeAndLongMatcher.cpp b/Phys/RelatedInfoTools/src/ProbeAndLongMatcher.cpp index d7b03f9c7..9493d3988 100644 --- a/Phys/RelatedInfoTools/src/ProbeAndLongMatcher.cpp +++ b/Phys/RelatedInfoTools/src/ProbeAndLongMatcher.cpp @@ -11,153 +11,151 @@ #include "Event/Particle.h" #include "GaudiAlg/Transformer.h" -#include "Kernel/HeaderMapping.h" #include "Kernel/HashIDs.h" +#include "Kernel/HeaderMapping.h" #include "Kernel/LHCbID.h" -/**** @ class ProbeAndLongMatcher - * - * Function to match the probe daughter of Jpsi composite to a long track - * by comparing the hits in sub-detector - * Needed in the study of Tracking efficiency - * - * @ author Giulia Frau, Peilian LI - * @ date 2021-06-01 - * +/**** @ class ProbeAndLongMatcher + * + * Function to match the probe daughter of Jpsi composite to a long track + * by comparing the hits in sub-detector + * Needed in the study of Tracking efficiency + * + * @ author Giulia Frau, Peilian LI + * @ date 2021-06-01 + * */ -class ProbeAndLongMatcher - : public Gaudi::Functional::MultiTransformerFilter( - LHCb::Particle::Range const&, LHCb::Particle::Range const& )>{ - +class ProbeAndLongMatcher + : public Gaudi::Functional::MultiTransformerFilter( + LHCb::Particle::Range const&, LHCb::Particle::Range const& )> { public: ProbeAndLongMatcher( const std::string& name, ISvcLocator* pSvcLocator ); - - std::tuple - operator()( LHCb::Particle::Range const& composites, LHCb::Particle::Range const& longparts ) const override; + std::tuple + operator()( LHCb::Particle::Range const& composites, LHCb::Particle::Range const& longparts ) const override; -private: +private: + // properties are members of the class + // need to specify owner, name, default value, doc + Gaudi::Property m_thresMuon{this, "MinMuonFrac", 0.4}; // overlap threshold of Muon stations + Gaudi::Property m_thresVP{this, "MinVPFrac", 0.4}; // overlap threshold of VP + Gaudi::Property m_thresUT{this, "MinUTFrac", 0.4}; // overlap threshold of UT + Gaudi::Property m_thresFT{this, "MinFTFrac", 0.4}; // overlap threshold of FT - //properties are members of the class - //need to specify owner, name, default value, doc - Gaudi::Property m_thresMuon{this, "MinMuonFrac", 0.4}; //overlap threshold of Muon stations - Gaudi::Property m_thresVP{this, "MinVPFrac", 0.4}; //overlap threshold of VP - Gaudi::Property m_thresUT{this, "MinUTFrac", 0.4}; //overlap threshold of UT - Gaudi::Property m_thresFT{this, "MinFTFrac", 0.4}; //overlap threshold of FT - Gaudi::Property p_checkMuon{this, "checkMuon", false}; Gaudi::Property p_checkVP{this, "checkVP", false}; Gaudi::Property p_checkUT{this, "checkUT", false}; Gaudi::Property p_checkFT{this, "checkFT", false}; - mutable Gaudi::Accumulators::StatCounter m_all {this, "#Input composites"}; //Number of JPsi candidates - mutable Gaudi::Accumulators::StatCounter m_matched {this, "#Matched composites"}; //Number of JPsi candidates with a matched probe track + mutable Gaudi::Accumulators::StatCounter m_all{this, "#Input composites"}; // Number of JPsi candidates + mutable Gaudi::Accumulators::StatCounter m_matched{ + this, "#Matched composites"}; // Number of JPsi candidates with a matched probe track }; DECLARE_COMPONENT( ProbeAndLongMatcher ) -//Implementation +// Implementation ProbeAndLongMatcher::ProbeAndLongMatcher( const std::string& name, ISvcLocator* pSvcLocator ) - : MultiTransformerFilter ( name, pSvcLocator, - { KeyValue{"TwoBodyComposites", ""}, KeyValue{"LongTracks", ""} }, - { KeyValue{"MatchedComposites", ""}, KeyValue{"MatchedLongTracks", ""}} ) {} + : MultiTransformerFilter( name, pSvcLocator, {KeyValue{"TwoBodyComposites", ""}, KeyValue{"LongTracks", ""}}, + {KeyValue{"MatchedComposites", ""}, KeyValue{"MatchedLongTracks", ""}} ) {} -std::tuple ProbeAndLongMatcher::operator() //we use a mulitransformer to define multiple outputs - ( LHCb::Particle::Range const& composites, LHCb::Particle::Range const& longparts ) const{ +std::tuple ProbeAndLongMatcher:: + operator() // we use a mulitransformer to define multiple outputs + ( LHCb::Particle::Range const& composites, LHCb::Particle::Range const& longparts ) const { - //initialize counter + // initialize counter m_all += composites.size(); - - //output containers + + // output containers auto results = std::tuple{}; auto& [filter_passed, selectedComp, selectedLong] = results; - for (const auto composite : composites){ - - const SmartRefVector daughters = composite->daughters(); //define composite daughters - - for (const auto daughter : daughters){ + for ( const auto composite : composites ) { + + const SmartRefVector daughters = composite->daughters(); // define composite daughters - const LHCb::ProtoParticle* proto = daughter->proto(); - const LHCb::Track* track = proto->track(); + for ( const auto daughter : daughters ) { + + const LHCb::ProtoParticle* proto = daughter->proto(); + const LHCb::Track* track = proto->track(); const auto lhcbids = track->lhcbIDs(); - + // Sanity check from Particle_to_Particle.cpp if ( proto == nullptr ) { - Warning( "Charged ProtoParticle with no Track found. Ignoring." ).ignore(); - continue; + Warning( "Charged ProtoParticle with no Track found. Ignoring." ).ignore(); + continue; } if ( track->states().empty() ) { - Warning( "Track has empty states. This is likely to be a bug" ).ignore(); - continue; + Warning( "Track has empty states. This is likely to be a bug" ).ignore(); + continue; } - + bool hasVELO = false; bool hasUT = false; bool hasFT = false; for ( auto const id : lhcbids ) { - if ( id.isVP() ) hasVELO = true; - if ( id.isUT() ) hasUT = true; - if ( id.isFT() ) hasFT = true; + if ( id.isVP() ) hasVELO = true; + if ( id.isUT() ) hasUT = true; + if ( id.isFT() ) hasFT = true; } - // to remove the tag tracks from the daughters (maybe come up with a better way / flag or label? to identify the probe track??) - if ( (!p_checkUT && hasVELO && hasFT) || (p_checkUT && hasVELO && hasUT && hasFT) ) continue; + // to remove the tag tracks from the daughters (maybe come up with a better way / flag or label? to identify the + // probe track??) + if ( ( !p_checkUT && hasVELO && hasFT ) || ( p_checkUT && hasVELO && hasUT && hasFT ) ) continue; const LHCb::Particle* tmp_long = nullptr; double tmp_frac = 0; - - for (const auto longpart : longparts){ - if ( daughter->charge() != longpart->charge()) continue; + for ( const auto longpart : longparts ) { + + if ( daughter->charge() != longpart->charge() ) continue; - //define LHCbIDs and muonPID for the long track - const LHCb::ProtoParticle* longproto = longpart->proto(); - const LHCb::Track* longtrack = longproto->track(); - const auto longIDs = longtrack->lhcbIDs(); - const auto muonpid = longproto->muonPID(); - std::vector muonids; + // define LHCbIDs and muonPID for the long track + const LHCb::ProtoParticle* longproto = longpart->proto(); + const LHCb::Track* longtrack = longproto->track(); + const auto longIDs = longtrack->lhcbIDs(); + const auto muonpid = longproto->muonPID(); + std::vector muonids; muonids.reserve( 10 ); - LHCb::HashIDs::lhcbIDs( muonpid, muonids ); - - //evaluate the overlap - std::pair fracVP( 0., 0. ), fracUT( 0., 0. ), fracFT( 0., 0. ), fracMuon( 0., 0. ); + LHCb::HashIDs::lhcbIDs( muonpid, muonids ); + + // evaluate the overlap + std::pair fracVP( 0., 0. ), fracUT( 0., 0. ), fracFT( 0., 0. ), fracMuon( 0., 0. ); - if ( p_checkVP ) fracVP = LHCb::HashIDs::overlap( lhcbids, longIDs, LHCb::LHCbID::channelIDtype::VP ); - if ( p_checkUT ) fracUT = LHCb::HashIDs::overlap( lhcbids, longIDs, LHCb::LHCbID::channelIDtype::UT ); - if ( p_checkFT ) fracFT = LHCb::HashIDs::overlap( lhcbids, longIDs, LHCb::LHCbID::channelIDtype::FT ); - if ( p_checkMuon ) fracMuon = LHCb::HashIDs::overlap( lhcbids, muonids, LHCb::LHCbID::channelIDtype::Muon ); + if ( p_checkVP ) fracVP = LHCb::HashIDs::overlap( lhcbids, longIDs, LHCb::LHCbID::channelIDtype::VP ); + if ( p_checkUT ) fracUT = LHCb::HashIDs::overlap( lhcbids, longIDs, LHCb::LHCbID::channelIDtype::UT ); + if ( p_checkFT ) fracFT = LHCb::HashIDs::overlap( lhcbids, longIDs, LHCb::LHCbID::channelIDtype::FT ); + if ( p_checkMuon ) fracMuon = LHCb::HashIDs::overlap( lhcbids, muonids, LHCb::LHCbID::channelIDtype::Muon ); if ( p_checkVP ) debug() << "match fraction of VP hits " << fracVP.first << " " << fracVP.second << endmsg; if ( p_checkUT ) debug() << "match fraction of UT hits " << fracUT.first << " " << fracUT.second << endmsg; if ( p_checkFT ) debug() << "match fraction of FT hits " << fracFT.first << " " << fracFT.second << endmsg; - if ( p_checkMuon ) debug() << "match fraction of muon hits " << fracMuon.first << " " << fracMuon.second << endmsg; - - if ( p_checkVP && fracVP.first < m_thresVP.value() ) continue; - if ( p_checkUT && fracUT.first < m_thresUT.value() ) continue; - if ( p_checkFT && fracFT.first < m_thresFT.value() ) continue; - if ( p_checkMuon && fracMuon.first < m_thresMuon.value() ) continue; - - double frac = fracVP.first + fracUT.first + fracFT.first + fracMuon.first; - - if ( tmp_frac < frac ){ - tmp_frac = frac; - tmp_long = longpart; - } - } //end loop over long tracks - - if ( tmp_frac > 0 ){ - selectedComp.insert( composite ); + if ( p_checkMuon ) + debug() << "match fraction of muon hits " << fracMuon.first << " " << fracMuon.second << endmsg; + + if ( p_checkVP && fracVP.first < m_thresVP.value() ) continue; + if ( p_checkUT && fracUT.first < m_thresUT.value() ) continue; + if ( p_checkFT && fracFT.first < m_thresFT.value() ) continue; + if ( p_checkMuon && fracMuon.first < m_thresMuon.value() ) continue; + + double frac = fracVP.first + fracUT.first + fracFT.first + fracMuon.first; + + if ( tmp_frac < frac ) { + tmp_frac = frac; + tmp_long = longpart; + } + } // end loop over long tracks + + if ( tmp_frac > 0 ) { + selectedComp.insert( composite ); selectedLong.insert( tmp_long ); } - } //end loop over daughters - } //end loop over composites + } // end loop over daughters + } // end loop over composites filter_passed = selectedComp.size() > 0; m_matched += selectedComp.size(); return results; - } - -- GitLab From a8155fb1aa8bce8972a9f0f82c12b5e51cfe2355 Mon Sep 17 00:00:00 2001 From: Christoph Hasse Date: Tue, 7 Sep 2021 10:52:24 +0200 Subject: [PATCH 08/14] Apply 1 suggestion(s) to 1 file(s) --- Phys/RelatedInfoTools/src/ProbeAndLongMatcher.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/Phys/RelatedInfoTools/src/ProbeAndLongMatcher.cpp b/Phys/RelatedInfoTools/src/ProbeAndLongMatcher.cpp index 9493d3988..2a0b586c6 100644 --- a/Phys/RelatedInfoTools/src/ProbeAndLongMatcher.cpp +++ b/Phys/RelatedInfoTools/src/ProbeAndLongMatcher.cpp @@ -21,8 +21,6 @@ * by comparing the hits in sub-detector * Needed in the study of Tracking efficiency * - * @ author Giulia Frau, Peilian LI - * @ date 2021-06-01 * */ -- GitLab From 750e2f9ea0fd27df3fcd112938bb3a47c1c20535 Mon Sep 17 00:00:00 2001 From: Gerhard Raven Date: Tue, 7 Sep 2021 11:43:23 +0200 Subject: [PATCH 09/14] Apply 1 suggestion(s) to 1 file(s) --- Phys/RelatedInfoTools/src/ProbeAndLongMatcher.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Phys/RelatedInfoTools/src/ProbeAndLongMatcher.cpp b/Phys/RelatedInfoTools/src/ProbeAndLongMatcher.cpp index 2a0b586c6..96fce2d09 100644 --- a/Phys/RelatedInfoTools/src/ProbeAndLongMatcher.cpp +++ b/Phys/RelatedInfoTools/src/ProbeAndLongMatcher.cpp @@ -72,9 +72,7 @@ std::tuple ProbeAndL for ( const auto composite : composites ) { - const SmartRefVector daughters = composite->daughters(); // define composite daughters - - for ( const auto daughter : daughters ) { + for ( const auto daughter : composite->daughters() ) { const LHCb::ProtoParticle* proto = daughter->proto(); const LHCb::Track* track = proto->track(); -- GitLab From be39ee8719cf0432feaa97717a9eb0f31310ac47 Mon Sep 17 00:00:00 2001 From: Gerhard Raven Date: Tue, 7 Sep 2021 11:43:56 +0200 Subject: [PATCH 10/14] Apply 1 suggestion(s) to 1 file(s) --- Phys/RelatedInfoTools/src/ProbeAndLongMatcher.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Phys/RelatedInfoTools/src/ProbeAndLongMatcher.cpp b/Phys/RelatedInfoTools/src/ProbeAndLongMatcher.cpp index 96fce2d09..0478ed96f 100644 --- a/Phys/RelatedInfoTools/src/ProbeAndLongMatcher.cpp +++ b/Phys/RelatedInfoTools/src/ProbeAndLongMatcher.cpp @@ -80,7 +80,7 @@ std::tuple ProbeAndL // Sanity check from Particle_to_Particle.cpp if ( proto == nullptr ) { - Warning( "Charged ProtoParticle with no Track found. Ignoring." ).ignore(); + ++m_no_track; continue; } if ( track->states().empty() ) { -- GitLab From 768c7f2a03e8a4941f81542ca3b88694fe6736fc Mon Sep 17 00:00:00 2001 From: gifrau Date: Tue, 7 Sep 2021 12:14:15 +0200 Subject: [PATCH 11/14] Applying suggestions --- Phys/RelatedInfoTools/src/ProbeAndLongMatcher.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Phys/RelatedInfoTools/src/ProbeAndLongMatcher.cpp b/Phys/RelatedInfoTools/src/ProbeAndLongMatcher.cpp index 0478ed96f..2b1e943e3 100644 --- a/Phys/RelatedInfoTools/src/ProbeAndLongMatcher.cpp +++ b/Phys/RelatedInfoTools/src/ProbeAndLongMatcher.cpp @@ -1,5 +1,5 @@ /*****************************************************************************\ - * (c) Copyright 2000-2019 CERN for the benefit of the LHCb Collaboration * + * (c) Copyright 2000-2021 CERN for the benefit of the LHCb Collaboration * * * * This software is distributed under the terms of the GNU General Public * * Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". * @@ -50,6 +50,8 @@ private: mutable Gaudi::Accumulators::StatCounter m_all{this, "#Input composites"}; // Number of JPsi candidates mutable Gaudi::Accumulators::StatCounter m_matched{ this, "#Matched composites"}; // Number of JPsi candidates with a matched probe track + mutable Gaudi::Accumulators::MsgCounter m_no_track{this, "Charged ProtoParticle with no Track found. Ignoring." }; + }; DECLARE_COMPONENT( ProbeAndLongMatcher ) -- GitLab From d37bdbb7da7bcf6115a3432faf90544693d7eab5 Mon Sep 17 00:00:00 2001 From: Gitlab CI Date: Tue, 7 Sep 2021 16:01:57 +0000 Subject: [PATCH 12/14] Fixed formatting patch generated by https://gitlab.cern.ch/lhcb/Phys/-/jobs/16152348 --- Phys/RelatedInfoTools/src/ProbeAndLongMatcher.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Phys/RelatedInfoTools/src/ProbeAndLongMatcher.cpp b/Phys/RelatedInfoTools/src/ProbeAndLongMatcher.cpp index 2b1e943e3..8ce27a31c 100644 --- a/Phys/RelatedInfoTools/src/ProbeAndLongMatcher.cpp +++ b/Phys/RelatedInfoTools/src/ProbeAndLongMatcher.cpp @@ -50,8 +50,8 @@ private: mutable Gaudi::Accumulators::StatCounter m_all{this, "#Input composites"}; // Number of JPsi candidates mutable Gaudi::Accumulators::StatCounter m_matched{ this, "#Matched composites"}; // Number of JPsi candidates with a matched probe track - mutable Gaudi::Accumulators::MsgCounter m_no_track{this, "Charged ProtoParticle with no Track found. Ignoring." }; - + mutable Gaudi::Accumulators::MsgCounter m_no_track{ + this, "Charged ProtoParticle with no Track found. Ignoring."}; }; DECLARE_COMPONENT( ProbeAndLongMatcher ) -- GitLab From def896f695da6b02c427a10b745519df50956466 Mon Sep 17 00:00:00 2001 From: Peilian LI Date: Fri, 10 Sep 2021 15:08:04 +0200 Subject: [PATCH 13/14] fix the missing suggestion --- Phys/RelatedInfoTools/src/ProbeAndLongMatcher.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Phys/RelatedInfoTools/src/ProbeAndLongMatcher.cpp b/Phys/RelatedInfoTools/src/ProbeAndLongMatcher.cpp index 8ce27a31c..665aeaecd 100644 --- a/Phys/RelatedInfoTools/src/ProbeAndLongMatcher.cpp +++ b/Phys/RelatedInfoTools/src/ProbeAndLongMatcher.cpp @@ -51,7 +51,9 @@ private: mutable Gaudi::Accumulators::StatCounter m_matched{ this, "#Matched composites"}; // Number of JPsi candidates with a matched probe track mutable Gaudi::Accumulators::MsgCounter m_no_track{ - this, "Charged ProtoParticle with no Track found. Ignoring."}; + this, "Charged ProtoParticle with no Track found. This is likely to be a bug."}; + mutable Gaudi::Accumulators::MsgCounter m_no_state{ + this, "Track has empty states. This is likely to be a bug."}; }; DECLARE_COMPONENT( ProbeAndLongMatcher ) @@ -86,7 +88,7 @@ std::tuple ProbeAndL continue; } if ( track->states().empty() ) { - Warning( "Track has empty states. This is likely to be a bug" ).ignore(); + ++m_no_state; continue; } -- GitLab From 265941cab2888f1f9d52f1c6508128296b1bccb4 Mon Sep 17 00:00:00 2001 From: gifrau Date: Tue, 14 Sep 2021 11:01:36 +0200 Subject: [PATCH 14/14] Removing warning --- Phys/RelatedInfoTools/src/ProbeAndLongMatcher.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Phys/RelatedInfoTools/src/ProbeAndLongMatcher.cpp b/Phys/RelatedInfoTools/src/ProbeAndLongMatcher.cpp index 2b1e943e3..2436051c7 100644 --- a/Phys/RelatedInfoTools/src/ProbeAndLongMatcher.cpp +++ b/Phys/RelatedInfoTools/src/ProbeAndLongMatcher.cpp @@ -74,7 +74,7 @@ std::tuple ProbeAndL for ( const auto composite : composites ) { - for ( const auto daughter : composite->daughters() ) { + for ( const auto& daughter : composite->daughters() ) { const LHCb::ProtoParticle* proto = daughter->proto(); const LHCb::Track* track = proto->track(); -- GitLab