From efa379bd1dbc3f51a7ec6a4ac2d13f40f64ac700 Mon Sep 17 00:00:00 2001 From: cdelitzs <chris.malena.delitzsch@cern.ch> Date: Mon, 2 Dec 2019 11:23:14 -0700 Subject: [PATCH] Using isCharged function for pFlow objects --- .../Root/MissingETAssociation_v1.cxx | 4 ++-- Event/xAOD/xAODPFlow/Root/PFO_v1.cxx | 16 +++++++++------- .../JetMomentTools/Root/JetECPSFractionTool.cxx | 4 ++-- .../JetMomentTools/Root/JetTrackMomentsTool.cxx | 4 ++-- .../Root/JetConstituentModifierBase.cxx | 10 +++++----- .../JetRecTools/Root/SoftKillerWeightTool.cxx | 4 ++-- .../Jet/JetUtils/Root/JetCaloCalculations.cxx | 4 ++-- .../Root/METEgammaAssociator.cxx | 10 +++++----- .../METReconstruction/Root/METJetAssocTool.cxx | 6 +++--- .../METReconstruction/Root/METMuonAssociator.cxx | 4 ++-- .../METReconstruction/Root/METSoftAssociator.cxx | 4 ++-- .../METReconstruction/Root/METSoftTermsTool.cxx | 6 +++--- .../METReconstruction/Root/METTauAssociator.cxx | 4 ++-- .../Root/METTruthAssociator.cxx | 6 +++--- .../src/ParticleFlowEventFilter_r207.cxx | 4 ++-- .../PanTauAlgs/Root/Tool_InputConverter.cxx | 12 ++++++------ 16 files changed, 52 insertions(+), 50 deletions(-) diff --git a/Event/xAOD/xAODMissingET/Root/MissingETAssociation_v1.cxx b/Event/xAOD/xAODMissingET/Root/MissingETAssociation_v1.cxx index 6793e2441ee4..ca0755adeb1d 100644 --- a/Event/xAOD/xAODMissingET/Root/MissingETAssociation_v1.cxx +++ b/Event/xAOD/xAODMissingET/Root/MissingETAssociation_v1.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ #include "xAODMissingET/versions/MissingETAssociation_v1.h" @@ -592,7 +592,7 @@ namespace xAOD { if (obj->type()==xAOD::Type::TrackParticle) trkOverlaps[bm] += MissingETBase::Types::constvec_t(*obj); else if (obj->type()==xAOD::Type::ParticleFlow) { const PFO* pfo = static_cast<const PFO*>(obj); - if(fabs(pfo->charge())>1e-9) { + if(pfo->isCharged()) { // apply cPFO weight if present, only for the inclusive PFO sum if (m_override.find(obj)!=m_override.end()) { calOverlaps[bm] += m_override[obj]; diff --git a/Event/xAOD/xAODPFlow/Root/PFO_v1.cxx b/Event/xAOD/xAODPFlow/Root/PFO_v1.cxx index 27634b3142a3..cfdc83cda0e2 100644 --- a/Event/xAOD/xAODPFlow/Root/PFO_v1.cxx +++ b/Event/xAOD/xAODPFlow/Root/PFO_v1.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ // EDM include(s): @@ -143,7 +143,7 @@ namespace xAOD { PFO_v1::FourMom_t PFO_v1::p4EM() const { - if (fabs(this->charge()) > FLT_MIN) return p4(); + if (this->isCharged()) return p4(); FourMom_t p4EM; @@ -159,7 +159,7 @@ namespace xAOD { PFO_v1::GenVecFourMom_t PFO_v1::genvecP4EM() const { - if (fabs(this->charge()) > FLT_MIN) return genvecP4(); + if (this->isCharged()) return genvecP4(); //change to use pt, eta, phi ,e const static ConstAccessor<float> accPt("ptEM"); @@ -203,7 +203,7 @@ namespace xAOD { double PFO_v1::ptEM() const { - if (fabs(this->charge()) > FLT_MIN) return this->pt(); + if (this->isCharged()) return this->pt(); const static ConstAccessor<float> accPt("ptEM"); float pt = accPt(*this); @@ -223,7 +223,7 @@ namespace xAOD { double PFO_v1::mEM() const { - if (fabs(this->charge()) > FLT_MIN) return this->m(); + if (this->isCharged()) return this->m(); const static ConstAccessor<float> accM("mEM"); float M = accM(*this); @@ -232,7 +232,7 @@ namespace xAOD { double PFO_v1::eEM() const { - if (fabs(this->charge()) > FLT_MIN) return this->e(); + if (this->isCharged()) return this->e(); const static ConstAccessor<float> accPt("ptEM"); float pt = accPt(*this); @@ -246,8 +246,10 @@ namespace xAOD { AUXSTORE_PRIMITIVE_SETTER_AND_GETTER(PFO_v1, float, centerMag, setCenterMag) AUXSTORE_PRIMITIVE_SETTER_AND_GETTER(PFO_v1, float, charge, setCharge) + // Define function to avoid issues due to numeric precision when comparing pFO charge to zero + // Discussed in https://its.cern.ch/jira/browse/ATLJETMET-796 bool PFO_v1::isCharged() const{ - return (fabs(this->charge())>FLT_MIN); + return (fabs(this->charge())>1e-6); } /** specaial implementations for floats, for eflowRec JetETMiss variables, to reduce disk space usage */ diff --git a/Reconstruction/Jet/JetMomentTools/Root/JetECPSFractionTool.cxx b/Reconstruction/Jet/JetMomentTools/Root/JetECPSFractionTool.cxx index 94e8af8039d5..9ad518155d8a 100644 --- a/Reconstruction/Jet/JetMomentTools/Root/JetECPSFractionTool.cxx +++ b/Reconstruction/Jet/JetMomentTools/Root/JetECPSFractionTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ // JetECPSFractionTool.cxx @@ -49,7 +49,7 @@ double JetECPSFractionTool::energyFraction(const xAOD::Jet& jet) const { const PFO* ppfl = dynamic_cast<const PFO*>(ppar); const CaloCluster* pclu = nullptr; if ( ppfl != nullptr ) { - if ( ppfl->charge() == 0 ) { + if ( !ppfl->isCharged() ) { pclu = ppfl->cluster(0); // Assume PFO has exactly one cluster. if ( pclu != nullptr ) ATH_MSG_VERBOSE(" Constituent is a PFO pointing to a cluster"); else ATH_MSG_WARNING(" Constituent is cluster-based PFO but the cluster is not found."); diff --git a/Reconstruction/Jet/JetMomentTools/Root/JetTrackMomentsTool.cxx b/Reconstruction/Jet/JetMomentTools/Root/JetTrackMomentsTool.cxx index 6bfb3c202e7f..82d702e42935 100644 --- a/Reconstruction/Jet/JetMomentTools/Root/JetTrackMomentsTool.cxx +++ b/Reconstruction/Jet/JetMomentTools/Root/JetTrackMomentsTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ @@ -109,7 +109,7 @@ int JetTrackMomentsTool::modifyJet(xAOD::Jet& jet) const { size_t numConstit = jet.numConstituents(); for ( size_t i=0; i<numConstit; i++ ) { const xAOD::PFO* constit = dynamic_cast<const xAOD::PFO*>(jet.rawConstituent(i)); - if (0.0 != constit->charge()){ + if (constit->isCharged()){ const xAOD::TrackParticle *thisTrack = constit->track(0);//by construction xAOD::PFO can only have one track, in eflowRec usage pflowTracks.push_back(thisTrack); }//we have a charged PFO diff --git a/Reconstruction/Jet/JetRecTools/Root/JetConstituentModifierBase.cxx b/Reconstruction/Jet/JetRecTools/Root/JetConstituentModifierBase.cxx index b9c250a9b048..e9098b9afd3d 100644 --- a/Reconstruction/Jet/JetRecTools/Root/JetConstituentModifierBase.cxx +++ b/Reconstruction/Jet/JetRecTools/Root/JetConstituentModifierBase.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ // Source file for the JetConstituentModifierBase.h @@ -73,8 +73,8 @@ StatusCode JetConstituentModifierBase::setEnergyPt(xAOD::IParticle* obj, float e case xAOD::Type::ParticleFlow: { xAOD::PFO* pfo = static_cast<xAOD::PFO*>(obj); - if( (m_applyToChargedPFO && fabs(pfo->charge())>=1e-9) || - (m_applyToNeutralPFO && fabs(pfo->charge())<1e-9) ) { + if( (m_applyToChargedPFO && pfo->isCharged()) || + (m_applyToNeutralPFO && !pfo->isCharged()) ) { if(weightAcc) (*weightAcc)(*pfo) = pt / pfo->pt(); // KTJ: Temporary fix // Defeats the purpose, but we need to use this to reset the 4-vec cache @@ -116,8 +116,8 @@ StatusCode JetConstituentModifierBase::setP4(xAOD::IParticle* obj, const xAOD::J { xAOD::PFO* pfo = static_cast<xAOD::PFO*>(obj); // The PFO setter defaults to m=0 - if( (m_applyToChargedPFO && fabs(pfo->charge())>=1e-9) || - (m_applyToNeutralPFO && fabs(pfo->charge())<1e-9) ) { + if( (m_applyToChargedPFO && pfo->isCharged()) || + (m_applyToNeutralPFO && !pfo->isCharged()) ) { if(weightAcc) (*weightAcc)(*pfo) = pfo->pt() > FLT_MIN ? p4.pt() / pfo->pt() : 0.; pfo->setP4(p4.pt(),p4.eta(),p4.phi(),p4.mass()); } diff --git a/Reconstruction/Jet/JetRecTools/Root/SoftKillerWeightTool.cxx b/Reconstruction/Jet/JetRecTools/Root/SoftKillerWeightTool.cxx index fbf857b97e83..60706f80a54a 100644 --- a/Reconstruction/Jet/JetRecTools/Root/SoftKillerWeightTool.cxx +++ b/Reconstruction/Jet/JetRecTools/Root/SoftKillerWeightTool.cxx @@ -125,7 +125,7 @@ double SoftKillerWeightTool::getSoftKillerMinPt(xAOD::IParticleContainer& cont) // However, we might still want to use the cPFOs for the min pt calculation if(m_inputType==xAOD::Type::ParticleFlow && m_ignoreChargedPFOs) { xAOD::PFO* pfo = static_cast<xAOD::PFO*>(part); - accept = fabs(pfo->charge())<1e-9; + accept = !pfo->isCharged(); } if(m_inputType==xAOD::Type::TrackCaloCluster ) { xAOD::TrackCaloCluster* tcc = static_cast<xAOD::TrackCaloCluster*>(part); @@ -158,7 +158,7 @@ std::pair<double,double> SoftKillerWeightTool::getSoftKillerMinPtSplit(xAOD::IPa // However, we might still want to use the cPFOs for the min pt calculation if(m_inputType==xAOD::Type::ParticleFlow && m_ignoreChargedPFOs) { xAOD::PFO* pfo = static_cast<xAOD::PFO*>(part); - accept = fabs(pfo->charge())<1e-9; + accept = !pfo->isCharged(); } if(m_inputType==xAOD::Type::TrackCaloCluster) { xAOD::TrackCaloCluster* tcc = static_cast<xAOD::TrackCaloCluster*>(part); diff --git a/Reconstruction/Jet/JetUtils/Root/JetCaloCalculations.cxx b/Reconstruction/Jet/JetUtils/Root/JetCaloCalculations.cxx index fcb24a21c08a..ba027622237f 100644 --- a/Reconstruction/Jet/JetUtils/Root/JetCaloCalculations.cxx +++ b/Reconstruction/Jet/JetUtils/Root/JetCaloCalculations.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ @@ -50,7 +50,7 @@ namespace CaloConstitHelpers { virtual ~PFOExtractor(){} virtual bool valid(JetConstitIterator & it ) { const xAOD::PFO* pfo = dynamic_cast<const xAOD::PFO*>(it->rawConstituent()); - if (pfo!=0) return (pfo->charge() ==0. ); + if (pfo!=0) return (!pfo->isCharged()); return false; } diff --git a/Reconstruction/MET/METReconstruction/Root/METEgammaAssociator.cxx b/Reconstruction/MET/METReconstruction/Root/METEgammaAssociator.cxx index 6e115dad5bb2..c69c6977dba2 100644 --- a/Reconstruction/MET/METReconstruction/Root/METEgammaAssociator.cxx +++ b/Reconstruction/MET/METReconstruction/Root/METEgammaAssociator.cxx @@ -1,7 +1,7 @@ ///////////////////////// -*- C++ -*- ///////////////////////////// /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ // METEgammaAssociator.cxx @@ -163,8 +163,8 @@ namespace met { // We set a small -ve pt for cPFOs that were rejected // by the ChargedHadronSubtractionTool const static SG::AuxElement::ConstAccessor<char> PVMatchedAcc("matchedToPV"); - if( ( fabs(pfo->charge())<FLT_MIN && pfo->e() > FLT_MIN ) || - ( fabs(pfo->charge())>FLT_MIN && PVMatchedAcc(*pfo) + if( ( !pfo->isCharged() && pfo->e() > FLT_MIN ) || + ( pfo->isCharged() && PVMatchedAcc(*pfo) && ( !m_cleanChargedPFO || isGoodEoverP(pfo->track(0)) ) ) ) { nearbyPFO.push_back(pfo); @@ -177,7 +177,7 @@ namespace met { ATH_CHECK( selectEgammaTracks(eg, constits.trkCont, trackset) ); for(const auto& track : trackset) { for(const auto& pfo : nearbyPFO) { - if(fabs(pfo->charge())>FLT_MIN && pfo->track(0) == track) { + if(pfo->isCharged() && pfo->track(0) == track) { pfolist.push_back(pfo); } // PFO/track match } // PFO loop @@ -194,7 +194,7 @@ namespace met { std::sort(nearbyPFO.begin(),nearbyPFO.end(),greaterPtPFO); for(const auto& pfo : nearbyPFO) { // Skip charged PFOs, as we already matched them - if(fabs(pfo->charge())>FLT_MIN || !P4Helpers::isInDeltaR(*pfo, *swclus, m_tcMatch_dR, m_useRapidity)) {continue;} + if(pfo->isCharged() || !P4Helpers::isInDeltaR(*pfo, *swclus, m_tcMatch_dR, m_useRapidity)) {continue;} // Handle neutral PFOs like topoclusters double pfo_e = pfo->eEM(); // skip cluster if it's above our bad match threshold or outside the matching radius diff --git a/Reconstruction/MET/METReconstruction/Root/METJetAssocTool.cxx b/Reconstruction/MET/METReconstruction/Root/METJetAssocTool.cxx index c6239b7aeb2a..04f995d3105c 100644 --- a/Reconstruction/MET/METReconstruction/Root/METJetAssocTool.cxx +++ b/Reconstruction/MET/METReconstruction/Root/METJetAssocTool.cxx @@ -1,7 +1,7 @@ ///////////////////////// -*- C++ -*- ///////////////////////////// /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ // METJetAssocTool.cxx @@ -120,7 +120,7 @@ namespace met { for (size_t consti = 0; consti < jet->numConstituents(); consti++) { const xAOD::PFO *pfo = static_cast<const xAOD::PFO*>(jet->rawConstituent(consti)); ATH_MSG_VERBOSE("Jet constituent PFO, pt :" << pfo->pt() << ", charge: " << pfo->charge()); - if (fabs(pfo->charge())>1e-9 && (!m_cleanChargedPFO || isGoodEoverP(pfo->track(0)))) { + if (pfo->isCharged() && (!m_cleanChargedPFO || isGoodEoverP(pfo->track(0)))) { ATH_MSG_VERBOSE(" Accepted charged PFO, pt " << pfo->pt()); selectedTracks.push_back(pfo); } @@ -165,7 +165,7 @@ namespace met { jet->getAssociatedObjects<IParticle>(JetAttribute::GhostTrack,jettracks); for(const auto& pfo : *constits.pfoCont) { - if (fabs(pfo->charge())>1e-9) { + if (pfo->isCharged()) { const TrackParticle* pfotrk = pfo->track(0); for(const auto& trk : jettracks) { if (trk==pfotrk) { diff --git a/Reconstruction/MET/METReconstruction/Root/METMuonAssociator.cxx b/Reconstruction/MET/METReconstruction/Root/METMuonAssociator.cxx index 8636256d5e08..dd523dc3a240 100644 --- a/Reconstruction/MET/METReconstruction/Root/METMuonAssociator.cxx +++ b/Reconstruction/MET/METReconstruction/Root/METMuonAssociator.cxx @@ -1,7 +1,7 @@ ///////////////////////// -*- C++ -*- ///////////////////////////// /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ // METMuonAssociator.cxx @@ -173,7 +173,7 @@ namespace met { // One loop over PFOs for(const auto& pfo : *constits.pfoCont) { - if(fabs(pfo->charge())>1e-9) { + if(pfo->isCharged()) { // get charged PFOs by matching the muon ID track // We set a small -ve pt for cPFOs that were rejected // by the ChargedHadronSubtractionTool diff --git a/Reconstruction/MET/METReconstruction/Root/METSoftAssociator.cxx b/Reconstruction/MET/METReconstruction/Root/METSoftAssociator.cxx index edf093a99f29..0681270d3d11 100644 --- a/Reconstruction/MET/METReconstruction/Root/METSoftAssociator.cxx +++ b/Reconstruction/MET/METReconstruction/Root/METSoftAssociator.cxx @@ -1,7 +1,7 @@ ///////////////////////// -*- C++ -*- ///////////////////////////// /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ // METSoftAssociator.cxx @@ -99,7 +99,7 @@ namespace met { } for(const auto& sig : *uniquePFOs) { const PFO *pfo = static_cast<const PFO*>(sig); - if (fabs(pfo->charge())>FLT_MIN) { // Charged PFOs + if (pfo->isCharged()) { // Charged PFOs // We set a small -ve pt for cPFOs that were rejected // by the ChargedHadronSubtractionTool const static SG::AuxElement::ConstAccessor<char> PVMatchedAcc("matchedToPV"); diff --git a/Reconstruction/MET/METReconstruction/Root/METSoftTermsTool.cxx b/Reconstruction/MET/METReconstruction/Root/METSoftTermsTool.cxx index ff67e743cab9..9d820fc86c2b 100644 --- a/Reconstruction/MET/METReconstruction/Root/METSoftTermsTool.cxx +++ b/Reconstruction/MET/METReconstruction/Root/METSoftTermsTool.cxx @@ -1,7 +1,7 @@ ///////////////////////// -*- C++ -*- ///////////////////////////// /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ // METSoftTermsTool.cxx @@ -203,7 +203,7 @@ namespace met { bool METSoftTermsTool::accept(const xAOD::PFO* pfo, const xAOD::Vertex* pv) const { - if(fabs(pfo->charge())<1e-9) return true; + if(!pfo->isCharged()) return true; if(fabs(pfo->track(0)->z0() - pv->z())>2) return false; return true; } @@ -388,7 +388,7 @@ namespace met { } else { // In principle for the charged PFOs we should perhaps add the weights // but this shouldn't happen if we don't have a jet. - if(fabs(pfo->charge()<1e-9)) { + if(!pfo->isCharged()) { metTerm->add(pfo->pt()*cos(pfo->phi()), pfo->pt()*sin(pfo->phi()), pfo->pt()); diff --git a/Reconstruction/MET/METReconstruction/Root/METTauAssociator.cxx b/Reconstruction/MET/METReconstruction/Root/METTauAssociator.cxx index afdf1b46671c..0cd3ba11a482 100644 --- a/Reconstruction/MET/METReconstruction/Root/METTauAssociator.cxx +++ b/Reconstruction/MET/METReconstruction/Root/METTauAssociator.cxx @@ -1,7 +1,7 @@ ///////////////////////// -*- C++ -*- ///////////////////////////// /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ // METTauAssociator.cxx @@ -150,7 +150,7 @@ namespace met { TLorentzVector momentum; for(const auto& pfo : *constits.pfoCont) { bool match = false; - if (fabs(pfo->charge())<FLT_MIN) { + if (!pfo->isChargd()) { if(xAOD::P4Helpers::isInDeltaR(*seedjet,*pfo,0.2,m_useRapidity) && pfo->eEM()>0) { ATH_MSG_VERBOSE("Found nPFO with dR " << seedjet->p4().DeltaR(pfo->p4EM())); match = true; diff --git a/Reconstruction/MET/METReconstruction/Root/METTruthAssociator.cxx b/Reconstruction/MET/METReconstruction/Root/METTruthAssociator.cxx index f4ba808ec0af..4ce4a55be028 100644 --- a/Reconstruction/MET/METReconstruction/Root/METTruthAssociator.cxx +++ b/Reconstruction/MET/METReconstruction/Root/METTruthAssociator.cxx @@ -1,7 +1,7 @@ ///////////////////////// -*- C++ -*- ///////////////////////////// /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ // METTruthAssociator.cxx @@ -197,7 +197,7 @@ namespace met { ATH_MSG_VERBOSE("Jet contains truth particle with pt " << truth->pt() << " status " << truth->status() << " pdgId " << truth->pdgId() ); - if(fabs(truth->charge())>1e-9) { + if(fabs(truth->charge())>1e-6) { trkvec += *truth; } if(!truth->isMuon()) { @@ -267,7 +267,7 @@ namespace met { ATH_MSG_VERBOSE("Accepted soft truth particle with pt " << truth->pt() << " status " << truth->status() << " pdgId " << truth->pdgId() ); - if(fabs(truth->charge())>1e-9) { + if(fabs(truth->charge())>1e-6) { // in ID acceptance if(fabs(truth->eta())<2.5) *metCoreChargedCentralTruth += truth; *metCoreChargedTruth += truth; diff --git a/Reconstruction/PFlow/PFlowUtils/src/ParticleFlowEventFilter_r207.cxx b/Reconstruction/PFlow/PFlowUtils/src/ParticleFlowEventFilter_r207.cxx index 541b05d042b7..8716d9768eba 100644 --- a/Reconstruction/PFlow/PFlowUtils/src/ParticleFlowEventFilter_r207.cxx +++ b/Reconstruction/PFlow/PFlowUtils/src/ParticleFlowEventFilter_r207.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ #include "ParticleFlowEventFilter_r207.h" @@ -31,7 +31,7 @@ StatusCode ParticleFlowEventFilter_r207::execute(){ const xAOD::IParticle* theRawConstituent = aConstituent->rawConstituent(); if (theRawConstituent){ const xAOD::PFO* thePFO = dynamic_cast<const xAOD::PFO*>(theRawConstituent); - if (thePFO->charge() != 0) { + if (thePFO->isCharged()) { if (thePFO->pt() < 30000) weight = 1.0; else if (thePFO->pt() >= 30000 && thePFO->pt() < 60000) weight = (1.0 - (thePFO->pt()-30000)/30000); diff --git a/Reconstruction/PanTau/PanTauAlgs/Root/Tool_InputConverter.cxx b/Reconstruction/PanTau/PanTauAlgs/Root/Tool_InputConverter.cxx index b2c6764da73e..1be59e20a39b 100644 --- a/Reconstruction/PanTau/PanTauAlgs/Root/Tool_InputConverter.cxx +++ b/Reconstruction/PanTau/PanTauAlgs/Root/Tool_InputConverter.cxx @@ -96,7 +96,7 @@ StatusCode PanTau::Tool_InputConverter::ConvertToTauConstituent2(xAOD::PFO* pfo, //! ================================================== //! Check whether neutral input pfo has pion mass (it may have if xAOD is being reprocessed) //! If it does, make it massless again and use that - if(pfo->charge() == 0 && pfo->m() != 0) { + if(!pfo->isCharged() && pfo->m() != 0) { TLorentzVector tlvUpdate; PanTau::SetP4EEtaPhiM( tlvUpdate, pfo->e(), pfo->eta(), pfo->phi(), 0); pfo->setP4(tlvUpdate.Pt(), pfo->eta(), pfo->phi(), 0); @@ -118,7 +118,7 @@ StatusCode PanTau::Tool_InputConverter::ConvertToTauConstituent2(xAOD::PFO* pfo, if(m_Config_UsePionMass == true) { //clusters: don't touch the measured energy. set mass to pion mass, so momentum will be altered - if(pfoCharge == 0) { + if(!pfoCharge->isCharged()) { constituentMass = 134.98; } } @@ -139,11 +139,11 @@ StatusCode PanTau::Tool_InputConverter::ConvertToTauConstituent2(xAOD::PFO* pfo, double deltaR_toTauJet = tlv_intAxis.DeltaR( pfo->p4() ); if(deltaR_toTauJet > m_Config_TauConstituents_Types_DeltaRCore) { - if(pfoCharge != 0) { + if(pfoCharge->isCharged()) { //itsTypeFlags.at((int)PanTau::TauConstituent2::t_OutChrg) = 1; itsTypeFlags.at((int)PanTau::TauConstituent2::t_Charged) = 1; } - if(pfoCharge == 0) { + if(!pfoCharge->isCharged()) { itsTypeFlags.at((int)PanTau::TauConstituent2::t_OutNeut) = 1; mvaValue = pfo->bdtPi0Score(); } @@ -151,10 +151,10 @@ StatusCode PanTau::Tool_InputConverter::ConvertToTauConstituent2(xAOD::PFO* pfo, if(deltaR_toTauJet <= m_Config_TauConstituents_Types_DeltaRCore) { - if(pfoCharge != 0) { + if(pfoCharge->isCharged()) { itsTypeFlags.at((int)PanTau::TauConstituent2::t_Charged) = 1; } - if(pfoCharge == 0) { + if(!pfoCharge->isCharged()) { itsTypeFlags.at((int)PanTau::TauConstituent2::t_Neutral) = 1; itsTypeFlags.at((int)PanTau::TauConstituent2::t_NeutLowA) = 1; itsTypeFlags.at((int)PanTau::TauConstituent2::t_NeutLowB) = 1; -- GitLab