From ca2e934a243a30f0ad893ea29458d7ac1413a952 Mon Sep 17 00:00:00 2001 From: christos <christos@cern.ch> Date: Sun, 4 Apr 2021 03:59:49 +0200 Subject: [PATCH] InDetRecAlgs clang-tidy related fixes --- .../src/ConversionFinder.cxx | 4 +- .../src/InDetExtensionProcessor.cxx | 20 ++++--- .../src/InDetSecVtxFinder.cxx | 10 ++-- .../src/TRT_RIO_Maker.cxx | 2 +- .../InDetPriVxFinder/InDetPriVxFinder.h | 4 +- .../InDetPriVxFinder/src/InDetPriVxFinder.cxx | 12 ++-- .../InDetV0Finder/InDetV0FinderTool.h | 6 +- .../InDetV0Finder/src/InDetV0Finder.cxx | 8 +-- .../InDetV0Finder/src/InDetV0FinderTool.cxx | 60 +++++++++---------- .../src/SiElementPropertiesTable.cxx | 4 +- .../src/SiTrackerSpacePointFinder.cxx | 8 +-- .../src/TRT_SeededTrackFinder.cxx | 26 ++++---- .../src/TRT_TrackExtensionAlg.cxx | 4 +- 13 files changed, 85 insertions(+), 83 deletions(-) diff --git a/InnerDetector/InDetRecAlgs/InDetConversionFinder/src/ConversionFinder.cxx b/InnerDetector/InDetRecAlgs/InDetConversionFinder/src/ConversionFinder.cxx index c73277a0bd04..b5f0e00ee38d 100755 --- a/InnerDetector/InDetRecAlgs/InDetConversionFinder/src/ConversionFinder.cxx +++ b/InnerDetector/InDetRecAlgs/InDetConversionFinder/src/ConversionFinder.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ /*************************************************************************** @@ -195,7 +195,7 @@ namespace InDet bool isTrt1 = false; bool isSi1 = false; bool isTrt2 = false; bool isSi2 = false; for (unsigned int i = 0; i < fz->nTrackParticles() ; ++i) { - auto trackParticle = fz->trackParticle( i ); + const auto *trackParticle = fz->trackParticle( i ); if(!trackParticle) continue; uint8_t temp(0); uint8_t ncl(0); diff --git a/InnerDetector/InDetRecAlgs/InDetExtensionProcessor/src/InDetExtensionProcessor.cxx b/InnerDetector/InDetRecAlgs/InDetExtensionProcessor/src/InDetExtensionProcessor.cxx index 67b0a53a2882..26c2bf3574a8 100644 --- a/InnerDetector/InDetRecAlgs/InDetExtensionProcessor/src/InDetExtensionProcessor.cxx +++ b/InnerDetector/InDetRecAlgs/InDetExtensionProcessor/src/InDetExtensionProcessor.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -11,13 +11,15 @@ #include "InDetExtensionProcessor/InDetExtensionProcessor.h" #include "TrkFitterInterfaces/ITrackFitter.h" -#include "TrkToolInterfaces/ITrackScoringTool.h" -#include "TrkRIO_OnTrack/RIO_OnTrack.h" -#include "TrkPrepRawData/PrepRawData.h" #include "TrkParameters/TrackParameters.h" +#include "TrkPrepRawData/PrepRawData.h" +#include "TrkRIO_OnTrack/RIO_OnTrack.h" +#include "TrkToolInterfaces/ITrackScoringTool.h" #include <algorithm> //for std::transform #include <cmath> //for std::abs #include <functional> //for std::plus<> +#include <memory> + //================================================================================================== @@ -379,7 +381,7 @@ InDet::InDetExtensionProcessor::createExtendedTracks(const EventContext& ctx, if (m_keepFailedExtensionOnTrack) { ntrk.reset(trackPlusExtension(ctx,thisTrack, pThisExtensionPair->second)); } else { - ntrk.reset(new Trk::Track(*thisTrack)); + ntrk = std::make_unique<Trk::Track>(*thisTrack); } ntrk->info().setPatternRecognitionInfo(Trk::TrackInfo::InDetExtensionProcessor); newTracks->push_back(std::move(ntrk)); @@ -415,7 +417,7 @@ void InDet::InDetExtensionProcessor::incrementRegionCounter(std::array<int, 4>& ATH_MSG_ERROR("track pointer zero, should not happen!"); return; } - const auto pTrackParameters {track->trackParameters()}; + const auto *const pTrackParameters {track->trackParameters()}; // use first parameter if (not pTrackParameters) { ATH_MSG_WARNING("No track parameters, needed for statistics code in Trk::SimpleAmbiguityProcessorTool!"); @@ -436,7 +438,7 @@ InDet::InDetExtensionProcessor::trackPlusExtension( const std::vector<const Trk::MeasurementBase*>& extension) const { const auto& trackStatesOnSurfaces{ *(siTrack->trackStateOnSurfaces()) }; - auto pExtendedTrajectory = new DataVector<const Trk::TrackStateOnSurface>; + auto *pExtendedTrajectory = new DataVector<const Trk::TrackStateOnSurface>; pExtendedTrajectory->reserve(trackStatesOnSurfaces.size() + extension.size()); int nSiStates = 0, nExtStates = 0; @@ -452,7 +454,7 @@ InDet::InDetExtensionProcessor::trackPlusExtension( constexpr std::bitset<Trk::TrackStateOnSurface::NumberOfTrackStateOnSurfaceTypes> outlierPattern(outlierDigit); //create new track state on surface auto createNewTSOS = [outlierPattern](const Trk::MeasurementBase* pm) -> const Trk::TrackStateOnSurface*{ - return new Trk::TrackStateOnSurface(pm->clone(), 0, 0, 0, outlierPattern); + return new Trk::TrackStateOnSurface(pm->clone(), nullptr, nullptr, nullptr, outlierPattern); }; //Adding to cosmic tracks beginning or end depending on the direction of track auto addNewTSOS_ForCosmics = [&pExtendedTrajectory, siTrack, createNewTSOS](const Trk::MeasurementBase* pm) { @@ -471,7 +473,7 @@ InDet::InDetExtensionProcessor::trackPlusExtension( std::transform(extension.begin(), extension.end(), std::back_inserter(*pExtendedTrajectory), createNewTSOS); } else { //difficult to use std::transform here, since don't know whether back or front are added to - for (const auto pMeasurementBase: extension) { + for (const auto *const pMeasurementBase: extension) { addNewTSOS_ForCosmics(pMeasurementBase); } } diff --git a/InnerDetector/InDetRecAlgs/InDetInclusiveSecVtx/src/InDetSecVtxFinder.cxx b/InnerDetector/InDetRecAlgs/InDetInclusiveSecVtx/src/InDetSecVtxFinder.cxx index 6ae2b6c19697..c0213672acde 100755 --- a/InnerDetector/InDetRecAlgs/InDetInclusiveSecVtx/src/InDetSecVtxFinder.cxx +++ b/InnerDetector/InDetRecAlgs/InDetInclusiveSecVtx/src/InDetSecVtxFinder.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ /*************************************************************************** InDetSecVtxFinder.cxx - Description @@ -93,8 +93,8 @@ namespace InDet SG::WriteHandle<xAOD::VertexContainer> outputVertices (m_vxCandidatesOutputName); - xAOD::VertexContainer* theXAODContainer = 0; - xAOD::VertexAuxContainer* theXAODAuxContainer = 0; + xAOD::VertexContainer* theXAODContainer = nullptr; + xAOD::VertexAuxContainer* theXAODAuxContainer = nullptr; std::pair<xAOD::VertexContainer*,xAOD::VertexAuxContainer*> theXAODContainers = std::make_pair( theXAODContainer, theXAODAuxContainer ); @@ -143,8 +143,8 @@ namespace InDet // now re-merge and resort the vertex container and store to SG - xAOD::VertexContainer* myVertexContainer = 0; - xAOD::VertexAuxContainer* myVertexAuxContainer = 0; + xAOD::VertexContainer* myVertexContainer = nullptr; + xAOD::VertexAuxContainer* myVertexAuxContainer = nullptr; std::pair<xAOD::VertexContainer*, xAOD::VertexAuxContainer*> myVxContainers = std::make_pair( myVertexContainer, myVertexAuxContainer ); diff --git a/InnerDetector/InDetRecAlgs/InDetPrepRawDataFormation/src/TRT_RIO_Maker.cxx b/InnerDetector/InDetRecAlgs/InDetPrepRawDataFormation/src/TRT_RIO_Maker.cxx index e8ecaf7be483..05aa3a02646a 100644 --- a/InnerDetector/InDetRecAlgs/InDetPrepRawDataFormation/src/TRT_RIO_Maker.cxx +++ b/InnerDetector/InDetRecAlgs/InDetPrepRawDataFormation/src/TRT_RIO_Maker.cxx @@ -95,7 +95,7 @@ namespace InDet { // Get TRT_RDO and produce TRT_RIO collections if (!m_roiSeeded) {//Full-scan mode - for(const auto rdoCollections : *rdoContainer) { + for(const auto *const rdoCollections : *rdoContainer) { const InDetRawDataCollection<TRT_RDORawData>* currentCollection(rdoCollections); InDet::TRT_DriftCircleContainer::IDC_WriteHandle lock = rioContainer->getWriteHandle(currentCollection->identifyHash()); if( lock.OnlineAndPresentInAnotherView() ) continue; diff --git a/InnerDetector/InDetRecAlgs/InDetPriVxFinder/InDetPriVxFinder/InDetPriVxFinder.h b/InnerDetector/InDetRecAlgs/InDetPriVxFinder/InDetPriVxFinder/InDetPriVxFinder.h index e22abc877469..ff2aeed504a9 100755 --- a/InnerDetector/InDetRecAlgs/InDetPriVxFinder/InDetPriVxFinder/InDetPriVxFinder.h +++ b/InnerDetector/InDetRecAlgs/InDetPriVxFinder/InDetPriVxFinder/InDetPriVxFinder.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ /*************************************************************************** @@ -55,7 +55,7 @@ namespace InDet private: //Monitoring of the vertex variables - void monitor_vertex( const std::string &prefix, xAOD::Vertex vertex ) const; + void monitor_vertex( const std::string &prefix, const xAOD::Vertex& vertex ) const; SG::ReadHandleKey<TrackCollection> m_trkTracksName{this,"TrkTracksName","Tracks","Trk::Track Collection used in Vertexing"}; SG::ReadHandleKey<xAOD::TrackParticleContainer> m_tracksName{this,"TracksName","InDetTrackParticles","xAOD::TrackParticle Collection used in Vertexing"}; diff --git a/InnerDetector/InDetRecAlgs/InDetPriVxFinder/src/InDetPriVxFinder.cxx b/InnerDetector/InDetRecAlgs/InDetPriVxFinder/src/InDetPriVxFinder.cxx index a69afcffd895..f8ccdae33366 100755 --- a/InnerDetector/InDetRecAlgs/InDetPriVxFinder/src/InDetPriVxFinder.cxx +++ b/InnerDetector/InDetRecAlgs/InDetPriVxFinder/src/InDetPriVxFinder.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ /*************************************************************************** @@ -85,8 +85,8 @@ InDetPriVxFinder::InDetPriVxFinder SG::WriteHandle<xAOD::VertexContainer> outputVertices (m_vxCandidatesOutputName, ctx); - xAOD::VertexContainer* vertexContainer = 0; - xAOD::VertexAuxContainer* vertexAuxContainer = 0; + xAOD::VertexContainer* vertexContainer = nullptr; + xAOD::VertexAuxContainer* vertexAuxContainer = nullptr; std::pair< xAOD::VertexContainer*, xAOD::VertexAuxContainer* > vertexContainerPair = std::make_pair( vertexContainer, vertexAuxContainer ); @@ -114,8 +114,8 @@ InDetPriVxFinder::InDetPriVxFinder } // now re-merge and resort the vertex container and store to SG - xAOD::VertexContainer* myVertexContainer = 0; - xAOD::VertexAuxContainer* myVertexAuxContainer = 0; + xAOD::VertexContainer* myVertexContainer = nullptr; + xAOD::VertexAuxContainer* myVertexAuxContainer = nullptr; std::pair<xAOD::VertexContainer*, xAOD::VertexAuxContainer* > myVertexContainerPair = std::make_pair( myVertexContainer, myVertexAuxContainer ); @@ -173,7 +173,7 @@ InDetPriVxFinder::InDetPriVxFinder return StatusCode::SUCCESS; } - void InDetPriVxFinder::monitor_vertex( const std::string &prefix, xAOD::Vertex vertex ) const { + void InDetPriVxFinder::monitor_vertex( const std::string &prefix, const xAOD::Vertex& vertex ) const { if (prefix == "allVertex"){ auto x = Monitored::Scalar<double>( "allVertexX", vertex.x() ); auto y = Monitored::Scalar<double>( "allVertexY", vertex.y() ); diff --git a/InnerDetector/InDetRecAlgs/InDetV0Finder/InDetV0Finder/InDetV0FinderTool.h b/InnerDetector/InDetRecAlgs/InDetV0Finder/InDetV0Finder/InDetV0FinderTool.h index 8b044728fe12..c308dcaba1c3 100755 --- a/InnerDetector/InDetRecAlgs/InDetV0Finder/InDetV0Finder/InDetV0FinderTool.h +++ b/InnerDetector/InDetRecAlgs/InDetV0Finder/InDetV0Finder/InDetV0FinderTool.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ /*************************************************************************** @@ -173,7 +173,7 @@ namespace InDet mutable std::atomic<unsigned int> m_Gamma_stored; - void SGError(std::string errService) const; + void SGError(const std::string& errService) const; double invariantMass(const Trk::TrackParameters* per1, const Trk::TrackParameters* per2, double m1, double m2) const; @@ -181,7 +181,7 @@ namespace InDet bool d0Pass(const xAOD::TrackParticle* track1, const xAOD::TrackParticle* track2, const xAOD::VertexContainer * vertColl) const; bool d0Pass(const xAOD::TrackParticle* track1, const xAOD::TrackParticle* track2, const xAOD::Vertex * vertex) const; - bool d0Pass(const xAOD::TrackParticle* track1, const xAOD::TrackParticle* track2, Amg::Vector3D vertex) const; + bool d0Pass(const xAOD::TrackParticle* track1, const xAOD::TrackParticle* track2, const Amg::Vector3D& vertex) const; bool pointAtVertex(const xAOD::Vertex* v0, const xAOD::Vertex* PV) const; bool pointAtVertexColl(xAOD::Vertex* v0, const xAOD::VertexContainer * vertColl) const; diff --git a/InnerDetector/InDetRecAlgs/InDetV0Finder/src/InDetV0Finder.cxx b/InnerDetector/InDetRecAlgs/InDetV0Finder/src/InDetV0Finder.cxx index a2b63df68ee5..7ebb6995bf1e 100755 --- a/InnerDetector/InDetRecAlgs/InDetV0Finder/src/InDetV0Finder.cxx +++ b/InnerDetector/InDetRecAlgs/InDetV0Finder/src/InDetV0Finder.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ /*************************************************************************** @@ -40,7 +40,7 @@ InDetV0Finder::InDetV0Finder(const std::string &n, ISvcLocator *pSvcLoc) AthAlgorithm(n, pSvcLoc), m_v0FinderTool("InDet::InDetV0FinderTool"), m_V0Tools("Trk::V0Tools"), - m_particleDataTable(0), + m_particleDataTable(nullptr), m_decorate(true), m_masses(1), m_masspi(139.57), @@ -174,7 +174,7 @@ StatusCode InDetV0Finder::initialize() msg(MSG::INFO) << "Retrieved tool " << m_V0Tools << endmsg; // get the Particle Properties Service - IPartPropSvc* partPropSvc = 0; + IPartPropSvc* partPropSvc = nullptr; ATH_CHECK( service("PartPropSvc", partPropSvc, true) ); m_particleDataTable = partPropSvc->PDT(); @@ -237,7 +237,7 @@ StatusCode InDetV0Finder::execute() primaryVertex, importedVxContainer.cptr()); // typedef std::unique_ptr<xAOD::VertexContainer> Container_p; - typedef std::unique_ptr<xAOD::VertexAuxContainer> Aux_p; + using Aux_p = std::unique_ptr<xAOD::VertexAuxContainer>; //create unique pointers for all containers and aux containers Container_p pV = Container_p(v0Container); Aux_p pVaux = Aux_p(v0AuxContainer); diff --git a/InnerDetector/InDetRecAlgs/InDetV0Finder/src/InDetV0FinderTool.cxx b/InnerDetector/InDetRecAlgs/InDetV0Finder/src/InDetV0FinderTool.cxx index 6a650b43a55c..b5f4c04cffcd 100755 --- a/InnerDetector/InDetRecAlgs/InDetV0Finder/src/InDetV0FinderTool.cxx +++ b/InnerDetector/InDetRecAlgs/InDetV0Finder/src/InDetV0FinderTool.cxx @@ -63,7 +63,7 @@ InDetV0FinderTool::InDetV0FinderTool(const std::string& t, const std::string& n, m_trkSelector("InDet::TrackSelectorTool"), m_vertexEstimator("InDet::VertexPointEstimator"), m_extrapolator("Trk::Extrapolator"), - m_particleDataTable(0), + m_particleDataTable(nullptr), m_doSimpleV0(false), m_useorigin(true), m_samesign(false), @@ -190,7 +190,7 @@ StatusCode InDetV0FinderTool::initialize() } // get the Particle Properties Service - IPartPropSvc* partPropSvc = 0; + IPartPropSvc* partPropSvc = nullptr; ATH_CHECK( service("PartPropSvc", partPropSvc, true) ); m_particleDataTable = partPropSvc->PDT(); @@ -262,10 +262,10 @@ StatusCode InDetV0FinderTool::initialize() m_Gamma_stored = 0; // making a concrete fitter for the V0Fitter - m_concreteVertexFitter = 0; + m_concreteVertexFitter = nullptr; if (m_useV0Fitter) { m_concreteVertexFitter = dynamic_cast<Trk::TrkV0VertexFitter * >(&(*m_iVertexFitter)); - if (m_concreteVertexFitter == 0) { + if (m_concreteVertexFitter == nullptr) { ATH_MSG_FATAL("The vertex fitter passed is not a V0 Vertex Fitter"); return StatusCode::FAILURE; } @@ -322,7 +322,7 @@ StatusCode InDetV0FinderTool::performSearch(xAOD::VertexContainer*& v0Container, // track preselection std::vector<const xAOD::TrackParticle*> posTracks; posTracks.clear(); std::vector<const xAOD::TrackParticle*> negTracks; negTracks.clear(); - const xAOD::Vertex* vx = 0; + const xAOD::Vertex* vx = nullptr; if (m_pv && primaryVertex) vx = primaryVertex; if (TPC->size() > 1) { @@ -349,7 +349,7 @@ StatusCode InDetV0FinderTool::performSearch(xAOD::VertexContainer*& v0Container, } ATH_MSG_DEBUG("number of tracks passing preselection, positive " << posTracks.size() << " negative " << negTracks.size()); - if (posTracks.size() > 0 && negTracks.size() > 0) + if (!posTracks.empty() && !negTracks.empty()) { SG::ReadHandle<xAOD::VertexContainer> vertices { m_vertexKey }; if (!vertices.isValid()) @@ -373,7 +373,7 @@ StatusCode InDetV0FinderTool::performSearch(xAOD::VertexContainer*& v0Container, const xAOD::Vertex* foundVertex1 { nullptr }; if (m_useorigin) { - for (const auto vx : *vertices) + for (const auto *const vx : *vertices) { for (const auto& tpLink : vx->trackParticleLinks()) { @@ -416,7 +416,7 @@ StatusCode InDetV0FinderTool::performSearch(xAOD::VertexContainer*& v0Container, const xAOD::Vertex* foundVertex2 { nullptr }; if (m_useorigin) { - for (const auto vx : *vertices) + for (const auto *const vx : *vertices) { for (const auto& tpLink : vx->trackParticleLinks()) { @@ -679,10 +679,10 @@ StatusCode InDetV0FinderTool::performSearch(xAOD::VertexContainer*& v0Container, } // posTracks.size() > 0 && negTracks.size() > 0 - if (v0Container->size()==0) ATH_MSG_DEBUG("No Candidates found. Empty container returned"); - if (ksContainer->size()==0) ATH_MSG_DEBUG("No Kshort Candidates found. Empty container returned"); - if (laContainer->size()==0) ATH_MSG_DEBUG("No Lambda Candidates found. Empty container returned"); - if (lbContainer->size()==0) ATH_MSG_DEBUG("No Lambdabar Candidates found. Empty container returned"); + if (v0Container->empty()) ATH_MSG_DEBUG("No Candidates found. Empty container returned"); + if (ksContainer->empty()) ATH_MSG_DEBUG("No Kshort Candidates found. Empty container returned"); + if (laContainer->empty()) ATH_MSG_DEBUG("No Lambda Candidates found. Empty container returned"); + if (lbContainer->empty()) ATH_MSG_DEBUG("No Lambdabar Candidates found. Empty container returned"); return StatusCode::SUCCESS; } @@ -702,7 +702,7 @@ StatusCode InDetV0FinderTool::finalize() return StatusCode::SUCCESS; } -void InDetV0FinderTool::SGError(std::string errService) const +void InDetV0FinderTool::SGError(const std::string& errService) const { msg(MSG::FATAL) << errService << " not found. Exiting !" << endmsg; return; @@ -716,20 +716,20 @@ bool InDetV0FinderTool::doFit(const xAOD::TrackParticle* track1, const xAOD::Tra if (srxy <= m_maxsxy) { double massKshort_i=2000001., massLambda_i=2000001., massLambdabar_i=2000001.; - Amg::Vector3D globalPosition = startingPoint; + const Amg::Vector3D& globalPosition = startingPoint; Trk::PerigeeSurface perigeeSurface(globalPosition); std::vector<std::unique_ptr<const Trk::TrackParameters> > cleanup; - const Trk::TrackParameters* extrapolatedPerigee1(0); - const Trk::TrackParameters* extrapolatedPerigee2(0); + const Trk::TrackParameters* extrapolatedPerigee1(nullptr); + const Trk::TrackParameters* extrapolatedPerigee2(nullptr); extrapolatedPerigee1 = m_extrapolator->extrapolate(track1->perigeeParameters(), perigeeSurface); - if (extrapolatedPerigee1 == 0) extrapolatedPerigee1 = &track1->perigeeParameters(); + if (extrapolatedPerigee1 == nullptr) extrapolatedPerigee1 = &track1->perigeeParameters(); else cleanup.push_back(std::unique_ptr<const Trk::TrackParameters>(extrapolatedPerigee1)); extrapolatedPerigee2 = m_extrapolator->extrapolate(track2->perigeeParameters(), perigeeSurface); - if (extrapolatedPerigee2 == 0) extrapolatedPerigee2 = &track2->perigeeParameters(); + if (extrapolatedPerigee2 == nullptr) extrapolatedPerigee2 = &track2->perigeeParameters(); else cleanup.push_back(std::unique_ptr<const Trk::TrackParameters>(extrapolatedPerigee2)); - if (extrapolatedPerigee1 != 0 && extrapolatedPerigee2 != 0) { + if (extrapolatedPerigee1 != nullptr && extrapolatedPerigee2 != nullptr) { massKshort_i = invariantMass(extrapolatedPerigee1,extrapolatedPerigee2,m_masspi,m_masspi); massLambda_i = invariantMass(extrapolatedPerigee1,extrapolatedPerigee2,m_massp,m_masspi); massLambdabar_i = invariantMass(extrapolatedPerigee1,extrapolatedPerigee2,m_masspi,m_massp); @@ -750,9 +750,9 @@ bool InDetV0FinderTool::d0Pass(const xAOD::TrackParticle* track1, const xAOD::Tr { const xAOD::Vertex* PV = (*vItr); const Trk::Perigee* per1 = m_trackToVertexTool->perigeeAtVertex( *track1, PV->position() ); - if (per1 == 0) return pass; + if (per1 == nullptr) return pass; const Trk::Perigee* per2 = m_trackToVertexTool->perigeeAtVertex( *track2, PV->position() ); - if (per2 == 0) { + if (per2 == nullptr) { delete per1; return pass; } @@ -771,9 +771,9 @@ bool InDetV0FinderTool::d0Pass(const xAOD::TrackParticle* track1, const xAOD::Tr { bool pass = false; const Trk::Perigee* per1 = m_trackToVertexTool->perigeeAtVertex( *track1, PV->position() ); - if (per1 == 0) return pass; + if (per1 == nullptr) return pass; const Trk::Perigee* per2 = m_trackToVertexTool->perigeeAtVertex( *track2, PV->position() ); - if (per2 == 0) { + if (per2 == nullptr) { delete per1; return pass; } @@ -787,13 +787,13 @@ bool InDetV0FinderTool::d0Pass(const xAOD::TrackParticle* track1, const xAOD::Tr return pass; } -bool InDetV0FinderTool::d0Pass(const xAOD::TrackParticle* track1, const xAOD::TrackParticle* track2, Amg::Vector3D PV) const +bool InDetV0FinderTool::d0Pass(const xAOD::TrackParticle* track1, const xAOD::TrackParticle* track2, const Amg::Vector3D& PV) const { bool pass = false; const Trk::Perigee* per1 = m_trackToVertexTool->perigeeAtVertex( *track1, PV ); - if (per1 == 0) return pass; + if (per1 == nullptr) return pass; const Trk::Perigee* per2 = m_trackToVertexTool->perigeeAtVertex( *track2, PV ); - if (per2 == 0) { + if (per2 == nullptr) { delete per1; return pass; } @@ -880,7 +880,7 @@ bool InDetV0FinderTool::doMassFit(xAOD::Vertex* vxCandidate, int pdgID) const xAOD::Vertex* InDetV0FinderTool::massFit(int pdgID, const std::vector<const xAOD::TrackParticle*> &pairV0, const Amg::Vector3D &vertex) const { - xAOD::Vertex* vxCandidate(0); + xAOD::Vertex* vxCandidate(nullptr); std::vector<double> masses; if (pdgID == 310) { masses.push_back(m_masspi); @@ -901,21 +901,21 @@ xAOD::Vertex* InDetV0FinderTool::massFit(int pdgID, const std::vector<const xAOD } if (pdgID == 310) { if (m_useV0Fitter) { - vxCandidate = m_concreteVertexFitter->fit(pairV0, masses, m_massK0S, 0, vertex); + vxCandidate = m_concreteVertexFitter->fit(pairV0, masses, m_massK0S, nullptr, vertex); } else { vxCandidate = m_iKshortFitter->fit(pairV0, vertex); } } if (pdgID == 3122) { if (m_useV0Fitter) { - vxCandidate = m_concreteVertexFitter->fit(pairV0, masses, m_massLambda, 0, vertex); + vxCandidate = m_concreteVertexFitter->fit(pairV0, masses, m_massLambda, nullptr, vertex); } else { vxCandidate = m_iLambdaFitter->fit(pairV0, vertex); } } if (pdgID == -3122) { if (m_useV0Fitter) { - vxCandidate = m_concreteVertexFitter->fit(pairV0, masses, m_massLambda, 0, vertex); + vxCandidate = m_concreteVertexFitter->fit(pairV0, masses, m_massLambda, nullptr, vertex); } else { vxCandidate = m_iLambdabarFitter->fit(pairV0, vertex); } diff --git a/InnerDetector/InDetRecAlgs/SiSpacePointFormation/src/SiElementPropertiesTable.cxx b/InnerDetector/InDetRecAlgs/SiSpacePointFormation/src/SiElementPropertiesTable.cxx index 2853f4fcca6f..a155dbba5e0d 100755 --- a/InnerDetector/InDetRecAlgs/SiSpacePointFormation/src/SiElementPropertiesTable.cxx +++ b/InnerDetector/InDetRecAlgs/SiSpacePointFormation/src/SiElementPropertiesTable.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ /*************************************************************************** @@ -25,7 +25,7 @@ SiElementPropertiesTable::SiElementPropertiesTable(const SCT_ID& idHelper, for (size_t i = 0; i < maxSCT; ++i){ IdentifierHash hash(i); const InDetDD::SiDetectorElement* element = elements[hash]; - if (element != 0){ + if (element != nullptr){ m_properties.emplace_back(hash, idHelper,*element,epsilonWidth); } } diff --git a/InnerDetector/InDetRecAlgs/SiSpacePointFormation/src/SiTrackerSpacePointFinder.cxx b/InnerDetector/InDetRecAlgs/SiSpacePointFormation/src/SiTrackerSpacePointFinder.cxx index f8774f6c50f6..ea24ed6bc223 100755 --- a/InnerDetector/InDetRecAlgs/SiSpacePointFormation/src/SiTrackerSpacePointFinder.cxx +++ b/InnerDetector/InDetRecAlgs/SiSpacePointFormation/src/SiTrackerSpacePointFinder.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ /*************************************************************************** @@ -284,7 +284,7 @@ StatusCode SiTrackerSpacePointFinder::execute (const EventContext& ctx) const auto spacepointCollection = std::make_unique< SpacePointCollection >(idHash); spacepointCollection->setIdentifier(elementID); - if ((*colNext)->size() != 0) + if (!(*colNext)->empty()) { m_SiSpacePointMakerTool->fillPixelSpacePointCollection(*colNext,spacepointCollection.get()); } @@ -314,7 +314,7 @@ StatusCode SiTrackerSpacePointFinder::execute (const EventContext& ctx) const // store the overlap space points. // check that the set isn't empty. - if (spacepointoverlapCollection->size()==0) + if (spacepointoverlapCollection->empty()) { ATH_MSG_DEBUG( "No overlap space points found" ); } @@ -412,7 +412,7 @@ void SiTrackerSpacePointFinder::addSCT_SpacePoints(const SCT_ClusterCollection* // Retrieve the neighbours of the detector element const std::vector<IdentifierHash>* others(properties->neighbours(triggerIdHash)); - if (others==0 || others->empty() ) return; + if (others==nullptr || others->empty() ) return; // Save the current detector element and clusters neighbourElements[0] = triggerElement; diff --git a/InnerDetector/InDetRecAlgs/TRT_SeededTrackFinder/src/TRT_SeededTrackFinder.cxx b/InnerDetector/InDetRecAlgs/TRT_SeededTrackFinder/src/TRT_SeededTrackFinder.cxx index d54e524c0c53..be529fd3ea49 100644 --- a/InnerDetector/InDetRecAlgs/TRT_SeededTrackFinder/src/TRT_SeededTrackFinder.cxx +++ b/InnerDetector/InDetRecAlgs/TRT_SeededTrackFinder/src/TRT_SeededTrackFinder.cxx @@ -194,7 +194,7 @@ StatusCode InDet::TRT_SeededTrackFinder::execute_r (const EventContext& ctx) con std::unique_ptr<RoiDescriptor> roiComp = std::make_unique<RoiDescriptor>(true); if (calo.isValid()) { - RoiDescriptor * roi =0; + RoiDescriptor * roi =nullptr; SG::ReadCondHandle<InDet::BeamSpotData> beamSpotHandle { m_beamSpotKey, ctx }; double beamZ = beamSpotHandle->beamVtx().position().z(); roiComp->clear(); @@ -273,7 +273,7 @@ StatusCode InDet::TRT_SeededTrackFinder::execute_r (const EventContext& ctx) con // ok, call track maker and get list of possible track candidates std::list<Trk::Track*> trackSi = m_trackmaker->getTrack(ctx, *event_data_p, *trackTRT); //Get the possible Si extensions - if (trackSi.size()==0) { + if (trackSi.empty()) { ATH_MSG_DEBUG ("No Si track candidates associated to the TRT track "); // statistics @@ -282,7 +282,7 @@ StatusCode InDet::TRT_SeededTrackFinder::execute_r (const EventContext& ctx) con // obsolete backup of TRT only if(m_saveTRT && trackTRT->numberOfMeasurementBases() > m_minTRTonly){ ///Transform the original TRT segment into a track - Trk::Track* trtSeg = 0;trtSeg = segToTrack(ctx, *trackTRT); + Trk::Track* trtSeg = nullptr;trtSeg = segToTrack(ctx, *trackTRT); if(!trtSeg) { ATH_MSG_DEBUG ("Failed to make a track out of the TRT segment!"); continue; @@ -394,7 +394,7 @@ StatusCode InDet::TRT_SeededTrackFinder::execute_r (const EventContext& ctx) con } // do re run a Track extension into TRT ? - Trk::Track* globalTrackNew = 0; + Trk::Track* globalTrackNew = nullptr; // do we have 4 and extension is enabled ? if(int(temptsos->size())>=4 && m_doExtension){ @@ -408,7 +408,7 @@ StatusCode InDet::TRT_SeededTrackFinder::execute_r (const EventContext& ctx) con // call extension tool std::vector<const Trk::MeasurementBase*>& tn = m_trtExtension->extendTrack(ctx, *(*itt), *ext_event_data_p); - if(!tn.size()) { + if(tn.empty()) { // Fallback if extension failed ATH_MSG_DEBUG ("No new segment found, use input segment as fallback."); @@ -469,7 +469,7 @@ StatusCode InDet::TRT_SeededTrackFinder::execute_r (const EventContext& ctx) con ATH_MSG_DEBUG ("Failed to merge TRT+Si track segment !"); if(m_saveTRT && trackTRT->numberOfMeasurementBases() > m_minTRTonly) { - Trk::Track* trtSeg = 0;trtSeg = segToTrack(ctx, *trackTRT); + Trk::Track* trtSeg = nullptr;trtSeg = segToTrack(ctx, *trackTRT); if(!trtSeg){ ATH_MSG_DEBUG ("Failed to make a track out of the TRT segment!"); continue; @@ -525,7 +525,7 @@ StatusCode InDet::TRT_SeededTrackFinder::execute_r (const EventContext& ctx) con m_totalStat += ev_stat; } - for (auto p : tempTracks){ + for (auto *p : tempTracks){ delete p; } m_trackmaker->endEvent(*event_data_p); @@ -654,14 +654,14 @@ Trk::Track* InDet::TRT_SeededTrackFinder::mergeSegments(const Trk::Track& tT, co if ( dynamic_cast<const Trk::PseudoMeasurementOnTrack*>(tS.measurement(it)) ) { if (siHits < 4) { ATH_MSG_DEBUG ("Too few Si hits.Will keep pseudomeasurement..."); - const Trk::TrackStateOnSurface* seg_tsos = new Trk::TrackStateOnSurface(tS.measurement(it)->clone(), 0); + const Trk::TrackStateOnSurface* seg_tsos = new Trk::TrackStateOnSurface(tS.measurement(it)->clone(), nullptr); ntsos->push_back(seg_tsos); } } else { std::bitset<Trk::TrackStateOnSurface::NumberOfTrackStateOnSurfaceTypes> typePattern; typePattern.set(Trk::TrackStateOnSurface::Measurement); // Possible memory leak - const Trk::TrackStateOnSurface* seg_tsos = new Trk::TrackStateOnSurface(tS.measurement(it)->clone(), 0, 0, 0, typePattern); + const Trk::TrackStateOnSurface* seg_tsos = new Trk::TrackStateOnSurface(tS.measurement(it)->clone(), nullptr, nullptr, nullptr, typePattern); ntsos->push_back(seg_tsos); } } @@ -730,13 +730,13 @@ Trk::Track* InDet::TRT_SeededTrackFinder::segToTrack(const EventContext&, const for (int it = 0; it < int(tS.numberOfMeasurementBases()); it++) { // on first measurement add parameters - const Trk::TrackStateOnSurface* seg_tsos = 0; + const Trk::TrackStateOnSurface* seg_tsos = nullptr; std::bitset<Trk::TrackStateOnSurface::NumberOfTrackStateOnSurfaceTypes> typePattern; typePattern.set(Trk::TrackStateOnSurface::Measurement); if (it == 0) - seg_tsos = new Trk::TrackStateOnSurface(tS.measurement(it)->clone(), segPar.release(), 0, 0, typePattern); + seg_tsos = new Trk::TrackStateOnSurface(tS.measurement(it)->clone(), segPar.release(), nullptr, nullptr, typePattern); else - seg_tsos = new Trk::TrackStateOnSurface(tS.measurement(it)->clone(), 0, 0, 0, typePattern); + seg_tsos = new Trk::TrackStateOnSurface(tS.measurement(it)->clone(), nullptr, nullptr, nullptr, typePattern); ntsos->push_back(seg_tsos); } @@ -794,7 +794,7 @@ mergeExtension(const Trk::Track& tT, std::vector<const Trk::MeasurementBase*>& t for (int it = 0; it < int(tS.size()); it++) { std::bitset<Trk::TrackStateOnSurface::NumberOfTrackStateOnSurfaceTypes> typePattern; typePattern.set(Trk::TrackStateOnSurface::Measurement); - const Trk::TrackStateOnSurface* seg_tsos = new Trk::TrackStateOnSurface(tS[it]->clone(), 0, 0, 0, typePattern); + const Trk::TrackStateOnSurface* seg_tsos = new Trk::TrackStateOnSurface(tS[it]->clone(), nullptr, nullptr, nullptr, typePattern); ntsos->push_back(seg_tsos); } diff --git a/InnerDetector/InDetRecAlgs/TRT_TrackExtensionAlg/src/TRT_TrackExtensionAlg.cxx b/InnerDetector/InDetRecAlgs/TRT_TrackExtensionAlg/src/TRT_TrackExtensionAlg.cxx index 8d5191913f60..cd1c2129de49 100755 --- a/InnerDetector/InDetRecAlgs/TRT_TrackExtensionAlg/src/TRT_TrackExtensionAlg.cxx +++ b/InnerDetector/InDetRecAlgs/TRT_TrackExtensionAlg/src/TRT_TrackExtensionAlg.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ #include "TRT_TrackExtensionAlg/TRT_TrackExtensionAlg.h" @@ -61,7 +61,7 @@ StatusCode InDet::TRT_TrackExtensionAlg::execute(const EventContext& ctx) const ++counter.m_nTracks; std::vector<const Trk::MeasurementBase*>& trkExt = m_trtExtension->extendTrack(ctx, *(*trk), *event_data_p); - if( !trkExt.size() ) continue; + if( trkExt.empty() ) continue; outputTracks->insert( std::make_pair((*trk), trkExt) ); ++counter.m_nTracksExtended; -- GitLab