From ee7de0ce0a188d81d3566ec7fda43d4c17299972 Mon Sep 17 00:00:00 2001 From: Helder Lopes <lopes@lxplus9104.cern.ch> Date: Thu, 21 Mar 2024 21:28:11 +0100 Subject: [PATCH 01/14] Add relations tables with jet ID info --- Phys/JetAccessories/CMakeLists.txt | 4 + .../src/JetInfoRelationTable.cpp | 114 ++++++++++++++++++ 2 files changed, 118 insertions(+) create mode 100644 Phys/JetAccessories/src/JetInfoRelationTable.cpp diff --git a/Phys/JetAccessories/CMakeLists.txt b/Phys/JetAccessories/CMakeLists.txt index b3b9754caa9..ab33ff62c5b 100644 --- a/Phys/JetAccessories/CMakeLists.txt +++ b/Phys/JetAccessories/CMakeLists.txt @@ -16,10 +16,12 @@ Phys/JetAccessories gaudi_add_header_only_library(JetAccessoriesLib LINK Gaudi::GaudiKernel + Gaudi::GaudiAlgLib LHCb::CaloDetLib LHCb::PartPropLib LHCb::PhysEvent LHCb::RecEvent + LHCb::RelationsLib Rec::DaVinciInterfacesLib ) @@ -30,6 +32,7 @@ gaudi_add_module(JetAccessories src/ParticleFlowFilter.cpp src/ParticleFlowMaker.cpp src/ParticleFlowMakerMC.cpp + src/JetInfoRelationTable.cpp LINK AIDA::aida Boost::headers @@ -58,6 +61,7 @@ gaudi_add_module(JetAccessories ROOT::GenVector ROOT::Hist ROOT::MathCore + Rec::FunctorCoreLib ) gaudi_add_dictionary(JetAccessoriesDict diff --git a/Phys/JetAccessories/src/JetInfoRelationTable.cpp b/Phys/JetAccessories/src/JetInfoRelationTable.cpp new file mode 100644 index 00000000000..d531b90a443 --- /dev/null +++ b/Phys/JetAccessories/src/JetInfoRelationTable.cpp @@ -0,0 +1,114 @@ +/*****************************************************************************\ +* (c) Copyright 2022 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. * +\*****************************************************************************/ +/** +Algorithms for handling 1D relation tables: + +- to extract particle range from relation table (FROM = particles, TO= double). +Can optionally filter the tables using any functor with respect to the value +in TO column of the table. For single or multiple relation tables. +- to construct multiple relation tables from Additional Info +*/ +#include "Event/Particle.h" +#include "Event/TableView.h" +#include "Functors/with_functors.h" +#include "GaudiAlg/FunctionalDetails.h" +#include "LHCbAlgs/MergingTransformer.h" +#include "LHCbAlgs/SplittingTransformer.h" +#include "LHCbAlgs/Transformer.h" +#include "Relations/Relation1D.h" + +#include "Kernel/JetUtils.h" +#include "Math/VectorUtil.h" + +#include <map> +#include <stdexcept> +#include <string> + +#include <type_traits> +#include <vector> + +namespace LHCb { + using BaseClass_t = Gaudi::Functional::Traits::BaseClass_t<Gaudi::Algorithm>; + using Relations = LHCb::Relation1D<LHCb::Particle, double>; + using VectorOfRelations = Gaudi::Functional::vector_of_const_<Relations>; + + /** + Construct multiple relation tables from Jet Info + */ + class JetInfoRelationTable final + : public LHCb::Algorithm::SplittingTransformer<std::vector<Relations>( const LHCb::Particle::Range& )> { + + public: + Gaudi::Property<std::vector<std::string>> m_vai{this, "JetInfo", {std::string( "Unknown" )}, "List of jet infos."}; + + JetInfoRelationTable( const std::string& name, ISvcLocator* svcLoc ) + : SplittingTransformer( name, svcLoc, KeyValue( "InputParticles", {} ), KeyValues( "OutputLocation", {""} ) ) {} + + std::vector<Relations> operator()( const LHCb::Particle::Range& input ) const override { + assert( m_vai.size() == outputLocationSize() ); + std::vector<Relations> vai; + vai.reserve( m_vai.size() ); + for ( unsigned int i = 0; i < m_vai.size(); i++ ) { vai.emplace_back( Relations{input.size()} ); } + for ( const auto* prt : input ) { + double cpx( 0 ), cpy( 0 ), cptMax( 0 ), nptMax( 0 ), width( 0 ), norm( 0 ), trks( 0 ), + pt( prt->momentum().Pt() ); + const auto dtrs = LHCb::JetAccessories::getBasics( prt ); + for ( auto dtr : dtrs ) { + const Gaudi::LorentzVector& vec = dtr->momentum(); + if ( dtr->charge() != 0 ) { + if ( vec.Pt() > cptMax ) cptMax = vec.Pt(); + cpx += vec.Px(); + cpy += vec.Py(); + ++trks; + } else if ( vec.Pt() > nptMax ) + nptMax = vec.Pt(); + width += ROOT::Math::VectorUtil::DeltaR( vec, prt->momentum() ) * vec.Pt(); + norm += vec.Pt(); + } + // Add a check that the required info exists ... Return a dummy value if not, or raise an exception? + for ( auto&& [i, m_ai] : LHCb::range::enumerate( m_vai.value() ) ) { + if ( "Ntracks" == m_ai ) { + vai[i].relate( prt, trks ).ignore(); + continue; + } + if ( "MTF" == m_ai ) { + vai[i].relate( prt, cptMax / pt ).ignore(); + continue; + } + if ( "MNF" == m_ai ) { + vai[i].relate( prt, nptMax ).ignore(); + continue; + } + if ( "MPT" == m_ai ) { + vai[i].relate( prt, cptMax ).ignore(); + continue; + } + if ( "CPF" == m_ai ) { + vai[i].relate( prt, sqrt( cpx * cpx + cpy * cpy ) / pt ).ignore(); + continue; + } + if ( "JetWidth" == m_ai ) { + vai[i].relate( prt, width ).ignore(); + continue; + } + if ( "JetWidthNorm" == m_ai ) { + vai[i].relate( prt, width / norm ).ignore(); + continue; + } + } + } + return vai; + } + }; + + DECLARE_COMPONENT( JetInfoRelationTable ) + +} // namespace LHCb -- GitLab From ef16635bac5e46293d39465d39cf257e0bf1fc5b Mon Sep 17 00:00:00 2001 From: Helder Lopes <lopes@lxplus9101.cern.ch> Date: Tue, 23 Apr 2024 03:24:49 +0200 Subject: [PATCH 02/14] Implemented suggestions in MR Rec/3826 --- Phys/JetAccessories/CMakeLists.txt | 9 +--- Phys/JetAccessories/include/Kernel/JetEnums.h | 10 ++++ Phys/JetAccessories/src/JetEnums.cpp | 50 +++++++++++++++++++ .../src/JetInfoRelationTable.cpp | 40 ++++++--------- 4 files changed, 75 insertions(+), 34 deletions(-) create mode 100644 Phys/JetAccessories/src/JetEnums.cpp diff --git a/Phys/JetAccessories/CMakeLists.txt b/Phys/JetAccessories/CMakeLists.txt index ab33ff62c5b..f5e505b80a6 100644 --- a/Phys/JetAccessories/CMakeLists.txt +++ b/Phys/JetAccessories/CMakeLists.txt @@ -15,8 +15,6 @@ Phys/JetAccessories gaudi_add_header_only_library(JetAccessoriesLib LINK - Gaudi::GaudiKernel - Gaudi::GaudiAlgLib LHCb::CaloDetLib LHCb::PartPropLib LHCb::PhysEvent @@ -33,12 +31,11 @@ gaudi_add_module(JetAccessories src/ParticleFlowMaker.cpp src/ParticleFlowMakerMC.cpp src/JetInfoRelationTable.cpp + src/JetEnums.cpp LINK AIDA::aida Boost::headers FastJet::FastJet - Gaudi::GaudiAlgLib - Gaudi::GaudiKernel Gaudi::GaudiUtilsLib JetAccessoriesLib LHCb::CaloDetLib @@ -58,10 +55,6 @@ gaudi_add_module(JetAccessories Rec::DaVinciTypesLib Rec::LoKiPhysLib Rec::TrackInterfacesLib - ROOT::GenVector - ROOT::Hist - ROOT::MathCore - Rec::FunctorCoreLib ) gaudi_add_dictionary(JetAccessoriesDict diff --git a/Phys/JetAccessories/include/Kernel/JetEnums.h b/Phys/JetAccessories/include/Kernel/JetEnums.h index 1be3428235f..c1ea28b9679 100644 --- a/Phys/JetAccessories/include/Kernel/JetEnums.h +++ b/Phys/JetAccessories/include/Kernel/JetEnums.h @@ -11,6 +11,9 @@ #ifndef LHCB_JETEXTRAINFO_ENUMS_H #define LHCB_JETEXTRAINFO_ENUMS_H 1 +#include "GaudiKernel/StatusCode.h" +#include <string> + namespace LHCb { namespace ParticleFlowType { const int KEY = 900; @@ -131,5 +134,12 @@ namespace LHCb { }; } + + StatusCode parse( JetIDInfo::JetIDInfos& e, const std::string& in ); } // namespace LHCb + +namespace Gaudi::Parsers { + StatusCode parse( std::vector<LHCb::JetIDInfo::JetIDInfos>& v, const std::string& in ); +} // namespace Gaudi::Parsers + #endif // LHCB_JETEXTRAINFO_ENUMS_H 1 diff --git a/Phys/JetAccessories/src/JetEnums.cpp b/Phys/JetAccessories/src/JetEnums.cpp new file mode 100644 index 00000000000..01650671e37 --- /dev/null +++ b/Phys/JetAccessories/src/JetEnums.cpp @@ -0,0 +1,50 @@ +#include "Kernel/JetEnums.h" +#include "GaudiKernel/ParsersFactory.h" + +namespace { + static const GaudiUtils::VectorMap<std::string, LHCb::JetIDInfo::JetIDInfos> s_JetIDInfopMap_m = { + {"Ntracks", LHCb::JetIDInfo::JetIDInfos::Ntracks}, + {"N90", LHCb::JetIDInfo::JetIDInfos::N90}, + {"MTF", LHCb::JetIDInfo::JetIDInfos::MTF}, + {"CPF", LHCb::JetIDInfo::JetIDInfos::CPF}, + {"JetWidth", LHCb::JetIDInfo::JetIDInfos::JetWidth}, + {"NIPChi2Inf4", LHCb::JetIDInfo::JetIDInfos::NIPChi2Inf4}, + {"MPT", LHCb::JetIDInfo::JetIDInfos::MPT}, + {"MNF", LHCb::JetIDInfo::JetIDInfos::MNF}, + {"JetWidthNorm", LHCb::JetIDInfo::JetIDInfos::JetWidthNorm}, + }; +} + +namespace LHCb { + + namespace JetIDInfo { + const GaudiUtils::VectorMap<std::string, LHCb::JetIDInfo::JetIDInfos>& s_JetIDInfopMap() { + return s_JetIDInfopMap_m; + } + + StatusCode parse( JetIDInfo::JetIDInfos& ai, std::string in ) { + if ( in.size() > 1 && in.front() == in.back() && ( in.front() == '\'' || in.front() == '\"' ) ) { + in = in.substr( 1, in.size() - 2 ); + } + const auto& table = s_JetIDInfopMap(); + auto iter = table.find( in ); + if ( iter == table.end() ) return StatusCode::FAILURE; + ai = iter->second; + return StatusCode::SUCCESS; + } + } // namespace JetIDInfo +} // namespace LHCb + +namespace Gaudi::Parsers { + StatusCode parse( std::vector<LHCb::JetIDInfo::JetIDInfos>& v, const std::string& in ) { + std::vector<std::string> vs; + return parse( vs, in ).andThen( [&]() -> StatusCode { + v.clear(); + for ( const auto& s : vs ) { + LHCb::JetIDInfo::JetIDInfos ai; + LHCb::JetIDInfo::parse( ai, s ).andThen( [&] { v.push_back( ai ); } ).ignore(); + } + return v.size() == vs.size() ? StatusCode::SUCCESS : StatusCode::FAILURE; + } ); + } +} // namespace Gaudi::Parsers diff --git a/Phys/JetAccessories/src/JetInfoRelationTable.cpp b/Phys/JetAccessories/src/JetInfoRelationTable.cpp index d531b90a443..1c8f91bafc6 100644 --- a/Phys/JetAccessories/src/JetInfoRelationTable.cpp +++ b/Phys/JetAccessories/src/JetInfoRelationTable.cpp @@ -18,13 +18,10 @@ in TO column of the table. For single or multiple relation tables. */ #include "Event/Particle.h" #include "Event/TableView.h" -#include "Functors/with_functors.h" -#include "GaudiAlg/FunctionalDetails.h" -#include "LHCbAlgs/MergingTransformer.h" #include "LHCbAlgs/SplittingTransformer.h" -#include "LHCbAlgs/Transformer.h" #include "Relations/Relation1D.h" +#include "Kernel/JetEnums.h" #include "Kernel/JetUtils.h" #include "Math/VectorUtil.h" @@ -36,9 +33,8 @@ in TO column of the table. For single or multiple relation tables. #include <vector> namespace LHCb { - using BaseClass_t = Gaudi::Functional::Traits::BaseClass_t<Gaudi::Algorithm>; - using Relations = LHCb::Relation1D<LHCb::Particle, double>; - using VectorOfRelations = Gaudi::Functional::vector_of_const_<Relations>; + using Relations = LHCb::Relation1D<LHCb::Particle, double>; + using JetID = LHCb::JetIDInfo::JetIDInfos; /** Construct multiple relation tables from Jet Info @@ -47,16 +43,14 @@ namespace LHCb { : public LHCb::Algorithm::SplittingTransformer<std::vector<Relations>( const LHCb::Particle::Range& )> { public: - Gaudi::Property<std::vector<std::string>> m_vai{this, "JetInfo", {std::string( "Unknown" )}, "List of jet infos."}; + Gaudi::Property<std::vector<JetID>> m_vai{this, "JetInfo", {}, "List of jet infos."}; JetInfoRelationTable( const std::string& name, ISvcLocator* svcLoc ) : SplittingTransformer( name, svcLoc, KeyValue( "InputParticles", {} ), KeyValues( "OutputLocation", {""} ) ) {} std::vector<Relations> operator()( const LHCb::Particle::Range& input ) const override { assert( m_vai.size() == outputLocationSize() ); - std::vector<Relations> vai; - vai.reserve( m_vai.size() ); - for ( unsigned int i = 0; i < m_vai.size(); i++ ) { vai.emplace_back( Relations{input.size()} ); } + std::vector<Relations> vai( m_vai.size(), Relations{input.size()} ); for ( const auto* prt : input ) { double cpx( 0 ), cpy( 0 ), cptMax( 0 ), nptMax( 0 ), width( 0 ), norm( 0 ), trks( 0 ), pt( prt->momentum().Pt() ); @@ -73,33 +67,27 @@ namespace LHCb { width += ROOT::Math::VectorUtil::DeltaR( vec, prt->momentum() ) * vec.Pt(); norm += vec.Pt(); } - // Add a check that the required info exists ... Return a dummy value if not, or raise an exception? - for ( auto&& [i, m_ai] : LHCb::range::enumerate( m_vai.value() ) ) { - if ( "Ntracks" == m_ai ) { + for ( auto&& [i, ai] : LHCb::range::enumerate( m_vai.value() ) ) { + switch ( ai ) { + case JetID::Ntracks: vai[i].relate( prt, trks ).ignore(); continue; - } - if ( "MTF" == m_ai ) { + case JetID::MTF: vai[i].relate( prt, cptMax / pt ).ignore(); continue; - } - if ( "MNF" == m_ai ) { + case JetID::MNF: vai[i].relate( prt, nptMax ).ignore(); continue; - } - if ( "MPT" == m_ai ) { + case JetID::MPT: vai[i].relate( prt, cptMax ).ignore(); continue; - } - if ( "CPF" == m_ai ) { + case JetID::CPF: vai[i].relate( prt, sqrt( cpx * cpx + cpy * cpy ) / pt ).ignore(); continue; - } - if ( "JetWidth" == m_ai ) { + case JetID::JetWidth: vai[i].relate( prt, width ).ignore(); continue; - } - if ( "JetWidthNorm" == m_ai ) { + case JetID::JetWidthNorm: vai[i].relate( prt, width / norm ).ignore(); continue; } -- GitLab From 0a11d15488b1de4ce10027ae174b1e45c1414e52 Mon Sep 17 00:00:00 2001 From: Helder Lopes <lopes@lxplus9101.cern.ch> Date: Tue, 23 Apr 2024 03:34:04 +0200 Subject: [PATCH 03/14] Added copyright statement to JetEnums.cpp --- Phys/JetAccessories/src/JetEnums.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Phys/JetAccessories/src/JetEnums.cpp b/Phys/JetAccessories/src/JetEnums.cpp index 01650671e37..1cc6fd0b1a1 100644 --- a/Phys/JetAccessories/src/JetEnums.cpp +++ b/Phys/JetAccessories/src/JetEnums.cpp @@ -1,3 +1,13 @@ +/*****************************************************************************\ +* (c) Copyright 2024 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 "Kernel/JetEnums.h" #include "GaudiKernel/ParsersFactory.h" -- GitLab From cdfa3d9f1317e2d40099eb916d19b4b16825c4ee Mon Sep 17 00:00:00 2001 From: Helder Lopes <lopes@lxplus913.cern.ch> Date: Sat, 4 May 2024 02:41:06 +0200 Subject: [PATCH 04/14] Fixed use of getBasics(...) in JetInfoRelationTable --- Phys/JetAccessories/src/JetInfoRelationTable.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Phys/JetAccessories/src/JetInfoRelationTable.cpp b/Phys/JetAccessories/src/JetInfoRelationTable.cpp index 1c8f91bafc6..5853121cac4 100644 --- a/Phys/JetAccessories/src/JetInfoRelationTable.cpp +++ b/Phys/JetAccessories/src/JetInfoRelationTable.cpp @@ -21,8 +21,8 @@ in TO column of the table. For single or multiple relation tables. #include "LHCbAlgs/SplittingTransformer.h" #include "Relations/Relation1D.h" +#include "JetUtils.h" #include "Kernel/JetEnums.h" -#include "Kernel/JetUtils.h" #include "Math/VectorUtil.h" #include <map> @@ -51,10 +51,10 @@ namespace LHCb { std::vector<Relations> operator()( const LHCb::Particle::Range& input ) const override { assert( m_vai.size() == outputLocationSize() ); std::vector<Relations> vai( m_vai.size(), Relations{input.size()} ); - for ( const auto* prt : input ) { + for ( auto* prt : input ) { double cpx( 0 ), cpy( 0 ), cptMax( 0 ), nptMax( 0 ), width( 0 ), norm( 0 ), trks( 0 ), pt( prt->momentum().Pt() ); - const auto dtrs = LHCb::JetAccessories::getBasics( prt ); + auto dtrs = LHCb::JetAccessories::getBasics( *prt ); for ( auto dtr : dtrs ) { const Gaudi::LorentzVector& vec = dtr->momentum(); if ( dtr->charge() != 0 ) { -- GitLab From 0cb304b4b42945e5e5b92ea919b36bd19b3cafdf Mon Sep 17 00:00:00 2001 From: Helder Lopes <lopes@lxplus9104.cern.ch> Date: Thu, 21 Mar 2024 21:28:11 +0100 Subject: [PATCH 05/14] Add relations tables with jet ID info --- Phys/JetAccessories/CMakeLists.txt | 8 +++-- .../src/JetInfoRelationTable.cpp | 36 +++++++++---------- 2 files changed, 24 insertions(+), 20 deletions(-) diff --git a/Phys/JetAccessories/CMakeLists.txt b/Phys/JetAccessories/CMakeLists.txt index f5e505b80a6..17697b63765 100644 --- a/Phys/JetAccessories/CMakeLists.txt +++ b/Phys/JetAccessories/CMakeLists.txt @@ -15,6 +15,8 @@ Phys/JetAccessories gaudi_add_header_only_library(JetAccessoriesLib LINK + Gaudi::GaudiKernel + Gaudi::GaudiAlgLib LHCb::CaloDetLib LHCb::PartPropLib LHCb::PhysEvent @@ -30,8 +32,7 @@ gaudi_add_module(JetAccessories src/ParticleFlowFilter.cpp src/ParticleFlowMaker.cpp src/ParticleFlowMakerMC.cpp - src/JetInfoRelationTable.cpp - src/JetEnums.cpp + src/JetInfoRelationTable.cpp LINK AIDA::aida Boost::headers @@ -55,6 +56,9 @@ gaudi_add_module(JetAccessories Rec::DaVinciTypesLib Rec::LoKiPhysLib Rec::TrackInterfacesLib + ROOT::GenVector + ROOT::Hist + ROOT::MathCore ) gaudi_add_dictionary(JetAccessoriesDict diff --git a/Phys/JetAccessories/src/JetInfoRelationTable.cpp b/Phys/JetAccessories/src/JetInfoRelationTable.cpp index 5853121cac4..6dc63e1c761 100644 --- a/Phys/JetAccessories/src/JetInfoRelationTable.cpp +++ b/Phys/JetAccessories/src/JetInfoRelationTable.cpp @@ -1,21 +1,21 @@ /*****************************************************************************\ -* (c) Copyright 2022 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. * -\*****************************************************************************/ + * * (c) Copyright 2022 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. * + * \*****************************************************************************/ /** -Algorithms for handling 1D relation tables: - -- to extract particle range from relation table (FROM = particles, TO= double). -Can optionally filter the tables using any functor with respect to the value -in TO column of the table. For single or multiple relation tables. -- to construct multiple relation tables from Additional Info -*/ + * Algorithms for handling 1D relation tables: + * + * - to extract particle range from relation table (FROM = particles, TO= double). + * Can optionally filter the tables using any functor with respect to the value + * in TO column of the table. For single or multiple relation tables. + * - to construct multiple relation tables from Additional Info + * */ #include "Event/Particle.h" #include "Event/TableView.h" #include "LHCbAlgs/SplittingTransformer.h" @@ -37,8 +37,8 @@ namespace LHCb { using JetID = LHCb::JetIDInfo::JetIDInfos; /** - Construct multiple relation tables from Jet Info - */ + * Construct multiple relation tables from Jet Info + * */ class JetInfoRelationTable final : public LHCb::Algorithm::SplittingTransformer<std::vector<Relations>( const LHCb::Particle::Range& )> { -- GitLab From dd04647f399024369efb476d4b3a862e1cc8102e Mon Sep 17 00:00:00 2001 From: Helder Lopes <lopes@lxplus9101.cern.ch> Date: Tue, 23 Apr 2024 03:24:49 +0200 Subject: [PATCH 06/14] Implemented suggestions in MR Rec/3826 --- Phys/JetAccessories/CMakeLists.txt | 3 +- Phys/JetAccessories/src/JetEnums.cpp | 60 ---------------------------- 2 files changed, 1 insertion(+), 62 deletions(-) delete mode 100644 Phys/JetAccessories/src/JetEnums.cpp diff --git a/Phys/JetAccessories/CMakeLists.txt b/Phys/JetAccessories/CMakeLists.txt index 17697b63765..090c0d06883 100644 --- a/Phys/JetAccessories/CMakeLists.txt +++ b/Phys/JetAccessories/CMakeLists.txt @@ -16,12 +16,11 @@ Phys/JetAccessories gaudi_add_header_only_library(JetAccessoriesLib LINK Gaudi::GaudiKernel - Gaudi::GaudiAlgLib LHCb::CaloDetLib LHCb::PartPropLib LHCb::PhysEvent LHCb::RecEvent - LHCb::RelationsLib + LHCb::RelationsLib Rec::DaVinciInterfacesLib ) diff --git a/Phys/JetAccessories/src/JetEnums.cpp b/Phys/JetAccessories/src/JetEnums.cpp deleted file mode 100644 index 1cc6fd0b1a1..00000000000 --- a/Phys/JetAccessories/src/JetEnums.cpp +++ /dev/null @@ -1,60 +0,0 @@ -/*****************************************************************************\ -* (c) Copyright 2024 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 "Kernel/JetEnums.h" -#include "GaudiKernel/ParsersFactory.h" - -namespace { - static const GaudiUtils::VectorMap<std::string, LHCb::JetIDInfo::JetIDInfos> s_JetIDInfopMap_m = { - {"Ntracks", LHCb::JetIDInfo::JetIDInfos::Ntracks}, - {"N90", LHCb::JetIDInfo::JetIDInfos::N90}, - {"MTF", LHCb::JetIDInfo::JetIDInfos::MTF}, - {"CPF", LHCb::JetIDInfo::JetIDInfos::CPF}, - {"JetWidth", LHCb::JetIDInfo::JetIDInfos::JetWidth}, - {"NIPChi2Inf4", LHCb::JetIDInfo::JetIDInfos::NIPChi2Inf4}, - {"MPT", LHCb::JetIDInfo::JetIDInfos::MPT}, - {"MNF", LHCb::JetIDInfo::JetIDInfos::MNF}, - {"JetWidthNorm", LHCb::JetIDInfo::JetIDInfos::JetWidthNorm}, - }; -} - -namespace LHCb { - - namespace JetIDInfo { - const GaudiUtils::VectorMap<std::string, LHCb::JetIDInfo::JetIDInfos>& s_JetIDInfopMap() { - return s_JetIDInfopMap_m; - } - - StatusCode parse( JetIDInfo::JetIDInfos& ai, std::string in ) { - if ( in.size() > 1 && in.front() == in.back() && ( in.front() == '\'' || in.front() == '\"' ) ) { - in = in.substr( 1, in.size() - 2 ); - } - const auto& table = s_JetIDInfopMap(); - auto iter = table.find( in ); - if ( iter == table.end() ) return StatusCode::FAILURE; - ai = iter->second; - return StatusCode::SUCCESS; - } - } // namespace JetIDInfo -} // namespace LHCb - -namespace Gaudi::Parsers { - StatusCode parse( std::vector<LHCb::JetIDInfo::JetIDInfos>& v, const std::string& in ) { - std::vector<std::string> vs; - return parse( vs, in ).andThen( [&]() -> StatusCode { - v.clear(); - for ( const auto& s : vs ) { - LHCb::JetIDInfo::JetIDInfos ai; - LHCb::JetIDInfo::parse( ai, s ).andThen( [&] { v.push_back( ai ); } ).ignore(); - } - return v.size() == vs.size() ? StatusCode::SUCCESS : StatusCode::FAILURE; - } ); - } -} // namespace Gaudi::Parsers -- GitLab From 48e9a3c96adfa2a385805eee638e4f0d8ba82a4e Mon Sep 17 00:00:00 2001 From: Murilo Santana Rangel <murilo.rangel@cern.ch> Date: Sat, 8 Jun 2024 15:01:04 +0200 Subject: [PATCH 07/14] updated - but not compiling --- Phys/JetAccessories/CMakeLists.txt | 6 +--- Phys/JetAccessories/include/Kernel/JetEnums.h | 10 ------- Phys/JetAccessories/src/FastJetBuilder.cpp | 30 +++++++++---------- 3 files changed, 16 insertions(+), 30 deletions(-) diff --git a/Phys/JetAccessories/CMakeLists.txt b/Phys/JetAccessories/CMakeLists.txt index 090c0d06883..db4a7f51e6c 100644 --- a/Phys/JetAccessories/CMakeLists.txt +++ b/Phys/JetAccessories/CMakeLists.txt @@ -15,12 +15,11 @@ Phys/JetAccessories gaudi_add_header_only_library(JetAccessoriesLib LINK - Gaudi::GaudiKernel LHCb::CaloDetLib LHCb::PartPropLib LHCb::PhysEvent LHCb::RecEvent - LHCb::RelationsLib + LHCb::RelationsLib Rec::DaVinciInterfacesLib ) @@ -55,9 +54,6 @@ gaudi_add_module(JetAccessories Rec::DaVinciTypesLib Rec::LoKiPhysLib Rec::TrackInterfacesLib - ROOT::GenVector - ROOT::Hist - ROOT::MathCore ) gaudi_add_dictionary(JetAccessoriesDict diff --git a/Phys/JetAccessories/include/Kernel/JetEnums.h b/Phys/JetAccessories/include/Kernel/JetEnums.h index c1ea28b9679..c4b123d6529 100644 --- a/Phys/JetAccessories/include/Kernel/JetEnums.h +++ b/Phys/JetAccessories/include/Kernel/JetEnums.h @@ -49,23 +49,13 @@ namespace LHCb { } // namespace ParticleFlowType namespace JetIDInfo { enum JetIDInfos { - StartJetIDInfo = 9000, Ntracks = 9001, - N90 = 9002, MTF = 9003, - NSatCalo = 9004, - NHasPV = 9005, CPF = 9006, JetWidth = 9007, - NSatECAL = 9008, - NSatHCAL = 9009, - NIPChi2Inf4 = 9010, MPT = 9011, MNF = 9012, JetWidthNorm = 9013, - vtx_x = 9016, - vtx_y = 9017, - vtx_z = 9018, }; } namespace JECInfo { diff --git a/Phys/JetAccessories/src/FastJetBuilder.cpp b/Phys/JetAccessories/src/FastJetBuilder.cpp index 8b7a05a37bf..d4ea957d34a 100644 --- a/Phys/JetAccessories/src/FastJetBuilder.cpp +++ b/Phys/JetAccessories/src/FastJetBuilder.cpp @@ -469,9 +469,9 @@ LHCb::Particles FastJetBuilder::operator()( const LHCb::Particle::Range& Particl auto tmprecojets = makeFastJets( prts, geometry ); recojets.reserve( tmprecojets.size() ); for ( auto& jet : tmprecojets ) { - jet->addInfo( LHCb::JetIDInfo::vtx_x, vtx.X() ); - jet->addInfo( LHCb::JetIDInfo::vtx_y, vtx.Y() ); - jet->addInfo( LHCb::JetIDInfo::vtx_z, vtx.Z() ); +// jet->addInfo( LHCb::JetIDInfo::vtx_x, vtx.X() ); +// jet->addInfo( LHCb::JetIDInfo::vtx_y, vtx.Y() ); +// jet->addInfo( LHCb::JetIDInfo::vtx_z, vtx.Z() ); recojets.insert( jet.release() ); } } @@ -511,9 +511,9 @@ LHCb::Particles FastJetBuilder::operator()( const LHCb::Particle::Range& Particl recojets.reserve( tmprecojets.size() ); for ( auto& jet : tmprecojets ) { jet->setPV( vtx ); - jet->addInfo( LHCb::JetIDInfo::vtx_x, vtx->position().X() ); // TODO: remove: redundant information - jet->addInfo( LHCb::JetIDInfo::vtx_y, vtx->position().Y() ); // TODO: remove: redundant information - jet->addInfo( LHCb::JetIDInfo::vtx_z, vtx->position().Z() ); // TODO: remove: redundant information +// jet->addInfo( LHCb::JetIDInfo::vtx_x, vtx->position().X() ); // TODO: remove: redundant information +// jet->addInfo( LHCb::JetIDInfo::vtx_y, vtx->position().Y() ); // TODO: remove: redundant information +// jet->addInfo( LHCb::JetIDInfo::vtx_z, vtx->position().Z() ); // TODO: remove: redundant information recojets.insert( jet.release() ); } } @@ -527,15 +527,15 @@ LHCb::Particles FastJetBuilder::operator()( const LHCb::Particle::Range& Particl for ( auto& jet : tmprecojets ) { auto vtx = m_prtVtxTool->relatedPV( jet.get(), PrimaryVertices ); jet->setPV( vtx ); - if ( vtx ) { - jet->addInfo( LHCb::JetIDInfo::vtx_x, vtx->position().X() ); // TODO: remove: redundant information - jet->addInfo( LHCb::JetIDInfo::vtx_y, vtx->position().Y() ); // TODO: remove: redundant information - jet->addInfo( LHCb::JetIDInfo::vtx_z, vtx->position().Z() ); // TODO: remove: redundant information - } else { - jet->addInfo( LHCb::JetIDInfo::vtx_x, 0. ); // TODO: remove: redundant information - jet->addInfo( LHCb::JetIDInfo::vtx_y, 0. ); // TODO: remove: redundant information - jet->addInfo( LHCb::JetIDInfo::vtx_z, 0. ); // TODO: remove: redundant information - } +// if ( vtx ) { +// jet->addInfo( LHCb::JetIDInfo::vtx_x, vtx->position().X() ); // TODO: remove: redundant information +// jet->addInfo( LHCb::JetIDInfo::vtx_y, vtx->position().Y() ); // TODO: remove: redundant information +// jet->addInfo( LHCb::JetIDInfo::vtx_z, vtx->position().Z() ); // TODO: remove: redundant information +// } else { +// jet->addInfo( LHCb::JetIDInfo::vtx_x, 0. ); // TODO: remove: redundant information +// jet->addInfo( LHCb::JetIDInfo::vtx_y, 0. ); // TODO: remove: redundant information +// jet->addInfo( LHCb::JetIDInfo::vtx_z, 0. ); // TODO: remove: redundant information +// } recojets.insert( jet.release() ); } } -- GitLab From 794c53736b144dc18c0c7dcd59b72f6573d61855 Mon Sep 17 00:00:00 2001 From: Murilo Santana Rangel <murilo.rangel@cern.ch> Date: Sat, 8 Jun 2024 21:32:32 +0200 Subject: [PATCH 08/14] update CMakeList --- Phys/JetAccessories/CMakeLists.txt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Phys/JetAccessories/CMakeLists.txt b/Phys/JetAccessories/CMakeLists.txt index db4a7f51e6c..89b657ef954 100644 --- a/Phys/JetAccessories/CMakeLists.txt +++ b/Phys/JetAccessories/CMakeLists.txt @@ -15,11 +15,12 @@ Phys/JetAccessories gaudi_add_header_only_library(JetAccessoriesLib LINK + Gaudi::GaudiKernel LHCb::CaloDetLib LHCb::PartPropLib LHCb::PhysEvent LHCb::RecEvent - LHCb::RelationsLib + LHCb::RelationsLib Rec::DaVinciInterfacesLib ) @@ -35,6 +36,8 @@ gaudi_add_module(JetAccessories AIDA::aida Boost::headers FastJet::FastJet + Gaudi::GaudiAlgLib + Gaudi::GaudiKernel Gaudi::GaudiUtilsLib JetAccessoriesLib LHCb::CaloDetLib @@ -54,6 +57,9 @@ gaudi_add_module(JetAccessories Rec::DaVinciTypesLib Rec::LoKiPhysLib Rec::TrackInterfacesLib + ROOT::GenVector + ROOT::Hist + ROOT::MathCore ) gaudi_add_dictionary(JetAccessoriesDict -- GitLab From 173e9535a5f62c48c3a045af8610d58fcc7d1bff Mon Sep 17 00:00:00 2001 From: Murilo Santana Rangel <murilo.rangel@cern.ch> Date: Tue, 11 Jun 2024 18:28:43 +0200 Subject: [PATCH 09/14] rebased to 2024-patches --- Phys/JetAccessories/CMakeLists.txt | 1 + Phys/JetAccessories/src/JetEnums.cpp | 58 ++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100644 Phys/JetAccessories/src/JetEnums.cpp diff --git a/Phys/JetAccessories/CMakeLists.txt b/Phys/JetAccessories/CMakeLists.txt index 89b657ef954..3219b5a5cf4 100644 --- a/Phys/JetAccessories/CMakeLists.txt +++ b/Phys/JetAccessories/CMakeLists.txt @@ -32,6 +32,7 @@ gaudi_add_module(JetAccessories src/ParticleFlowMaker.cpp src/ParticleFlowMakerMC.cpp src/JetInfoRelationTable.cpp + src/JetEnums.cpp LINK AIDA::aida Boost::headers diff --git a/Phys/JetAccessories/src/JetEnums.cpp b/Phys/JetAccessories/src/JetEnums.cpp new file mode 100644 index 00000000000..2c5ad98a04c --- /dev/null +++ b/Phys/JetAccessories/src/JetEnums.cpp @@ -0,0 +1,58 @@ +/*****************************************************************************\ +* (c) Copyright 2024 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 "Kernel/JetEnums.h" +#include "GaudiKernel/ParsersFactory.h" + +namespace { + static const GaudiUtils::VectorMap<std::string, LHCb::JetIDInfo::JetIDInfos> s_JetIDInfopMap_m = { + {"Ntracks", LHCb::JetIDInfo::JetIDInfos::Ntracks}, + {"MTF", LHCb::JetIDInfo::JetIDInfos::MTF}, + {"CPF", LHCb::JetIDInfo::JetIDInfos::CPF}, + {"JetWidth", LHCb::JetIDInfo::JetIDInfos::JetWidth}, + {"MPT", LHCb::JetIDInfo::JetIDInfos::MPT}, + {"MNF", LHCb::JetIDInfo::JetIDInfos::MNF}, + {"JetWidthNorm", LHCb::JetIDInfo::JetIDInfos::JetWidthNorm}, + }; +} + +namespace LHCb { + + namespace JetIDInfo { + const GaudiUtils::VectorMap<std::string, LHCb::JetIDInfo::JetIDInfos>& s_JetIDInfopMap() { + return s_JetIDInfopMap_m; + } + + StatusCode parse( JetIDInfo::JetIDInfos& ai, std::string in ) { + if ( in.size() > 1 && in.front() == in.back() && ( in.front() == '\'' || in.front() == '\"' ) ) { + in = in.substr( 1, in.size() - 2 ); + } + const auto& table = s_JetIDInfopMap(); + auto iter = table.find( in ); + if ( iter == table.end() ) return StatusCode::FAILURE; + ai = iter->second; + return StatusCode::SUCCESS; + } + } // namespace JetIDInfo +} // namespace LHCb + +namespace Gaudi::Parsers { + StatusCode parse( std::vector<LHCb::JetIDInfo::JetIDInfos>& v, const std::string& in ) { + std::vector<std::string> vs; + return parse( vs, in ).andThen( [&]() -> StatusCode { + v.clear(); + for ( const auto& s : vs ) { + LHCb::JetIDInfo::JetIDInfos ai; + LHCb::JetIDInfo::parse( ai, s ).andThen( [&] { v.push_back( ai ); } ).ignore(); + } + return v.size() == vs.size() ? StatusCode::SUCCESS : StatusCode::FAILURE; + } ); + } +} // namespace Gaudi::Parsers -- GitLab From 40123aab4cb0e4499e9a0d7aa42c8f20fff0ffab Mon Sep 17 00:00:00 2001 From: Gitlab CI <noreply@cern.ch> Date: Tue, 11 Jun 2024 16:29:59 +0000 Subject: [PATCH 10/14] Fixed formatting patch generated by https://gitlab.cern.ch/lhcb/Rec/-/jobs/39937328 --- Phys/JetAccessories/include/Kernel/JetEnums.h | 14 ++++----- Phys/JetAccessories/src/FastJetBuilder.cpp | 31 ++++++++++--------- 2 files changed, 23 insertions(+), 22 deletions(-) diff --git a/Phys/JetAccessories/include/Kernel/JetEnums.h b/Phys/JetAccessories/include/Kernel/JetEnums.h index c4b123d6529..c4a2fb24dbb 100644 --- a/Phys/JetAccessories/include/Kernel/JetEnums.h +++ b/Phys/JetAccessories/include/Kernel/JetEnums.h @@ -49,13 +49,13 @@ namespace LHCb { } // namespace ParticleFlowType namespace JetIDInfo { enum JetIDInfos { - Ntracks = 9001, - MTF = 9003, - CPF = 9006, - JetWidth = 9007, - MPT = 9011, - MNF = 9012, - JetWidthNorm = 9013, + Ntracks = 9001, + MTF = 9003, + CPF = 9006, + JetWidth = 9007, + MPT = 9011, + MNF = 9012, + JetWidthNorm = 9013, }; } namespace JECInfo { diff --git a/Phys/JetAccessories/src/FastJetBuilder.cpp b/Phys/JetAccessories/src/FastJetBuilder.cpp index d4ea957d34a..929cb261aca 100644 --- a/Phys/JetAccessories/src/FastJetBuilder.cpp +++ b/Phys/JetAccessories/src/FastJetBuilder.cpp @@ -469,9 +469,9 @@ LHCb::Particles FastJetBuilder::operator()( const LHCb::Particle::Range& Particl auto tmprecojets = makeFastJets( prts, geometry ); recojets.reserve( tmprecojets.size() ); for ( auto& jet : tmprecojets ) { -// jet->addInfo( LHCb::JetIDInfo::vtx_x, vtx.X() ); -// jet->addInfo( LHCb::JetIDInfo::vtx_y, vtx.Y() ); -// jet->addInfo( LHCb::JetIDInfo::vtx_z, vtx.Z() ); + // jet->addInfo( LHCb::JetIDInfo::vtx_x, vtx.X() ); + // jet->addInfo( LHCb::JetIDInfo::vtx_y, vtx.Y() ); + // jet->addInfo( LHCb::JetIDInfo::vtx_z, vtx.Z() ); recojets.insert( jet.release() ); } } @@ -511,9 +511,10 @@ LHCb::Particles FastJetBuilder::operator()( const LHCb::Particle::Range& Particl recojets.reserve( tmprecojets.size() ); for ( auto& jet : tmprecojets ) { jet->setPV( vtx ); -// jet->addInfo( LHCb::JetIDInfo::vtx_x, vtx->position().X() ); // TODO: remove: redundant information -// jet->addInfo( LHCb::JetIDInfo::vtx_y, vtx->position().Y() ); // TODO: remove: redundant information -// jet->addInfo( LHCb::JetIDInfo::vtx_z, vtx->position().Z() ); // TODO: remove: redundant information + // jet->addInfo( LHCb::JetIDInfo::vtx_x, vtx->position().X() ); // TODO: remove: redundant + // information jet->addInfo( LHCb::JetIDInfo::vtx_y, vtx->position().Y() ); // TODO: remove: + // redundant information jet->addInfo( LHCb::JetIDInfo::vtx_z, vtx->position().Z() ); // TODO: + // remove: redundant information recojets.insert( jet.release() ); } } @@ -527,15 +528,15 @@ LHCb::Particles FastJetBuilder::operator()( const LHCb::Particle::Range& Particl for ( auto& jet : tmprecojets ) { auto vtx = m_prtVtxTool->relatedPV( jet.get(), PrimaryVertices ); jet->setPV( vtx ); -// if ( vtx ) { -// jet->addInfo( LHCb::JetIDInfo::vtx_x, vtx->position().X() ); // TODO: remove: redundant information -// jet->addInfo( LHCb::JetIDInfo::vtx_y, vtx->position().Y() ); // TODO: remove: redundant information -// jet->addInfo( LHCb::JetIDInfo::vtx_z, vtx->position().Z() ); // TODO: remove: redundant information -// } else { -// jet->addInfo( LHCb::JetIDInfo::vtx_x, 0. ); // TODO: remove: redundant information -// jet->addInfo( LHCb::JetIDInfo::vtx_y, 0. ); // TODO: remove: redundant information -// jet->addInfo( LHCb::JetIDInfo::vtx_z, 0. ); // TODO: remove: redundant information -// } + // if ( vtx ) { + // jet->addInfo( LHCb::JetIDInfo::vtx_x, vtx->position().X() ); // TODO: remove: redundant information + // jet->addInfo( LHCb::JetIDInfo::vtx_y, vtx->position().Y() ); // TODO: remove: redundant information + // jet->addInfo( LHCb::JetIDInfo::vtx_z, vtx->position().Z() ); // TODO: remove: redundant information + // } else { + // jet->addInfo( LHCb::JetIDInfo::vtx_x, 0. ); // TODO: remove: redundant information + // jet->addInfo( LHCb::JetIDInfo::vtx_y, 0. ); // TODO: remove: redundant information + // jet->addInfo( LHCb::JetIDInfo::vtx_z, 0. ); // TODO: remove: redundant information + // } recojets.insert( jet.release() ); } } -- GitLab From 4fd63bf723c1fadefe7ae1d7208ab7cc56ed2de1 Mon Sep 17 00:00:00 2001 From: Helder Lopes <you@example.com> Date: Sat, 13 Jul 2024 21:42:39 +0200 Subject: [PATCH 11/14] Fixed bug in MNF variable --- Phys/JetAccessories/src/JetInfoRelationTable.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Phys/JetAccessories/src/JetInfoRelationTable.cpp b/Phys/JetAccessories/src/JetInfoRelationTable.cpp index 6dc63e1c761..e964fa7d236 100644 --- a/Phys/JetAccessories/src/JetInfoRelationTable.cpp +++ b/Phys/JetAccessories/src/JetInfoRelationTable.cpp @@ -76,7 +76,7 @@ namespace LHCb { vai[i].relate( prt, cptMax / pt ).ignore(); continue; case JetID::MNF: - vai[i].relate( prt, nptMax ).ignore(); + vai[i].relate( prt, nptMax / pt ).ignore(); continue; case JetID::MPT: vai[i].relate( prt, cptMax ).ignore(); -- GitLab From 7cb888e96f4bef7b86f6d855d98ee38d24a0a868 Mon Sep 17 00:00:00 2001 From: Helder Lopes <you@example.com> Date: Tue, 16 Jul 2024 15:03:33 +0200 Subject: [PATCH 12/14] Fixed setting PV for MC jets and removed coments in FastJetBuilder --- Phys/JetAccessories/src/FastJetBuilder.cpp | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/Phys/JetAccessories/src/FastJetBuilder.cpp b/Phys/JetAccessories/src/FastJetBuilder.cpp index 929cb261aca..4b6d5592f4a 100644 --- a/Phys/JetAccessories/src/FastJetBuilder.cpp +++ b/Phys/JetAccessories/src/FastJetBuilder.cpp @@ -469,9 +469,9 @@ LHCb::Particles FastJetBuilder::operator()( const LHCb::Particle::Range& Particl auto tmprecojets = makeFastJets( prts, geometry ); recojets.reserve( tmprecojets.size() ); for ( auto& jet : tmprecojets ) { - // jet->addInfo( LHCb::JetIDInfo::vtx_x, vtx.X() ); - // jet->addInfo( LHCb::JetIDInfo::vtx_y, vtx.Y() ); - // jet->addInfo( LHCb::JetIDInfo::vtx_z, vtx.Z() ); + jet->addInfo( LHCb::JetPFMCInfo::mcpv_x, vtx.X() ); + jet->addInfo( LHCb::JetPFMCInfo::mcpv_y, vtx.Y() ); + jet->addInfo( LHCb::JetPFMCInfo::mcpv_z, vtx.Z() ); recojets.insert( jet.release() ); } } @@ -511,10 +511,6 @@ LHCb::Particles FastJetBuilder::operator()( const LHCb::Particle::Range& Particl recojets.reserve( tmprecojets.size() ); for ( auto& jet : tmprecojets ) { jet->setPV( vtx ); - // jet->addInfo( LHCb::JetIDInfo::vtx_x, vtx->position().X() ); // TODO: remove: redundant - // information jet->addInfo( LHCb::JetIDInfo::vtx_y, vtx->position().Y() ); // TODO: remove: - // redundant information jet->addInfo( LHCb::JetIDInfo::vtx_z, vtx->position().Z() ); // TODO: - // remove: redundant information recojets.insert( jet.release() ); } } @@ -528,16 +524,6 @@ LHCb::Particles FastJetBuilder::operator()( const LHCb::Particle::Range& Particl for ( auto& jet : tmprecojets ) { auto vtx = m_prtVtxTool->relatedPV( jet.get(), PrimaryVertices ); jet->setPV( vtx ); - // if ( vtx ) { - // jet->addInfo( LHCb::JetIDInfo::vtx_x, vtx->position().X() ); // TODO: remove: redundant information - // jet->addInfo( LHCb::JetIDInfo::vtx_y, vtx->position().Y() ); // TODO: remove: redundant information - // jet->addInfo( LHCb::JetIDInfo::vtx_z, vtx->position().Z() ); // TODO: remove: redundant information - // } else { - // jet->addInfo( LHCb::JetIDInfo::vtx_x, 0. ); // TODO: remove: redundant information - // jet->addInfo( LHCb::JetIDInfo::vtx_y, 0. ); // TODO: remove: redundant information - // jet->addInfo( LHCb::JetIDInfo::vtx_z, 0. ); // TODO: remove: redundant information - // } - recojets.insert( jet.release() ); } } m_nbJetCounter += recojets.size(); -- GitLab From 3b9a2374f12a42856c69283e1964a5e827b3d968 Mon Sep 17 00:00:00 2001 From: Helder Lopes <you@example.com> Date: Mon, 28 Oct 2024 16:21:42 +0100 Subject: [PATCH 13/14] Fix conflict using getBasics() in JetInfoRelationTable.cpp. Implemented local version not requiring link to protoparticles --- Phys/JetAccessories/src/JetInfoRelationTable.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Phys/JetAccessories/src/JetInfoRelationTable.cpp b/Phys/JetAccessories/src/JetInfoRelationTable.cpp index e964fa7d236..3c6ccd4f971 100644 --- a/Phys/JetAccessories/src/JetInfoRelationTable.cpp +++ b/Phys/JetAccessories/src/JetInfoRelationTable.cpp @@ -21,7 +21,8 @@ #include "LHCbAlgs/SplittingTransformer.h" #include "Relations/Relation1D.h" -#include "JetUtils.h" +#include "Event/ParticleUtils.h" + #include "Kernel/JetEnums.h" #include "Math/VectorUtil.h" @@ -32,6 +33,12 @@ #include <type_traits> #include <vector> +// Local version of LHCb::Utils::Particle::getBasics not requiring link to a protoparticle +// Works also with LHCb::Particle made from LHCb::MCParticle +inline auto getBasics( const LHCb::Particle& p ) { + return LHCb::Utils::Particle::details::filter( LHCb::Utils::Particle::walk( p ), []( LHCb::Particle const* i ) { return i->isBasicParticle(); } ); +} + namespace LHCb { using Relations = LHCb::Relation1D<LHCb::Particle, double>; using JetID = LHCb::JetIDInfo::JetIDInfos; @@ -54,7 +61,7 @@ namespace LHCb { for ( auto* prt : input ) { double cpx( 0 ), cpy( 0 ), cptMax( 0 ), nptMax( 0 ), width( 0 ), norm( 0 ), trks( 0 ), pt( prt->momentum().Pt() ); - auto dtrs = LHCb::JetAccessories::getBasics( *prt ); + auto dtrs = getBasics( *prt ); for ( auto dtr : dtrs ) { const Gaudi::LorentzVector& vec = dtr->momentum(); if ( dtr->charge() != 0 ) { -- GitLab From 234c15dff421a82516e800ddf3fc17ca91c9be05 Mon Sep 17 00:00:00 2001 From: Helder Lopes <you@example.com> Date: Mon, 28 Oct 2024 18:07:02 +0100 Subject: [PATCH 14/14] Fixed formatting --- Phys/JetAccessories/src/JetInfoRelationTable.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Phys/JetAccessories/src/JetInfoRelationTable.cpp b/Phys/JetAccessories/src/JetInfoRelationTable.cpp index 3c6ccd4f971..5fbf5d2722c 100644 --- a/Phys/JetAccessories/src/JetInfoRelationTable.cpp +++ b/Phys/JetAccessories/src/JetInfoRelationTable.cpp @@ -36,7 +36,8 @@ // Local version of LHCb::Utils::Particle::getBasics not requiring link to a protoparticle // Works also with LHCb::Particle made from LHCb::MCParticle inline auto getBasics( const LHCb::Particle& p ) { - return LHCb::Utils::Particle::details::filter( LHCb::Utils::Particle::walk( p ), []( LHCb::Particle const* i ) { return i->isBasicParticle(); } ); + return LHCb::Utils::Particle::details::filter( LHCb::Utils::Particle::walk( p ), + []( LHCb::Particle const* i ) { return i->isBasicParticle(); } ); } namespace LHCb { -- GitLab