From 7f8ebf01cd36abee37654ab84b3c49a5c799affc Mon Sep 17 00:00:00 2001 From: Matthew Basso <matthew.joseph.basso@cern.ch> Date: Fri, 11 Dec 2020 21:08:15 +0100 Subject: [PATCH] abs -> std::abs --- .../EventUtils/src/ParticleSortingTool.cxx | 18 +++++++----------- .../EventUtils/src/ParticleSortingTool.h | 15 ++++++++------- 2 files changed, 15 insertions(+), 18 deletions(-) diff --git a/PhysicsAnalysis/AnalysisCommon/EventUtils/src/ParticleSortingTool.cxx b/PhysicsAnalysis/AnalysisCommon/EventUtils/src/ParticleSortingTool.cxx index fa1702c32ef..876c7e005d2 100644 --- a/PhysicsAnalysis/AnalysisCommon/EventUtils/src/ParticleSortingTool.cxx +++ b/PhysicsAnalysis/AnalysisCommon/EventUtils/src/ParticleSortingTool.cxx @@ -29,10 +29,6 @@ #include "xAODCaloEvent/CaloClusterContainer.h" #include "AthContainers/ConstDataVector.h" -// STL includes -#include <vector> -#include <string> - // Constructors //////////////// ParticleSortingTool::ParticleSortingTool( const std::string& type, @@ -220,37 +216,37 @@ StatusCode ParticleSortingTool::doSort( xAOD::IParticleContainer* cont ) const } // Actually do the sorting, using a C++11 lambda function construct // to be able to use the member function here - if ( abs(m_sortID) == 1 ) { + if ( std::abs(m_sortID) == 1 ) { cont->sort( [this](const xAOD::IParticle* a, const xAOD::IParticle* b) { return this->comparePt(a,b); } ); } - else if ( abs(m_sortID) == 2 ) { + else if ( std::abs(m_sortID) == 2 ) { cont->sort( [this](const xAOD::IParticle* a, const xAOD::IParticle* b) { return this->compareEta(a,b); } ); } - else if ( abs(m_sortID) == 3 ) { + else if ( std::abs(m_sortID) == 3 ) { cont->sort( [this](const xAOD::IParticle* a, const xAOD::IParticle* b) { return this->comparePhi(a,b); } ); } - else if ( abs(m_sortID) == 4 ) { + else if ( std::abs(m_sortID) == 4 ) { cont->sort( [this](const xAOD::IParticle* a, const xAOD::IParticle* b) { return this->compareMass(a,b); } ); } - else if ( abs(m_sortID) == 5 ) { + else if ( std::abs(m_sortID) == 5 ) { cont->sort( [this](const xAOD::IParticle* a, const xAOD::IParticle* b) { return this->compareEnergy(a,b); } ); } - else if ( abs(m_sortID) == 6 ) { + else if ( std::abs(m_sortID) == 6 ) { cont->sort( [this](const xAOD::IParticle* a, const xAOD::IParticle* b) { return this->compareRapidity(a,b); } ); } - else if ( abs(m_sortID) == 7 ) { + else if ( std::abs(m_sortID) == 7 ) { cont->sort( [this](const xAOD::IParticle* a, const xAOD::IParticle* b) { return this->compareAuxData(a,b); } ); diff --git a/PhysicsAnalysis/AnalysisCommon/EventUtils/src/ParticleSortingTool.h b/PhysicsAnalysis/AnalysisCommon/EventUtils/src/ParticleSortingTool.h index 4fb4ebe5b34..dc097711cfb 100644 --- a/PhysicsAnalysis/AnalysisCommon/EventUtils/src/ParticleSortingTool.h +++ b/PhysicsAnalysis/AnalysisCommon/EventUtils/src/ParticleSortingTool.h @@ -24,6 +24,7 @@ // STL includes #include <vector> #include <string> +#include <cmath> class ParticleSortingTool : virtual public ::DerivationFramework::IAugmentationTool, @@ -138,37 +139,37 @@ StatusCode ParticleSortingTool::doSortConst( ConstDataVector<CONTAINERTYPE>* con } // Actually do the sorting, using a C++11 lambda function construct // to be able to use the member function here - if ( abs(m_sortID) == 1 ) { + if ( std::abs(m_sortID) == 1 ) { cont->sort( [this](const xAOD::IParticle* a, const xAOD::IParticle* b) { return this->comparePt(a,b); } ); } - else if ( abs(m_sortID) == 2 ) { + else if ( std::abs(m_sortID) == 2 ) { cont->sort( [this](const xAOD::IParticle* a, const xAOD::IParticle* b) { return this->compareEta(a,b); } ); } - else if ( abs(m_sortID) == 3 ) { + else if ( std::abs(m_sortID) == 3 ) { cont->sort( [this](const xAOD::IParticle* a, const xAOD::IParticle* b) { return this->comparePhi(a,b); } ); } - else if ( abs(m_sortID) == 4 ) { + else if ( std::abs(m_sortID) == 4 ) { cont->sort( [this](const xAOD::IParticle* a, const xAOD::IParticle* b) { return this->compareMass(a,b); } ); } - else if ( abs(m_sortID) == 5 ) { + else if ( std::abs(m_sortID) == 5 ) { cont->sort( [this](const xAOD::IParticle* a, const xAOD::IParticle* b) { return this->compareEnergy(a,b); } ); } - else if ( abs(m_sortID) == 6 ) { + else if ( std::abs(m_sortID) == 6 ) { cont->sort( [this](const xAOD::IParticle* a, const xAOD::IParticle* b) { return this->compareRapidity(a,b); } ); } - else if ( abs(m_sortID) == 7 ) { + else if ( std::abs(m_sortID) == 7 ) { cont->sort( [this](const xAOD::IParticle* a, const xAOD::IParticle* b) { return this->compareAuxData(a,b); } ); -- GitLab