Skip to content
Snippets Groups Projects

Use CaloFutureUtils without CaloParticle.

Merged Alejandro Alfonso Albero requested to merge aalfonso_Drop_Neutrals_CaloParticle into master
2 files
+ 43
29
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -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 ) ) {
Loading