diff --git a/Phys/ParticleMaker/CMakeLists.txt b/Phys/ParticleMaker/CMakeLists.txt index ea0bba9e8e9a222e21c4ddbb8c966f2479c41c2f..533b4331f9fbb44477b7eb5d32f0ad98b7afd699 100644 --- a/Phys/ParticleMaker/CMakeLists.txt +++ b/Phys/ParticleMaker/CMakeLists.txt @@ -14,7 +14,7 @@ gaudi_subdir(ParticleMaker) gaudi_depends_on_subdirs(Calo/CaloInterfaces - Calo/CaloUtils + CaloFuture/CaloFutureUtils Event/RecEvent Phys/DaVinciKernel Tr/TrackInterfaces) @@ -26,7 +26,7 @@ include_directories(SYSTEM ${Boost_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS}) gaudi_add_module(ParticleMaker src/*.cpp INCLUDE_DIRS Tr/TrackInterfaces - LINK_LIBRARIES CaloUtils RecEvent DaVinciKernelLib) + LINK_LIBRARIES CaloFutureUtils RecEvent DaVinciKernelLib) if(TARGET Rec::TrackInterfacesLib) target_link_libraries(ParticleMaker Rec::TrackInterfacesLib) diff --git a/Phys/ParticleMaker/src/NeutralMakers.cpp b/Phys/ParticleMaker/src/NeutralMakers.cpp index d192251527551db1a465b41f7421fd1854af7e34..79aa728df536f70c44ec0fdc1854339f39daa4e6 100644 --- a/Phys/ParticleMaker/src/NeutralMakers.cpp +++ b/Phys/ParticleMaker/src/NeutralMakers.cpp @@ -17,7 +17,7 @@ #include "Event/ProtoParticle.h" #include "Event/RecVertex.h" -#include "CaloUtils/CaloParticle.h" +#include "CaloFutureUtils/CaloMomentum.h" #include "Kernel/IParticlePropertySvc.h" #include "Kernel/ParticleProperty.h" @@ -96,9 +96,10 @@ namespace { Gaudi::SymMatrix3x3 GetPointErr( LHCb::RecVertices const& PVs, bool const setPV ); ClusterCodes to_ClusterCodes( std::string_view type ); std::map<ClusterCodes, std::pair<double, double>> - ClusterCodeToEnum( std::map<std::string, std::pair<double, double>> const& clusterMasks, std::string const& AlgName ); - double confLevelPhoton( const LHCb::ProtoParticle& proto ); - double confLevelMergedPi0( const LHCb::ProtoParticle& proto ); + ClusterCodeToEnum( std::map<std::string, std::pair<double, double>> const& clusterMasks, std::string const& AlgName ); + double confLevelPhoton( const LHCb::ProtoParticle& proto ); + double confLevelMergedPi0( const LHCb::ProtoParticle& proto ); + LHCb::Particle make_neutral( LHCb::Calo::Momentum& momentum ); // ==================== // Get first PV point @@ -180,6 +181,24 @@ namespace { else return -1.0; } + + // ==================== + // Function to replace old CaloParticle class behaviour. + // Creates neutral LHCb::Particle from CaloMomentum + // The particle is set as if coming from first PV if requested ((0,0,0) otherwise) + // Only suitable for non-composite particles (photons, mergedpi0) which is the case here + LHCb::Particle make_neutral( LHCb::Calo::Momentum& momentum ) { + // Build particle + auto particle = LHCb::Particle(); + // Set particle momentum + particle.setReferencePoint( momentum.referencePoint() ); + particle.setPosCovMatrix( momentum.pointCovMatrix() ); + particle.setMomentum( momentum.momentum() ); + particle.setMomCovMatrix( momentum.momCovMatrix() ); + particle.setPosMomCovMatrix( momentum.momPointCovMatrix() ); + + return particle; + } } // namespace // Classes are embedded in this namespace @@ -323,7 +342,7 @@ namespace LHCb::Phys::ParticleMakers { } // == evaluate kinematical properties - LHCb::CaloMomentum momentum( &proto, point, pointErr ); + LHCb::Calo::Momentum momentum = LHCb::Calo::Momentum( &proto, point, pointErr ); if ( momentum.status() ) { ++m_invalid_calomom; return {}; @@ -349,25 +368,23 @@ namespace LHCb::Phys::ParticleMakers { if ( CL < m_clCut ) return {}; m_confidenceLevelCounter += CL; + // === set photon parameters (4-momentum, vertex and correlations) + auto particle = std::make_optional<LHCb::Particle>( make_neutral( momentum ) ); + + // Warning : covariant matrix should be modified accordingly -> to be included in CaloMomentum ... + if ( m_partProp->mass() > 0 ) particle->setMomentum( Gaudi::LorentzVector( px, py, pz, E ) ); + // ===== create new particle and fill it - auto particle = std::make_optional<LHCb::Particle>(); // photon constructor particle->setParticleID( LHCb::ParticleID( m_partProp->pdgID().pid() ) ); particle->setProto( &proto ); // === set mass and mass uncertainties particle->setMeasuredMass( m_partProp->mass() ); - particle->setMeasuredMassErr( 0 ); // the mass is EXACT zero! + particle->setMeasuredMassErr( 0 ); // the mass error is EXACTLY zero! // === set confidence level particle->setConfLevel( CL ); - // === set photon parameters (4-momentum, vertex and correlations) - LHCb::CaloParticle calopart( &particle.value(), point, pointErr ); - calopart.updateParticle(); - - // Warning : covariant matrix should be modified accordingly -> to be included in CaloParticle ... - if ( m_partProp->mass() > 0 ) particle->setMomentum( Gaudi::LorentzVector( px, py, pz, E ) ); - // === printout if ( msgLevel( MSG::VERBOSE ) ) { verbose() << "----- Single " << m_part << " found" << endmsg; @@ -526,7 +543,7 @@ namespace LHCb::Phys::ParticleMakers { ++m_Pi0sCounter; // Filters - LHCb::CaloMomentum pi0Momentum( &proto, point, pointErr ); + LHCb::Calo::Momentum pi0Momentum( &proto, point, pointErr ); if ( pi0Momentum.status() ) { ++m_invalid_calomom; return {}; @@ -552,11 +569,11 @@ namespace LHCb::Phys::ParticleMakers { } // == extract SplitPhotons hypos - const auto& ghypos = hypo->hypos(); - const auto& g1 = ghypos.front(); - const auto& g2 = ghypos.at( 1 ); - LHCb::CaloMomentum g1Momentum( g1, point, pointErr ); - LHCb::CaloMomentum g2Momentum( g2, point, pointErr ); + const auto& ghypos = hypo->hypos(); + const auto& g1 = ghypos.front(); + const auto& g2 = ghypos.at( 1 ); + LHCb::Calo::Momentum g1Momentum( g1, point, pointErr ); + LHCb::Calo::Momentum g2Momentum( g2, point, pointErr ); // info() << hypos.size() << " -> " << g1Momentum.pt() << " " << g2Momentum.pt() << endmsg; // ---- Apply SplitPhoton pT cut @@ -583,21 +600,18 @@ namespace LHCb::Phys::ParticleMakers { if ( m_clCut >= 0 && CL < m_clCut ) return {}; m_confidenceLevelCounter_pi0 += CL; - // === create new particle and fill it - auto particle = std::make_optional<LHCb::Particle>(); + // === set MergedPi0 parameters in particle(4-momentum, vertex and correlations) + auto particle = std::make_optional<LHCb::Particle>( make_neutral( pi0Momentum ) ); + particle->setParticleID( LHCb::ParticleID( m_partProp->pdgID().pid() ) ); particle->setProto( &proto ); // --- set confidence level particle->setConfLevel( CL ); - // --- set MergedPi0 parameters (4-momentum, vertex and correlations) - LHCb::CaloParticle calopart( &particle.value(), point, pointErr ); - calopart.updateParticle(); - //-- set mass and mass uncertainties particle->setMeasuredMass( part_mass ); - particle->setMeasuredMassErr( calopart.emass() ); + particle->setMeasuredMassErr( pi0Momentum.emass() ); // === printout if ( msgLevel( MSG::VERBOSE ) ) {