From 4bfcfbe34bbb11449b1370ec2a160f5451407b04 Mon Sep 17 00:00:00 2001 From: AJPfleger Date: Tue, 3 Sep 2024 16:33:48 +0200 Subject: [PATCH 01/32] reverse, rotate, copy_if --- .../TrackFitting/src/RefittingAlgorithm.cpp | 7 ++++--- Examples/Algorithms/Utilities/src/HitSelector.cpp | 11 +++++++---- .../ActsFatras/Kernel/ContinuousProcess.hpp | 9 ++++++--- Fatras/include/ActsFatras/Kernel/Simulation.hpp | 14 +++++++++----- Tests/IntegrationTests/NavigatorConsistency.cpp | 6 ++++-- Tests/UnitTests/Core/EventData/TrackTests.cpp | 3 ++- Tests/UnitTests/Core/EventData/TrackTestsExtra.cpp | 5 +++-- 7 files changed, 35 insertions(+), 20 deletions(-) diff --git a/Examples/Algorithms/TrackFitting/src/RefittingAlgorithm.cpp b/Examples/Algorithms/TrackFitting/src/RefittingAlgorithm.cpp index f3d0df6d1ad..22eb214f634 100644 --- a/Examples/Algorithms/TrackFitting/src/RefittingAlgorithm.cpp +++ b/Examples/Algorithms/TrackFitting/src/RefittingAlgorithm.cpp @@ -1,6 +1,6 @@ // This file is part of the Acts project. // -// Copyright (C) 2023 CERN for the benefit of the Acts project +// Copyright (C) 2023-2024 CERN for the benefit of the Acts project // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include @@ -96,13 +97,13 @@ ActsExamples::ProcessCode ActsExamples::RefittingAlgorithm::execute( trackSourceLinks.push_back(Acts::SourceLink{sl}); } - std::reverse(surfSequence.begin(), surfSequence.end()); - if (surfSequence.empty()) { ACTS_WARNING("Empty track " << itrack << " found."); continue; } + std::ranges::reverse(surfSequence); + ACTS_VERBOSE("Initial parameters: " << initialParams.fourPosition(ctx.geoContext).transpose() << " -> " << initialParams.direction().transpose()); diff --git a/Examples/Algorithms/Utilities/src/HitSelector.cpp b/Examples/Algorithms/Utilities/src/HitSelector.cpp index 1da7e059483..69ce9a1916f 100644 --- a/Examples/Algorithms/Utilities/src/HitSelector.cpp +++ b/Examples/Algorithms/Utilities/src/HitSelector.cpp @@ -1,6 +1,6 @@ // This file is part of the Acts project. // -// Copyright (C) 2019-2023 CERN for the benefit of the Acts project +// Copyright (C) 2019-2024 CERN for the benefit of the Acts project // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this @@ -8,6 +8,8 @@ #include "ActsExamples/Utilities/HitSelector.hpp" +#include + ActsExamples::HitSelector::HitSelector(const Config& config, Acts::Logging::Level level) : IAlgorithm("HitSelector", level), m_cfg(config) { @@ -20,9 +22,10 @@ ActsExamples::ProcessCode ActsExamples::HitSelector::execute( const auto& hits = m_inputHits(ctx); SimHitContainer selectedHits; - std::copy_if(hits.begin(), hits.end(), - std::inserter(selectedHits, selectedHits.begin()), - [&](const auto& hit) { return hit.time() < m_cfg.maxTime; }); + std::ranges::copy(hits | std::ranges::views::filter([&](const auto& hit) { + return hit.time() < m_cfg.maxTime; + }), + std::inserter(selectedHits, selectedHits.begin())); ACTS_DEBUG("selected " << selectedHits.size() << " from " << hits.size() << " hits"); diff --git a/Fatras/include/ActsFatras/Kernel/ContinuousProcess.hpp b/Fatras/include/ActsFatras/Kernel/ContinuousProcess.hpp index 570d509d883..bac20422b7c 100644 --- a/Fatras/include/ActsFatras/Kernel/ContinuousProcess.hpp +++ b/Fatras/include/ActsFatras/Kernel/ContinuousProcess.hpp @@ -1,6 +1,6 @@ // This file is part of the Acts project. // -// Copyright (C) 2018-2020 CERN for the benefit of the Acts project +// Copyright (C) 2018-2024 CERN for the benefit of the Acts project // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this @@ -11,6 +11,8 @@ #include "Acts/Material/MaterialSlab.hpp" #include "ActsFatras/EventData/Particle.hpp" +#include + namespace ActsFatras { /// A continuous simulation process based on a physics model plus selectors. @@ -70,8 +72,9 @@ struct ContinuousProcess { // modify particle according to the physics process auto children = physics(generator, slab, particle); // move selected child particles to the output container - std::copy_if(std::begin(children), std::end(children), - std::back_inserter(generated), selectChildParticle); + std::ranges::copy( + children | std::ranges::views::filter(selectChildParticle), + std::back_inserter(generated)); // break condition is defined by whether the output particle is still valid // or not e.g. because it has fallen below a momentum threshold. return !selectOutputParticle(particle); diff --git a/Fatras/include/ActsFatras/Kernel/Simulation.hpp b/Fatras/include/ActsFatras/Kernel/Simulation.hpp index c60bed02b9f..7571a0d2991 100644 --- a/Fatras/include/ActsFatras/Kernel/Simulation.hpp +++ b/Fatras/include/ActsFatras/Kernel/Simulation.hpp @@ -1,6 +1,6 @@ // This file is part of the Acts project. // -// Copyright (C) 2018-2021 CERN for the benefit of the Acts project +// Copyright (C) 2018-2024 CERN for the benefit of the Acts project // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this @@ -29,6 +29,7 @@ #include #include #include +#include #include namespace ActsFatras { @@ -288,10 +289,13 @@ struct Simulation { // store final particle state at the end of the simulation particlesFinal.push_back(result.particle); // move generated secondaries that should be simulated to the output - std::copy_if( - result.generatedParticles.begin(), result.generatedParticles.end(), - std::back_inserter(particlesInitial), - [this](const Particle &particle) { return selectParticle(particle); }); + std::ranges::copy( + result.generatedParticles | + std::ranges::views::filter([this](const Particle &particle) { + return selectParticle(particle); + }), + std::back_inserter(particlesInitial)); + std::copy(result.hits.begin(), result.hits.end(), std::back_inserter(hits)); } diff --git a/Tests/IntegrationTests/NavigatorConsistency.cpp b/Tests/IntegrationTests/NavigatorConsistency.cpp index c4a380a5d3f..e32e78b6ab4 100644 --- a/Tests/IntegrationTests/NavigatorConsistency.cpp +++ b/Tests/IntegrationTests/NavigatorConsistency.cpp @@ -23,6 +23,8 @@ #include "Acts/Tests/CommonHelpers/CylindricalTrackingGeometry.hpp" #include "Acts/Utilities/VectorHelpers.hpp" +#include + namespace bdata = boost::unit_test::data; using namespace Acts::UnitLiterals; using Acts::VectorHelpers::perp; @@ -130,7 +132,7 @@ void runSelfConsistencyTest(const propagator_t& prop, // forward-backward compatibility test { - std::reverse(bwdSurfaces.begin(), bwdSurfaces.end()); + std::ranges::reverse(bwdSurfaces); BOOST_CHECK_EQUAL_COLLECTIONS(bwdSurfaces.begin(), bwdSurfaces.end(), fwdSurfaces.begin(), fwdSurfaces.end()); } @@ -235,7 +237,7 @@ void runSelfConsistencyTest(const propagator_t& prop, // TODO backward-backward step compatibility test - std::reverse(bwdStepSurfaces.begin(), bwdStepSurfaces.end()); + std::ranges::reverse(bwdStepSurfaces); BOOST_CHECK_EQUAL_COLLECTIONS(bwdStepSurfaces.begin(), bwdStepSurfaces.end(), fwdStepSurfaces.begin(), fwdStepSurfaces.end()); } diff --git a/Tests/UnitTests/Core/EventData/TrackTests.cpp b/Tests/UnitTests/Core/EventData/TrackTests.cpp index 698ea737d2a..4eccbafc261 100644 --- a/Tests/UnitTests/Core/EventData/TrackTests.cpp +++ b/Tests/UnitTests/Core/EventData/TrackTests.cpp @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -441,7 +442,7 @@ BOOST_AUTO_TEST_CASE(ForwardIteration) { indices.push_back(ts.index()); } - std::reverse(indices.begin(), indices.end()); + std::ranges::reverse(indices); std::vector act; for (auto ts : t.trackStates()) { diff --git a/Tests/UnitTests/Core/EventData/TrackTestsExtra.cpp b/Tests/UnitTests/Core/EventData/TrackTestsExtra.cpp index 811c3cd3770..a4e411a02bd 100644 --- a/Tests/UnitTests/Core/EventData/TrackTestsExtra.cpp +++ b/Tests/UnitTests/Core/EventData/TrackTestsExtra.cpp @@ -16,6 +16,7 @@ #include "Acts/Utilities/Zip.hpp" #include +#include using namespace Acts; using namespace Acts::HashedStringLiteral; @@ -419,8 +420,8 @@ BOOST_AUTO_TEST_CASE(ReverseTrackStates) { // reverse with jacobians t.reverseTrackStates(true); - std::reverse(exp.begin(), exp.end()); - std::rotate(exp.rbegin(), std::next(exp.rbegin()), exp.rend()); + std::ranges::rotate(exp, std::next(exp.begin())); + std::ranges::reverse(exp); for (const auto [e, ts] : zip(exp, t.trackStates())) { Acts::BoundMatrix expJac; From 60415667c5d153f426495b0bd65dbdca1ff3bea4 Mon Sep 17 00:00:00 2001 From: AJPfleger Date: Tue, 3 Sep 2024 17:46:24 +0200 Subject: [PATCH 02/32] unique --- .../Acts/Navigation/MultiLayerNavigation.hpp | 4 ++-- Core/src/MagneticField/BFieldMapUtils.cpp | 23 ++++++++++--------- Core/src/Material/MaterialMapUtils.cpp | 23 ++++++++++--------- .../Geant4/src/SensitiveSurfaceMapper.cpp | 5 ++-- Plugins/DD4hep/src/DD4hepLayerBuilder.cpp | 9 ++++---- Plugins/ExaTrkX/src/BoostTrackBuilding.cpp | 4 ++-- .../src/TorchTruthGraphMetricsHook.cpp | 6 +++-- 7 files changed, 38 insertions(+), 36 deletions(-) diff --git a/Core/include/Acts/Navigation/MultiLayerNavigation.hpp b/Core/include/Acts/Navigation/MultiLayerNavigation.hpp index 15042881147..7b8e04a1f02 100644 --- a/Core/include/Acts/Navigation/MultiLayerNavigation.hpp +++ b/Core/include/Acts/Navigation/MultiLayerNavigation.hpp @@ -16,6 +16,7 @@ #include #include +#include namespace Acts::Experimental { @@ -117,8 +118,7 @@ class MultiLayerNavigation : public IInternalNavigation { }); // Remove the duplicates - surfaces.erase(std::unique(surfaces.begin(), surfaces.end()), - surfaces.end()); + surfaces.erase(std::ranges::unique(surfaces).begin(), surfaces.end()); } private: diff --git a/Core/src/MagneticField/BFieldMapUtils.cpp b/Core/src/MagneticField/BFieldMapUtils.cpp index b1977daac0b..ae955b3d60c 100644 --- a/Core/src/MagneticField/BFieldMapUtils.cpp +++ b/Core/src/MagneticField/BFieldMapUtils.cpp @@ -1,6 +1,6 @@ // This file is part of the Acts project. // -// Copyright (C) 2017-2018 CERN for the benefit of the Acts project +// Copyright (C) 2017-2024 CERN for the benefit of the Acts project // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this @@ -21,6 +21,7 @@ #include #include #include +#include #include #include @@ -39,11 +40,11 @@ Acts::fieldMapRZ( bool firstQuadrant) { // [1] Create Grid // sort the values - std::sort(rPos.begin(), rPos.end()); - std::sort(zPos.begin(), zPos.end()); + std::ranges::sort(rPos); + std::ranges::sort(zPos); // Get unique values - rPos.erase(std::unique(rPos.begin(), rPos.end()), rPos.end()); - zPos.erase(std::unique(zPos.begin(), zPos.end()), zPos.end()); + rPos.erase(std::ranges::unique(rPos).begin(), rPos.end()); + zPos.erase(std::ranges::unique(zPos).begin(), zPos.end()); rPos.shrink_to_fit(); zPos.shrink_to_fit(); // get the number of bins @@ -145,13 +146,13 @@ Acts::fieldMapXYZ( double lengthUnit, double BFieldUnit, bool firstOctant) { // [1] Create Grid // Sort the values - std::sort(xPos.begin(), xPos.end()); - std::sort(yPos.begin(), yPos.end()); - std::sort(zPos.begin(), zPos.end()); + std::ranges::sort(xPos); + std::ranges::sort(yPos); + std::ranges::sort(zPos); // Get unique values - xPos.erase(std::unique(xPos.begin(), xPos.end()), xPos.end()); - yPos.erase(std::unique(yPos.begin(), yPos.end()), yPos.end()); - zPos.erase(std::unique(zPos.begin(), zPos.end()), zPos.end()); + xPos.erase(std::ranges::unique(xPos).begin(), xPos.end()); + yPos.erase(std::ranges::unique(yPos).begin(), yPos.end()); + zPos.erase(std::ranges::unique(zPos).begin(), zPos.end()); xPos.shrink_to_fit(); yPos.shrink_to_fit(); zPos.shrink_to_fit(); diff --git a/Core/src/Material/MaterialMapUtils.cpp b/Core/src/Material/MaterialMapUtils.cpp index ee866556cd5..1ed1228b7dd 100644 --- a/Core/src/Material/MaterialMapUtils.cpp +++ b/Core/src/Material/MaterialMapUtils.cpp @@ -1,6 +1,6 @@ // This file is part of the Acts project. // -// Copyright (C) 2019-2020 CERN for the benefit of the Acts project +// Copyright (C) 2019-2024 CERN for the benefit of the Acts project // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -44,11 +45,11 @@ auto Acts::materialMapperRZ( // [2] Create Grid // sort the values - std::sort(rPos.begin(), rPos.end()); - std::sort(zPos.begin(), zPos.end()); + std::ranges::sort(rPos); + std::ranges::sort(zPos); // Get unique values - rPos.erase(std::unique(rPos.begin(), rPos.end()), rPos.end()); - zPos.erase(std::unique(zPos.begin(), zPos.end()), zPos.end()); + rPos.erase(std::ranges::unique(rPos).begin(), rPos.end()); + zPos.erase(std::ranges::unique(zPos).begin(), zPos.end()); rPos.shrink_to_fit(); zPos.shrink_to_fit(); // get the number of bins @@ -126,13 +127,13 @@ auto Acts::materialMapperXYZ( // [2] Create Grid // Sort the values - std::sort(xPos.begin(), xPos.end()); - std::sort(yPos.begin(), yPos.end()); - std::sort(zPos.begin(), zPos.end()); + std::ranges::sort(xPos); + std::ranges::sort(yPos); + std::ranges::sort(zPos); // Get unique values - xPos.erase(std::unique(xPos.begin(), xPos.end()), xPos.end()); - yPos.erase(std::unique(yPos.begin(), yPos.end()), yPos.end()); - zPos.erase(std::unique(zPos.begin(), zPos.end()), zPos.end()); + xPos.erase(std::ranges::unique(xPos).begin(), xPos.end()); + yPos.erase(std::ranges::unique(yPos).begin(), yPos.end()); + zPos.erase(std::ranges::unique(zPos).begin(), zPos.end()); xPos.shrink_to_fit(); yPos.shrink_to_fit(); zPos.shrink_to_fit(); diff --git a/Examples/Algorithms/Geant4/src/SensitiveSurfaceMapper.cpp b/Examples/Algorithms/Geant4/src/SensitiveSurfaceMapper.cpp index 341e0531b07..e1987a6a842 100644 --- a/Examples/Algorithms/Geant4/src/SensitiveSurfaceMapper.cpp +++ b/Examples/Algorithms/Geant4/src/SensitiveSurfaceMapper.cpp @@ -1,6 +1,6 @@ // This file is part of the Acts project. // -// Copyright (C) 2021 CERN for the benefit of the Acts project +// Copyright (C) 2021-2024 CERN for the benefit of the Acts project // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this @@ -303,8 +303,7 @@ bool ActsExamples::SensitiveSurfaceMapper::checkMapping( found.push_back(surfacePtr); } std::sort(found.begin(), found.end()); - auto newEnd = std::unique(found.begin(), found.end()); - found.erase(newEnd, found.end()); + found.erase(std::ranges::unique(found), found.end()); std::vector missing; std::set_difference(allSurfaces.begin(), allSurfaces.end(), found.begin(), diff --git a/Plugins/DD4hep/src/DD4hepLayerBuilder.cpp b/Plugins/DD4hep/src/DD4hepLayerBuilder.cpp index 4d604fbeb42..64ceaf0dd97 100644 --- a/Plugins/DD4hep/src/DD4hepLayerBuilder.cpp +++ b/Plugins/DD4hep/src/DD4hepLayerBuilder.cpp @@ -1,6 +1,6 @@ // This file is part of the Acts project. // -// Copyright (C) 2017-2019 CERN for the benefit of the Acts project +// Copyright (C) 2017-2024 CERN for the benefit of the Acts project // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this @@ -35,6 +35,7 @@ #include #include #include +#include #include #include @@ -104,8 +105,7 @@ const Acts::LayerVector Acts::DD4hepLayerBuilder::endcapLayers( }); std::sort(rvalues.begin(), rvalues.end()); std::vector locs; - std::transform(rvalues.begin(), - std::unique(rvalues.begin(), rvalues.end()), + std::transform(rvalues.begin(), std::ranges::unique(rvalues).begin(), std::back_inserter(locs), [](const auto& v) { return std::to_string(v); }); ACTS_VERBOSE( @@ -277,8 +277,7 @@ const Acts::LayerVector Acts::DD4hepLayerBuilder::centralLayers( }); std::sort(zvalues.begin(), zvalues.end()); std::vector locs; - std::transform(zvalues.begin(), - std::unique(zvalues.begin(), zvalues.end()), + std::transform(zvalues.begin(), std::ranges::unique(zvalues).begin(), std::back_inserter(locs), [](const auto& v) { return std::to_string(v); }); ACTS_VERBOSE( diff --git a/Plugins/ExaTrkX/src/BoostTrackBuilding.cpp b/Plugins/ExaTrkX/src/BoostTrackBuilding.cpp index 01083f50709..ea8442c1edf 100644 --- a/Plugins/ExaTrkX/src/BoostTrackBuilding.cpp +++ b/Plugins/ExaTrkX/src/BoostTrackBuilding.cpp @@ -82,8 +82,8 @@ std::vector> BoostTrackBuilding::operator()( ACTS_VERBOSE("Number of track labels: " << trackLabels.size()); ACTS_VERBOSE("Number of unique track labels: " << [&]() { std::vector sorted(trackLabels); - std::sort(sorted.begin(), sorted.end()); - sorted.erase(std::unique(sorted.begin(), sorted.end()), sorted.end()); + std::ranges::sort(sorted); + sorted.erase(std::ranges::unique(sorted).begin(), sorted.end()); return sorted.size(); }()); diff --git a/Plugins/ExaTrkX/src/TorchTruthGraphMetricsHook.cpp b/Plugins/ExaTrkX/src/TorchTruthGraphMetricsHook.cpp index f279c5bb2cd..b04ff5640dc 100644 --- a/Plugins/ExaTrkX/src/TorchTruthGraphMetricsHook.cpp +++ b/Plugins/ExaTrkX/src/TorchTruthGraphMetricsHook.cpp @@ -10,6 +10,8 @@ #include "Acts/Plugins/ExaTrkX/detail/TensorVectorConversion.hpp" +#include + #include namespace { @@ -24,9 +26,9 @@ auto cantorize(std::vector edgeIndex, cantorEdgeIndex.emplace_back(*it, *std::next(it)); } - std::sort(cantorEdgeIndex.begin(), cantorEdgeIndex.end()); + std::ranges::sort(cantorEdgeIndex); - auto new_end = std::unique(cantorEdgeIndex.begin(), cantorEdgeIndex.end()); + auto new_end = std::ranges::unique(cantorEdgeIndex); if (new_end != cantorEdgeIndex.end()) { ACTS_WARNING("Graph not unique (" << std::distance(new_end, cantorEdgeIndex.end()) From c4293765d796990f70aafc4f94f96e2711aa6ef1 Mon Sep 17 00:00:00 2001 From: AJPfleger Date: Tue, 3 Sep 2024 17:54:53 +0200 Subject: [PATCH 03/32] some sort --- .../Acts/Clusterization/Clusterization.ipp | 5 ++-- Core/include/Acts/Propagator/Navigator.hpp | 24 +++++++++---------- Core/include/Acts/Seeding/SeedFilter.ipp | 7 +++--- .../Geometry/TrackingVolumeArrayCreator.cpp | 5 ++-- 4 files changed, 21 insertions(+), 20 deletions(-) diff --git a/Core/include/Acts/Clusterization/Clusterization.ipp b/Core/include/Acts/Clusterization/Clusterization.ipp index 44f8abd1267..523387c715b 100644 --- a/Core/include/Acts/Clusterization/Clusterization.ipp +++ b/Core/include/Acts/Clusterization/Clusterization.ipp @@ -1,12 +1,13 @@ // This file is part of the Acts project. // -// Copyright (C) 2022 CERN for the benefit of the Acts project +// Copyright (C) 2022-2024 CERN for the benefit of the Acts project // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. #include +#include #include #include @@ -273,7 +274,7 @@ void labelClusters(CellCollection& cells, Connect connect) { internal::DisjointSets ds{}; // Sort cells by position to enable in-order scan - std::sort(cells.begin(), cells.end(), internal::Compare()); + std::ranges::sort(cells, internal::Compare()); // First pass: Allocate labels and record equivalences for (auto it = cells.begin(); it != cells.end(); ++it) { diff --git a/Core/include/Acts/Propagator/Navigator.hpp b/Core/include/Acts/Propagator/Navigator.hpp index 73e928b762e..168aba8e0cc 100644 --- a/Core/include/Acts/Propagator/Navigator.hpp +++ b/Core/include/Acts/Propagator/Navigator.hpp @@ -20,6 +20,7 @@ #include "Acts/Utilities/Logger.hpp" #include "Acts/Utilities/StringHelpers.hpp" +#include #include #include @@ -889,11 +890,10 @@ class Navigator { state.geoContext, stepper.position(state.stepping), state.options.direction * stepper.direction(state.stepping), navOpts, logger()); - std::sort(state.navigation.navBoundaries.begin(), - state.navigation.navBoundaries.end(), - [](const auto& a, const auto& b) { - return SurfaceIntersection::pathLengthOrder(a.first, b.first); - }); + std::ranges::sort( + state.navigation.navBoundaries, [](const auto& a, const auto& b) { + return SurfaceIntersection::pathLengthOrder(a.first, b.first); + }); // Print boundary information if (logger().doPrint(Logging::VERBOSE)) { @@ -1011,9 +1011,8 @@ class Navigator { state.navigation.navSurfaces = currentLayer->compatibleSurfaces( state.geoContext, stepper.position(state.stepping), state.options.direction * stepper.direction(state.stepping), navOpts); - std::sort(state.navigation.navSurfaces.begin(), - state.navigation.navSurfaces.end(), - SurfaceIntersection::pathLengthOrder); + std::ranges::sort(state.navigation.navSurfaces, + SurfaceIntersection::pathLengthOrder); // Print surface information if (logger().doPrint(Logging::VERBOSE)) { @@ -1079,11 +1078,10 @@ class Navigator { state.geoContext, stepper.position(state.stepping), state.options.direction * stepper.direction(state.stepping), navOpts); - std::sort(state.navigation.navLayers.begin(), - state.navigation.navLayers.end(), - [](const auto& a, const auto& b) { - return SurfaceIntersection::pathLengthOrder(a.first, b.first); - }); + std::ranges::sort( + state.navigation.navLayers, [](const auto& a, const auto& b) { + return SurfaceIntersection::pathLengthOrder(a.first, b.first); + }); // Print layer information if (logger().doPrint(Logging::VERBOSE)) { diff --git a/Core/include/Acts/Seeding/SeedFilter.ipp b/Core/include/Acts/Seeding/SeedFilter.ipp index 71d2a6250ce..7b45b24037b 100644 --- a/Core/include/Acts/Seeding/SeedFilter.ipp +++ b/Core/include/Acts/Seeding/SeedFilter.ipp @@ -1,6 +1,6 @@ // This file is part of the Acts project. // -// Copyright (C) 2023 CERN for the benefit of the Acts project +// Copyright (C) 2023-2024 CERN for the benefit of the Acts project // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this @@ -10,6 +10,7 @@ #include #include +#include #include namespace Acts { @@ -69,8 +70,8 @@ void SeedFilter::filterSeeds_2SpFixed( if (topSpVec.size() > 2) { // sort indexes based on comparing values in invHelixDiameterVec - std::sort( - topSPIndexVec.begin(), topSPIndexVec.end(), + std::ranges::sort( + topSPIndexVec, [&invHelixDiameterVec](const std::size_t i1, const std::size_t i2) { return invHelixDiameterVec[i1] < invHelixDiameterVec[i2]; }); diff --git a/Core/src/Geometry/TrackingVolumeArrayCreator.cpp b/Core/src/Geometry/TrackingVolumeArrayCreator.cpp index 15ca130289a..72b0b34ae29 100644 --- a/Core/src/Geometry/TrackingVolumeArrayCreator.cpp +++ b/Core/src/Geometry/TrackingVolumeArrayCreator.cpp @@ -1,6 +1,6 @@ // This file is part of the Acts project. // -// Copyright (C) 2016-2018 CERN for the benefit of the Acts project +// Copyright (C) 2016-2024 CERN for the benefit of the Acts project // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this @@ -16,6 +16,7 @@ #include "Acts/Utilities/BinnedArrayXD.hpp" #include +#include #include std::shared_ptr @@ -29,7 +30,7 @@ Acts::TrackingVolumeArrayCreator::trackingVolumeArray( // sort it accordingly to the binning value GeometryObjectSorterT> volumeSorter( gctx, bValue); - std::sort(volumes.begin(), volumes.end(), volumeSorter); + std::ranges::sort(volumes, volumeSorter); // prepare what we need : // (1) arbitrary binning for volumes is fast enough From dfec315be338e1c63fc9871306ccf0bbfe082eb4 Mon Sep 17 00:00:00 2001 From: "Alexander J. Pfleger" <70842573+AJPfleger@users.noreply.github.com> Date: Tue, 3 Sep 2024 20:53:53 +0200 Subject: [PATCH 04/32] Update SensitiveSurfaceMapper.cpp --- Examples/Algorithms/Geant4/src/SensitiveSurfaceMapper.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Examples/Algorithms/Geant4/src/SensitiveSurfaceMapper.cpp b/Examples/Algorithms/Geant4/src/SensitiveSurfaceMapper.cpp index e1987a6a842..b6365fa406a 100644 --- a/Examples/Algorithms/Geant4/src/SensitiveSurfaceMapper.cpp +++ b/Examples/Algorithms/Geant4/src/SensitiveSurfaceMapper.cpp @@ -303,7 +303,7 @@ bool ActsExamples::SensitiveSurfaceMapper::checkMapping( found.push_back(surfacePtr); } std::sort(found.begin(), found.end()); - found.erase(std::ranges::unique(found), found.end()); + found.erase(std::ranges::unique(found).begin(), found.end()); std::vector missing; std::set_difference(allSurfaces.begin(), allSurfaces.end(), found.begin(), From 267f80e0b09a0a6a1d828dd3c520c26862ea6484 Mon Sep 17 00:00:00 2001 From: "Alexander J. Pfleger" <70842573+AJPfleger@users.noreply.github.com> Date: Tue, 3 Sep 2024 21:20:04 +0200 Subject: [PATCH 05/32] Update MultiLayerNavigation.hpp --- Core/include/Acts/Navigation/MultiLayerNavigation.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Core/include/Acts/Navigation/MultiLayerNavigation.hpp b/Core/include/Acts/Navigation/MultiLayerNavigation.hpp index 7b8e04a1f02..15042881147 100644 --- a/Core/include/Acts/Navigation/MultiLayerNavigation.hpp +++ b/Core/include/Acts/Navigation/MultiLayerNavigation.hpp @@ -16,7 +16,6 @@ #include #include -#include namespace Acts::Experimental { @@ -118,7 +117,8 @@ class MultiLayerNavigation : public IInternalNavigation { }); // Remove the duplicates - surfaces.erase(std::ranges::unique(surfaces).begin(), surfaces.end()); + surfaces.erase(std::unique(surfaces.begin(), surfaces.end()), + surfaces.end()); } private: From 6ae5e5d586101912a47a4f4456830be9f92c98da Mon Sep 17 00:00:00 2001 From: AJPfleger Date: Wed, 4 Sep 2024 09:35:01 +0200 Subject: [PATCH 06/32] revert some unique --- Core/src/MagneticField/BFieldMapUtils.cpp | 10 +++++----- Core/src/Material/MaterialMapUtils.cpp | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Core/src/MagneticField/BFieldMapUtils.cpp b/Core/src/MagneticField/BFieldMapUtils.cpp index ae955b3d60c..e88f21b1c7f 100644 --- a/Core/src/MagneticField/BFieldMapUtils.cpp +++ b/Core/src/MagneticField/BFieldMapUtils.cpp @@ -43,8 +43,8 @@ Acts::fieldMapRZ( std::ranges::sort(rPos); std::ranges::sort(zPos); // Get unique values - rPos.erase(std::ranges::unique(rPos).begin(), rPos.end()); - zPos.erase(std::ranges::unique(zPos).begin(), zPos.end()); + rPos.erase(std::unique(rPos.begin(), rPos.end()), rPos.end()); + rPos.erase(std::unique(zPos.begin(), zPos.end()), zPos.end()); rPos.shrink_to_fit(); zPos.shrink_to_fit(); // get the number of bins @@ -150,9 +150,9 @@ Acts::fieldMapXYZ( std::ranges::sort(yPos); std::ranges::sort(zPos); // Get unique values - xPos.erase(std::ranges::unique(xPos).begin(), xPos.end()); - yPos.erase(std::ranges::unique(yPos).begin(), yPos.end()); - zPos.erase(std::ranges::unique(zPos).begin(), zPos.end()); + rPos.erase(std::unique(xPos.begin(), xPos.end()), xPos.end()); + rPos.erase(std::unique(yPos.begin(), yPos.end()), yPos.end()); + rPos.erase(std::unique(zPos.begin(), zPos.end()), zPos.end()); xPos.shrink_to_fit(); yPos.shrink_to_fit(); zPos.shrink_to_fit(); diff --git a/Core/src/Material/MaterialMapUtils.cpp b/Core/src/Material/MaterialMapUtils.cpp index 1ed1228b7dd..5681b82b68e 100644 --- a/Core/src/Material/MaterialMapUtils.cpp +++ b/Core/src/Material/MaterialMapUtils.cpp @@ -48,8 +48,8 @@ auto Acts::materialMapperRZ( std::ranges::sort(rPos); std::ranges::sort(zPos); // Get unique values - rPos.erase(std::ranges::unique(rPos).begin(), rPos.end()); - zPos.erase(std::ranges::unique(zPos).begin(), zPos.end()); + rPos.erase(std::unique(rPos.begin(), rPos.end()), rPos.end()); + rPos.erase(std::unique(zPos.begin(), zPos.end()), zPos.end()); rPos.shrink_to_fit(); zPos.shrink_to_fit(); // get the number of bins @@ -131,9 +131,9 @@ auto Acts::materialMapperXYZ( std::ranges::sort(yPos); std::ranges::sort(zPos); // Get unique values - xPos.erase(std::ranges::unique(xPos).begin(), xPos.end()); - yPos.erase(std::ranges::unique(yPos).begin(), yPos.end()); - zPos.erase(std::ranges::unique(zPos).begin(), zPos.end()); + rPos.erase(std::unique(xPos.begin(), xPos.end()), xPos.end()); + rPos.erase(std::unique(yPos.begin(), yPos.end()), yPos.end()); + rPos.erase(std::unique(zPos.begin(), zPos.end()), zPos.end()); xPos.shrink_to_fit(); yPos.shrink_to_fit(); zPos.shrink_to_fit(); From bb2589807824465064f370369df12effb7800da5 Mon Sep 17 00:00:00 2001 From: AJPfleger Date: Wed, 4 Sep 2024 10:37:59 +0200 Subject: [PATCH 07/32] sort where possible --- .../Acts/Navigation/DetectorNavigator.hpp | 16 +++++----- .../Acts/Navigation/MultiLayerNavigation.hpp | 22 +++++++------- .../Navigation/NavigationStateUpdaters.hpp | 12 ++++---- .../Acts/Propagator/TryAllNavigator.hpp | 10 +++---- Core/include/Acts/Seeding/GbtsDataStorage.hpp | 7 +++-- .../Acts/Seeding/GbtsTrackingFilter.hpp | 7 +++-- .../Acts/Seeding/HoughTransformUtils.ipp | 23 ++++++++------- Core/include/Acts/Seeding/SeedFinder.ipp | 25 +++++++++------- Core/include/Acts/Seeding/SeedFinderGbts.ipp | 11 +++---- .../Acts/Seeding/SeedFinderOrthogonal.ipp | 16 +++++----- .../detail/CylindricalSpacePointGrid.ipp | 7 ++--- Core/include/Acts/Utilities/BinningData.hpp | 5 ++-- .../Acts/Vertexing/SingleSeedVertexFinder.ipp | 18 ++++++------ Core/src/Detector/LayerStructureBuilder.cpp | 11 +++---- Core/src/Detector/detail/BlueprintHelper.cpp | 22 +++++++------- .../detail/CuboidalDetectorHelper.cpp | 5 ++-- .../src/Detector/detail/IndexedGridFiller.cpp | 7 +++-- Core/src/Geometry/CuboidVolumeBuilder.cpp | 11 +++---- Core/src/Geometry/CylinderVolumeBuilder.cpp | 7 +++-- Core/src/Geometry/CylinderVolumeStack.cpp | 25 +++++++++------- Core/src/Geometry/LayerArrayCreator.cpp | 5 ++-- Core/src/Geometry/SurfaceArrayCreator.cpp | 5 ++-- Core/src/MagneticField/BFieldMapUtils.cpp | 8 ++--- .../Material/IntersectionMaterialAssigner.cpp | 6 ++-- Core/src/Material/MaterialMapUtils.cpp | 8 ++--- Core/src/Surfaces/VerticesHelper.cpp | 5 ++-- Core/src/TrackFitting/GsfMixtureReduction.cpp | 11 +++---- Core/src/Vertexing/FsmwMode1dFinder.cpp | 9 +++--- .../src/DigitizationAlgorithm.cpp | 5 ++-- .../Geant4/src/SensitiveSurfaceMapper.cpp | 4 +-- .../HepMC/src/HepMCProcessExtractor.cpp | 11 +++---- .../src/PrototracksToParameters.cpp | 7 +++-- .../src/TruthGraphBuilder.cpp | 8 +++-- .../TruthTracking/TruthSeedingAlgorithm.cpp | 12 ++++---- .../AdaptiveMultiVertexFinderAlgorithm.cpp | 12 ++++---- .../src/MockupSectorBuilder.cpp | 10 +++---- .../src/TelescopeDetector.cpp | 5 ++-- .../include/ActsExamples/EventData/Index.hpp | 5 ++-- .../Framework/src/Framework/Sequencer.cpp | 5 ++-- .../Framework/src/Framework/WhiteBoard.cpp | 7 +++-- .../src/Utilities/EventDataTransforms.cpp | 7 +++-- .../src/Validation/TrackClassification.cpp | 13 +++++---- Examples/Io/Csv/src/CsvMeasurementReader.cpp | 5 ++-- Examples/Io/Csv/src/CsvTrackWriter.cpp | 29 ++++++++++--------- Examples/Io/EDM4hep/src/EDM4hepReader.cpp | 8 ++--- Examples/Io/Root/src/RootSimHitReader.cpp | 10 +++---- .../defineReconstructionPerformance.C | 5 ++-- Fatras/src/Digitization/PlanarSurfaceMask.cpp | 6 ++-- .../Acts/Plugins/Cuda/Seeding/SeedFinder.ipp | 7 +++-- .../Acts/Plugins/Cuda/Seeding2/SeedFinder.ipp | 11 ++++--- Plugins/DD4hep/src/DD4hepLayerBuilder.cpp | 4 +-- .../src/TorchTruthGraphMetricsHook.cpp | 2 +- .../GeoIntersectionAnnulusConverter.cpp | 9 +++--- .../src/detail/GeoPolygonConverter.cpp | 10 ++++--- .../Tests/CommonHelpers/BenchmarkTools.hpp | 5 ++-- .../Fatras/FatrasSimulationTests.cpp | 10 +++---- .../Legacy/ATLSeedingIntegrationTest.cpp | 7 +++-- .../Clusterization/ClusterizationTests1D.cpp | 9 +++--- .../Clusterization/ClusterizationTests2D.cpp | 9 +++--- .../CuboidalDetectorFromBlueprintTests.cpp | 5 ++-- .../Seeding/CandidatesForMiddleSpTests.cpp | 9 +++--- .../TrackFitting/GsfMixtureReductionTests.cpp | 9 +++--- .../Core/Utilities/IntersectionTests.cpp | 24 ++++++--------- .../Core/Utilities/SubspaceTests.cpp | 5 ++-- .../ExaTrkXBoostTrackBuildingTests.cpp | 7 +++-- .../ExaTrkX/ExaTrkXEdgeBuildingTest.cpp | 7 +++-- 66 files changed, 345 insertions(+), 302 deletions(-) diff --git a/Core/include/Acts/Navigation/DetectorNavigator.hpp b/Core/include/Acts/Navigation/DetectorNavigator.hpp index 02522888f14..d66ff3001c0 100644 --- a/Core/include/Acts/Navigation/DetectorNavigator.hpp +++ b/Core/include/Acts/Navigation/DetectorNavigator.hpp @@ -1,6 +1,6 @@ // This file is part of the Acts project. // -// Copyright (C) 2023 CERN for the benefit of the Acts project +// Copyright (C) 2023-2024 CERN for the benefit of the Acts project // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this @@ -24,6 +24,7 @@ #include #include +#include #include #include @@ -405,13 +406,12 @@ class DetectorNavigator { // Sort properly the surface candidates auto& nCandidates = nState.surfaceCandidates; - std::sort(nCandidates.begin(), nCandidates.end(), - [&](const auto& a, const auto& b) { - // The two path lengths - ActsScalar pathToA = a.objectIntersection.pathLength(); - ActsScalar pathToB = b.objectIntersection.pathLength(); - return pathToA < pathToB; - }); + std::ranges::sort(nCandidates, [&](const auto& a, const auto& b) { + // The two path lengths + ActsScalar pathToA = a.objectIntersection.pathLength(); + ActsScalar pathToB = b.objectIntersection.pathLength(); + return pathToA < pathToB; + }); // Set the surface candidate nState.surfaceCandidateIndex = 0; } diff --git a/Core/include/Acts/Navigation/MultiLayerNavigation.hpp b/Core/include/Acts/Navigation/MultiLayerNavigation.hpp index 15042881147..4105a72b5c4 100644 --- a/Core/include/Acts/Navigation/MultiLayerNavigation.hpp +++ b/Core/include/Acts/Navigation/MultiLayerNavigation.hpp @@ -1,6 +1,6 @@ // This file is part of the Acts project. // -// Copyright (C) 2022 CERN for the benefit of the Acts project +// Copyright (C) 2022-2024 CERN for the benefit of the Acts project // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this @@ -16,6 +16,7 @@ #include #include +#include namespace Acts::Experimental { @@ -105,16 +106,15 @@ class MultiLayerNavigation : public IInternalNavigation { void resolveDuplicates(const GeometryContext& gctx, std::vector& surfaces) const { // sorting the surfaces according to their radial distance - std::sort(surfaces.begin(), surfaces.end(), - [&gctx](const auto& surf1, const auto& surf2) { - if (surf1->center(gctx).x() != surf2->center(gctx).x()) { - return surf1->center(gctx).x() < surf2->center(gctx).x(); - } - if (surf1->center(gctx).y() != surf2->center(gctx).y()) { - return surf1->center(gctx).y() < surf2->center(gctx).y(); - } - return surf1->center(gctx).z() < surf2->center(gctx).z(); - }); + std::ranges::sort(surfaces, [&gctx](const auto& surf1, const auto& surf2) { + if (surf1->center(gctx).x() != surf2->center(gctx).x()) { + return surf1->center(gctx).x() < surf2->center(gctx).x(); + } + if (surf1->center(gctx).y() != surf2->center(gctx).y()) { + return surf1->center(gctx).y() < surf2->center(gctx).y(); + } + return surf1->center(gctx).z() < surf2->center(gctx).z(); + }); // Remove the duplicates surfaces.erase(std::unique(surfaces.begin(), surfaces.end()), diff --git a/Core/include/Acts/Navigation/NavigationStateUpdaters.hpp b/Core/include/Acts/Navigation/NavigationStateUpdaters.hpp index 3903d1e123c..8f349c6cc8a 100644 --- a/Core/include/Acts/Navigation/NavigationStateUpdaters.hpp +++ b/Core/include/Acts/Navigation/NavigationStateUpdaters.hpp @@ -1,6 +1,6 @@ // This file is part of the Acts project. // -// Copyright (C) 2022 CERN for the benefit of the Acts project +// Copyright (C) 2022-2024 CERN for the benefit of the Acts project // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this @@ -22,6 +22,7 @@ #include #include +#include namespace Acts::Experimental { @@ -65,11 +66,10 @@ inline void intitializeCandidates(const GeometryContext& gctx, } } - std::sort(confirmedCandidates.begin(), confirmedCandidates.end(), - [&](const auto& a, const auto& b) { - return a.objectIntersection.pathLength() < - b.objectIntersection.pathLength(); - }); + std::ranges::sort(confirmedCandidates, [&](const auto& a, const auto& b) { + return a.objectIntersection.pathLength() < + b.objectIntersection.pathLength(); + }); nState.surfaceCandidates = std::move(confirmedCandidates); nState.surfaceCandidateIndex = 0; diff --git a/Core/include/Acts/Propagator/TryAllNavigator.hpp b/Core/include/Acts/Propagator/TryAllNavigator.hpp index a516a3292d2..b621971897d 100644 --- a/Core/include/Acts/Propagator/TryAllNavigator.hpp +++ b/Core/include/Acts/Propagator/TryAllNavigator.hpp @@ -25,6 +25,7 @@ #include #include #include +#include #include namespace Acts { @@ -354,8 +355,8 @@ class TryAllNavigator : public TryAllNavigatorBase { } } - std::sort(intersectionCandidates.begin(), intersectionCandidates.end(), - detail::IntersectionCandidate::forwardOrder); + std::ranges::sort(intersectionCandidates, + detail::IntersectionCandidate::forwardOrder); ACTS_VERBOSE(volInfo(state) << "found " << intersectionCandidates.size() << " intersections"); @@ -766,9 +767,8 @@ class TryAllOverstepNavigator : public TryAllNavigatorBase { } } - std::sort(state.navigation.activeCandidates.begin(), - state.navigation.activeCandidates.end(), - detail::IntersectionCandidate::forwardOrder); + std::ranges::sort(state.navigation.activeCandidates, + detail::IntersectionCandidate::forwardOrder); state.navigation.activeCandidateIndex = 0; diff --git a/Core/include/Acts/Seeding/GbtsDataStorage.hpp b/Core/include/Acts/Seeding/GbtsDataStorage.hpp index 11debd64d7f..0adcb91187c 100644 --- a/Core/include/Acts/Seeding/GbtsDataStorage.hpp +++ b/Core/include/Acts/Seeding/GbtsDataStorage.hpp @@ -1,6 +1,6 @@ // This file is part of the Acts project. // -// Copyright (C) 2021 CERN for the benefit of the Acts project +// Copyright (C) 2021-2024 CERN for the benefit of the Acts project // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this @@ -14,6 +14,7 @@ #include #include +#include #include namespace Acts { @@ -105,8 +106,8 @@ class GbtsEtaBin { } void sortByPhi() { - std::sort(m_vn.begin(), m_vn.end(), - typename Acts::GbtsNode::CompareByPhi()); + std::ranges::sort(m_vn, + typename Acts::GbtsNode::CompareByPhi()); } bool empty() const { return m_vn.empty(); } diff --git a/Core/include/Acts/Seeding/GbtsTrackingFilter.hpp b/Core/include/Acts/Seeding/GbtsTrackingFilter.hpp index 7ce93170b9a..038391c36c1 100644 --- a/Core/include/Acts/Seeding/GbtsTrackingFilter.hpp +++ b/Core/include/Acts/Seeding/GbtsTrackingFilter.hpp @@ -1,6 +1,6 @@ // This file is part of the Acts project. // -// Copyright (C) 2021 CERN for the benefit of the Acts project +// Copyright (C) 2021-2024 CERN for the benefit of the Acts project // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this @@ -16,6 +16,7 @@ #include #include #include +#include #include template @@ -138,8 +139,8 @@ class GbtsTrackingFilter { if (m_stateVec.empty()) { return; } - std::sort(m_stateVec.begin(), m_stateVec.end(), - typename GbtsEdgeState::Compare()); + std::ranges::sort(m_stateVec, + typename GbtsEdgeState::Compare()); GbtsEdgeState* best = (*m_stateVec.begin()); diff --git a/Core/include/Acts/Seeding/HoughTransformUtils.ipp b/Core/include/Acts/Seeding/HoughTransformUtils.ipp index d6777d1918d..caea4cc1808 100644 --- a/Core/include/Acts/Seeding/HoughTransformUtils.ipp +++ b/Core/include/Acts/Seeding/HoughTransformUtils.ipp @@ -1,12 +1,13 @@ // This file is part of the Acts project. // -// Copyright (C) 2023 CERN for the benefit of the Acts project +// Copyright (C) 2023-2024 CERN for the benefit of the Acts project // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. #include +#include template template @@ -263,16 +264,16 @@ Acts::HoughTransformUtils::PeakFinders::IslandsAroundMax< } } // sort the candidate cells descending in content - std::sort(candidates.begin(), candidates.end(), - [&yieldMap](const std::size_t bin1, const std::size_t bin2) { - YieldType h1 = yieldMap[bin1]; - YieldType h2 = yieldMap[bin2]; - - if (h1 != h2) { - return h1 > h2; - } - return bin1 > bin2; - }); + std::ranges::sort( + candidates, [&yieldMap](const std::size_t bin1, const std::size_t bin2) { + YieldType h1 = yieldMap[bin1]; + YieldType h2 = yieldMap[bin2]; + + if (h1 != h2) { + return h1 > h2; + } + return bin1 > bin2; + }); // now we build islands from the candidate cells, starting with the most // populated one diff --git a/Core/include/Acts/Seeding/SeedFinder.ipp b/Core/include/Acts/Seeding/SeedFinder.ipp index ba36b260909..e4fcb1873a3 100644 --- a/Core/include/Acts/Seeding/SeedFinder.ipp +++ b/Core/include/Acts/Seeding/SeedFinder.ipp @@ -9,6 +9,7 @@ #include #include #include +#include #include namespace Acts { @@ -496,17 +497,19 @@ SeedFinder::filterCandidates( if constexpr (detailedMeasurement == Acts::DetectorMeasurementInfo::eDefault) { - std::sort(sorted_bottoms.begin(), sorted_bottoms.end(), - [&state](const std::size_t a, const std::size_t b) -> bool { - return state.linCircleBottom[a].cotTheta < - state.linCircleBottom[b].cotTheta; - }); - - std::sort(sorted_tops.begin(), sorted_tops.end(), - [&state](const std::size_t a, const std::size_t b) -> bool { - return state.linCircleTop[a].cotTheta < - state.linCircleTop[b].cotTheta; - }); + std::ranges::sort( + sorted_bottoms, + [&state](const std::size_t a, const std::size_t b) -> bool { + return state.linCircleBottom[a].cotTheta < + state.linCircleBottom[b].cotTheta; + }); + + std::ranges::sort( + sorted_tops, + [&state](const std::size_t a, const std::size_t b) -> bool { + return state.linCircleTop[a].cotTheta < + state.linCircleTop[b].cotTheta; + }); } // Reserve enough space, in case current capacity is too little diff --git a/Core/include/Acts/Seeding/SeedFinderGbts.ipp b/Core/include/Acts/Seeding/SeedFinderGbts.ipp index 92cc7cd1963..ce430565333 100644 --- a/Core/include/Acts/Seeding/SeedFinderGbts.ipp +++ b/Core/include/Acts/Seeding/SeedFinderGbts.ipp @@ -1,6 +1,6 @@ // This file is part of the Acts project. // -// Copyright (C) 2021 CERN for the benefit of the Acts project +// Copyright (C) 2021-2024 CERN for the benefit of the Acts project // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this @@ -23,6 +23,7 @@ #include #include #include +#include #include #include @@ -352,8 +353,8 @@ void SeedFinderGbts::runGbts_TrackFinder( out_sort[outIdx].first = pS->m_p[0]; } - std::sort(in_sort.begin(), in_sort.end()); - std::sort(out_sort.begin(), out_sort.end()); + std::ranges::sort(in_sort); + std::ranges::sort(out_sort); unsigned int last_out = 0; @@ -495,8 +496,8 @@ void SeedFinderGbts::runGbts_TrackFinder( m_triplets.clear(); - std::sort(vSeeds.begin(), vSeeds.end(), - typename Acts::GbtsEdge::CompareLevel()); + std::ranges::sort( + vSeeds, typename Acts::GbtsEdge::CompareLevel()); if (vSeeds.empty()) { return; diff --git a/Core/include/Acts/Seeding/SeedFinderOrthogonal.ipp b/Core/include/Acts/Seeding/SeedFinderOrthogonal.ipp index 31757e3e72a..ef78f6b1303 100644 --- a/Core/include/Acts/Seeding/SeedFinderOrthogonal.ipp +++ b/Core/include/Acts/Seeding/SeedFinderOrthogonal.ipp @@ -1,6 +1,6 @@ // This file is part of the Acts project. // -// Copyright (C) 2023 CERN for the benefit of the Acts project +// Copyright (C) 2023-2024 CERN for the benefit of the Acts project // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this @@ -16,6 +16,7 @@ #include #include #include +#include #include namespace Acts { @@ -311,16 +312,17 @@ void SeedFinderOrthogonal::filterCandidates( sorted_tops[i] = i; } - std::sort( - sorted_bottoms.begin(), sorted_bottoms.end(), + std::ranges::sort( + sorted_bottoms, [&linCircleBottom](const std::size_t a, const std::size_t b) -> bool { return linCircleBottom[a].cotTheta < linCircleBottom[b].cotTheta; }); - std::sort(sorted_tops.begin(), sorted_tops.end(), - [&linCircleTop](const std::size_t a, const std::size_t b) -> bool { - return linCircleTop[a].cotTheta < linCircleTop[b].cotTheta; - }); + std::ranges::sort( + sorted_tops, + [&linCircleTop](const std::size_t a, const std::size_t b) -> bool { + return linCircleTop[a].cotTheta < linCircleTop[b].cotTheta; + }); std::vector tanMT; tanMT.reserve(top.size()); diff --git a/Core/include/Acts/Seeding/detail/CylindricalSpacePointGrid.ipp b/Core/include/Acts/Seeding/detail/CylindricalSpacePointGrid.ipp index 5a88fc341ac..926c192ff6c 100644 --- a/Core/include/Acts/Seeding/detail/CylindricalSpacePointGrid.ipp +++ b/Core/include/Acts/Seeding/detail/CylindricalSpacePointGrid.ipp @@ -236,9 +236,8 @@ void Acts::CylindricalSpacePointGridCreator::fillGrid( /// sort SPs in R for each filled bin for (std::size_t binIndex : rBinsIndex) { auto& rbin = grid.atPosition(binIndex); - std::sort(rbin.begin(), rbin.end(), - [](const auto& a, const auto& b) -> bool { - return a->radius() < b->radius(); - }); + std::ranges::sort(rbin, [](const auto& a, const auto& b) -> bool { + return a->radius() < b->radius(); + }); } } diff --git a/Core/include/Acts/Utilities/BinningData.hpp b/Core/include/Acts/Utilities/BinningData.hpp index ed8668a3aca..0f1b6835383 100644 --- a/Core/include/Acts/Utilities/BinningData.hpp +++ b/Core/include/Acts/Utilities/BinningData.hpp @@ -1,6 +1,6 @@ // This file is part of the Acts project. // -// Copyright (C) 2016-2018 CERN for the benefit of the Acts project +// Copyright (C) 2016-2024 CERN for the benefit of the Acts project // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -481,7 +482,7 @@ class BinningData { } } // sort the total boundary vector - std::sort(m_totalBoundaries.begin(), m_totalBoundaries.end()); + std::ranges::sort(m_totalBoundaries); } } diff --git a/Core/include/Acts/Vertexing/SingleSeedVertexFinder.ipp b/Core/include/Acts/Vertexing/SingleSeedVertexFinder.ipp index 1206528cd5c..411cacf3eec 100644 --- a/Core/include/Acts/Vertexing/SingleSeedVertexFinder.ipp +++ b/Core/include/Acts/Vertexing/SingleSeedVertexFinder.ipp @@ -1,12 +1,13 @@ // This file is part of the Acts project. // -// Copyright (C) 2023 CERN for the benefit of the Acts project +// Copyright (C) 2023-2024 CERN for the benefit of the Acts project // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. #include +#include #include #include @@ -463,10 +464,10 @@ Acts::SingleSeedVertexFinder::findClosestPointFromPlanes( triplet.second = distance; } - std::sort(tripletsWithPlanes.begin(), tripletsWithPlanes.end(), - [](const auto& lhs, const auto& rhs) { - return lhs.second < rhs.second; - }); + std::ranges::sort(tripletsWithPlanes, + [](const auto& lhs, const auto& rhs) { + return lhs.second < rhs.second; + }); std::uint32_t threshold = static_cast( tripletsWithPlanes.size() * (1. - m_cfg.removeFraction)); @@ -571,10 +572,9 @@ Acts::SingleSeedVertexFinder::findClosestPointFromRays( triplet.second = distance; } - std::sort(tripletsWithRays.begin(), tripletsWithRays.end(), - [](const auto& lhs, const auto& rhs) { - return lhs.second < rhs.second; - }); + std::ranges::sort(tripletsWithRays, [](const auto& lhs, const auto& rhs) { + return lhs.second < rhs.second; + }); std::uint32_t threshold = static_cast( tripletsWithRays.size() * (1. - m_cfg.removeFraction)); diff --git a/Core/src/Detector/LayerStructureBuilder.cpp b/Core/src/Detector/LayerStructureBuilder.cpp index 6a421671cf1..53ac763267b 100644 --- a/Core/src/Detector/LayerStructureBuilder.cpp +++ b/Core/src/Detector/LayerStructureBuilder.cpp @@ -1,6 +1,6 @@ // This file is part of the Acts project. // -// Copyright (C) 2023 CERN for the benefit of the Acts project +// Copyright (C) 2023-2024 CERN for the benefit of the Acts project // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include @@ -339,10 +340,10 @@ Acts::Experimental::LayerStructureBuilder::construct( adaptBinningRange(binnings, m_cfg.extent.value()); } // Sort the binning for conventions - std::sort(binnings.begin(), binnings.end(), - [](const ProtoBinning& a, const ProtoBinning& b) { - return a.binValue < b.binValue; - }); + std::ranges::sort(binnings, + [](const ProtoBinning& a, const ProtoBinning& b) { + return a.binValue < b.binValue; + }); ACTS_DEBUG("- 2-dimensional surface binning detected."); // Capture the binnings diff --git a/Core/src/Detector/detail/BlueprintHelper.cpp b/Core/src/Detector/detail/BlueprintHelper.cpp index 305cd58f349..fd6f30bac75 100644 --- a/Core/src/Detector/detail/BlueprintHelper.cpp +++ b/Core/src/Detector/detail/BlueprintHelper.cpp @@ -1,6 +1,6 @@ // This file is part of the Acts project. // -// Copyright (C) 2023 CERN for the benefit of the Acts project +// Copyright (C) 2023-2024 CERN for the benefit of the Acts project // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this @@ -13,6 +13,7 @@ #include "Acts/Geometry/VolumeBounds.hpp" #include +#include namespace { @@ -55,19 +56,16 @@ void Acts::Experimental::detail::BlueprintHelper::sort(Blueprint::Node& node, bVal == BinningValue::binZ) { Vector3 nodeCenter = node.transform.translation(); Vector3 nodeSortAxis = node.transform.rotation().col(toUnderlying(bVal)); - std::sort( - node.children.begin(), node.children.end(), - [&](const auto& a, const auto& b) { - return (a->transform.translation() - nodeCenter).dot(nodeSortAxis) < - (b->transform.translation() - nodeCenter).dot(nodeSortAxis); - }); + std::ranges::sort(node.children, [&](const auto& a, const auto& b) { + return (a->transform.translation() - nodeCenter).dot(nodeSortAxis) < + (b->transform.translation() - nodeCenter).dot(nodeSortAxis); + }); } else if (bVal == BinningValue::binR && node.boundsType == VolumeBounds::eCylinder) { - std::sort(node.children.begin(), node.children.end(), - [](const auto& a, const auto& b) { - return 0.5 * (a->boundaryValues[0] + a->boundaryValues[1]) < - 0.5 * (b->boundaryValues[0] + b->boundaryValues[1]); - }); + std::ranges::sort(node.children, [](const auto& a, const auto& b) { + return 0.5 * (a->boundaryValues[0] + a->boundaryValues[1]) < + 0.5 * (b->boundaryValues[0] + b->boundaryValues[1]); + }); } } diff --git a/Core/src/Detector/detail/CuboidalDetectorHelper.cpp b/Core/src/Detector/detail/CuboidalDetectorHelper.cpp index 4bf7edbabd2..e820b419e6e 100644 --- a/Core/src/Detector/detail/CuboidalDetectorHelper.cpp +++ b/Core/src/Detector/detail/CuboidalDetectorHelper.cpp @@ -1,6 +1,6 @@ // This file is part of the Acts project. // -// Copyright (C) 2023 CERN for the benefit of the Acts project +// Copyright (C) 2023-2024 CERN for the benefit of the Acts project // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this @@ -22,6 +22,7 @@ #include "Acts/Utilities/StringHelpers.hpp" #include +#include Acts::Experimental::DetectorComponent::PortalContainer Acts::Experimental::detail::CuboidalDetectorHelper::connect( @@ -380,7 +381,7 @@ Acts::Experimental::detail::CuboidalDetectorHelper::xyzBoundaries( for (auto [key, value] : map) { boundaries[im].push_back(key); } - std::sort(boundaries[im].begin(), boundaries[im].end()); + std::ranges::sort(boundaries[im]); } ACTS_VERBOSE("- did yield " << boundaries[0u].size() << " boundaries in X."); diff --git a/Core/src/Detector/detail/IndexedGridFiller.cpp b/Core/src/Detector/detail/IndexedGridFiller.cpp index 82373d23947..b9a6bcdd90a 100644 --- a/Core/src/Detector/detail/IndexedGridFiller.cpp +++ b/Core/src/Detector/detail/IndexedGridFiller.cpp @@ -1,6 +1,6 @@ // This file is part of the Acts project. // -// Copyright (C) 2023 CERN for the benefit of the Acts project +// Copyright (C) 2023-2024 CERN for the benefit of the Acts project // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this @@ -21,6 +21,7 @@ #include #include +#include #include #include #include @@ -82,12 +83,12 @@ std::vector Acts::Experimental::detail::binSequence( abs(static_cast(bmin) - static_cast(expand)); fill_linear(nBins - understep, nBins); } - std::sort(rBins.begin(), rBins.end()); + std::ranges::sort(rBins); } else { // Jump over the phi boundary fill_linear(bmax - expand, nBins); fill_linear(1, bmin + expand); - std::sort(rBins.begin(), rBins.end()); + std::ranges::sort(rBins); } } return rBins; diff --git a/Core/src/Geometry/CuboidVolumeBuilder.cpp b/Core/src/Geometry/CuboidVolumeBuilder.cpp index 02b600b37ef..9cbdf8c676d 100644 --- a/Core/src/Geometry/CuboidVolumeBuilder.cpp +++ b/Core/src/Geometry/CuboidVolumeBuilder.cpp @@ -1,6 +1,6 @@ // This file is part of the Acts project. // -// Copyright (C) 2018-2020 CERN for the benefit of the Acts project +// Copyright (C) 2018-2024 CERN for the benefit of the Acts project // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this @@ -30,6 +30,7 @@ #include #include +#include #include #include @@ -212,10 +213,10 @@ Acts::MutableTrackingVolumePtr Acts::CuboidVolumeBuilder::trackingVolume( // Sort the volumes vectors according to the center location, otherwise the // binning boundaries will fail - std::sort(volumes.begin(), volumes.end(), - [](const TrackingVolumePtr& lhs, const TrackingVolumePtr& rhs) { - return lhs->center().x() < rhs->center().x(); - }); + std::ranges::sort( + volumes, [](const TrackingVolumePtr& lhs, const TrackingVolumePtr& rhs) { + return lhs->center().x() < rhs->center().x(); + }); // Glue volumes for (unsigned int i = 0; i < volumes.size() - 1; i++) { diff --git a/Core/src/Geometry/CylinderVolumeBuilder.cpp b/Core/src/Geometry/CylinderVolumeBuilder.cpp index 195eaefffe6..c7af100b703 100644 --- a/Core/src/Geometry/CylinderVolumeBuilder.cpp +++ b/Core/src/Geometry/CylinderVolumeBuilder.cpp @@ -1,6 +1,6 @@ // This file is part of the Acts project. // -// Copyright (C) 2016-2020 CERN for the benefit of the Acts project +// Copyright (C) 2016-2024 CERN for the benefit of the Acts project // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this @@ -29,6 +29,7 @@ #include #include +#include #include #include @@ -295,8 +296,8 @@ Acts::CylinderVolumeBuilder::trackingVolume( // we check radii for consistency from the inside outwards, so need to // sort - std::sort(innerRadii.begin(), innerRadii.end()); - std::sort(outerRadii.begin(), outerRadii.end()); + std::ranges::sort(innerRadii); + std::ranges::sort(outerRadii); ACTS_DEBUG("Inner radii:" << [&]() { std::stringstream ss; diff --git a/Core/src/Geometry/CylinderVolumeStack.cpp b/Core/src/Geometry/CylinderVolumeStack.cpp index b6c75afb54f..3a1a7af484a 100644 --- a/Core/src/Geometry/CylinderVolumeStack.cpp +++ b/Core/src/Geometry/CylinderVolumeStack.cpp @@ -16,6 +16,7 @@ #include "Acts/Utilities/Logger.hpp" #include +#include #include namespace Acts { @@ -159,11 +160,10 @@ void CylinderVolumeStack::initializeOuterVolume(BinningValue direction, if (direction == Acts::BinningValue::binZ) { ACTS_VERBOSE("Sorting by volume z position"); - std::sort(volumeTuples.begin(), volumeTuples.end(), - [](const auto& a, const auto& b) { - return a.localTransform.translation()[eZ] < - b.localTransform.translation()[eZ]; - }); + std::ranges::sort(volumeTuples, [](const auto& a, const auto& b) { + return a.localTransform.translation()[eZ] < + b.localTransform.translation()[eZ]; + }); ACTS_VERBOSE("Checking for overlaps and attaching volumes in z"); std::vector gapVolumes = @@ -192,8 +192,9 @@ void CylinderVolumeStack::initializeOuterVolume(BinningValue direction, ACTS_VERBOSE("*** Volume configuration after r synchronization:"); printVolumeSequence(volumeTuples, logger, Acts::Logging::VERBOSE); - std::sort(volumeTuples.begin(), volumeTuples.end(), - [](const auto& a, const auto& b) { return a.midZ() < b.midZ(); }); + std::ranges::sort(volumeTuples, [](const auto& a, const auto& b) { + return a.midZ() < b.midZ(); + }); m_volumes.clear(); for (const auto& vt : volumeTuples) { @@ -222,8 +223,9 @@ void CylinderVolumeStack::initializeOuterVolume(BinningValue direction, } else if (direction == Acts::BinningValue::binR) { ACTS_VERBOSE("Sorting by volume r middle point"); - std::sort(volumeTuples.begin(), volumeTuples.end(), - [](const auto& a, const auto& b) { return a.midR() < b.midR(); }); + std::ranges::sort(volumeTuples, [](const auto& a, const auto& b) { + return a.midR() < b.midR(); + }); ACTS_VERBOSE("Checking for overlaps and attaching volumes in r"); std::vector gapVolumes = @@ -250,8 +252,9 @@ void CylinderVolumeStack::initializeOuterVolume(BinningValue direction, ACTS_VERBOSE("*** Volume configuration after z synchronization:"); printVolumeSequence(volumeTuples, logger, Acts::Logging::VERBOSE); - std::sort(volumeTuples.begin(), volumeTuples.end(), - [](const auto& a, const auto& b) { return a.midR() < b.midR(); }); + std::ranges::sort(volumeTuples, [](const auto& a, const auto& b) { + return a.midR() < b.midR(); + }); m_volumes.clear(); for (const auto& vt : volumeTuples) { diff --git a/Core/src/Geometry/LayerArrayCreator.cpp b/Core/src/Geometry/LayerArrayCreator.cpp index baca1a8c13d..689f9c7c778 100644 --- a/Core/src/Geometry/LayerArrayCreator.cpp +++ b/Core/src/Geometry/LayerArrayCreator.cpp @@ -1,6 +1,6 @@ // This file is part of the Acts project. // -// Copyright (C) 2016-2018 CERN for the benefit of the Acts project +// Copyright (C) 2016-2024 CERN for the benefit of the Acts project // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this @@ -25,6 +25,7 @@ #include #include #include +#include #include #include @@ -42,7 +43,7 @@ std::unique_ptr Acts::LayerArrayCreator::layerArray( // sort it accordingly to the binning value GeometryObjectSorterT> layerSorter(gctx, bValue); - std::sort(layers.begin(), layers.end(), layerSorter); + std::ranges::sort(layers, layerSorter); // useful typedef using LayerOrderPosition = std::pair, Vector3>; // needed for all cases diff --git a/Core/src/Geometry/SurfaceArrayCreator.cpp b/Core/src/Geometry/SurfaceArrayCreator.cpp index c01a4473b4f..ba21956d914 100644 --- a/Core/src/Geometry/SurfaceArrayCreator.cpp +++ b/Core/src/Geometry/SurfaceArrayCreator.cpp @@ -1,6 +1,6 @@ // This file is part of the Acts project. // -// Copyright (C) 2016-2020 CERN for the benefit of the Acts project +// Copyright (C) 2016-2024 CERN for the benefit of the Acts project // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this @@ -21,6 +21,7 @@ #include #include +#include #include using Acts::VectorHelpers::perp; @@ -539,7 +540,7 @@ Acts::SurfaceArrayCreator::createVariableAxis( previous = perp((*surface)->binningPosition(gctx, BinningValue::binR)); } } - std::sort(bValues.begin(), bValues.end()); + std::ranges::sort(bValues); ACTS_VERBOSE("Create variable binning Axis for binned SurfaceArray"); ACTS_VERBOSE(" BinningValue: " << bValue); ACTS_VERBOSE(" Number of bins: " << (bValues.size() - 1)); diff --git a/Core/src/MagneticField/BFieldMapUtils.cpp b/Core/src/MagneticField/BFieldMapUtils.cpp index e88f21b1c7f..ff8799f5d89 100644 --- a/Core/src/MagneticField/BFieldMapUtils.cpp +++ b/Core/src/MagneticField/BFieldMapUtils.cpp @@ -44,7 +44,7 @@ Acts::fieldMapRZ( std::ranges::sort(zPos); // Get unique values rPos.erase(std::unique(rPos.begin(), rPos.end()), rPos.end()); - rPos.erase(std::unique(zPos.begin(), zPos.end()), zPos.end()); + zPos.erase(std::unique(zPos.begin(), zPos.end()), zPos.end()); rPos.shrink_to_fit(); zPos.shrink_to_fit(); // get the number of bins @@ -150,9 +150,9 @@ Acts::fieldMapXYZ( std::ranges::sort(yPos); std::ranges::sort(zPos); // Get unique values - rPos.erase(std::unique(xPos.begin(), xPos.end()), xPos.end()); - rPos.erase(std::unique(yPos.begin(), yPos.end()), yPos.end()); - rPos.erase(std::unique(zPos.begin(), zPos.end()), zPos.end()); + xPos.erase(std::unique(xPos.begin(), xPos.end()), xPos.end()); + yPos.erase(std::unique(yPos.begin(), yPos.end()), yPos.end()); + zPos.erase(std::unique(zPos.begin(), zPos.end()), zPos.end()); xPos.shrink_to_fit(); yPos.shrink_to_fit(); zPos.shrink_to_fit(); diff --git a/Core/src/Material/IntersectionMaterialAssigner.cpp b/Core/src/Material/IntersectionMaterialAssigner.cpp index f3f068e8b0f..5765e0817f8 100644 --- a/Core/src/Material/IntersectionMaterialAssigner.cpp +++ b/Core/src/Material/IntersectionMaterialAssigner.cpp @@ -12,6 +12,8 @@ #include "Acts/Surfaces/Surface.hpp" #include "Acts/Utilities/StringHelpers.hpp" +#include + namespace { std::vector forwardOrderedIntersections( @@ -35,8 +37,8 @@ std::vector forwardOrderedIntersections( } } // Sort the intersection along the pathlength - std::sort(sIntersections.begin(), sIntersections.end(), - &Acts::SurfaceIntersection::pathLengthOrder); + std::ranges::sort(sIntersections, + &Acts::SurfaceIntersection::pathLengthOrder); return sIntersections; } diff --git a/Core/src/Material/MaterialMapUtils.cpp b/Core/src/Material/MaterialMapUtils.cpp index 5681b82b68e..15f0d67982a 100644 --- a/Core/src/Material/MaterialMapUtils.cpp +++ b/Core/src/Material/MaterialMapUtils.cpp @@ -49,7 +49,7 @@ auto Acts::materialMapperRZ( std::ranges::sort(zPos); // Get unique values rPos.erase(std::unique(rPos.begin(), rPos.end()), rPos.end()); - rPos.erase(std::unique(zPos.begin(), zPos.end()), zPos.end()); + zPos.erase(std::unique(zPos.begin(), zPos.end()), zPos.end()); rPos.shrink_to_fit(); zPos.shrink_to_fit(); // get the number of bins @@ -131,9 +131,9 @@ auto Acts::materialMapperXYZ( std::ranges::sort(yPos); std::ranges::sort(zPos); // Get unique values - rPos.erase(std::unique(xPos.begin(), xPos.end()), xPos.end()); - rPos.erase(std::unique(yPos.begin(), yPos.end()), yPos.end()); - rPos.erase(std::unique(zPos.begin(), zPos.end()), zPos.end()); + xPos.erase(std::unique(xPos.begin(), xPos.end()), xPos.end()); + yPos.erase(std::unique(yPos.begin(), yPos.end()), yPos.end()); + zPos.erase(std::unique(zPos.begin(), zPos.end()), zPos.end()); xPos.shrink_to_fit(); yPos.shrink_to_fit(); zPos.shrink_to_fit(); diff --git a/Core/src/Surfaces/VerticesHelper.cpp b/Core/src/Surfaces/VerticesHelper.cpp index a0367936dc9..fd9f5392f66 100644 --- a/Core/src/Surfaces/VerticesHelper.cpp +++ b/Core/src/Surfaces/VerticesHelper.cpp @@ -1,6 +1,6 @@ // This file is part of the Acts project. // -// Copyright (C) 2020 CERN for the benefit of the Acts project +// Copyright (C) 2020-2024 CERN for the benefit of the Acts project // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this @@ -10,6 +10,7 @@ #include #include +#include std::vector Acts::detail::VerticesHelper::phiSegments( ActsScalar phiMin, ActsScalar phiMax, @@ -42,7 +43,7 @@ std::vector Acts::detail::VerticesHelper::phiSegments( phiSegments.push_back(phiRef); } } - std::sort(phiSegments.begin(), phiSegments.end()); + std::ranges::sort(phiSegments); } return phiSegments; } diff --git a/Core/src/TrackFitting/GsfMixtureReduction.cpp b/Core/src/TrackFitting/GsfMixtureReduction.cpp index 6008ad66a81..0aba836bcec 100644 --- a/Core/src/TrackFitting/GsfMixtureReduction.cpp +++ b/Core/src/TrackFitting/GsfMixtureReduction.cpp @@ -1,6 +1,6 @@ // This file is part of the Acts project. // -// Copyright (C) 2023 CERN for the benefit of the Acts project +// Copyright (C) 2023-2024 CERN for the benefit of the Acts project // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this @@ -10,6 +10,8 @@ #include "Acts/TrackFitting/detail/SymmetricKlDistanceMatrix.hpp" +#include + template void reduceWithKLDistanceImpl(std::vector &cmpCache, std::size_t maxCmpsAfterMerge, const proj_t &proj, @@ -35,10 +37,9 @@ void reduceWithKLDistanceImpl(std::vector &cmpCache, } // Remove all components which are labeled with weight -1 - std::sort(cmpCache.begin(), cmpCache.end(), - [&](const auto &a, const auto &b) { - return proj(a).weight < proj(b).weight; - }); + std::ranges::sort(cmpCache, [&](const auto &a, const auto &b) { + return proj(a).weight < proj(b).weight; + }); cmpCache.erase( std::remove_if(cmpCache.begin(), cmpCache.end(), [&](const auto &a) { return proj(a).weight == -1.0; }), diff --git a/Core/src/Vertexing/FsmwMode1dFinder.cpp b/Core/src/Vertexing/FsmwMode1dFinder.cpp index d17518be20b..a2d97b39158 100644 --- a/Core/src/Vertexing/FsmwMode1dFinder.cpp +++ b/Core/src/Vertexing/FsmwMode1dFinder.cpp @@ -13,6 +13,7 @@ #include #include #include +#include Acts::FsmwMode1dFinder::FsmwMode1dFinder(double firstFraction, double fraction) : m_firstFraction(firstFraction), m_fraction(fraction) {} @@ -28,10 +29,10 @@ Acts::Result Acts::FsmwMode1dFinder::getMode( // first of all order the vector according to the double value - std::sort(inputVector.begin(), inputVector.end(), - [](std::pair a, std::pair b) { - return a.first < b.first; - }); + std::ranges::sort(inputVector, [](std::pair a, + std::pair b) { + return a.first < b.first; + }); // begin to consider a certain number of elements according to the fraction auto begin = inputVector.begin(); diff --git a/Examples/Algorithms/Digitization/src/DigitizationAlgorithm.cpp b/Examples/Algorithms/Digitization/src/DigitizationAlgorithm.cpp index f3b04ac0aff..830cf7a6ae9 100644 --- a/Examples/Algorithms/Digitization/src/DigitizationAlgorithm.cpp +++ b/Examples/Algorithms/Digitization/src/DigitizationAlgorithm.cpp @@ -1,6 +1,6 @@ // This file is part of the Acts project. // -// Copyright (C) 2021 CERN for the benefit of the Acts project +// Copyright (C) 2021-2024 CERN for the benefit of the Acts project // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -98,7 +99,7 @@ ActsExamples::DigitizationAlgorithm::DigitizationAlgorithm( geoCfg.indices.end()); // Make sure the configured input parameter indices are sorted and unique - std::sort(indices.begin(), indices.end()); + std::ranges::sort(indices); auto dup = std::adjacent_find(indices.begin(), indices.end()); if (dup != indices.end()) { diff --git a/Examples/Algorithms/Geant4/src/SensitiveSurfaceMapper.cpp b/Examples/Algorithms/Geant4/src/SensitiveSurfaceMapper.cpp index b6365fa406a..fdcbac60f2b 100644 --- a/Examples/Algorithms/Geant4/src/SensitiveSurfaceMapper.cpp +++ b/Examples/Algorithms/Geant4/src/SensitiveSurfaceMapper.cpp @@ -296,13 +296,13 @@ bool ActsExamples::SensitiveSurfaceMapper::checkMapping( const State& state, const Acts::GeometryContext& gctx, bool writeMissingG4VolsAsObj, bool writeMissingSurfacesAsObj) const { auto allSurfaces = m_cfg.candidateSurfaces->queryAll(); - std::sort(allSurfaces.begin(), allSurfaces.end()); + std::ranges::sort(allSurfaces); std::vector found; for (const auto [_, surfacePtr] : state.g4VolumeToSurfaces) { found.push_back(surfacePtr); } - std::sort(found.begin(), found.end()); + std::ranges::sort(found); found.erase(std::ranges::unique(found).begin(), found.end()); std::vector missing; diff --git a/Examples/Algorithms/HepMC/src/HepMCProcessExtractor.cpp b/Examples/Algorithms/HepMC/src/HepMCProcessExtractor.cpp index 5dfbdcbcf73..19e6b5a7652 100644 --- a/Examples/Algorithms/HepMC/src/HepMCProcessExtractor.cpp +++ b/Examples/Algorithms/HepMC/src/HepMCProcessExtractor.cpp @@ -1,6 +1,6 @@ // This file is part of the Acts project. // -// Copyright (C) 2020 CERN for the benefit of the Acts project +// Copyright (C) 2020-2024 CERN for the benefit of the Acts project // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this @@ -11,6 +11,7 @@ #include "ActsExamples/Framework/WhiteBoard.hpp" #include "ActsExamples/Io/HepMC3/HepMC3Particle.hpp" +#include #include #include @@ -167,10 +168,10 @@ void filterAndSort( // Sort the particles based on their momentum for (auto& interaction : interactions) { - std::sort(interaction.after.begin(), interaction.after.end(), - [](ActsExamples::SimParticle& a, ActsExamples::SimParticle& b) { - return a.absoluteMomentum() > b.absoluteMomentum(); - }); + std::ranges::sort(interaction.after, [](ActsExamples::SimParticle& a, + ActsExamples::SimParticle& b) { + return a.absoluteMomentum() > b.absoluteMomentum(); + }); } } } // namespace diff --git a/Examples/Algorithms/TrackFindingExaTrkX/src/PrototracksToParameters.cpp b/Examples/Algorithms/TrackFindingExaTrkX/src/PrototracksToParameters.cpp index 83714f83f46..6ba87ec5df6 100644 --- a/Examples/Algorithms/TrackFindingExaTrkX/src/PrototracksToParameters.cpp +++ b/Examples/Algorithms/TrackFindingExaTrkX/src/PrototracksToParameters.cpp @@ -22,6 +22,7 @@ #include "ActsExamples/Utilities/EventDataTransforms.hpp" #include +#include using namespace ActsExamples; using namespace Acts::UnitLiterals; @@ -96,7 +97,7 @@ ProcessCode PrototracksToParameters::execute( // layer-volume spacepoints has 3 or more hits. However, if this is the // case, we want to keep the whole prototrack. Therefore, we operate on a // tmpTrack. - std::sort(track.begin(), track.end(), [&](auto a, auto b) { + std::ranges::sort(track, [&](auto a, auto b) { if (indexToGeoId[a].volume() != indexToGeoId[b].volume()) { return indexToGeoId[a].volume() < indexToGeoId[b].volume(); } @@ -134,8 +135,8 @@ ProcessCode PrototracksToParameters::execute( continue; } - std::sort(tmpSps.begin(), tmpSps.end(), - [](const auto &a, const auto &b) { return a->r() < b->r(); }); + std::ranges::sort( + tmpSps, [](const auto &a, const auto &b) { return a->r() < b->r(); }); // Simply use r = m*z + t and solve for r=0 to find z vertex position... // Probably not the textbook way to do diff --git a/Examples/Algorithms/TrackFindingExaTrkX/src/TruthGraphBuilder.cpp b/Examples/Algorithms/TrackFindingExaTrkX/src/TruthGraphBuilder.cpp index 4d8df390e50..745158ab8a3 100644 --- a/Examples/Algorithms/TrackFindingExaTrkX/src/TruthGraphBuilder.cpp +++ b/Examples/Algorithms/TrackFindingExaTrkX/src/TruthGraphBuilder.cpp @@ -1,6 +1,6 @@ // This file is part of the Acts project. // -// Copyright (C) 2022 CERN for the benefit of the Acts project +// Copyright (C) 2022-2024 CERN for the benefit of the Acts project // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this @@ -9,6 +9,8 @@ #include #include +#include + using namespace Acts::UnitLiterals; namespace ActsExamples { @@ -82,7 +84,7 @@ std::vector TruthGraphBuilder::buildFromMeasurements( }; // Sort by radius (this breaks down if the particle has to low momentum) - std::sort(track.begin(), track.end(), [&](const auto& a, const auto& b) { + std::ranges::sort(track, [&](const auto& a, const auto& b) { return radiusForOrdering(a) < radiusForOrdering(b); }); @@ -148,7 +150,7 @@ std::vector TruthGraphBuilder::buildFromSimhits( for (auto& [pid, track] : tracks) { // Sort by hit index, so the edges are connected correctly - std::sort(track.begin(), track.end(), [](const auto& a, const auto& b) { + std::ranges::sort(track, [](const auto& a, const auto& b) { return a.hitIndex < b.hitIndex; }); diff --git a/Examples/Algorithms/TruthTracking/ActsExamples/TruthTracking/TruthSeedingAlgorithm.cpp b/Examples/Algorithms/TruthTracking/ActsExamples/TruthTracking/TruthSeedingAlgorithm.cpp index 99e6c3ccb8e..d0b5ba67b76 100644 --- a/Examples/Algorithms/TruthTracking/ActsExamples/TruthTracking/TruthSeedingAlgorithm.cpp +++ b/Examples/Algorithms/TruthTracking/ActsExamples/TruthTracking/TruthSeedingAlgorithm.cpp @@ -1,6 +1,6 @@ // This file is part of the Acts project. // -// Copyright (C) 2021 CERN for the benefit of the Acts project +// Copyright (C) 2021-2024 CERN for the benefit of the Acts project // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -151,11 +152,10 @@ ActsExamples::ProcessCode ActsExamples::TruthSeedingAlgorithm::execute( continue; } // Sort the space points - std::sort(spacePointsOnTrack.begin(), spacePointsOnTrack.end(), - [](const SimSpacePoint* lhs, const SimSpacePoint* rhs) { - return std::hypot(lhs->r(), lhs->z()) < - std::hypot(rhs->r(), rhs->z()); - }); + std::ranges::sort(spacePointsOnTrack, [](const SimSpacePoint* lhs, + const SimSpacePoint* rhs) { + return std::hypot(lhs->r(), lhs->z()) < std::hypot(rhs->r(), rhs->z()); + }); // Loop over the found space points to find the seed with maximum deltaR // between the bottom and top space point diff --git a/Examples/Algorithms/Vertexing/src/AdaptiveMultiVertexFinderAlgorithm.cpp b/Examples/Algorithms/Vertexing/src/AdaptiveMultiVertexFinderAlgorithm.cpp index 0844ed89f1d..e2da9ddf39a 100644 --- a/Examples/Algorithms/Vertexing/src/AdaptiveMultiVertexFinderAlgorithm.cpp +++ b/Examples/Algorithms/Vertexing/src/AdaptiveMultiVertexFinderAlgorithm.cpp @@ -34,6 +34,7 @@ #include #include #include +#include #include #include #include @@ -256,12 +257,11 @@ ProcessCode AdaptiveMultiVertexFinderAlgorithm::execute( } // sort by number of particles - std::sort(vertexSeederState.truthVertices.begin(), - vertexSeederState.truthVertices.end(), - [&vertexParticleCount](const auto& lhs, const auto& rhs) { - return vertexParticleCount[lhs.vertexId()] > - vertexParticleCount[rhs.vertexId()]; - }); + std::ranges::sort(vertexSeederState.truthVertices, + [&vertexParticleCount](const auto& lhs, const auto& rhs) { + return vertexParticleCount[lhs.vertexId()] > + vertexParticleCount[rhs.vertexId()]; + }); ACTS_INFO("Got " << truthVertices.size() << " truth vertices and selected " << vertexSeederState.truthVertices.size() << " in event"); diff --git a/Examples/Detectors/MuonSpectrometerMockupDetector/src/MockupSectorBuilder.cpp b/Examples/Detectors/MuonSpectrometerMockupDetector/src/MockupSectorBuilder.cpp index b9b6e3ec3b1..6c772617bd3 100644 --- a/Examples/Detectors/MuonSpectrometerMockupDetector/src/MockupSectorBuilder.cpp +++ b/Examples/Detectors/MuonSpectrometerMockupDetector/src/MockupSectorBuilder.cpp @@ -1,6 +1,6 @@ // This file is part of the Acts project. // -// Copyright (C) 2022-2023 CERN for the benefit of the Acts project +// Copyright (C) 2022-2024 CERN for the benefit of the Acts project // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this @@ -37,6 +37,7 @@ #include #include #include +#include #include #include #include @@ -167,10 +168,9 @@ ActsExamples::MockupSectorBuilder::buildSector( // sort the detector volumes by their radial distance (from // innermost---->outermost) - std::sort(detVolumes.begin(), detVolumes.end(), - [](const auto& detVol1, const auto& detVol2) { - return detVol1->center().y() < detVol2->center().y(); - }); + std::ranges::sort(detVolumes, [](const auto& detVol1, const auto& detVol2) { + return detVol1->center().y() < detVol2->center().y(); + }); auto xA = detVolumes.back()->center().x() + detVolumes.back()->volumeBounds().values()[0]; diff --git a/Examples/Detectors/TelescopeDetector/src/TelescopeDetector.cpp b/Examples/Detectors/TelescopeDetector/src/TelescopeDetector.cpp index 0d5c35800d5..965fea896cd 100644 --- a/Examples/Detectors/TelescopeDetector/src/TelescopeDetector.cpp +++ b/Examples/Detectors/TelescopeDetector/src/TelescopeDetector.cpp @@ -1,6 +1,6 @@ // This file is part of the Acts project. // -// Copyright (C) 2020-2021 CERN for the benefit of the Acts project +// Copyright (C) 2020-2024 CERN for the benefit of the Acts project // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this @@ -14,6 +14,7 @@ #include "ActsExamples/TelescopeDetector/TelescopeDetectorElement.hpp" #include +#include #include auto ActsExamples::Telescope::TelescopeDetector::finalize( @@ -46,7 +47,7 @@ auto ActsExamples::Telescope::TelescopeDetector::finalize( // Sort the provided distances std::vector positions = cfg.positions; std::vector stereos = cfg.stereos; - std::sort(positions.begin(), positions.end()); + std::ranges::sort(positions); /// Return the telescope detector TrackingGeometryPtr gGeometry = ActsExamples::Telescope::buildDetector( diff --git a/Examples/Framework/include/ActsExamples/EventData/Index.hpp b/Examples/Framework/include/ActsExamples/EventData/Index.hpp index 74e7153b78f..cd8b77bfda5 100644 --- a/Examples/Framework/include/ActsExamples/EventData/Index.hpp +++ b/Examples/Framework/include/ActsExamples/EventData/Index.hpp @@ -1,6 +1,6 @@ // This file is part of the Acts project. // -// Copyright (C) 2019-2020 CERN for the benefit of the Acts project +// Copyright (C) 2019-2024 CERN for the benefit of the Acts project // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this @@ -10,6 +10,7 @@ #include #include +#include #include #include @@ -55,7 +56,7 @@ inline boost::container::flat_multimap invertIndexMultimap( inverse.insert(i); } #else - std::sort(unordered.begin(), unordered.end()); + std::ranges::sort(unordered); inverse.insert(boost::container::ordered_range_t{}, unordered.begin(), unordered.end()); #endif diff --git a/Examples/Framework/src/Framework/Sequencer.cpp b/Examples/Framework/src/Framework/Sequencer.cpp index 520bc86587e..5d7ff2feef0 100644 --- a/Examples/Framework/src/Framework/Sequencer.cpp +++ b/Examples/Framework/src/Framework/Sequencer.cpp @@ -1,6 +1,6 @@ // This file is part of the Acts project. // -// Copyright (C) 2017-2019 CERN for the benefit of the Acts project +// Copyright (C) 2017-2024 CERN for the benefit of the Acts project // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this @@ -35,6 +35,7 @@ #include #include #include +#include #include #include #include @@ -622,7 +623,7 @@ void Sequencer::fpeReport() const { std::transform(merged.stackTraces().begin(), merged.stackTraces().end(), std::back_inserter(sorted), [](const auto& f) -> const auto& { return f; }); - std::sort(sorted.begin(), sorted.end(), [](const auto& a, const auto& b) { + std::ranges::sort(sorted, [](const auto& a, const auto& b) { return a.get().count > b.get().count; }); diff --git a/Examples/Framework/src/Framework/WhiteBoard.cpp b/Examples/Framework/src/Framework/WhiteBoard.cpp index b7e53eaeda5..065b1b117e1 100644 --- a/Examples/Framework/src/Framework/WhiteBoard.cpp +++ b/Examples/Framework/src/Framework/WhiteBoard.cpp @@ -1,6 +1,6 @@ // This file is part of the Acts project. // -// Copyright (C) 2022 CERN for the benefit of the Acts project +// Copyright (C) 2022-2024 CERN for the benefit of the Acts project // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this @@ -9,6 +9,7 @@ #include "ActsExamples/Framework/WhiteBoard.hpp" #include +#include #include #include @@ -67,8 +68,8 @@ std::vector ActsExamples::WhiteBoard::similarNames( } } - std::sort(names.begin(), names.end(), - [&](const auto &a, const auto &b) { return a.first < b.first; }); + std::ranges::sort( + names, [&](const auto &a, const auto &b) { return a.first < b.first; }); std::vector selected_names; for (std::size_t i = 0; i < std::min(names.size(), maxNumber); ++i) { diff --git a/Examples/Framework/src/Utilities/EventDataTransforms.cpp b/Examples/Framework/src/Utilities/EventDataTransforms.cpp index c32c1875d5d..d061f91a4ae 100644 --- a/Examples/Framework/src/Utilities/EventDataTransforms.cpp +++ b/Examples/Framework/src/Utilities/EventDataTransforms.cpp @@ -1,6 +1,6 @@ // This file is part of the Acts project. // -// Copyright (C) 2022 CERN for the benefit of the Acts project +// Copyright (C) 2022-2024 CERN for the benefit of the Acts project // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this @@ -12,6 +12,7 @@ #include "ActsExamples/EventData/IndexSourceLink.hpp" #include "ActsExamples/EventData/SimSpacePoint.hpp" +#include #include ActsExamples::ProtoTrack ActsExamples::seedToPrototrack( @@ -68,8 +69,8 @@ ActsExamples::SimSeed ActsExamples::prototrackToSeed( std::transform(track.begin(), track.end(), std::back_inserter(ps), findSpacePoint); - std::sort(ps.begin(), ps.end(), - [](const auto& a, const auto& b) { return a->r() < b->r(); }); + std::ranges::sort( + ps, [](const auto& a, const auto& b) { return a->r() < b->r(); }); // Simply use r = m*z + t and solve for r=0 to find z vertex position... // Probably not the textbook way to do diff --git a/Examples/Framework/src/Validation/TrackClassification.cpp b/Examples/Framework/src/Validation/TrackClassification.cpp index e163106b291..1cc16073e57 100644 --- a/Examples/Framework/src/Validation/TrackClassification.cpp +++ b/Examples/Framework/src/Validation/TrackClassification.cpp @@ -1,6 +1,6 @@ // This file is part of the Acts project. // -// Copyright (C) 2019-2020 CERN for the benefit of the Acts project +// Copyright (C) 2019-2024 CERN for the benefit of the Acts project // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this @@ -16,6 +16,7 @@ #include "ActsExamples/Utilities/Range.hpp" #include +#include #include namespace { @@ -40,11 +41,11 @@ inline void increaseHitCount( /// Sort hit counts by decreasing values, i.e. majority particle comes first. inline void sortHitCount( std::vector& particleHitCounts) { - std::sort(particleHitCounts.begin(), particleHitCounts.end(), - [](const ActsExamples::ParticleHitCount& lhs, - const ActsExamples::ParticleHitCount& rhs) { - return (lhs.hitCount > rhs.hitCount); - }); + std::ranges::sort(particleHitCounts, + [](const ActsExamples::ParticleHitCount& lhs, + const ActsExamples::ParticleHitCount& rhs) { + return (lhs.hitCount > rhs.hitCount); + }); } } // namespace diff --git a/Examples/Io/Csv/src/CsvMeasurementReader.cpp b/Examples/Io/Csv/src/CsvMeasurementReader.cpp index e1c31d52b63..844c90fb74b 100644 --- a/Examples/Io/Csv/src/CsvMeasurementReader.cpp +++ b/Examples/Io/Csv/src/CsvMeasurementReader.cpp @@ -1,6 +1,6 @@ // This file is part of the Acts project. // -// Copyright (C) 2021 CERN for the benefit of the Acts project +// Copyright (C) 2021-2024 CERN for the benefit of the Acts project // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this @@ -27,6 +27,7 @@ #include #include #include +#include #include #include @@ -124,7 +125,7 @@ std::vector readMeasurementsByGeometryId( auto measurements = readEverything( inputDir, "measurements.csv", {"geometry_id", "t"}, event); // sort same way they will be sorted in the output container - std::sort(measurements.begin(), measurements.end(), CompareGeometryId{}); + std::ranges::sort(measurements, CompareGeometryId{}); return measurements; } diff --git a/Examples/Io/Csv/src/CsvTrackWriter.cpp b/Examples/Io/Csv/src/CsvTrackWriter.cpp index 5ac430f4b7a..a53322505a8 100644 --- a/Examples/Io/Csv/src/CsvTrackWriter.cpp +++ b/Examples/Io/Csv/src/CsvTrackWriter.cpp @@ -1,6 +1,6 @@ // This file is part of the Acts project. // -// Copyright (C) 2021 CERN for the benefit of the Acts project +// Copyright (C) 2021-2024 CERN for the benefit of the Acts project // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -159,19 +160,19 @@ ProcessCode CsvTrackWriter::writeT(const AlgorithmContext& context, // Find duplicates std::unordered_set listGoodTracks; for (auto& [particleId, matchedTracks] : matched) { - std::sort(matchedTracks.begin(), matchedTracks.end(), - [](const RecoTrackInfo& lhs, const RecoTrackInfo& rhs) { - // sort by nMajorityHits - if (lhs.first.nMajorityHits != rhs.first.nMajorityHits) { - return (lhs.first.nMajorityHits > rhs.first.nMajorityHits); - } - // sort by nOutliers - if (lhs.first.nOutliers != rhs.first.nOutliers) { - return (lhs.first.nOutliers < rhs.first.nOutliers); - } - // sort by chi2 - return (lhs.first.chi2Sum < rhs.first.chi2Sum); - }); + std::ranges::sort( + matchedTracks, [](const RecoTrackInfo& lhs, const RecoTrackInfo& rhs) { + // sort by nMajorityHits + if (lhs.first.nMajorityHits != rhs.first.nMajorityHits) { + return (lhs.first.nMajorityHits > rhs.first.nMajorityHits); + } + // sort by nOutliers + if (lhs.first.nOutliers != rhs.first.nOutliers) { + return (lhs.first.nOutliers < rhs.first.nOutliers); + } + // sort by chi2 + return (lhs.first.chi2Sum < rhs.first.chi2Sum); + }); listGoodTracks.insert(matchedTracks.front().first.trackId); } diff --git a/Examples/Io/EDM4hep/src/EDM4hepReader.cpp b/Examples/Io/EDM4hep/src/EDM4hepReader.cpp index 7e61ba2a561..05945f19530 100644 --- a/Examples/Io/EDM4hep/src/EDM4hepReader.cpp +++ b/Examples/Io/EDM4hep/src/EDM4hepReader.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #include #include @@ -396,10 +397,9 @@ ProcessCode EDM4hepReader::read(const AlgorithmContext& ctx) { } } - std::sort(hitIndices.begin(), hitIndices.end(), - [&](std::size_t a, std::size_t b) { - return simHits.nth(a)->time() < simHits.nth(b)->time(); - }); + std::ranges::sort(hitIndices, [&](std::size_t a, std::size_t b) { + return simHits.nth(a)->time() < simHits.nth(b)->time(); + }); for (std::size_t i = 0; i < hitIndices.size(); ++i) { auto& hit = *simHits.nth(hitIndices[i]); diff --git a/Examples/Io/Root/src/RootSimHitReader.cpp b/Examples/Io/Root/src/RootSimHitReader.cpp index 4acd9825af0..96122c2085a 100644 --- a/Examples/Io/Root/src/RootSimHitReader.cpp +++ b/Examples/Io/Root/src/RootSimHitReader.cpp @@ -1,6 +1,6 @@ // This file is part of the Acts project. // -// Copyright (C) 2023 CERN for the benefit of the Acts project +// Copyright (C) 2023-2024 CERN for the benefit of the Acts project // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this @@ -17,6 +17,7 @@ #include #include #include +#include #include #include @@ -94,10 +95,9 @@ RootSimHitReader::RootSimHitReader(const RootSimHitReader::Config& config, std::get<2>(m_eventMap.back()) = nEntries; // Sort by event id - std::sort(m_eventMap.begin(), m_eventMap.end(), - [](const auto& a, const auto& b) { - return std::get<0>(a) < std::get<0>(b); - }); + std::ranges::sort(m_eventMap, [](const auto& a, const auto& b) { + return std::get<0>(a) < std::get<0>(b); + }); // Re-Enable all branches m_inputChain->SetBranchStatus("*", true); diff --git a/Examples/Scripts/TrackingPerformance/defineReconstructionPerformance.C b/Examples/Scripts/TrackingPerformance/defineReconstructionPerformance.C index 04715e27fe7..5aeb4de46f7 100644 --- a/Examples/Scripts/TrackingPerformance/defineReconstructionPerformance.C +++ b/Examples/Scripts/TrackingPerformance/defineReconstructionPerformance.C @@ -1,6 +1,6 @@ // This file is part of the Acts project. // -// Copyright (C) 2021 CERN for the benefit of the Acts project +// Copyright (C) 2021-2024 CERN for the benefit of the Acts project // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this @@ -8,6 +8,7 @@ #include #include +#include #include #include #include @@ -189,7 +190,7 @@ void defineReconstructionPerformance( for (auto& [id, matchedTracks] : matchedParticles) { // Sort all tracks matched to this particle according to majority prob // and track quality - std::sort(matchedTracks.begin(), matchedTracks.end(), + std::ranges::sort(matchedTracks, [](const RecoTrackInfo& lhs, const RecoTrackInfo& rhs) { if (lhs.nMajorityHits > rhs.nMajorityHits) { return true; diff --git a/Fatras/src/Digitization/PlanarSurfaceMask.cpp b/Fatras/src/Digitization/PlanarSurfaceMask.cpp index f660082bfad..b4d0d05ae57 100644 --- a/Fatras/src/Digitization/PlanarSurfaceMask.cpp +++ b/Fatras/src/Digitization/PlanarSurfaceMask.cpp @@ -1,6 +1,6 @@ // This file is part of the Acts project. // -// Copyright (C) 2020 CERN for the benefit of the Acts project +// Copyright (C) 2020-2024 CERN for the benefit of the Acts project // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this @@ -25,6 +25,7 @@ #include #include #include +#include namespace { @@ -58,8 +59,7 @@ void checkIntersection(std::vector& intersections, Acts::Result maskAndReturn( std::vector& intersections, const ActsFatras::PlanarSurfaceMask::Segment2D& segment, bool firstInside) { - std::sort(intersections.begin(), intersections.end(), - Acts::Intersection2D::pathLengthOrder); + std::ranges::sort(intersections, Acts::Intersection2D::pathLengthOrder); if (intersections.size() >= 2) { return ActsFatras::PlanarSurfaceMask::Segment2D{ intersections[0].position(), intersections[1].position()}; diff --git a/Plugins/Cuda/include/Acts/Plugins/Cuda/Seeding/SeedFinder.ipp b/Plugins/Cuda/include/Acts/Plugins/Cuda/Seeding/SeedFinder.ipp index 6049dd3876b..9b4ba668561 100644 --- a/Plugins/Cuda/include/Acts/Plugins/Cuda/Seeding/SeedFinder.ipp +++ b/Plugins/Cuda/include/Acts/Plugins/Cuda/Seeding/SeedFinder.ipp @@ -11,6 +11,7 @@ #include #include #include +#include #include namespace Acts { @@ -306,9 +307,9 @@ SeedFinder::createSeedsForGroup( false); } - std::sort(candidates.begin(), candidates.end(), - CandidatesForMiddleSp>::descendingByQuality); + std::ranges::sort(candidates, + CandidatesForMiddleSp>::descendingByQuality); std::size_t numQualitySeeds = 0; // not used but needs to be fixed m_config.seedFilter->filterSeeds_1SpFixed(spacePointData, candidates, numQualitySeeds, diff --git a/Plugins/Cuda/include/Acts/Plugins/Cuda/Seeding2/SeedFinder.ipp b/Plugins/Cuda/include/Acts/Plugins/Cuda/Seeding2/SeedFinder.ipp index deee520fab0..6bcd8ebd641 100644 --- a/Plugins/Cuda/include/Acts/Plugins/Cuda/Seeding2/SeedFinder.ipp +++ b/Plugins/Cuda/include/Acts/Plugins/Cuda/Seeding2/SeedFinder.ipp @@ -24,10 +24,10 @@ // System include(s). #include +#include #include -namespace Acts { -namespace Cuda { +namespace Acts::Cuda { template SeedFinder::SeedFinder( @@ -226,8 +226,8 @@ SeedFinder::createSeedsForGroup( candidates.emplace_back(bottomSP, middleSP, topSP, triplet.weight, 0, false); } - std::sort( - candidates.begin(), candidates.end(), + std::ranges::sort( + candidates, CandidatesForMiddleSp>:: descendingByQuality); std::size_t numQualitySeeds = 0; // not used but needs to be fixed @@ -249,5 +249,4 @@ void SeedFinder::setLogger( return m_logger.swap(newLogger); } -} // namespace Cuda -} // namespace Acts +} // namespace Acts::Cuda diff --git a/Plugins/DD4hep/src/DD4hepLayerBuilder.cpp b/Plugins/DD4hep/src/DD4hepLayerBuilder.cpp index 64ceaf0dd97..3e15d71fa14 100644 --- a/Plugins/DD4hep/src/DD4hepLayerBuilder.cpp +++ b/Plugins/DD4hep/src/DD4hepLayerBuilder.cpp @@ -103,7 +103,7 @@ const Acts::LayerVector Acts::DD4hepLayerBuilder::endcapLayers( std::back_inserter(rvalues), [&](const auto& surface) { return VectorHelpers::perp(surface->center(gctx)); }); - std::sort(rvalues.begin(), rvalues.end()); + std::ranges::sort(rvalues); std::vector locs; std::transform(rvalues.begin(), std::ranges::unique(rvalues).begin(), std::back_inserter(locs), @@ -275,7 +275,7 @@ const Acts::LayerVector Acts::DD4hepLayerBuilder::centralLayers( std::back_inserter(zvalues), [&](const auto& surface) { return surface->center(gctx)[eZ]; }); - std::sort(zvalues.begin(), zvalues.end()); + std::ranges::sort(zvalues); std::vector locs; std::transform(zvalues.begin(), std::ranges::unique(zvalues).begin(), std::back_inserter(locs), diff --git a/Plugins/ExaTrkX/src/TorchTruthGraphMetricsHook.cpp b/Plugins/ExaTrkX/src/TorchTruthGraphMetricsHook.cpp index b04ff5640dc..7f54ff10cdc 100644 --- a/Plugins/ExaTrkX/src/TorchTruthGraphMetricsHook.cpp +++ b/Plugins/ExaTrkX/src/TorchTruthGraphMetricsHook.cpp @@ -28,7 +28,7 @@ auto cantorize(std::vector edgeIndex, std::ranges::sort(cantorEdgeIndex); - auto new_end = std::ranges::unique(cantorEdgeIndex); + auto new_end = std::unique(cantorEdgeIndex.begin(), cantorEdgeIndex.end()); if (new_end != cantorEdgeIndex.end()) { ACTS_WARNING("Graph not unique (" << std::distance(new_end, cantorEdgeIndex.end()) diff --git a/Plugins/GeoModel/src/detail/GeoIntersectionAnnulusConverter.cpp b/Plugins/GeoModel/src/detail/GeoIntersectionAnnulusConverter.cpp index d3214e60bc7..fb962157405 100644 --- a/Plugins/GeoModel/src/detail/GeoIntersectionAnnulusConverter.cpp +++ b/Plugins/GeoModel/src/detail/GeoIntersectionAnnulusConverter.cpp @@ -16,6 +16,8 @@ #include "Acts/Surfaces/Surface.hpp" #include "Acts/Surfaces/detail/AnnulusBoundsHelper.hpp" +#include + #include #include #include @@ -56,10 +58,9 @@ Acts::detail::GeoIntersectionAnnulusConverter::operator()( std::vector faceVertices(trapVertices.begin(), trapVertices.begin() + 4u); // to make sure they are in the right order - std::sort(faceVertices.begin(), faceVertices.end(), - [](const auto& a, const auto& b) { - return (VectorHelpers::phi(a) > VectorHelpers::phi(b)); - }); + std::ranges::sort(faceVertices, [](const auto& a, const auto& b) { + return (VectorHelpers::phi(a) > VectorHelpers::phi(b)); + }); // Turn them into global std::vector faceVertices3D; diff --git a/Plugins/GeoModel/src/detail/GeoPolygonConverter.cpp b/Plugins/GeoModel/src/detail/GeoPolygonConverter.cpp index e40d94ba1f6..e1849180e9b 100644 --- a/Plugins/GeoModel/src/detail/GeoPolygonConverter.cpp +++ b/Plugins/GeoModel/src/detail/GeoPolygonConverter.cpp @@ -17,6 +17,8 @@ #include "Acts/Surfaces/Surface.hpp" #include "Acts/Surfaces/TrapezoidBounds.hpp" +#include + #include #include #include @@ -43,10 +45,10 @@ Acts::detail::GeoPolygonConverter::operator()( vertices.push_back({polygon.getXVertex(i), polygon.getYVertex(i)}); } // sort based on the y-coordinate - std::sort(vertices.begin(), vertices.end(), - [](const std::vector& a, const std::vector& b) { - return a[1] < b[1]; - }); + std::ranges::sort( + vertices, [](const std::vector& a, const std::vector& b) { + return a[1] < b[1]; + }); if (nVertices == 4) { double hlxnegy = fabs(vertices[0][0] - vertices[1][0]) / 2; double hlxposy = fabs(vertices[2][0] - vertices[3][0]) / 2; diff --git a/Tests/CommonHelpers/Acts/Tests/CommonHelpers/BenchmarkTools.hpp b/Tests/CommonHelpers/Acts/Tests/CommonHelpers/BenchmarkTools.hpp index eea10efad4c..3d46d236a2d 100644 --- a/Tests/CommonHelpers/Acts/Tests/CommonHelpers/BenchmarkTools.hpp +++ b/Tests/CommonHelpers/Acts/Tests/CommonHelpers/BenchmarkTools.hpp @@ -1,6 +1,6 @@ // This file is part of the Acts project. // -// Copyright (C) 2019-2020 CERN for the benefit of the Acts project +// Copyright (C) 2019-2024 CERN for the benefit of the Acts project // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -233,7 +234,7 @@ struct MicroBenchmarkResult { // Sorted benchmark run times, used for computing outlier-robust statistics std::vector sortedRunTimes() const { std::vector sorted_timings = run_timings; - std::sort(sorted_timings.begin(), sorted_timings.end()); + std::ranges::sort(sorted_timings); return sorted_timings; } diff --git a/Tests/IntegrationTests/Fatras/FatrasSimulationTests.cpp b/Tests/IntegrationTests/Fatras/FatrasSimulationTests.cpp index 6355f804ce0..fb1406671fb 100644 --- a/Tests/IntegrationTests/Fatras/FatrasSimulationTests.cpp +++ b/Tests/IntegrationTests/Fatras/FatrasSimulationTests.cpp @@ -1,6 +1,6 @@ // This file is part of the Acts project. // -// Copyright (C) 2020-2021 CERN for the benefit of the Acts project +// Copyright (C) 2020-2024 CERN for the benefit of the Acts project // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this @@ -27,6 +27,7 @@ #include #include +#include using namespace Acts::UnitLiterals; @@ -123,10 +124,9 @@ const auto dataset = // helper functions for tests template void sortByParticleId(Container& container) { - std::sort(container.begin(), container.end(), - [](const auto& lhs, const auto& rhs) { - return lhs.particleId() < rhs.particleId(); - }); + std::ranges::sort(container, [](const auto& lhs, const auto& rhs) { + return lhs.particleId() < rhs.particleId(); + }); } template bool areParticleIdsUnique(const Container& sortedByParticleId) { diff --git a/Tests/IntegrationTests/Legacy/ATLSeedingIntegrationTest.cpp b/Tests/IntegrationTests/Legacy/ATLSeedingIntegrationTest.cpp index 0e6c730bfac..97443623831 100644 --- a/Tests/IntegrationTests/Legacy/ATLSeedingIntegrationTest.cpp +++ b/Tests/IntegrationTests/Legacy/ATLSeedingIntegrationTest.cpp @@ -1,6 +1,6 @@ // This file is part of the Acts project. // -// Copyright (C) 2018 CERN for the benefit of the Acts project +// Copyright (C) 2018-2024 CERN for the benefit of the Acts project // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this @@ -11,6 +11,7 @@ #include "Acts/Seeding/AtlasSeedFinder.hpp" #include +#include // space point structure with the bare minimum and reasonable default // covariances. clusterList default is SCT (strip detector) @@ -137,8 +138,8 @@ BOOST_AUTO_TEST_CASE(number_of_seeds_correct_) { // sorting required for set_difference call. sorting assumes space points // inside seed are already sorted. - std::sort(refVec.begin(), refVec.end(), seedComparator()); - std::sort(seedVec.begin(), seedVec.end(), seedComparator()); + std::ranges::sort(refVec, seedComparator()); + std::ranges::sort(seedVec, seedComparator()); // difference between reference and result shows if results exactly the same // (i.e. difference is 0) diff --git a/Tests/UnitTests/Core/Clusterization/ClusterizationTests1D.cpp b/Tests/UnitTests/Core/Clusterization/ClusterizationTests1D.cpp index 83423852791..e92d8838f4f 100644 --- a/Tests/UnitTests/Core/Clusterization/ClusterizationTests1D.cpp +++ b/Tests/UnitTests/Core/Clusterization/ClusterizationTests1D.cpp @@ -1,6 +1,6 @@ // This file is part of the Acts project. // -// Copyright (C) 2022 CERN for the benefit of the Acts project +// Copyright (C) 2022-2024 CERN for the benefit of the Acts project // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this @@ -15,6 +15,7 @@ #include #include #include +#include #include #include @@ -54,7 +55,7 @@ bool clHashComp(const Cluster1D& left, const Cluster1D& right) { } void hash(Cluster1D& cl) { - std::sort(cl.cells.begin(), cl.cells.end(), cellComp); + std::ranges::sort(cl.cells, cellComp); cl.hash = 0; for (const Cell1D& c : cl.cells) { boost::hash_combine(cl.hash, c.col); @@ -117,8 +118,8 @@ BOOST_AUTO_TEST_CASE(Grid_1D_rand) { hash(cl); } - std::sort(clusters.begin(), clusters.end(), clHashComp); - std::sort(newCls.begin(), newCls.end(), clHashComp); + std::ranges::sort(clusters, clHashComp); + std::ranges::sort(newCls, clHashComp); BOOST_CHECK_EQUAL(clusters.size(), newCls.size()); for (std::size_t i = 0; i < clusters.size(); i++) { diff --git a/Tests/UnitTests/Core/Clusterization/ClusterizationTests2D.cpp b/Tests/UnitTests/Core/Clusterization/ClusterizationTests2D.cpp index e850d213551..3ecb537f1eb 100644 --- a/Tests/UnitTests/Core/Clusterization/ClusterizationTests2D.cpp +++ b/Tests/UnitTests/Core/Clusterization/ClusterizationTests2D.cpp @@ -1,6 +1,6 @@ // This file is part of the Acts project. // -// Copyright (C) 2022 CERN for the benefit of the Acts project +// Copyright (C) 2022-2024 CERN for the benefit of the Acts project // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -113,7 +114,7 @@ void clusterAddCell(Cluster2D& cl, const Cell2D& cell) { } void hash(Cluster2D& cl) { - std::sort(cl.cells.begin(), cl.cells.end(), cellComp); + std::ranges::sort(cl.cells, cellComp); cl.hash = 0; for (const Cell2D& c : cl.cells) { boost::hash_combine(cl.hash, c.col); @@ -236,8 +237,8 @@ BOOST_AUTO_TEST_CASE(Grid_2D_rand) { hash(cl); } - std::sort(cls.begin(), cls.end(), clHashComp); - std::sort(newCls.begin(), newCls.end(), clHashComp); + std::ranges::sort(cls, clHashComp); + std::ranges::sort(newCls, clHashComp); BOOST_CHECK_EQUAL(cls.size(), newCls.size()); for (std::size_t i = 0; i < cls.size(); i++) { diff --git a/Tests/UnitTests/Core/Detector/CuboidalDetectorFromBlueprintTests.cpp b/Tests/UnitTests/Core/Detector/CuboidalDetectorFromBlueprintTests.cpp index aba5426de06..2ac6db4b480 100644 --- a/Tests/UnitTests/Core/Detector/CuboidalDetectorFromBlueprintTests.cpp +++ b/Tests/UnitTests/Core/Detector/CuboidalDetectorFromBlueprintTests.cpp @@ -1,6 +1,6 @@ // This file is part of the Acts project. // -// Copyright (C) 2023 CERN for the benefit of the Acts project +// Copyright (C) 2023-2024 CERN for the benefit of the Acts project // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this @@ -27,6 +27,7 @@ #include "Acts/Utilities/BinningData.hpp" #include +#include class SurfaceBuilder : public Acts::Experimental::IInternalStructureBuilder { public: @@ -363,7 +364,7 @@ BOOST_AUTO_TEST_CASE(CuboidalDetectorFromBlueprintTest) { portals.insert(portals.end(), volume->portals().begin(), volume->portals().end()); } - std::sort(portals.begin(), portals.end()); + std::ranges::sort(portals); auto last = std::unique(portals.begin(), portals.end()); portals.erase(last, portals.end()); BOOST_CHECK_EQUAL(portals.size(), 19u); diff --git a/Tests/UnitTests/Core/Seeding/CandidatesForMiddleSpTests.cpp b/Tests/UnitTests/Core/Seeding/CandidatesForMiddleSpTests.cpp index 3d8b672cb45..7adfe32a744 100644 --- a/Tests/UnitTests/Core/Seeding/CandidatesForMiddleSpTests.cpp +++ b/Tests/UnitTests/Core/Seeding/CandidatesForMiddleSpTests.cpp @@ -11,6 +11,7 @@ #include "Acts/Seeding/CandidatesForMiddleSp.hpp" #include +#include #include #include "SpacePoint.hpp" @@ -145,16 +146,16 @@ BOOST_AUTO_TEST_CASE(CandidatesForMiddleSpObject) { BOOST_CHECK(storagedValues[i].weight >= storagedValues[i + 1].weight); } - std::sort( - storagedValues.begin(), storagedValues.end(), + std::ranges::sort( + storagedValues, Acts::CandidatesForMiddleSp::ascendingByQuality); // check values are sorted properly for (std::size_t i(0); i < storagedValues.size() - 1; ++i) { BOOST_CHECK(storagedValues[i].weight <= storagedValues[i + 1].weight); } - std::sort( - storagedValues.begin(), storagedValues.end(), + std::ranges::sort( + storagedValues, Acts::CandidatesForMiddleSp::descendingByQuality); // check values are sorted properly for (std::size_t i(0); i < storagedValues.size() - 1; ++i) { diff --git a/Tests/UnitTests/Core/TrackFitting/GsfMixtureReductionTests.cpp b/Tests/UnitTests/Core/TrackFitting/GsfMixtureReductionTests.cpp index 3daa93a59f6..5fd4270a3c4 100644 --- a/Tests/UnitTests/Core/TrackFitting/GsfMixtureReductionTests.cpp +++ b/Tests/UnitTests/Core/TrackFitting/GsfMixtureReductionTests.cpp @@ -1,6 +1,6 @@ // This file is part of the Acts project. // -// Copyright (C) 2022-2023 CERN for the benefit of the Acts project +// Copyright (C) 2022-2024 CERN for the benefit of the Acts project // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -145,7 +146,7 @@ BOOST_AUTO_TEST_CASE(test_mixture_reduction) { BOOST_CHECK_EQUAL(cmps.size(), 2); - std::sort(cmps.begin(), cmps.end(), [](const auto &a, const auto &b) { + std::ranges::sort(cmps, [](const auto &a, const auto &b) { return a.boundPars[eBoundQOverP] < b.boundPars[eBoundQOverP]; }); BOOST_CHECK_CLOSE(cmps[0].boundPars[eBoundQOverP], 1.0_GeV, 1.e-8); @@ -181,8 +182,8 @@ BOOST_AUTO_TEST_CASE(test_weight_cut_reduction) { Acts::reduceMixtureLargestWeights(cmps, 2, *dummy); BOOST_CHECK_EQUAL(cmps.size(), 2); - std::sort(cmps.begin(), cmps.end(), - [](const auto &a, const auto &b) { return a.weight < b.weight; }); + std::ranges::sort( + cmps, [](const auto &a, const auto &b) { return a.weight < b.weight; }); BOOST_CHECK_EQUAL(cmps[0].weight, 3.0); BOOST_CHECK_EQUAL(cmps[1].weight, 4.0); diff --git a/Tests/UnitTests/Core/Utilities/IntersectionTests.cpp b/Tests/UnitTests/Core/Utilities/IntersectionTests.cpp index 076abbfe088..a4d20bac821 100644 --- a/Tests/UnitTests/Core/Utilities/IntersectionTests.cpp +++ b/Tests/UnitTests/Core/Utilities/IntersectionTests.cpp @@ -1,6 +1,6 @@ // This file is part of the Acts project. // -// Copyright (C) 2018 CERN for the benefit of the Acts project +// Copyright (C) 2018-2024 CERN for the benefit of the Acts project // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -50,8 +51,7 @@ BOOST_AUTO_TEST_CASE(IntersectionTest) { std::vector tsfpIntersections = {tIp, sIp, fIp}; // let's sort the tsf intersection, it should give fst - std::sort(tsfpIntersections.begin(), tsfpIntersections.end(), - Intersection3D::pathLengthOrder); + std::ranges::sort(tsfpIntersections, Intersection3D::pathLengthOrder); BOOST_CHECK_EQUAL(fstpIntersections[0].pathLength(), tsfpIntersections[0].pathLength()); BOOST_CHECK_EQUAL(fstpIntersections[1].pathLength(), @@ -65,8 +65,7 @@ BOOST_AUTO_TEST_CASE(IntersectionTest) { std::vector tfnsnpIntersections = {tIp, fIp, nIp, sIp, nIp}; // shuffle the intersections - std::sort(ntfspIntersections.begin(), ntfspIntersections.end(), - Intersection3D::pathLengthOrder); + std::ranges::sort(ntfspIntersections, Intersection3D::pathLengthOrder); BOOST_CHECK_EQUAL(fstpIntersections[0].pathLength(), ntfspIntersections[0].pathLength()); BOOST_CHECK_EQUAL(fstpIntersections[1].pathLength(), @@ -74,8 +73,7 @@ BOOST_AUTO_TEST_CASE(IntersectionTest) { BOOST_CHECK_EQUAL(fstpIntersections[2].pathLength(), ntfspIntersections[2].pathLength()); - std::sort(tfnsnpIntersections.begin(), tfnsnpIntersections.end(), - Intersection3D::pathLengthOrder); + std::ranges::sort(tfnsnpIntersections, Intersection3D::pathLengthOrder); BOOST_CHECK_EQUAL(fstpIntersections[0].pathLength(), tfnsnpIntersections[0].pathLength()); BOOST_CHECK_EQUAL(fstpIntersections[1].pathLength(), @@ -95,8 +93,7 @@ BOOST_AUTO_TEST_CASE(IntersectionTest) { std::vector fstnIntersections = {fIn, sIn, tIn}; // this time around, sort the f-s-t-n to match the t-s-f-n - std::sort(fstnIntersections.begin(), fstnIntersections.end(), - Intersection3D::pathLengthOrder); + std::ranges::sort(fstnIntersections, Intersection3D::pathLengthOrder); BOOST_CHECK_EQUAL(fstnIntersections[0].pathLength(), tsfnIntersections[0].pathLength()); BOOST_CHECK_EQUAL(fstnIntersections[1].pathLength(), @@ -106,8 +103,7 @@ BOOST_AUTO_TEST_CASE(IntersectionTest) { // shuffle negative and positive solutions std::vector pnsolutions = {tIp, sIn, sIp, fIn, tIn, fIp}; - std::sort(pnsolutions.begin(), pnsolutions.end(), - Intersection3D::pathLengthOrder); + std::ranges::sort(pnsolutions, Intersection3D::pathLengthOrder); BOOST_CHECK_EQUAL(pnsolutions[0].pathLength(), -3.); BOOST_CHECK_EQUAL(pnsolutions[1].pathLength(), -2.); @@ -120,8 +116,7 @@ BOOST_AUTO_TEST_CASE(IntersectionTest) { Intersection3D zI(Vector3(0., 0., 0.), 0., Intersection3D::Status::onSurface); std::vector tszfpIntersections = {tIp, sIp, zI, fIp}; - std::sort(tszfpIntersections.begin(), tszfpIntersections.end(), - Intersection3D::pathLengthOrder); + std::ranges::sort(tszfpIntersections, Intersection3D::pathLengthOrder); BOOST_CHECK_EQUAL(tszfpIntersections[0].pathLength(), 0.); BOOST_CHECK_EQUAL(tszfpIntersections[1].pathLength(), 1.); BOOST_CHECK_EQUAL(tszfpIntersections[2].pathLength(), 2.); @@ -130,8 +125,7 @@ BOOST_AUTO_TEST_CASE(IntersectionTest) { std::vector tfsznIntersections = {tIn, fIn, sIn, zI}; std::vector ztfsnIntersections = {zI, tIn, fIn, sIn}; - std::sort(tfsznIntersections.begin(), tfsznIntersections.end(), - Intersection3D::pathLengthOrder); + std::ranges::sort(tfsznIntersections, Intersection3D::pathLengthOrder); BOOST_CHECK_EQUAL(tfsznIntersections[0].pathLength(), -3.); BOOST_CHECK_EQUAL(tfsznIntersections[1].pathLength(), -2.); BOOST_CHECK_EQUAL(tfsznIntersections[2].pathLength(), -1.); diff --git a/Tests/UnitTests/Core/Utilities/SubspaceTests.cpp b/Tests/UnitTests/Core/Utilities/SubspaceTests.cpp index 2fbf0d2ffc4..5d695c31a6d 100644 --- a/Tests/UnitTests/Core/Utilities/SubspaceTests.cpp +++ b/Tests/UnitTests/Core/Utilities/SubspaceTests.cpp @@ -1,6 +1,6 @@ // This file is part of the Acts project. // -// Copyright (C) 2020 CERN for the benefit of the Acts project +// Copyright (C) 2020-2024 CERN for the benefit of the Acts project // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -78,7 +79,7 @@ std::array selectFixedIndices( for (auto i = 0u; i < kSize; ++i) { indices[i] = fullIndices[i]; } - std::sort(indices.begin(), indices.end()); + std::ranges::sort(indices); return indices; } diff --git a/Tests/UnitTests/Plugins/ExaTrkX/ExaTrkXBoostTrackBuildingTests.cpp b/Tests/UnitTests/Plugins/ExaTrkX/ExaTrkXBoostTrackBuildingTests.cpp index 7fad2d0b071..aaaa95fe8c2 100644 --- a/Tests/UnitTests/Plugins/ExaTrkX/ExaTrkXBoostTrackBuildingTests.cpp +++ b/Tests/UnitTests/Plugins/ExaTrkX/ExaTrkXBoostTrackBuildingTests.cpp @@ -1,6 +1,6 @@ // This file is part of the Acts project. // -// Copyright (C) 2022 CERN for the benefit of the Acts project +// Copyright (C) 2022-2024 CERN for the benefit of the Acts project // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this @@ -12,6 +12,7 @@ #include "Acts/Plugins/ExaTrkX/detail/TensorVectorConversion.hpp" #include +#include BOOST_AUTO_TEST_CASE(test_track_building) { // Make some spacepoint IDs @@ -50,9 +51,9 @@ BOOST_AUTO_TEST_CASE(test_track_building) { // Sort tracks, so we can find them std::for_each(testTracks.begin(), testTracks.end(), - [](auto &t) { std::sort(t.begin(), t.end()); }); + [](auto &t) { std::ranges::sort(t); }); std::for_each(refTracks.begin(), refTracks.end(), - [](auto &t) { std::sort(t.begin(), t.end()); }); + [](auto &t) { std::ranges::sort(t); }); // Check what we have here for (const auto &refTrack : refTracks) { diff --git a/Tests/UnitTests/Plugins/ExaTrkX/ExaTrkXEdgeBuildingTest.cpp b/Tests/UnitTests/Plugins/ExaTrkX/ExaTrkXEdgeBuildingTest.cpp index 7e75b2a8b43..cae8d8f02bc 100644 --- a/Tests/UnitTests/Plugins/ExaTrkX/ExaTrkXEdgeBuildingTest.cpp +++ b/Tests/UnitTests/Plugins/ExaTrkX/ExaTrkXEdgeBuildingTest.cpp @@ -1,6 +1,6 @@ // This file is part of the Acts project. // -// Copyright (C) 2022 CERN for the benefit of the Acts project +// Copyright (C) 2022-2024 CERN for the benefit of the Acts project // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this @@ -14,6 +14,7 @@ #include #include +#include #include #include @@ -83,8 +84,8 @@ void test_random_graph(int emb_dim, int n_nodes, float r, int knn, edges_test_cantor.push_back(a < b ? CantorPair(a, b) : CantorPair(b, a)); } - std::sort(edges_ref_cantor.begin(), edges_ref_cantor.end()); - std::sort(edges_test_cantor.begin(), edges_test_cantor.end()); + std::ranges::sort(edges_ref_cantor); + std::ranges::sort(edges_test_cantor); #if PRINT std::cout << "test size " << edges_test_cantor.size() << std::endl; From 4df163013463945fad9a0ed506ac04b340977ef1 Mon Sep 17 00:00:00 2001 From: AJPfleger Date: Wed, 4 Sep 2024 11:05:28 +0200 Subject: [PATCH 08/32] revert unique --- Examples/Algorithms/Geant4/src/SensitiveSurfaceMapper.cpp | 3 ++- Plugins/DD4hep/src/DD4hepLayerBuilder.cpp | 6 ++++-- Plugins/ExaTrkX/src/BoostTrackBuilding.cpp | 5 +++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/Examples/Algorithms/Geant4/src/SensitiveSurfaceMapper.cpp b/Examples/Algorithms/Geant4/src/SensitiveSurfaceMapper.cpp index fdcbac60f2b..30e0c8ad08d 100644 --- a/Examples/Algorithms/Geant4/src/SensitiveSurfaceMapper.cpp +++ b/Examples/Algorithms/Geant4/src/SensitiveSurfaceMapper.cpp @@ -303,7 +303,8 @@ bool ActsExamples::SensitiveSurfaceMapper::checkMapping( found.push_back(surfacePtr); } std::ranges::sort(found); - found.erase(std::ranges::unique(found).begin(), found.end()); + auto newEnd = std::unique(found.begin(), found.end()); + found.erase(newEnd, found.end()); std::vector missing; std::set_difference(allSurfaces.begin(), allSurfaces.end(), found.begin(), diff --git a/Plugins/DD4hep/src/DD4hepLayerBuilder.cpp b/Plugins/DD4hep/src/DD4hepLayerBuilder.cpp index 3e15d71fa14..83fc048ca53 100644 --- a/Plugins/DD4hep/src/DD4hepLayerBuilder.cpp +++ b/Plugins/DD4hep/src/DD4hepLayerBuilder.cpp @@ -105,7 +105,8 @@ const Acts::LayerVector Acts::DD4hepLayerBuilder::endcapLayers( }); std::ranges::sort(rvalues); std::vector locs; - std::transform(rvalues.begin(), std::ranges::unique(rvalues).begin(), + std::transform(rvalues.begin(), + std::unique(rvalues.begin(), rvalues.end()), std::back_inserter(locs), [](const auto& v) { return std::to_string(v); }); ACTS_VERBOSE( @@ -277,7 +278,8 @@ const Acts::LayerVector Acts::DD4hepLayerBuilder::centralLayers( }); std::ranges::sort(zvalues); std::vector locs; - std::transform(zvalues.begin(), std::ranges::unique(zvalues).begin(), + std::transform(zvalues.begin(), + std::unique(zvalues.begin(), zvalues.end()), std::back_inserter(locs), [](const auto& v) { return std::to_string(v); }); ACTS_VERBOSE( diff --git a/Plugins/ExaTrkX/src/BoostTrackBuilding.cpp b/Plugins/ExaTrkX/src/BoostTrackBuilding.cpp index ea8442c1edf..1e621f1f7dc 100644 --- a/Plugins/ExaTrkX/src/BoostTrackBuilding.cpp +++ b/Plugins/ExaTrkX/src/BoostTrackBuilding.cpp @@ -1,6 +1,6 @@ // This file is part of the Acts project. // -// Copyright (C) 2023 CERN for the benefit of the Acts project +// Copyright (C) 2023-2024 CERN for the benefit of the Acts project // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this @@ -11,6 +11,7 @@ #include "Acts/Utilities/Zip.hpp" #include +#include #include #include @@ -83,7 +84,7 @@ std::vector> BoostTrackBuilding::operator()( ACTS_VERBOSE("Number of unique track labels: " << [&]() { std::vector sorted(trackLabels); std::ranges::sort(sorted); - sorted.erase(std::ranges::unique(sorted).begin(), sorted.end()); + sorted.erase(std::unique(sorted.begin(), sorted.end()), sorted.end()); return sorted.size(); }()); From 0591e2bce71e0f5f0b7e23898f6ed78b773b5e75 Mon Sep 17 00:00:00 2001 From: AJPfleger Date: Wed, 4 Sep 2024 11:27:21 +0200 Subject: [PATCH 09/32] revert copy_if --- Examples/Algorithms/Utilities/src/HitSelector.cpp | 11 ++++------- .../ActsFatras/Kernel/ContinuousProcess.hpp | 9 +++------ Fatras/include/ActsFatras/Kernel/Simulation.hpp | 14 +++++--------- 3 files changed, 12 insertions(+), 22 deletions(-) diff --git a/Examples/Algorithms/Utilities/src/HitSelector.cpp b/Examples/Algorithms/Utilities/src/HitSelector.cpp index 69ce9a1916f..1da7e059483 100644 --- a/Examples/Algorithms/Utilities/src/HitSelector.cpp +++ b/Examples/Algorithms/Utilities/src/HitSelector.cpp @@ -1,6 +1,6 @@ // This file is part of the Acts project. // -// Copyright (C) 2019-2024 CERN for the benefit of the Acts project +// Copyright (C) 2019-2023 CERN for the benefit of the Acts project // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this @@ -8,8 +8,6 @@ #include "ActsExamples/Utilities/HitSelector.hpp" -#include - ActsExamples::HitSelector::HitSelector(const Config& config, Acts::Logging::Level level) : IAlgorithm("HitSelector", level), m_cfg(config) { @@ -22,10 +20,9 @@ ActsExamples::ProcessCode ActsExamples::HitSelector::execute( const auto& hits = m_inputHits(ctx); SimHitContainer selectedHits; - std::ranges::copy(hits | std::ranges::views::filter([&](const auto& hit) { - return hit.time() < m_cfg.maxTime; - }), - std::inserter(selectedHits, selectedHits.begin())); + std::copy_if(hits.begin(), hits.end(), + std::inserter(selectedHits, selectedHits.begin()), + [&](const auto& hit) { return hit.time() < m_cfg.maxTime; }); ACTS_DEBUG("selected " << selectedHits.size() << " from " << hits.size() << " hits"); diff --git a/Fatras/include/ActsFatras/Kernel/ContinuousProcess.hpp b/Fatras/include/ActsFatras/Kernel/ContinuousProcess.hpp index bac20422b7c..570d509d883 100644 --- a/Fatras/include/ActsFatras/Kernel/ContinuousProcess.hpp +++ b/Fatras/include/ActsFatras/Kernel/ContinuousProcess.hpp @@ -1,6 +1,6 @@ // This file is part of the Acts project. // -// Copyright (C) 2018-2024 CERN for the benefit of the Acts project +// Copyright (C) 2018-2020 CERN for the benefit of the Acts project // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this @@ -11,8 +11,6 @@ #include "Acts/Material/MaterialSlab.hpp" #include "ActsFatras/EventData/Particle.hpp" -#include - namespace ActsFatras { /// A continuous simulation process based on a physics model plus selectors. @@ -72,9 +70,8 @@ struct ContinuousProcess { // modify particle according to the physics process auto children = physics(generator, slab, particle); // move selected child particles to the output container - std::ranges::copy( - children | std::ranges::views::filter(selectChildParticle), - std::back_inserter(generated)); + std::copy_if(std::begin(children), std::end(children), + std::back_inserter(generated), selectChildParticle); // break condition is defined by whether the output particle is still valid // or not e.g. because it has fallen below a momentum threshold. return !selectOutputParticle(particle); diff --git a/Fatras/include/ActsFatras/Kernel/Simulation.hpp b/Fatras/include/ActsFatras/Kernel/Simulation.hpp index 7571a0d2991..c60bed02b9f 100644 --- a/Fatras/include/ActsFatras/Kernel/Simulation.hpp +++ b/Fatras/include/ActsFatras/Kernel/Simulation.hpp @@ -1,6 +1,6 @@ // This file is part of the Acts project. // -// Copyright (C) 2018-2024 CERN for the benefit of the Acts project +// Copyright (C) 2018-2021 CERN for the benefit of the Acts project // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this @@ -29,7 +29,6 @@ #include #include #include -#include #include namespace ActsFatras { @@ -289,13 +288,10 @@ struct Simulation { // store final particle state at the end of the simulation particlesFinal.push_back(result.particle); // move generated secondaries that should be simulated to the output - std::ranges::copy( - result.generatedParticles | - std::ranges::views::filter([this](const Particle &particle) { - return selectParticle(particle); - }), - std::back_inserter(particlesInitial)); - + std::copy_if( + result.generatedParticles.begin(), result.generatedParticles.end(), + std::back_inserter(particlesInitial), + [this](const Particle &particle) { return selectParticle(particle); }); std::copy(result.hits.begin(), result.hits.end(), std::back_inserter(hits)); } From 7eab62f24dbf2de127a78553801f90778f186014 Mon Sep 17 00:00:00 2001 From: AJPfleger Date: Wed, 4 Sep 2024 14:38:01 +0200 Subject: [PATCH 10/32] revert rotation --- Tests/UnitTests/Core/EventData/TrackTestsExtra.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/UnitTests/Core/EventData/TrackTestsExtra.cpp b/Tests/UnitTests/Core/EventData/TrackTestsExtra.cpp index a4e411a02bd..1e6f9e69d1a 100644 --- a/Tests/UnitTests/Core/EventData/TrackTestsExtra.cpp +++ b/Tests/UnitTests/Core/EventData/TrackTestsExtra.cpp @@ -420,8 +420,8 @@ BOOST_AUTO_TEST_CASE(ReverseTrackStates) { // reverse with jacobians t.reverseTrackStates(true); - std::ranges::rotate(exp, std::next(exp.begin())); std::ranges::reverse(exp); + std::rotate(exp.rbegin(), std::next(exp.rbegin()), exp.rend()); for (const auto [e, ts] : zip(exp, t.trackStates())) { Acts::BoundMatrix expJac; From 386497e3443b5d6e7733544df7c4aedc7d12e53c Mon Sep 17 00:00:00 2001 From: AJPfleger Date: Wed, 4 Sep 2024 16:02:17 +0200 Subject: [PATCH 11/32] remaining sorts --- Core/include/Acts/Clusterization/Clusterization.ipp | 2 +- Core/include/Acts/Material/MaterialComposition.hpp | 5 +++-- Core/include/Acts/TrackFinding/MeasurementSelector.ipp | 6 ++++-- .../Algorithms/TrackFinding/src/HoughTransformSeeder.cpp | 8 +++++--- Examples/Algorithms/TrackFinding/src/SpacePointMaker.cpp | 8 +++++--- Fatras/src/Digitization/Segmentizer.cpp | 2 +- 6 files changed, 19 insertions(+), 12 deletions(-) diff --git a/Core/include/Acts/Clusterization/Clusterization.ipp b/Core/include/Acts/Clusterization/Clusterization.ipp index 523387c715b..4fdc10ec22c 100644 --- a/Core/include/Acts/Clusterization/Clusterization.ipp +++ b/Core/include/Acts/Clusterization/Clusterization.ipp @@ -309,7 +309,7 @@ ClusterCollection mergeClusters(CellCollection& cells) { if constexpr (GridDim > 1) { // Sort the cells by their cluster label, only needed if more than // one spatial dimension - std::sort(cells.begin(), cells.end(), [](Cell& lhs, Cell& rhs) { + std::ranges::sort(cells, [](Cell& lhs, Cell& rhs) { return getCellLabel(lhs) < getCellLabel(rhs); }); } diff --git a/Core/include/Acts/Material/MaterialComposition.hpp b/Core/include/Acts/Material/MaterialComposition.hpp index 1b11901e032..817b0b09b27 100644 --- a/Core/include/Acts/Material/MaterialComposition.hpp +++ b/Core/include/Acts/Material/MaterialComposition.hpp @@ -12,6 +12,7 @@ #include #include #include +#include #include namespace Acts { @@ -100,10 +101,10 @@ class MaterialComposition { /// Rescales the fractions so they all add up to unity within the accuracy. MaterialComposition(std::vector elements) : m_elements(std::move(elements)) { - std::sort(m_elements.begin(), m_elements.end()); + std::ranges::sort(m_elements, std::less{}); // compute the total weight first unsigned total = 0u; - for (auto element : m_elements) { + for (const auto& element : m_elements) { total += element.m_fraction; } // compute scale factor into the [0, 256) range diff --git a/Core/include/Acts/TrackFinding/MeasurementSelector.ipp b/Core/include/Acts/TrackFinding/MeasurementSelector.ipp index 1a157f2a324..fa26ce00ef8 100644 --- a/Core/include/Acts/TrackFinding/MeasurementSelector.ipp +++ b/Core/include/Acts/TrackFinding/MeasurementSelector.ipp @@ -6,6 +6,8 @@ // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. +#include + namespace Acts { template @@ -108,8 +110,8 @@ MeasurementSelector::select( candidates.begin() + minIndex + 1)); } - std::sort( - candidates.begin(), candidates.begin() + passedCandidates, + std::ranges::sort( + candidates | std::views::take(passedCandidates), [](const auto& tsa, const auto& tsb) { return tsa.chi2() < tsb.chi2(); }); ACTS_VERBOSE("Number of selected measurements: " diff --git a/Examples/Algorithms/TrackFinding/src/HoughTransformSeeder.cpp b/Examples/Algorithms/TrackFinding/src/HoughTransformSeeder.cpp index 25d9d7f2e25..b5a415ff752 100644 --- a/Examples/Algorithms/TrackFinding/src/HoughTransformSeeder.cpp +++ b/Examples/Algorithms/TrackFinding/src/HoughTransformSeeder.cpp @@ -1,6 +1,6 @@ // This file is part of the Acts project. // -// Copyright (C) 2020 CERN for the benefit of the Acts project +// Copyright (C) 2020-2024 CERN for the benefit of the Acts project // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this @@ -29,6 +29,7 @@ #include #include #include +#include #include #include @@ -121,10 +122,11 @@ ActsExamples::HoughTransformSeeder::HoughTransformSeeder( // within the same volume hierarchy only consider layers return (ref.layer() == cmp.layer()); }; + // sort geometry selection so the unique filtering works + std::ranges::sort(m_cfg.geometrySelection, + std::less{}); auto geoSelBeg = m_cfg.geometrySelection.begin(); auto geoSelEnd = m_cfg.geometrySelection.end(); - // sort geometry selection so the unique filtering works - std::sort(geoSelBeg, geoSelEnd); auto geoSelLastUnique = std::unique(geoSelBeg, geoSelEnd, isDuplicate); if (geoSelLastUnique != geoSelEnd) { ACTS_WARNING("Removed " << std::distance(geoSelLastUnique, geoSelEnd) diff --git a/Examples/Algorithms/TrackFinding/src/SpacePointMaker.cpp b/Examples/Algorithms/TrackFinding/src/SpacePointMaker.cpp index 49802b57087..bc523ea508b 100644 --- a/Examples/Algorithms/TrackFinding/src/SpacePointMaker.cpp +++ b/Examples/Algorithms/TrackFinding/src/SpacePointMaker.cpp @@ -1,6 +1,6 @@ // This file is part of the Acts project. // -// Copyright (C) 2020-2022 CERN for the benefit of the Acts project +// Copyright (C) 2020-2024 CERN for the benefit of the Acts project // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include @@ -80,10 +81,11 @@ ActsExamples::SpacePointMaker::SpacePointMaker(Config cfg, // within the same volume hierarchy only consider layers return (ref.layer() == cmp.layer()); }; + // sort geometry selection so the unique filtering works + std::ranges::sort(m_cfg.geometrySelection, + std::less{}); auto geoSelBeg = m_cfg.geometrySelection.begin(); auto geoSelEnd = m_cfg.geometrySelection.end(); - // sort geometry selection so the unique filtering works - std::sort(geoSelBeg, geoSelEnd); auto geoSelLastUnique = std::unique(geoSelBeg, geoSelEnd, isDuplicate); if (geoSelLastUnique != geoSelEnd) { ACTS_WARNING("Removed " << std::distance(geoSelLastUnique, geoSelEnd) diff --git a/Fatras/src/Digitization/Segmentizer.cpp b/Fatras/src/Digitization/Segmentizer.cpp index 9c2bb72c972..53f388dd7db 100644 --- a/Fatras/src/Digitization/Segmentizer.cpp +++ b/Fatras/src/Digitization/Segmentizer.cpp @@ -140,7 +140,7 @@ ActsFatras::Segmentizer::segments(const Acts::GeometryContext& geoCtx, // Register the last step if successful if (!cSteps.empty()) { cSteps.push_back(ChannelStep({0, 0}, end, start)); - std::sort(cSteps.begin(), cSteps.end()); + std::ranges::sort(cSteps, std::less{}); } std::vector cSegments; From c422c790095a9e07f0465d0d97903af955beacbd Mon Sep 17 00:00:00 2001 From: AJPfleger Date: Wed, 4 Sep 2024 17:04:13 +0200 Subject: [PATCH 12/32] rever MeasurementSelector.ipp because of '|' --- .../Acts/TrackFinding/MeasurementSelector.ipp | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/Core/include/Acts/TrackFinding/MeasurementSelector.ipp b/Core/include/Acts/TrackFinding/MeasurementSelector.ipp index fa26ce00ef8..9b70f359cad 100644 --- a/Core/include/Acts/TrackFinding/MeasurementSelector.ipp +++ b/Core/include/Acts/TrackFinding/MeasurementSelector.ipp @@ -6,8 +6,6 @@ // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. -#include - namespace Acts { template @@ -61,11 +59,11 @@ MeasurementSelector::select( // with compile time size. That way the Eigen math operations are // still done with compile time size and no dynamic memory allocation // is needed. - double chi2 = calculateChi2( - trackState.effectiveCalibrated().data(), - trackState.effectiveCalibratedCovariance().data(), - trackState.predicted(), trackState.predictedCovariance(), - trackState.boundSubspaceIndices(), trackState.calibratedSize()); + double chi2 = + calculateChi2(trackState.effectiveCalibrated().data(), + trackState.effectiveCalibratedCovariance().data(), + trackState.predicted(), trackState.predictedCovariance(), + trackState.projector(), trackState.calibratedSize()); trackState.chi2() = chi2; if (chi2 < minChi2) { @@ -110,8 +108,8 @@ MeasurementSelector::select( candidates.begin() + minIndex + 1)); } - std::ranges::sort( - candidates | std::views::take(passedCandidates), + std::sort( + candidates.begin(), candidates.begin() + passedCandidates, [](const auto& tsa, const auto& tsb) { return tsa.chi2() < tsb.chi2(); }); ACTS_VERBOSE("Number of selected measurements: " From 7366a40d623b3deea0385b9f835a60417001d432 Mon Sep 17 00:00:00 2001 From: "Alexander J. Pfleger" <70842573+AJPfleger@users.noreply.github.com> Date: Wed, 4 Sep 2024 19:33:18 +0200 Subject: [PATCH 13/32] Update MeasurementSelector.ipp --- Core/include/Acts/TrackFinding/MeasurementSelector.ipp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Core/include/Acts/TrackFinding/MeasurementSelector.ipp b/Core/include/Acts/TrackFinding/MeasurementSelector.ipp index 9b70f359cad..1a157f2a324 100644 --- a/Core/include/Acts/TrackFinding/MeasurementSelector.ipp +++ b/Core/include/Acts/TrackFinding/MeasurementSelector.ipp @@ -59,11 +59,11 @@ MeasurementSelector::select( // with compile time size. That way the Eigen math operations are // still done with compile time size and no dynamic memory allocation // is needed. - double chi2 = - calculateChi2(trackState.effectiveCalibrated().data(), - trackState.effectiveCalibratedCovariance().data(), - trackState.predicted(), trackState.predictedCovariance(), - trackState.projector(), trackState.calibratedSize()); + double chi2 = calculateChi2( + trackState.effectiveCalibrated().data(), + trackState.effectiveCalibratedCovariance().data(), + trackState.predicted(), trackState.predictedCovariance(), + trackState.boundSubspaceIndices(), trackState.calibratedSize()); trackState.chi2() = chi2; if (chi2 < minChi2) { From 2311d1f209a3957bd1454e946ae056132a6e18cb Mon Sep 17 00:00:00 2001 From: AJPfleger Date: Thu, 5 Sep 2024 09:27:01 +0200 Subject: [PATCH 14/32] fix include --- Core/include/Acts/Clusterization/Clusterization.ipp | 2 +- Core/include/Acts/Material/MaterialComposition.hpp | 1 - Core/include/Acts/Navigation/DetectorNavigator.hpp | 2 +- Core/include/Acts/Navigation/MultiLayerNavigation.hpp | 2 +- Core/include/Acts/Navigation/NavigationStateUpdaters.hpp | 2 +- Core/include/Acts/Propagator/Navigator.hpp | 2 +- Core/include/Acts/Propagator/TryAllNavigator.hpp | 1 - Core/include/Acts/Seeding/GbtsDataStorage.hpp | 1 - Core/include/Acts/Seeding/GbtsTrackingFilter.hpp | 1 - Core/include/Acts/Seeding/HoughTransformUtils.ipp | 1 - Core/include/Acts/Seeding/SeedFilter.ipp | 1 - Core/include/Acts/Seeding/SeedFinder.ipp | 1 - Core/include/Acts/Seeding/SeedFinderGbts.ipp | 2 +- Core/include/Acts/Seeding/SeedFinderOrthogonal.ipp | 2 +- Core/include/Acts/Utilities/BinningData.hpp | 1 - Core/include/Acts/Vertexing/SingleSeedVertexFinder.ipp | 2 +- Core/src/Detector/LayerStructureBuilder.cpp | 2 +- Core/src/Detector/detail/BlueprintHelper.cpp | 2 +- Core/src/Detector/detail/CuboidalDetectorHelper.cpp | 1 - Core/src/Detector/detail/IndexedGridFiller.cpp | 1 - Core/src/Geometry/CuboidVolumeBuilder.cpp | 1 - Core/src/Geometry/CylinderVolumeBuilder.cpp | 1 - Core/src/Geometry/CylinderVolumeStack.cpp | 2 +- Core/src/Geometry/LayerArrayCreator.cpp | 1 - Core/src/Geometry/SurfaceArrayCreator.cpp | 1 - Core/src/Geometry/TrackingVolumeArrayCreator.cpp | 1 - Core/src/MagneticField/BFieldMapUtils.cpp | 1 - Core/src/Material/IntersectionMaterialAssigner.cpp | 2 +- Core/src/Material/MaterialMapUtils.cpp | 1 - Core/src/Surfaces/VerticesHelper.cpp | 2 +- Core/src/TrackFitting/GsfMixtureReduction.cpp | 2 +- Core/src/Vertexing/FsmwMode1dFinder.cpp | 1 - Examples/Algorithms/Digitization/src/DigitizationAlgorithm.cpp | 1 - Examples/Algorithms/Geant4/src/SensitiveSurfaceMapper.cpp | 1 - Examples/Algorithms/HepMC/src/HepMCProcessExtractor.cpp | 2 +- Examples/Algorithms/TrackFinding/src/HoughTransformSeeder.cpp | 1 - Examples/Algorithms/TrackFinding/src/SpacePointMaker.cpp | 1 - .../TrackFindingExaTrkX/src/PrototracksToParameters.cpp | 1 - .../Algorithms/TrackFindingExaTrkX/src/TruthGraphBuilder.cpp | 2 +- Examples/Algorithms/TrackFitting/src/RefittingAlgorithm.cpp | 2 +- .../ActsExamples/TruthTracking/TruthSeedingAlgorithm.cpp | 1 - .../Vertexing/src/AdaptiveMultiVertexFinderAlgorithm.cpp | 2 +- .../MuonSpectrometerMockupDetector/src/MockupSectorBuilder.cpp | 1 - Examples/Detectors/TelescopeDetector/src/TelescopeDetector.cpp | 1 - Examples/Framework/include/ActsExamples/EventData/Index.hpp | 1 - Examples/Framework/src/Framework/Sequencer.cpp | 1 - Examples/Framework/src/Framework/WhiteBoard.cpp | 2 +- Examples/Framework/src/Utilities/EventDataTransforms.cpp | 2 +- Examples/Framework/src/Validation/TrackClassification.cpp | 1 - Examples/Io/Csv/src/CsvMeasurementReader.cpp | 1 - Examples/Io/Csv/src/CsvTrackWriter.cpp | 1 - Examples/Io/EDM4hep/src/EDM4hepReader.cpp | 1 - Examples/Io/Root/src/RootSimHitReader.cpp | 1 - .../TrackingPerformance/defineReconstructionPerformance.C | 2 +- Plugins/Cuda/include/Acts/Plugins/Cuda/Seeding/SeedFinder.ipp | 1 - Plugins/Cuda/include/Acts/Plugins/Cuda/Seeding2/SeedFinder.ipp | 2 +- Plugins/DD4hep/src/DD4hepLayerBuilder.cpp | 1 - Plugins/ExaTrkX/src/BoostTrackBuilding.cpp | 2 +- Plugins/ExaTrkX/src/TorchTruthGraphMetricsHook.cpp | 2 +- Plugins/GeoModel/src/detail/GeoIntersectionAnnulusConverter.cpp | 2 +- Plugins/GeoModel/src/detail/GeoPolygonConverter.cpp | 2 +- Tests/CommonHelpers/Acts/Tests/CommonHelpers/BenchmarkTools.hpp | 1 - Tests/IntegrationTests/Fatras/FatrasSimulationTests.cpp | 1 - Tests/IntegrationTests/Legacy/ATLSeedingIntegrationTest.cpp | 1 - Tests/IntegrationTests/NavigatorConsistency.cpp | 2 +- Tests/UnitTests/Core/Clusterization/ClusterizationTests1D.cpp | 1 - Tests/UnitTests/Core/Clusterization/ClusterizationTests2D.cpp | 1 - .../Core/Detector/CuboidalDetectorFromBlueprintTests.cpp | 2 +- Tests/UnitTests/Core/EventData/TrackTests.cpp | 2 +- Tests/UnitTests/Core/EventData/TrackTestsExtra.cpp | 2 +- Tests/UnitTests/Core/Seeding/CandidatesForMiddleSpTests.cpp | 2 +- Tests/UnitTests/Core/TrackFitting/GsfMixtureReductionTests.cpp | 1 - Tests/UnitTests/Core/Utilities/IntersectionTests.cpp | 1 - Tests/UnitTests/Core/Utilities/SubspaceTests.cpp | 1 - .../Plugins/ExaTrkX/ExaTrkXBoostTrackBuildingTests.cpp | 1 - Tests/UnitTests/Plugins/ExaTrkX/ExaTrkXEdgeBuildingTest.cpp | 2 +- 76 files changed, 32 insertions(+), 76 deletions(-) diff --git a/Core/include/Acts/Clusterization/Clusterization.ipp b/Core/include/Acts/Clusterization/Clusterization.ipp index 4fdc10ec22c..3d8cf9d2302 100644 --- a/Core/include/Acts/Clusterization/Clusterization.ipp +++ b/Core/include/Acts/Clusterization/Clusterization.ipp @@ -6,8 +6,8 @@ // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. +#include #include -#include #include #include diff --git a/Core/include/Acts/Material/MaterialComposition.hpp b/Core/include/Acts/Material/MaterialComposition.hpp index 817b0b09b27..749ce286ba7 100644 --- a/Core/include/Acts/Material/MaterialComposition.hpp +++ b/Core/include/Acts/Material/MaterialComposition.hpp @@ -12,7 +12,6 @@ #include #include #include -#include #include namespace Acts { diff --git a/Core/include/Acts/Navigation/DetectorNavigator.hpp b/Core/include/Acts/Navigation/DetectorNavigator.hpp index d66ff3001c0..e606ca3472b 100644 --- a/Core/include/Acts/Navigation/DetectorNavigator.hpp +++ b/Core/include/Acts/Navigation/DetectorNavigator.hpp @@ -22,9 +22,9 @@ #include "Acts/Surfaces/Surface.hpp" #include "Acts/Utilities/Logger.hpp" +#include #include #include -#include #include #include diff --git a/Core/include/Acts/Navigation/MultiLayerNavigation.hpp b/Core/include/Acts/Navigation/MultiLayerNavigation.hpp index 4105a72b5c4..6c292026331 100644 --- a/Core/include/Acts/Navigation/MultiLayerNavigation.hpp +++ b/Core/include/Acts/Navigation/MultiLayerNavigation.hpp @@ -14,9 +14,9 @@ #include "Acts/Navigation/NavigationStateUpdaters.hpp" #include "Acts/Utilities/VectorHelpers.hpp" +#include #include #include -#include namespace Acts::Experimental { diff --git a/Core/include/Acts/Navigation/NavigationStateUpdaters.hpp b/Core/include/Acts/Navigation/NavigationStateUpdaters.hpp index 8f349c6cc8a..a49c3702852 100644 --- a/Core/include/Acts/Navigation/NavigationStateUpdaters.hpp +++ b/Core/include/Acts/Navigation/NavigationStateUpdaters.hpp @@ -20,9 +20,9 @@ #include "Acts/Utilities/IAxis.hpp" #include "Acts/Utilities/VectorHelpers.hpp" +#include #include #include -#include namespace Acts::Experimental { diff --git a/Core/include/Acts/Propagator/Navigator.hpp b/Core/include/Acts/Propagator/Navigator.hpp index 168aba8e0cc..dba15d46ac9 100644 --- a/Core/include/Acts/Propagator/Navigator.hpp +++ b/Core/include/Acts/Propagator/Navigator.hpp @@ -20,7 +20,7 @@ #include "Acts/Utilities/Logger.hpp" #include "Acts/Utilities/StringHelpers.hpp" -#include +#include #include #include diff --git a/Core/include/Acts/Propagator/TryAllNavigator.hpp b/Core/include/Acts/Propagator/TryAllNavigator.hpp index b621971897d..2ba9cc6a80e 100644 --- a/Core/include/Acts/Propagator/TryAllNavigator.hpp +++ b/Core/include/Acts/Propagator/TryAllNavigator.hpp @@ -25,7 +25,6 @@ #include #include #include -#include #include namespace Acts { diff --git a/Core/include/Acts/Seeding/GbtsDataStorage.hpp b/Core/include/Acts/Seeding/GbtsDataStorage.hpp index 0adcb91187c..5f088e4138e 100644 --- a/Core/include/Acts/Seeding/GbtsDataStorage.hpp +++ b/Core/include/Acts/Seeding/GbtsDataStorage.hpp @@ -14,7 +14,6 @@ #include #include -#include #include namespace Acts { diff --git a/Core/include/Acts/Seeding/GbtsTrackingFilter.hpp b/Core/include/Acts/Seeding/GbtsTrackingFilter.hpp index 038391c36c1..83a8aa2b362 100644 --- a/Core/include/Acts/Seeding/GbtsTrackingFilter.hpp +++ b/Core/include/Acts/Seeding/GbtsTrackingFilter.hpp @@ -16,7 +16,6 @@ #include #include #include -#include #include template diff --git a/Core/include/Acts/Seeding/HoughTransformUtils.ipp b/Core/include/Acts/Seeding/HoughTransformUtils.ipp index caea4cc1808..19c739ce0e6 100644 --- a/Core/include/Acts/Seeding/HoughTransformUtils.ipp +++ b/Core/include/Acts/Seeding/HoughTransformUtils.ipp @@ -7,7 +7,6 @@ // file, You can obtain one at http://mozilla.org/MPL/2.0/. #include -#include template template diff --git a/Core/include/Acts/Seeding/SeedFilter.ipp b/Core/include/Acts/Seeding/SeedFilter.ipp index 7b45b24037b..672749e5487 100644 --- a/Core/include/Acts/Seeding/SeedFilter.ipp +++ b/Core/include/Acts/Seeding/SeedFilter.ipp @@ -10,7 +10,6 @@ #include #include -#include #include namespace Acts { diff --git a/Core/include/Acts/Seeding/SeedFinder.ipp b/Core/include/Acts/Seeding/SeedFinder.ipp index e4fcb1873a3..7826e2f2abc 100644 --- a/Core/include/Acts/Seeding/SeedFinder.ipp +++ b/Core/include/Acts/Seeding/SeedFinder.ipp @@ -9,7 +9,6 @@ #include #include #include -#include #include namespace Acts { diff --git a/Core/include/Acts/Seeding/SeedFinderGbts.ipp b/Core/include/Acts/Seeding/SeedFinderGbts.ipp index ce430565333..5872707754e 100644 --- a/Core/include/Acts/Seeding/SeedFinderGbts.ipp +++ b/Core/include/Acts/Seeding/SeedFinderGbts.ipp @@ -17,13 +17,13 @@ #include "Acts/Seeding/SeedFinderUtils.hpp" #include "Acts/Utilities/BinningType.hpp" +#include #include #include #include #include #include #include -#include #include #include diff --git a/Core/include/Acts/Seeding/SeedFinderOrthogonal.ipp b/Core/include/Acts/Seeding/SeedFinderOrthogonal.ipp index ef78f6b1303..0721ce29edb 100644 --- a/Core/include/Acts/Seeding/SeedFinderOrthogonal.ipp +++ b/Core/include/Acts/Seeding/SeedFinderOrthogonal.ipp @@ -13,10 +13,10 @@ #include "Acts/Seeding/SeedFinderUtils.hpp" #include "Acts/Utilities/BinningType.hpp" +#include #include #include #include -#include #include namespace Acts { diff --git a/Core/include/Acts/Utilities/BinningData.hpp b/Core/include/Acts/Utilities/BinningData.hpp index 0f1b6835383..e4fcf700c9a 100644 --- a/Core/include/Acts/Utilities/BinningData.hpp +++ b/Core/include/Acts/Utilities/BinningData.hpp @@ -17,7 +17,6 @@ #include #include #include -#include #include #include #include diff --git a/Core/include/Acts/Vertexing/SingleSeedVertexFinder.ipp b/Core/include/Acts/Vertexing/SingleSeedVertexFinder.ipp index 411cacf3eec..90aaf3c59df 100644 --- a/Core/include/Acts/Vertexing/SingleSeedVertexFinder.ipp +++ b/Core/include/Acts/Vertexing/SingleSeedVertexFinder.ipp @@ -6,8 +6,8 @@ // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. +#include #include -#include #include #include diff --git a/Core/src/Detector/LayerStructureBuilder.cpp b/Core/src/Detector/LayerStructureBuilder.cpp index 53ac763267b..b2ef8d9cfbc 100644 --- a/Core/src/Detector/LayerStructureBuilder.cpp +++ b/Core/src/Detector/LayerStructureBuilder.cpp @@ -24,10 +24,10 @@ #include "Acts/Utilities/Grid.hpp" #include "Acts/Utilities/GridAxisGenerators.hpp" +#include #include #include #include -#include #include #include #include diff --git a/Core/src/Detector/detail/BlueprintHelper.cpp b/Core/src/Detector/detail/BlueprintHelper.cpp index fd6f30bac75..6b787f1fd55 100644 --- a/Core/src/Detector/detail/BlueprintHelper.cpp +++ b/Core/src/Detector/detail/BlueprintHelper.cpp @@ -12,8 +12,8 @@ #include "Acts/Definitions/Tolerance.hpp" #include "Acts/Geometry/VolumeBounds.hpp" +#include #include -#include namespace { diff --git a/Core/src/Detector/detail/CuboidalDetectorHelper.cpp b/Core/src/Detector/detail/CuboidalDetectorHelper.cpp index e820b419e6e..5e222c39e6d 100644 --- a/Core/src/Detector/detail/CuboidalDetectorHelper.cpp +++ b/Core/src/Detector/detail/CuboidalDetectorHelper.cpp @@ -22,7 +22,6 @@ #include "Acts/Utilities/StringHelpers.hpp" #include -#include Acts::Experimental::DetectorComponent::PortalContainer Acts::Experimental::detail::CuboidalDetectorHelper::connect( diff --git a/Core/src/Detector/detail/IndexedGridFiller.cpp b/Core/src/Detector/detail/IndexedGridFiller.cpp index b9a6bcdd90a..d1bd5d17634 100644 --- a/Core/src/Detector/detail/IndexedGridFiller.cpp +++ b/Core/src/Detector/detail/IndexedGridFiller.cpp @@ -21,7 +21,6 @@ #include #include -#include #include #include #include diff --git a/Core/src/Geometry/CuboidVolumeBuilder.cpp b/Core/src/Geometry/CuboidVolumeBuilder.cpp index 9cbdf8c676d..84a5897c98b 100644 --- a/Core/src/Geometry/CuboidVolumeBuilder.cpp +++ b/Core/src/Geometry/CuboidVolumeBuilder.cpp @@ -30,7 +30,6 @@ #include #include -#include #include #include diff --git a/Core/src/Geometry/CylinderVolumeBuilder.cpp b/Core/src/Geometry/CylinderVolumeBuilder.cpp index c7af100b703..8690c1d9b82 100644 --- a/Core/src/Geometry/CylinderVolumeBuilder.cpp +++ b/Core/src/Geometry/CylinderVolumeBuilder.cpp @@ -29,7 +29,6 @@ #include #include -#include #include #include diff --git a/Core/src/Geometry/CylinderVolumeStack.cpp b/Core/src/Geometry/CylinderVolumeStack.cpp index 3a1a7af484a..ab218de93f2 100644 --- a/Core/src/Geometry/CylinderVolumeStack.cpp +++ b/Core/src/Geometry/CylinderVolumeStack.cpp @@ -15,8 +15,8 @@ #include "Acts/Utilities/BinningType.hpp" #include "Acts/Utilities/Logger.hpp" +#include #include -#include #include namespace Acts { diff --git a/Core/src/Geometry/LayerArrayCreator.cpp b/Core/src/Geometry/LayerArrayCreator.cpp index 689f9c7c778..0a9c74d76f5 100644 --- a/Core/src/Geometry/LayerArrayCreator.cpp +++ b/Core/src/Geometry/LayerArrayCreator.cpp @@ -25,7 +25,6 @@ #include #include #include -#include #include #include diff --git a/Core/src/Geometry/SurfaceArrayCreator.cpp b/Core/src/Geometry/SurfaceArrayCreator.cpp index ba21956d914..7968b576f2c 100644 --- a/Core/src/Geometry/SurfaceArrayCreator.cpp +++ b/Core/src/Geometry/SurfaceArrayCreator.cpp @@ -21,7 +21,6 @@ #include #include -#include #include using Acts::VectorHelpers::perp; diff --git a/Core/src/Geometry/TrackingVolumeArrayCreator.cpp b/Core/src/Geometry/TrackingVolumeArrayCreator.cpp index 72b0b34ae29..e2d38b15fb0 100644 --- a/Core/src/Geometry/TrackingVolumeArrayCreator.cpp +++ b/Core/src/Geometry/TrackingVolumeArrayCreator.cpp @@ -16,7 +16,6 @@ #include "Acts/Utilities/BinnedArrayXD.hpp" #include -#include #include std::shared_ptr diff --git a/Core/src/MagneticField/BFieldMapUtils.cpp b/Core/src/MagneticField/BFieldMapUtils.cpp index ff8799f5d89..bffdc7520ef 100644 --- a/Core/src/MagneticField/BFieldMapUtils.cpp +++ b/Core/src/MagneticField/BFieldMapUtils.cpp @@ -21,7 +21,6 @@ #include #include #include -#include #include #include diff --git a/Core/src/Material/IntersectionMaterialAssigner.cpp b/Core/src/Material/IntersectionMaterialAssigner.cpp index 5765e0817f8..27adf41f78e 100644 --- a/Core/src/Material/IntersectionMaterialAssigner.cpp +++ b/Core/src/Material/IntersectionMaterialAssigner.cpp @@ -12,7 +12,7 @@ #include "Acts/Surfaces/Surface.hpp" #include "Acts/Utilities/StringHelpers.hpp" -#include +#include namespace { diff --git a/Core/src/Material/MaterialMapUtils.cpp b/Core/src/Material/MaterialMapUtils.cpp index 15f0d67982a..64fdd1f5187 100644 --- a/Core/src/Material/MaterialMapUtils.cpp +++ b/Core/src/Material/MaterialMapUtils.cpp @@ -18,7 +18,6 @@ #include #include #include -#include #include #include #include diff --git a/Core/src/Surfaces/VerticesHelper.cpp b/Core/src/Surfaces/VerticesHelper.cpp index fd9f5392f66..580bb4cbd0c 100644 --- a/Core/src/Surfaces/VerticesHelper.cpp +++ b/Core/src/Surfaces/VerticesHelper.cpp @@ -8,9 +8,9 @@ #include "Acts/Surfaces/detail/VerticesHelper.hpp" +#include #include #include -#include std::vector Acts::detail::VerticesHelper::phiSegments( ActsScalar phiMin, ActsScalar phiMax, diff --git a/Core/src/TrackFitting/GsfMixtureReduction.cpp b/Core/src/TrackFitting/GsfMixtureReduction.cpp index 0aba836bcec..b5469ccba31 100644 --- a/Core/src/TrackFitting/GsfMixtureReduction.cpp +++ b/Core/src/TrackFitting/GsfMixtureReduction.cpp @@ -10,7 +10,7 @@ #include "Acts/TrackFitting/detail/SymmetricKlDistanceMatrix.hpp" -#include +#include template void reduceWithKLDistanceImpl(std::vector &cmpCache, diff --git a/Core/src/Vertexing/FsmwMode1dFinder.cpp b/Core/src/Vertexing/FsmwMode1dFinder.cpp index a2d97b39158..331ce717893 100644 --- a/Core/src/Vertexing/FsmwMode1dFinder.cpp +++ b/Core/src/Vertexing/FsmwMode1dFinder.cpp @@ -13,7 +13,6 @@ #include #include #include -#include Acts::FsmwMode1dFinder::FsmwMode1dFinder(double firstFraction, double fraction) : m_firstFraction(firstFraction), m_fraction(fraction) {} diff --git a/Examples/Algorithms/Digitization/src/DigitizationAlgorithm.cpp b/Examples/Algorithms/Digitization/src/DigitizationAlgorithm.cpp index 377480cd53b..3ca9b5964f8 100644 --- a/Examples/Algorithms/Digitization/src/DigitizationAlgorithm.cpp +++ b/Examples/Algorithms/Digitization/src/DigitizationAlgorithm.cpp @@ -32,7 +32,6 @@ #include #include #include -#include #include #include #include diff --git a/Examples/Algorithms/Geant4/src/SensitiveSurfaceMapper.cpp b/Examples/Algorithms/Geant4/src/SensitiveSurfaceMapper.cpp index 30e0c8ad08d..a93f5b70e5a 100644 --- a/Examples/Algorithms/Geant4/src/SensitiveSurfaceMapper.cpp +++ b/Examples/Algorithms/Geant4/src/SensitiveSurfaceMapper.cpp @@ -16,7 +16,6 @@ #include #include -#include #include #include #include diff --git a/Examples/Algorithms/HepMC/src/HepMCProcessExtractor.cpp b/Examples/Algorithms/HepMC/src/HepMCProcessExtractor.cpp index 19e6b5a7652..ac9467b4dec 100644 --- a/Examples/Algorithms/HepMC/src/HepMCProcessExtractor.cpp +++ b/Examples/Algorithms/HepMC/src/HepMCProcessExtractor.cpp @@ -11,7 +11,7 @@ #include "ActsExamples/Framework/WhiteBoard.hpp" #include "ActsExamples/Io/HepMC3/HepMC3Particle.hpp" -#include +#include #include #include diff --git a/Examples/Algorithms/TrackFinding/src/HoughTransformSeeder.cpp b/Examples/Algorithms/TrackFinding/src/HoughTransformSeeder.cpp index 7185a3d5590..acd705d855a 100644 --- a/Examples/Algorithms/TrackFinding/src/HoughTransformSeeder.cpp +++ b/Examples/Algorithms/TrackFinding/src/HoughTransformSeeder.cpp @@ -29,7 +29,6 @@ #include #include #include -#include #include #include diff --git a/Examples/Algorithms/TrackFinding/src/SpacePointMaker.cpp b/Examples/Algorithms/TrackFinding/src/SpacePointMaker.cpp index 55d0599bb4a..99de1dfd646 100644 --- a/Examples/Algorithms/TrackFinding/src/SpacePointMaker.cpp +++ b/Examples/Algorithms/TrackFinding/src/SpacePointMaker.cpp @@ -25,7 +25,6 @@ #include #include #include -#include #include #include #include diff --git a/Examples/Algorithms/TrackFindingExaTrkX/src/PrototracksToParameters.cpp b/Examples/Algorithms/TrackFindingExaTrkX/src/PrototracksToParameters.cpp index 6ba87ec5df6..e6565c782e7 100644 --- a/Examples/Algorithms/TrackFindingExaTrkX/src/PrototracksToParameters.cpp +++ b/Examples/Algorithms/TrackFindingExaTrkX/src/PrototracksToParameters.cpp @@ -22,7 +22,6 @@ #include "ActsExamples/Utilities/EventDataTransforms.hpp" #include -#include using namespace ActsExamples; using namespace Acts::UnitLiterals; diff --git a/Examples/Algorithms/TrackFindingExaTrkX/src/TruthGraphBuilder.cpp b/Examples/Algorithms/TrackFindingExaTrkX/src/TruthGraphBuilder.cpp index 745158ab8a3..78c31a7e058 100644 --- a/Examples/Algorithms/TrackFindingExaTrkX/src/TruthGraphBuilder.cpp +++ b/Examples/Algorithms/TrackFindingExaTrkX/src/TruthGraphBuilder.cpp @@ -9,7 +9,7 @@ #include #include -#include +#include using namespace Acts::UnitLiterals; diff --git a/Examples/Algorithms/TrackFitting/src/RefittingAlgorithm.cpp b/Examples/Algorithms/TrackFitting/src/RefittingAlgorithm.cpp index 22eb214f634..ac1e41f005f 100644 --- a/Examples/Algorithms/TrackFitting/src/RefittingAlgorithm.cpp +++ b/Examples/Algorithms/TrackFitting/src/RefittingAlgorithm.cpp @@ -24,10 +24,10 @@ #include "ActsExamples/TrackFitting/RefittingCalibrator.hpp" #include "ActsExamples/TrackFitting/TrackFitterFunction.hpp" +#include #include #include #include -#include #include #include #include diff --git a/Examples/Algorithms/TruthTracking/ActsExamples/TruthTracking/TruthSeedingAlgorithm.cpp b/Examples/Algorithms/TruthTracking/ActsExamples/TruthTracking/TruthSeedingAlgorithm.cpp index d0b5ba67b76..975349af446 100644 --- a/Examples/Algorithms/TruthTracking/ActsExamples/TruthTracking/TruthSeedingAlgorithm.cpp +++ b/Examples/Algorithms/TruthTracking/ActsExamples/TruthTracking/TruthSeedingAlgorithm.cpp @@ -21,7 +21,6 @@ #include #include #include -#include #include #include #include diff --git a/Examples/Algorithms/Vertexing/src/AdaptiveMultiVertexFinderAlgorithm.cpp b/Examples/Algorithms/Vertexing/src/AdaptiveMultiVertexFinderAlgorithm.cpp index e2da9ddf39a..54c96d57258 100644 --- a/Examples/Algorithms/Vertexing/src/AdaptiveMultiVertexFinderAlgorithm.cpp +++ b/Examples/Algorithms/Vertexing/src/AdaptiveMultiVertexFinderAlgorithm.cpp @@ -31,10 +31,10 @@ #include "ActsExamples/Framework/ProcessCode.hpp" #include "ActsExamples/TruthTracking/TruthVertexFinder.hpp" +#include #include #include #include -#include #include #include #include diff --git a/Examples/Detectors/MuonSpectrometerMockupDetector/src/MockupSectorBuilder.cpp b/Examples/Detectors/MuonSpectrometerMockupDetector/src/MockupSectorBuilder.cpp index 6c772617bd3..17ede59023d 100644 --- a/Examples/Detectors/MuonSpectrometerMockupDetector/src/MockupSectorBuilder.cpp +++ b/Examples/Detectors/MuonSpectrometerMockupDetector/src/MockupSectorBuilder.cpp @@ -37,7 +37,6 @@ #include #include #include -#include #include #include #include diff --git a/Examples/Detectors/TelescopeDetector/src/TelescopeDetector.cpp b/Examples/Detectors/TelescopeDetector/src/TelescopeDetector.cpp index 965fea896cd..47dcf82bbd9 100644 --- a/Examples/Detectors/TelescopeDetector/src/TelescopeDetector.cpp +++ b/Examples/Detectors/TelescopeDetector/src/TelescopeDetector.cpp @@ -14,7 +14,6 @@ #include "ActsExamples/TelescopeDetector/TelescopeDetectorElement.hpp" #include -#include #include auto ActsExamples::Telescope::TelescopeDetector::finalize( diff --git a/Examples/Framework/include/ActsExamples/EventData/Index.hpp b/Examples/Framework/include/ActsExamples/EventData/Index.hpp index cd8b77bfda5..6502c246065 100644 --- a/Examples/Framework/include/ActsExamples/EventData/Index.hpp +++ b/Examples/Framework/include/ActsExamples/EventData/Index.hpp @@ -10,7 +10,6 @@ #include #include -#include #include #include diff --git a/Examples/Framework/src/Framework/Sequencer.cpp b/Examples/Framework/src/Framework/Sequencer.cpp index 5d7ff2feef0..5afde17c0d7 100644 --- a/Examples/Framework/src/Framework/Sequencer.cpp +++ b/Examples/Framework/src/Framework/Sequencer.cpp @@ -35,7 +35,6 @@ #include #include #include -#include #include #include #include diff --git a/Examples/Framework/src/Framework/WhiteBoard.cpp b/Examples/Framework/src/Framework/WhiteBoard.cpp index 065b1b117e1..e0a633c9819 100644 --- a/Examples/Framework/src/Framework/WhiteBoard.cpp +++ b/Examples/Framework/src/Framework/WhiteBoard.cpp @@ -8,8 +8,8 @@ #include "ActsExamples/Framework/WhiteBoard.hpp" +#include #include -#include #include #include diff --git a/Examples/Framework/src/Utilities/EventDataTransforms.cpp b/Examples/Framework/src/Utilities/EventDataTransforms.cpp index d061f91a4ae..55c3d4b66ec 100644 --- a/Examples/Framework/src/Utilities/EventDataTransforms.cpp +++ b/Examples/Framework/src/Utilities/EventDataTransforms.cpp @@ -12,7 +12,7 @@ #include "ActsExamples/EventData/IndexSourceLink.hpp" #include "ActsExamples/EventData/SimSpacePoint.hpp" -#include +#include #include ActsExamples::ProtoTrack ActsExamples::seedToPrototrack( diff --git a/Examples/Framework/src/Validation/TrackClassification.cpp b/Examples/Framework/src/Validation/TrackClassification.cpp index 1cc16073e57..29d4edbebbc 100644 --- a/Examples/Framework/src/Validation/TrackClassification.cpp +++ b/Examples/Framework/src/Validation/TrackClassification.cpp @@ -16,7 +16,6 @@ #include "ActsExamples/Utilities/Range.hpp" #include -#include #include namespace { diff --git a/Examples/Io/Csv/src/CsvMeasurementReader.cpp b/Examples/Io/Csv/src/CsvMeasurementReader.cpp index 9d90be550f1..aa68cfce2ba 100644 --- a/Examples/Io/Csv/src/CsvMeasurementReader.cpp +++ b/Examples/Io/Csv/src/CsvMeasurementReader.cpp @@ -27,7 +27,6 @@ #include #include #include -#include #include #include diff --git a/Examples/Io/Csv/src/CsvTrackWriter.cpp b/Examples/Io/Csv/src/CsvTrackWriter.cpp index a53322505a8..c0c25dfe51a 100644 --- a/Examples/Io/Csv/src/CsvTrackWriter.cpp +++ b/Examples/Io/Csv/src/CsvTrackWriter.cpp @@ -26,7 +26,6 @@ #include #include #include -#include #include #include #include diff --git a/Examples/Io/EDM4hep/src/EDM4hepReader.cpp b/Examples/Io/EDM4hep/src/EDM4hepReader.cpp index 05945f19530..885248c49c0 100644 --- a/Examples/Io/EDM4hep/src/EDM4hepReader.cpp +++ b/Examples/Io/EDM4hep/src/EDM4hepReader.cpp @@ -23,7 +23,6 @@ #include #include #include -#include #include #include diff --git a/Examples/Io/Root/src/RootSimHitReader.cpp b/Examples/Io/Root/src/RootSimHitReader.cpp index 96122c2085a..33db881483c 100644 --- a/Examples/Io/Root/src/RootSimHitReader.cpp +++ b/Examples/Io/Root/src/RootSimHitReader.cpp @@ -17,7 +17,6 @@ #include #include #include -#include #include #include diff --git a/Examples/Scripts/TrackingPerformance/defineReconstructionPerformance.C b/Examples/Scripts/TrackingPerformance/defineReconstructionPerformance.C index 5aeb4de46f7..78387955785 100644 --- a/Examples/Scripts/TrackingPerformance/defineReconstructionPerformance.C +++ b/Examples/Scripts/TrackingPerformance/defineReconstructionPerformance.C @@ -8,7 +8,7 @@ #include #include -#include +#include #include #include #include diff --git a/Plugins/Cuda/include/Acts/Plugins/Cuda/Seeding/SeedFinder.ipp b/Plugins/Cuda/include/Acts/Plugins/Cuda/Seeding/SeedFinder.ipp index 9b4ba668561..7ccdc1cee62 100644 --- a/Plugins/Cuda/include/Acts/Plugins/Cuda/Seeding/SeedFinder.ipp +++ b/Plugins/Cuda/include/Acts/Plugins/Cuda/Seeding/SeedFinder.ipp @@ -11,7 +11,6 @@ #include #include #include -#include #include namespace Acts { diff --git a/Plugins/Cuda/include/Acts/Plugins/Cuda/Seeding2/SeedFinder.ipp b/Plugins/Cuda/include/Acts/Plugins/Cuda/Seeding2/SeedFinder.ipp index 6bcd8ebd641..7304496aace 100644 --- a/Plugins/Cuda/include/Acts/Plugins/Cuda/Seeding2/SeedFinder.ipp +++ b/Plugins/Cuda/include/Acts/Plugins/Cuda/Seeding2/SeedFinder.ipp @@ -23,8 +23,8 @@ #include "Acts/Seeding/InternalSpacePoint.hpp" // System include(s). +#include #include -#include #include namespace Acts::Cuda { diff --git a/Plugins/DD4hep/src/DD4hepLayerBuilder.cpp b/Plugins/DD4hep/src/DD4hepLayerBuilder.cpp index 83fc048ca53..705426c9bb3 100644 --- a/Plugins/DD4hep/src/DD4hepLayerBuilder.cpp +++ b/Plugins/DD4hep/src/DD4hepLayerBuilder.cpp @@ -35,7 +35,6 @@ #include #include #include -#include #include #include diff --git a/Plugins/ExaTrkX/src/BoostTrackBuilding.cpp b/Plugins/ExaTrkX/src/BoostTrackBuilding.cpp index 1e621f1f7dc..aa072c83994 100644 --- a/Plugins/ExaTrkX/src/BoostTrackBuilding.cpp +++ b/Plugins/ExaTrkX/src/BoostTrackBuilding.cpp @@ -10,8 +10,8 @@ #include "Acts/Utilities/Zip.hpp" +#include #include -#include #include #include diff --git a/Plugins/ExaTrkX/src/TorchTruthGraphMetricsHook.cpp b/Plugins/ExaTrkX/src/TorchTruthGraphMetricsHook.cpp index 7f54ff10cdc..23717fa98be 100644 --- a/Plugins/ExaTrkX/src/TorchTruthGraphMetricsHook.cpp +++ b/Plugins/ExaTrkX/src/TorchTruthGraphMetricsHook.cpp @@ -10,7 +10,7 @@ #include "Acts/Plugins/ExaTrkX/detail/TensorVectorConversion.hpp" -#include +#include #include diff --git a/Plugins/GeoModel/src/detail/GeoIntersectionAnnulusConverter.cpp b/Plugins/GeoModel/src/detail/GeoIntersectionAnnulusConverter.cpp index fb962157405..cbf06328dcf 100644 --- a/Plugins/GeoModel/src/detail/GeoIntersectionAnnulusConverter.cpp +++ b/Plugins/GeoModel/src/detail/GeoIntersectionAnnulusConverter.cpp @@ -16,7 +16,7 @@ #include "Acts/Surfaces/Surface.hpp" #include "Acts/Surfaces/detail/AnnulusBoundsHelper.hpp" -#include +#include #include #include diff --git a/Plugins/GeoModel/src/detail/GeoPolygonConverter.cpp b/Plugins/GeoModel/src/detail/GeoPolygonConverter.cpp index e1849180e9b..3f5e1404295 100644 --- a/Plugins/GeoModel/src/detail/GeoPolygonConverter.cpp +++ b/Plugins/GeoModel/src/detail/GeoPolygonConverter.cpp @@ -17,7 +17,7 @@ #include "Acts/Surfaces/Surface.hpp" #include "Acts/Surfaces/TrapezoidBounds.hpp" -#include +#include #include #include diff --git a/Tests/CommonHelpers/Acts/Tests/CommonHelpers/BenchmarkTools.hpp b/Tests/CommonHelpers/Acts/Tests/CommonHelpers/BenchmarkTools.hpp index 3d46d236a2d..f04979e03b8 100644 --- a/Tests/CommonHelpers/Acts/Tests/CommonHelpers/BenchmarkTools.hpp +++ b/Tests/CommonHelpers/Acts/Tests/CommonHelpers/BenchmarkTools.hpp @@ -15,7 +15,6 @@ #include #include #include -#include #include #include #include diff --git a/Tests/IntegrationTests/Fatras/FatrasSimulationTests.cpp b/Tests/IntegrationTests/Fatras/FatrasSimulationTests.cpp index fb1406671fb..97703092e8f 100644 --- a/Tests/IntegrationTests/Fatras/FatrasSimulationTests.cpp +++ b/Tests/IntegrationTests/Fatras/FatrasSimulationTests.cpp @@ -27,7 +27,6 @@ #include #include -#include using namespace Acts::UnitLiterals; diff --git a/Tests/IntegrationTests/Legacy/ATLSeedingIntegrationTest.cpp b/Tests/IntegrationTests/Legacy/ATLSeedingIntegrationTest.cpp index 97443623831..20876537961 100644 --- a/Tests/IntegrationTests/Legacy/ATLSeedingIntegrationTest.cpp +++ b/Tests/IntegrationTests/Legacy/ATLSeedingIntegrationTest.cpp @@ -11,7 +11,6 @@ #include "Acts/Seeding/AtlasSeedFinder.hpp" #include -#include // space point structure with the bare minimum and reasonable default // covariances. clusterList default is SCT (strip detector) diff --git a/Tests/IntegrationTests/NavigatorConsistency.cpp b/Tests/IntegrationTests/NavigatorConsistency.cpp index e32e78b6ab4..b8de4d6b8d1 100644 --- a/Tests/IntegrationTests/NavigatorConsistency.cpp +++ b/Tests/IntegrationTests/NavigatorConsistency.cpp @@ -23,7 +23,7 @@ #include "Acts/Tests/CommonHelpers/CylindricalTrackingGeometry.hpp" #include "Acts/Utilities/VectorHelpers.hpp" -#include +#include namespace bdata = boost::unit_test::data; using namespace Acts::UnitLiterals; diff --git a/Tests/UnitTests/Core/Clusterization/ClusterizationTests1D.cpp b/Tests/UnitTests/Core/Clusterization/ClusterizationTests1D.cpp index e92d8838f4f..3ab655ade8d 100644 --- a/Tests/UnitTests/Core/Clusterization/ClusterizationTests1D.cpp +++ b/Tests/UnitTests/Core/Clusterization/ClusterizationTests1D.cpp @@ -15,7 +15,6 @@ #include #include #include -#include #include #include diff --git a/Tests/UnitTests/Core/Clusterization/ClusterizationTests2D.cpp b/Tests/UnitTests/Core/Clusterization/ClusterizationTests2D.cpp index 3ecb537f1eb..e26584226ad 100644 --- a/Tests/UnitTests/Core/Clusterization/ClusterizationTests2D.cpp +++ b/Tests/UnitTests/Core/Clusterization/ClusterizationTests2D.cpp @@ -17,7 +17,6 @@ #include #include #include -#include #include #include #include diff --git a/Tests/UnitTests/Core/Detector/CuboidalDetectorFromBlueprintTests.cpp b/Tests/UnitTests/Core/Detector/CuboidalDetectorFromBlueprintTests.cpp index 2ac6db4b480..9a194dbef1b 100644 --- a/Tests/UnitTests/Core/Detector/CuboidalDetectorFromBlueprintTests.cpp +++ b/Tests/UnitTests/Core/Detector/CuboidalDetectorFromBlueprintTests.cpp @@ -26,8 +26,8 @@ #include "Acts/Surfaces/Surface.hpp" #include "Acts/Utilities/BinningData.hpp" +#include #include -#include class SurfaceBuilder : public Acts::Experimental::IInternalStructureBuilder { public: diff --git a/Tests/UnitTests/Core/EventData/TrackTests.cpp b/Tests/UnitTests/Core/EventData/TrackTests.cpp index 4eccbafc261..db8863e5e6b 100644 --- a/Tests/UnitTests/Core/EventData/TrackTests.cpp +++ b/Tests/UnitTests/Core/EventData/TrackTests.cpp @@ -24,12 +24,12 @@ #include "Acts/Utilities/HashedString.hpp" #include "Acts/Utilities/Holders.hpp" +#include #include #include #include #include #include -#include #include #include #include diff --git a/Tests/UnitTests/Core/EventData/TrackTestsExtra.cpp b/Tests/UnitTests/Core/EventData/TrackTestsExtra.cpp index 1e6f9e69d1a..7500e119593 100644 --- a/Tests/UnitTests/Core/EventData/TrackTestsExtra.cpp +++ b/Tests/UnitTests/Core/EventData/TrackTestsExtra.cpp @@ -15,8 +15,8 @@ #include "Acts/Surfaces/PlaneSurface.hpp" #include "Acts/Utilities/Zip.hpp" +#include #include -#include using namespace Acts; using namespace Acts::HashedStringLiteral; diff --git a/Tests/UnitTests/Core/Seeding/CandidatesForMiddleSpTests.cpp b/Tests/UnitTests/Core/Seeding/CandidatesForMiddleSpTests.cpp index 7adfe32a744..e6068ed248c 100644 --- a/Tests/UnitTests/Core/Seeding/CandidatesForMiddleSpTests.cpp +++ b/Tests/UnitTests/Core/Seeding/CandidatesForMiddleSpTests.cpp @@ -10,8 +10,8 @@ #include "Acts/Seeding/CandidatesForMiddleSp.hpp" +#include #include -#include #include #include "SpacePoint.hpp" diff --git a/Tests/UnitTests/Core/TrackFitting/GsfMixtureReductionTests.cpp b/Tests/UnitTests/Core/TrackFitting/GsfMixtureReductionTests.cpp index 5fd4270a3c4..790ad75a75c 100644 --- a/Tests/UnitTests/Core/TrackFitting/GsfMixtureReductionTests.cpp +++ b/Tests/UnitTests/Core/TrackFitting/GsfMixtureReductionTests.cpp @@ -19,7 +19,6 @@ #include #include #include -#include #include #include #include diff --git a/Tests/UnitTests/Core/Utilities/IntersectionTests.cpp b/Tests/UnitTests/Core/Utilities/IntersectionTests.cpp index a4d20bac821..81aa55c832c 100644 --- a/Tests/UnitTests/Core/Utilities/IntersectionTests.cpp +++ b/Tests/UnitTests/Core/Utilities/IntersectionTests.cpp @@ -19,7 +19,6 @@ #include #include #include -#include #include #include #include diff --git a/Tests/UnitTests/Core/Utilities/SubspaceTests.cpp b/Tests/UnitTests/Core/Utilities/SubspaceTests.cpp index 5d695c31a6d..d61c46a3d69 100644 --- a/Tests/UnitTests/Core/Utilities/SubspaceTests.cpp +++ b/Tests/UnitTests/Core/Utilities/SubspaceTests.cpp @@ -19,7 +19,6 @@ #include #include #include -#include #include #include #include diff --git a/Tests/UnitTests/Plugins/ExaTrkX/ExaTrkXBoostTrackBuildingTests.cpp b/Tests/UnitTests/Plugins/ExaTrkX/ExaTrkXBoostTrackBuildingTests.cpp index aaaa95fe8c2..41c5044a02c 100644 --- a/Tests/UnitTests/Plugins/ExaTrkX/ExaTrkXBoostTrackBuildingTests.cpp +++ b/Tests/UnitTests/Plugins/ExaTrkX/ExaTrkXBoostTrackBuildingTests.cpp @@ -12,7 +12,6 @@ #include "Acts/Plugins/ExaTrkX/detail/TensorVectorConversion.hpp" #include -#include BOOST_AUTO_TEST_CASE(test_track_building) { // Make some spacepoint IDs diff --git a/Tests/UnitTests/Plugins/ExaTrkX/ExaTrkXEdgeBuildingTest.cpp b/Tests/UnitTests/Plugins/ExaTrkX/ExaTrkXEdgeBuildingTest.cpp index cae8d8f02bc..b806da0a6b6 100644 --- a/Tests/UnitTests/Plugins/ExaTrkX/ExaTrkXEdgeBuildingTest.cpp +++ b/Tests/UnitTests/Plugins/ExaTrkX/ExaTrkXEdgeBuildingTest.cpp @@ -12,9 +12,9 @@ #include "Acts/Plugins/ExaTrkX/detail/TensorVectorConversion.hpp" #include "Acts/Plugins/ExaTrkX/detail/buildEdges.hpp" +#include #include #include -#include #include #include From 29993c595abf262ba97d6ff737e608b2552e3176 Mon Sep 17 00:00:00 2001 From: AJPfleger Date: Thu, 5 Sep 2024 09:31:17 +0200 Subject: [PATCH 15/32] missed stuff --- Core/include/Acts/Material/MaterialComposition.hpp | 2 +- Examples/Algorithms/Geant4/src/SensitiveSurfaceMapper.cpp | 1 + Fatras/src/Digitization/PlanarSurfaceMask.cpp | 1 - Fatras/src/Digitization/Segmentizer.cpp | 2 +- 4 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Core/include/Acts/Material/MaterialComposition.hpp b/Core/include/Acts/Material/MaterialComposition.hpp index 749ce286ba7..00073a2b1f0 100644 --- a/Core/include/Acts/Material/MaterialComposition.hpp +++ b/Core/include/Acts/Material/MaterialComposition.hpp @@ -1,6 +1,6 @@ // This file is part of the Acts project. // -// Copyright (C) 2018-2020 CERN for the benefit of the Acts project +// Copyright (C) 2018-2024 CERN for the benefit of the Acts project // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this diff --git a/Examples/Algorithms/Geant4/src/SensitiveSurfaceMapper.cpp b/Examples/Algorithms/Geant4/src/SensitiveSurfaceMapper.cpp index a93f5b70e5a..30e0c8ad08d 100644 --- a/Examples/Algorithms/Geant4/src/SensitiveSurfaceMapper.cpp +++ b/Examples/Algorithms/Geant4/src/SensitiveSurfaceMapper.cpp @@ -16,6 +16,7 @@ #include #include +#include #include #include #include diff --git a/Fatras/src/Digitization/PlanarSurfaceMask.cpp b/Fatras/src/Digitization/PlanarSurfaceMask.cpp index b4d0d05ae57..fc25f609917 100644 --- a/Fatras/src/Digitization/PlanarSurfaceMask.cpp +++ b/Fatras/src/Digitization/PlanarSurfaceMask.cpp @@ -25,7 +25,6 @@ #include #include #include -#include namespace { diff --git a/Fatras/src/Digitization/Segmentizer.cpp b/Fatras/src/Digitization/Segmentizer.cpp index 53f388dd7db..8a3702a772f 100644 --- a/Fatras/src/Digitization/Segmentizer.cpp +++ b/Fatras/src/Digitization/Segmentizer.cpp @@ -1,6 +1,6 @@ // This file is part of the Acts project. // -// Copyright (C) 2020 CERN for the benefit of the Acts project +// Copyright (C) 2020-2024 CERN for the benefit of the Acts project // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this From 13eb70fa3e61a2f96814f8280e0b5e1c6f0cefd4 Mon Sep 17 00:00:00 2001 From: AJPfleger Date: Thu, 5 Sep 2024 09:38:53 +0200 Subject: [PATCH 16/32] missing years --- Core/src/Vertexing/FsmwMode1dFinder.cpp | 2 +- Plugins/ExaTrkX/src/TorchTruthGraphMetricsHook.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Core/src/Vertexing/FsmwMode1dFinder.cpp b/Core/src/Vertexing/FsmwMode1dFinder.cpp index 331ce717893..798aba5dfc1 100644 --- a/Core/src/Vertexing/FsmwMode1dFinder.cpp +++ b/Core/src/Vertexing/FsmwMode1dFinder.cpp @@ -1,6 +1,6 @@ // This file is part of the Acts project. // -// Copyright (C) 2019 CERN for the benefit of the Acts project +// Copyright (C) 2019-2024 CERN for the benefit of the Acts project // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this diff --git a/Plugins/ExaTrkX/src/TorchTruthGraphMetricsHook.cpp b/Plugins/ExaTrkX/src/TorchTruthGraphMetricsHook.cpp index 23717fa98be..15b27ef79a9 100644 --- a/Plugins/ExaTrkX/src/TorchTruthGraphMetricsHook.cpp +++ b/Plugins/ExaTrkX/src/TorchTruthGraphMetricsHook.cpp @@ -1,6 +1,6 @@ // This file is part of the Acts project. // -// Copyright (C) 2023 CERN for the benefit of the Acts project +// Copyright (C) 2023-2024 CERN for the benefit of the Acts project // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this From b50210a4ef329fe7cc7e31b608f0287f46cdf4f2 Mon Sep 17 00:00:00 2001 From: AJPfleger Date: Fri, 6 Sep 2024 10:02:16 +0200 Subject: [PATCH 17/32] fix exatrkx - cantorEdge --- Plugins/ExaTrkX/src/TorchTruthGraphMetricsHook.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/ExaTrkX/src/TorchTruthGraphMetricsHook.cpp b/Plugins/ExaTrkX/src/TorchTruthGraphMetricsHook.cpp index 15b27ef79a9..cf1abbaa549 100644 --- a/Plugins/ExaTrkX/src/TorchTruthGraphMetricsHook.cpp +++ b/Plugins/ExaTrkX/src/TorchTruthGraphMetricsHook.cpp @@ -26,7 +26,7 @@ auto cantorize(std::vector edgeIndex, cantorEdgeIndex.emplace_back(*it, *std::next(it)); } - std::ranges::sort(cantorEdgeIndex); + std::ranges::sort(cantorEdgeIndex, std::less>{}); auto new_end = std::unique(cantorEdgeIndex.begin(), cantorEdgeIndex.end()); if (new_end != cantorEdgeIndex.end()) { From e5591f710b0628ff27de09553a1641fdf4a7ff34 Mon Sep 17 00:00:00 2001 From: AJPfleger Date: Sat, 7 Sep 2024 09:24:55 +0200 Subject: [PATCH 18/32] fix exatrkx namespace cantoredge --- Plugins/ExaTrkX/src/TorchTruthGraphMetricsHook.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Plugins/ExaTrkX/src/TorchTruthGraphMetricsHook.cpp b/Plugins/ExaTrkX/src/TorchTruthGraphMetricsHook.cpp index cf1abbaa549..ce829860eb1 100644 --- a/Plugins/ExaTrkX/src/TorchTruthGraphMetricsHook.cpp +++ b/Plugins/ExaTrkX/src/TorchTruthGraphMetricsHook.cpp @@ -26,7 +26,8 @@ auto cantorize(std::vector edgeIndex, cantorEdgeIndex.emplace_back(*it, *std::next(it)); } - std::ranges::sort(cantorEdgeIndex, std::less>{}); + std::ranges::sort(cantorEdgeIndex, + std::less>{}); auto new_end = std::unique(cantorEdgeIndex.begin(), cantorEdgeIndex.end()); if (new_end != cantorEdgeIndex.end()) { From 16b3590811ecdd6e6285b7ce1e0e5e3184545054 Mon Sep 17 00:00:00 2001 From: AJPfleger Date: Sat, 7 Sep 2024 09:42:31 +0200 Subject: [PATCH 19/32] sonarcloud --- Examples/Algorithms/HepMC/src/HepMCProcessExtractor.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Examples/Algorithms/HepMC/src/HepMCProcessExtractor.cpp b/Examples/Algorithms/HepMC/src/HepMCProcessExtractor.cpp index ac9467b4dec..01666daec9a 100644 --- a/Examples/Algorithms/HepMC/src/HepMCProcessExtractor.cpp +++ b/Examples/Algorithms/HepMC/src/HepMCProcessExtractor.cpp @@ -168,10 +168,11 @@ void filterAndSort( // Sort the particles based on their momentum for (auto& interaction : interactions) { - std::ranges::sort(interaction.after, [](ActsExamples::SimParticle& a, - ActsExamples::SimParticle& b) { - return a.absoluteMomentum() > b.absoluteMomentum(); - }); + std::ranges::sort(interaction.after, + [](const ActsExamples::SimParticle& a, + const ActsExamples::SimParticle& b) { + return a.absoluteMomentum() > b.absoluteMomentum(); + }); } } } // namespace From 10c7931a45991ed2c967c375fef00d7fd3317090 Mon Sep 17 00:00:00 2001 From: AJPfleger Date: Sat, 7 Sep 2024 17:58:33 +0200 Subject: [PATCH 20/32] fix exatrakx cantorpair --- Tests/UnitTests/Plugins/ExaTrkX/ExaTrkXEdgeBuildingTest.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Tests/UnitTests/Plugins/ExaTrkX/ExaTrkXEdgeBuildingTest.cpp b/Tests/UnitTests/Plugins/ExaTrkX/ExaTrkXEdgeBuildingTest.cpp index b806da0a6b6..3f671aeb04e 100644 --- a/Tests/UnitTests/Plugins/ExaTrkX/ExaTrkXEdgeBuildingTest.cpp +++ b/Tests/UnitTests/Plugins/ExaTrkX/ExaTrkXEdgeBuildingTest.cpp @@ -84,8 +84,8 @@ void test_random_graph(int emb_dim, int n_nodes, float r, int knn, edges_test_cantor.push_back(a < b ? CantorPair(a, b) : CantorPair(b, a)); } - std::ranges::sort(edges_ref_cantor); - std::ranges::sort(edges_test_cantor); + std::ranges::sort(edges_ref_cantor, std::less{}); + std::ranges::sort(edges_test_cantor, std::less{}); #if PRINT std::cout << "test size " << edges_test_cantor.size() << std::endl; From e91cc398a4e12479c93692265baa499885d5f8db Mon Sep 17 00:00:00 2001 From: AJPfleger Date: Sun, 8 Sep 2024 14:33:13 +0200 Subject: [PATCH 21/32] try projector --- Core/include/Acts/Clusterization/Clusterization.ipp | 4 +--- Core/include/Acts/Navigation/DetectorNavigator.hpp | 7 ++----- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/Core/include/Acts/Clusterization/Clusterization.ipp b/Core/include/Acts/Clusterization/Clusterization.ipp index 3d8cf9d2302..16047295912 100644 --- a/Core/include/Acts/Clusterization/Clusterization.ipp +++ b/Core/include/Acts/Clusterization/Clusterization.ipp @@ -309,9 +309,7 @@ ClusterCollection mergeClusters(CellCollection& cells) { if constexpr (GridDim > 1) { // Sort the cells by their cluster label, only needed if more than // one spatial dimension - std::ranges::sort(cells, [](Cell& lhs, Cell& rhs) { - return getCellLabel(lhs) < getCellLabel(rhs); - }); + std::ranges::sort(cells, {}, [](Cell& c) { return getCellLabel(c); }); } return internal::mergeClustersImpl(cells); diff --git a/Core/include/Acts/Navigation/DetectorNavigator.hpp b/Core/include/Acts/Navigation/DetectorNavigator.hpp index e606ca3472b..eb18295ecef 100644 --- a/Core/include/Acts/Navigation/DetectorNavigator.hpp +++ b/Core/include/Acts/Navigation/DetectorNavigator.hpp @@ -406,11 +406,8 @@ class DetectorNavigator { // Sort properly the surface candidates auto& nCandidates = nState.surfaceCandidates; - std::ranges::sort(nCandidates, [&](const auto& a, const auto& b) { - // The two path lengths - ActsScalar pathToA = a.objectIntersection.pathLength(); - ActsScalar pathToB = b.objectIntersection.pathLength(); - return pathToA < pathToB; + std::ranges::sort(nCandidates, {}, [](const auto& c) { + return c.objectIntersection.pathLength(); }); // Set the surface candidate nState.surfaceCandidateIndex = 0; From 9dda03f07bcf45caf40ab94355f1f34d8212c909 Mon Sep 17 00:00:00 2001 From: AJPfleger Date: Sun, 8 Sep 2024 18:10:25 +0200 Subject: [PATCH 22/32] projector --- .../Acts/Navigation/MultiLayerNavigation.hpp | 12 +++----- .../Navigation/NavigationStateUpdaters.hpp | 5 ++-- .../Acts/Seeding/HoughTransformUtils.ipp | 14 +++------- Core/include/Acts/Seeding/SeedFilter.ipp | 9 +++--- Core/include/Acts/Seeding/SeedFinder.ipp | 20 +++++-------- .../Acts/Seeding/SeedFinderOrthogonal.ipp | 19 ++++++------- .../detail/CylindricalSpacePointGrid.ipp | 5 ++-- .../Acts/Vertexing/SingleSeedVertexFinder.ipp | 11 +++----- Core/src/Detector/LayerStructureBuilder.cpp | 5 +--- Core/src/Detector/detail/BlueprintHelper.cpp | 10 +++---- Core/src/Geometry/CuboidVolumeBuilder.cpp | 5 +--- Core/src/Geometry/CylinderVolumeStack.cpp | 17 ++++------- Core/src/TrackFitting/GsfMixtureReduction.cpp | 5 ++-- Core/src/Vertexing/FsmwMode1dFinder.cpp | 5 +--- .../HepMC/src/HepMCProcessExtractor.cpp | 7 ++--- .../src/PrototracksToParameters.cpp | 11 +++----- .../src/TruthGraphBuilder.cpp | 9 ++---- .../TruthTracking/TruthSeedingAlgorithm.cpp | 5 ++-- .../AdaptiveMultiVertexFinderAlgorithm.cpp | 7 ++--- .../src/MockupSectorBuilder.cpp | 5 ++-- .../Framework/src/Framework/Sequencer.cpp | 4 +-- .../Framework/src/Framework/WhiteBoard.cpp | 3 +- .../src/Utilities/EventDataTransforms.cpp | 3 +- .../src/Validation/TrackClassification.cpp | 7 ++--- Examples/Io/Csv/src/CsvTrackWriter.cpp | 28 +++++++++---------- Examples/Io/EDM4hep/src/EDM4hepReader.cpp | 4 +-- Examples/Io/Root/src/RootSimHitReader.cpp | 5 ++-- .../defineReconstructionPerformance.C | 16 ++--------- .../GeoIntersectionAnnulusConverter.cpp | 4 +-- .../src/detail/GeoPolygonConverter.cpp | 5 +--- .../Fatras/FatrasSimulationTests.cpp | 5 ++-- .../TrackFitting/GsfMixtureReductionTests.cpp | 8 ++---- 32 files changed, 99 insertions(+), 179 deletions(-) diff --git a/Core/include/Acts/Navigation/MultiLayerNavigation.hpp b/Core/include/Acts/Navigation/MultiLayerNavigation.hpp index 6c292026331..8ce76972878 100644 --- a/Core/include/Acts/Navigation/MultiLayerNavigation.hpp +++ b/Core/include/Acts/Navigation/MultiLayerNavigation.hpp @@ -17,6 +17,7 @@ #include #include #include +#include namespace Acts::Experimental { @@ -106,14 +107,9 @@ class MultiLayerNavigation : public IInternalNavigation { void resolveDuplicates(const GeometryContext& gctx, std::vector& surfaces) const { // sorting the surfaces according to their radial distance - std::ranges::sort(surfaces, [&gctx](const auto& surf1, const auto& surf2) { - if (surf1->center(gctx).x() != surf2->center(gctx).x()) { - return surf1->center(gctx).x() < surf2->center(gctx).x(); - } - if (surf1->center(gctx).y() != surf2->center(gctx).y()) { - return surf1->center(gctx).y() < surf2->center(gctx).y(); - } - return surf1->center(gctx).z() < surf2->center(gctx).z(); + std::ranges::sort(surfaces, {}, [&gctx](const auto& s) { + const auto& c = s->center(gctx); + return std::tie(c.x(), c.y(), c.z()); }); // Remove the duplicates diff --git a/Core/include/Acts/Navigation/NavigationStateUpdaters.hpp b/Core/include/Acts/Navigation/NavigationStateUpdaters.hpp index a49c3702852..b5e4d90f53b 100644 --- a/Core/include/Acts/Navigation/NavigationStateUpdaters.hpp +++ b/Core/include/Acts/Navigation/NavigationStateUpdaters.hpp @@ -66,9 +66,8 @@ inline void intitializeCandidates(const GeometryContext& gctx, } } - std::ranges::sort(confirmedCandidates, [&](const auto& a, const auto& b) { - return a.objectIntersection.pathLength() < - b.objectIntersection.pathLength(); + std::ranges::sort(confirmedCandidates, {}, [](const auto& c) { + return c.objectIntersection.pathLength(); }); nState.surfaceCandidates = std::move(confirmedCandidates); diff --git a/Core/include/Acts/Seeding/HoughTransformUtils.ipp b/Core/include/Acts/Seeding/HoughTransformUtils.ipp index 19c739ce0e6..bf4d839a8b6 100644 --- a/Core/include/Acts/Seeding/HoughTransformUtils.ipp +++ b/Core/include/Acts/Seeding/HoughTransformUtils.ipp @@ -7,6 +7,7 @@ // file, You can obtain one at http://mozilla.org/MPL/2.0/. #include +#include template template @@ -263,16 +264,9 @@ Acts::HoughTransformUtils::PeakFinders::IslandsAroundMax< } } // sort the candidate cells descending in content - std::ranges::sort( - candidates, [&yieldMap](const std::size_t bin1, const std::size_t bin2) { - YieldType h1 = yieldMap[bin1]; - YieldType h2 = yieldMap[bin2]; - - if (h1 != h2) { - return h1 > h2; - } - return bin1 > bin2; - }); + std::ranges::sort(candidates, {}, [&yieldMap](const auto c) { + return std::tie(yieldMap[c], c); + }); // now we build islands from the candidate cells, starting with the most // populated one diff --git a/Core/include/Acts/Seeding/SeedFilter.ipp b/Core/include/Acts/Seeding/SeedFilter.ipp index 672749e5487..284ab2932e3 100644 --- a/Core/include/Acts/Seeding/SeedFilter.ipp +++ b/Core/include/Acts/Seeding/SeedFilter.ipp @@ -69,11 +69,10 @@ void SeedFilter::filterSeeds_2SpFixed( if (topSpVec.size() > 2) { // sort indexes based on comparing values in invHelixDiameterVec - std::ranges::sort( - topSPIndexVec, - [&invHelixDiameterVec](const std::size_t i1, const std::size_t i2) { - return invHelixDiameterVec[i1] < invHelixDiameterVec[i2]; - }); + std::ranges::sort(topSPIndexVec, {}, + [&invHelixDiameterVec](const std::size_t t) { + return invHelixDiameterVec[t]; + }); } // vector containing the radius of all compatible seeds diff --git a/Core/include/Acts/Seeding/SeedFinder.ipp b/Core/include/Acts/Seeding/SeedFinder.ipp index 7826e2f2abc..f65a26e3f58 100644 --- a/Core/include/Acts/Seeding/SeedFinder.ipp +++ b/Core/include/Acts/Seeding/SeedFinder.ipp @@ -496,19 +496,13 @@ SeedFinder::filterCandidates( if constexpr (detailedMeasurement == Acts::DetectorMeasurementInfo::eDefault) { - std::ranges::sort( - sorted_bottoms, - [&state](const std::size_t a, const std::size_t b) -> bool { - return state.linCircleBottom[a].cotTheta < - state.linCircleBottom[b].cotTheta; - }); - - std::ranges::sort( - sorted_tops, - [&state](const std::size_t a, const std::size_t b) -> bool { - return state.linCircleTop[a].cotTheta < - state.linCircleTop[b].cotTheta; - }); + std::ranges::sort(sorted_bottoms, {}, [&state](const std::size_t s) { + return state.linCircleBottom[s].cotTheta; + }); + + std::ranges::sort(sorted_tops, {}, [&state](const std::size_t s) { + return state.linCircleTop[s].cotTheta; + }); } // Reserve enough space, in case current capacity is too little diff --git a/Core/include/Acts/Seeding/SeedFinderOrthogonal.ipp b/Core/include/Acts/Seeding/SeedFinderOrthogonal.ipp index 0721ce29edb..7caad023cf4 100644 --- a/Core/include/Acts/Seeding/SeedFinderOrthogonal.ipp +++ b/Core/include/Acts/Seeding/SeedFinderOrthogonal.ipp @@ -312,17 +312,14 @@ void SeedFinderOrthogonal::filterCandidates( sorted_tops[i] = i; } - std::ranges::sort( - sorted_bottoms, - [&linCircleBottom](const std::size_t a, const std::size_t b) -> bool { - return linCircleBottom[a].cotTheta < linCircleBottom[b].cotTheta; - }); - - std::ranges::sort( - sorted_tops, - [&linCircleTop](const std::size_t a, const std::size_t b) -> bool { - return linCircleTop[a].cotTheta < linCircleTop[b].cotTheta; - }); + std::ranges::sort(sorted_bottoms, {}, + [&linCircleBottom](const std::size_t s) { + return linCircleBottom[s].cotTheta; + }); + + std::ranges::sort(sorted_tops, {}, [&linCircleTop](const std::size_t s) { + return linCircleTop[s].cotTheta; + }); std::vector tanMT; tanMT.reserve(top.size()); diff --git a/Core/include/Acts/Seeding/detail/CylindricalSpacePointGrid.ipp b/Core/include/Acts/Seeding/detail/CylindricalSpacePointGrid.ipp index 926c192ff6c..bad3fc4c285 100644 --- a/Core/include/Acts/Seeding/detail/CylindricalSpacePointGrid.ipp +++ b/Core/include/Acts/Seeding/detail/CylindricalSpacePointGrid.ipp @@ -236,8 +236,7 @@ void Acts::CylindricalSpacePointGridCreator::fillGrid( /// sort SPs in R for each filled bin for (std::size_t binIndex : rBinsIndex) { auto& rbin = grid.atPosition(binIndex); - std::ranges::sort(rbin, [](const auto& a, const auto& b) -> bool { - return a->radius() < b->radius(); - }); + std::ranges::sort(rbin, {}, + [](const auto& rb) -> bool { return rb->radius(); }); } } diff --git a/Core/include/Acts/Vertexing/SingleSeedVertexFinder.ipp b/Core/include/Acts/Vertexing/SingleSeedVertexFinder.ipp index 90aaf3c59df..0f26a6a1ed3 100644 --- a/Core/include/Acts/Vertexing/SingleSeedVertexFinder.ipp +++ b/Core/include/Acts/Vertexing/SingleSeedVertexFinder.ipp @@ -464,10 +464,8 @@ Acts::SingleSeedVertexFinder::findClosestPointFromPlanes( triplet.second = distance; } - std::ranges::sort(tripletsWithPlanes, - [](const auto& lhs, const auto& rhs) { - return lhs.second < rhs.second; - }); + std::ranges::sort(tripletsWithPlanes, {}, + [](const auto& t) { return t.second; }); std::uint32_t threshold = static_cast( tripletsWithPlanes.size() * (1. - m_cfg.removeFraction)); @@ -572,9 +570,8 @@ Acts::SingleSeedVertexFinder::findClosestPointFromRays( triplet.second = distance; } - std::ranges::sort(tripletsWithRays, [](const auto& lhs, const auto& rhs) { - return lhs.second < rhs.second; - }); + std::ranges::sort(tripletsWithRays, {}, + [](const auto& t) { return t.second; }); std::uint32_t threshold = static_cast( tripletsWithRays.size() * (1. - m_cfg.removeFraction)); diff --git a/Core/src/Detector/LayerStructureBuilder.cpp b/Core/src/Detector/LayerStructureBuilder.cpp index b2ef8d9cfbc..7af5bdf5e5a 100644 --- a/Core/src/Detector/LayerStructureBuilder.cpp +++ b/Core/src/Detector/LayerStructureBuilder.cpp @@ -340,10 +340,7 @@ Acts::Experimental::LayerStructureBuilder::construct( adaptBinningRange(binnings, m_cfg.extent.value()); } // Sort the binning for conventions - std::ranges::sort(binnings, - [](const ProtoBinning& a, const ProtoBinning& b) { - return a.binValue < b.binValue; - }); + std::ranges::sort(binnings, {}, [](const auto& b) { return b.binValue; }); ACTS_DEBUG("- 2-dimensional surface binning detected."); // Capture the binnings diff --git a/Core/src/Detector/detail/BlueprintHelper.cpp b/Core/src/Detector/detail/BlueprintHelper.cpp index 6b787f1fd55..502d91f4d10 100644 --- a/Core/src/Detector/detail/BlueprintHelper.cpp +++ b/Core/src/Detector/detail/BlueprintHelper.cpp @@ -56,15 +56,13 @@ void Acts::Experimental::detail::BlueprintHelper::sort(Blueprint::Node& node, bVal == BinningValue::binZ) { Vector3 nodeCenter = node.transform.translation(); Vector3 nodeSortAxis = node.transform.rotation().col(toUnderlying(bVal)); - std::ranges::sort(node.children, [&](const auto& a, const auto& b) { - return (a->transform.translation() - nodeCenter).dot(nodeSortAxis) < - (b->transform.translation() - nodeCenter).dot(nodeSortAxis); + std::ranges::sort(node.children, {}, [&](const auto& c) { + return (c->transform.translation() - nodeCenter).dot(nodeSortAxis); }); } else if (bVal == BinningValue::binR && node.boundsType == VolumeBounds::eCylinder) { - std::ranges::sort(node.children, [](const auto& a, const auto& b) { - return 0.5 * (a->boundaryValues[0] + a->boundaryValues[1]) < - 0.5 * (b->boundaryValues[0] + b->boundaryValues[1]); + std::ranges::sort(node.children, {}, [](const auto& c) { + return c->boundaryValues[0] + c->boundaryValues[1]; }); } } diff --git a/Core/src/Geometry/CuboidVolumeBuilder.cpp b/Core/src/Geometry/CuboidVolumeBuilder.cpp index 84a5897c98b..1d226ca05fd 100644 --- a/Core/src/Geometry/CuboidVolumeBuilder.cpp +++ b/Core/src/Geometry/CuboidVolumeBuilder.cpp @@ -212,10 +212,7 @@ Acts::MutableTrackingVolumePtr Acts::CuboidVolumeBuilder::trackingVolume( // Sort the volumes vectors according to the center location, otherwise the // binning boundaries will fail - std::ranges::sort( - volumes, [](const TrackingVolumePtr& lhs, const TrackingVolumePtr& rhs) { - return lhs->center().x() < rhs->center().x(); - }); + std::ranges::sort(volumes, {}, [](const auto& v) { return v->center().x(); }); // Glue volumes for (unsigned int i = 0; i < volumes.size() - 1; i++) { diff --git a/Core/src/Geometry/CylinderVolumeStack.cpp b/Core/src/Geometry/CylinderVolumeStack.cpp index ab218de93f2..7be032e3850 100644 --- a/Core/src/Geometry/CylinderVolumeStack.cpp +++ b/Core/src/Geometry/CylinderVolumeStack.cpp @@ -160,9 +160,8 @@ void CylinderVolumeStack::initializeOuterVolume(BinningValue direction, if (direction == Acts::BinningValue::binZ) { ACTS_VERBOSE("Sorting by volume z position"); - std::ranges::sort(volumeTuples, [](const auto& a, const auto& b) { - return a.localTransform.translation()[eZ] < - b.localTransform.translation()[eZ]; + std::ranges::sort(volumeTuples, {}, [](const auto& v) { + return v.localTransform.translation()[eZ]; }); ACTS_VERBOSE("Checking for overlaps and attaching volumes in z"); @@ -192,9 +191,7 @@ void CylinderVolumeStack::initializeOuterVolume(BinningValue direction, ACTS_VERBOSE("*** Volume configuration after r synchronization:"); printVolumeSequence(volumeTuples, logger, Acts::Logging::VERBOSE); - std::ranges::sort(volumeTuples, [](const auto& a, const auto& b) { - return a.midZ() < b.midZ(); - }); + std::ranges::sort(volumeTuples, {}, [](const auto& v) { return v.midZ(); }); m_volumes.clear(); for (const auto& vt : volumeTuples) { @@ -223,9 +220,7 @@ void CylinderVolumeStack::initializeOuterVolume(BinningValue direction, } else if (direction == Acts::BinningValue::binR) { ACTS_VERBOSE("Sorting by volume r middle point"); - std::ranges::sort(volumeTuples, [](const auto& a, const auto& b) { - return a.midR() < b.midR(); - }); + std::ranges::sort(volumeTuples, {}, [](const auto& v) { return v.midR(); }); ACTS_VERBOSE("Checking for overlaps and attaching volumes in r"); std::vector gapVolumes = @@ -252,9 +247,7 @@ void CylinderVolumeStack::initializeOuterVolume(BinningValue direction, ACTS_VERBOSE("*** Volume configuration after z synchronization:"); printVolumeSequence(volumeTuples, logger, Acts::Logging::VERBOSE); - std::ranges::sort(volumeTuples, [](const auto& a, const auto& b) { - return a.midR() < b.midR(); - }); + std::ranges::sort(volumeTuples, {}, [](const auto& v) { return v.midR(); }); m_volumes.clear(); for (const auto& vt : volumeTuples) { diff --git a/Core/src/TrackFitting/GsfMixtureReduction.cpp b/Core/src/TrackFitting/GsfMixtureReduction.cpp index b5469ccba31..d0d5b2dfd79 100644 --- a/Core/src/TrackFitting/GsfMixtureReduction.cpp +++ b/Core/src/TrackFitting/GsfMixtureReduction.cpp @@ -37,9 +37,8 @@ void reduceWithKLDistanceImpl(std::vector &cmpCache, } // Remove all components which are labeled with weight -1 - std::ranges::sort(cmpCache, [&](const auto &a, const auto &b) { - return proj(a).weight < proj(b).weight; - }); + std::ranges::sort(cmpCache, {}, + [&](const auto &c) { return proj(c).weight; }); cmpCache.erase( std::remove_if(cmpCache.begin(), cmpCache.end(), [&](const auto &a) { return proj(a).weight == -1.0; }), diff --git a/Core/src/Vertexing/FsmwMode1dFinder.cpp b/Core/src/Vertexing/FsmwMode1dFinder.cpp index 798aba5dfc1..8d075fe131b 100644 --- a/Core/src/Vertexing/FsmwMode1dFinder.cpp +++ b/Core/src/Vertexing/FsmwMode1dFinder.cpp @@ -28,10 +28,7 @@ Acts::Result Acts::FsmwMode1dFinder::getMode( // first of all order the vector according to the double value - std::ranges::sort(inputVector, [](std::pair a, - std::pair b) { - return a.first < b.first; - }); + std::ranges::sort(inputVector, {}, [](const auto& i) { return i.first; }); // begin to consider a certain number of elements according to the fraction auto begin = inputVector.begin(); diff --git a/Examples/Algorithms/HepMC/src/HepMCProcessExtractor.cpp b/Examples/Algorithms/HepMC/src/HepMCProcessExtractor.cpp index 01666daec9a..628f87f4c69 100644 --- a/Examples/Algorithms/HepMC/src/HepMCProcessExtractor.cpp +++ b/Examples/Algorithms/HepMC/src/HepMCProcessExtractor.cpp @@ -168,11 +168,8 @@ void filterAndSort( // Sort the particles based on their momentum for (auto& interaction : interactions) { - std::ranges::sort(interaction.after, - [](const ActsExamples::SimParticle& a, - const ActsExamples::SimParticle& b) { - return a.absoluteMomentum() > b.absoluteMomentum(); - }); + std::ranges::sort(interaction.after, {}, + [](const auto& a) { return a.absoluteMomentum(); }); } } } // namespace diff --git a/Examples/Algorithms/TrackFindingExaTrkX/src/PrototracksToParameters.cpp b/Examples/Algorithms/TrackFindingExaTrkX/src/PrototracksToParameters.cpp index e6565c782e7..ce45d49b31f 100644 --- a/Examples/Algorithms/TrackFindingExaTrkX/src/PrototracksToParameters.cpp +++ b/Examples/Algorithms/TrackFindingExaTrkX/src/PrototracksToParameters.cpp @@ -21,6 +21,7 @@ #include "ActsExamples/Framework/WhiteBoard.hpp" #include "ActsExamples/Utilities/EventDataTransforms.hpp" +#include #include using namespace ActsExamples; @@ -96,11 +97,8 @@ ProcessCode PrototracksToParameters::execute( // layer-volume spacepoints has 3 or more hits. However, if this is the // case, we want to keep the whole prototrack. Therefore, we operate on a // tmpTrack. - std::ranges::sort(track, [&](auto a, auto b) { - if (indexToGeoId[a].volume() != indexToGeoId[b].volume()) { - return indexToGeoId[a].volume() < indexToGeoId[b].volume(); - } - return indexToGeoId[a].layer() < indexToGeoId[b].layer(); + std::ranges::sort(track, {}, [&](const auto &t) { + return std::tie(indexToGeoId[t].volume(), indexToGeoId[t].layer()); }); tmpTrack.clear(); @@ -134,8 +132,7 @@ ProcessCode PrototracksToParameters::execute( continue; } - std::ranges::sort( - tmpSps, [](const auto &a, const auto &b) { return a->r() < b->r(); }); + std::ranges::sort(tmpSps, {}, [](const auto &t) { return t->r(); }); // Simply use r = m*z + t and solve for r=0 to find z vertex position... // Probably not the textbook way to do diff --git a/Examples/Algorithms/TrackFindingExaTrkX/src/TruthGraphBuilder.cpp b/Examples/Algorithms/TrackFindingExaTrkX/src/TruthGraphBuilder.cpp index 78c31a7e058..9dc0d407862 100644 --- a/Examples/Algorithms/TrackFindingExaTrkX/src/TruthGraphBuilder.cpp +++ b/Examples/Algorithms/TrackFindingExaTrkX/src/TruthGraphBuilder.cpp @@ -84,9 +84,8 @@ std::vector TruthGraphBuilder::buildFromMeasurements( }; // Sort by radius (this breaks down if the particle has to low momentum) - std::ranges::sort(track, [&](const auto& a, const auto& b) { - return radiusForOrdering(a) < radiusForOrdering(b); - }); + std::ranges::sort(track, {}, + [](const auto& t) { return radiusForOrdering(t); }); if (m_cfg.uniqueModules) { auto newEnd = std::unique( @@ -150,9 +149,7 @@ std::vector TruthGraphBuilder::buildFromSimhits( for (auto& [pid, track] : tracks) { // Sort by hit index, so the edges are connected correctly - std::ranges::sort(track, [](const auto& a, const auto& b) { - return a.hitIndex < b.hitIndex; - }); + std::ranges::sort(track, {}, [](const auto& t) { return t.hitIndex; }); auto found = particles.find(pid); if (found == particles.end()) { diff --git a/Examples/Algorithms/TruthTracking/ActsExamples/TruthTracking/TruthSeedingAlgorithm.cpp b/Examples/Algorithms/TruthTracking/ActsExamples/TruthTracking/TruthSeedingAlgorithm.cpp index 975349af446..5a79534d141 100644 --- a/Examples/Algorithms/TruthTracking/ActsExamples/TruthTracking/TruthSeedingAlgorithm.cpp +++ b/Examples/Algorithms/TruthTracking/ActsExamples/TruthTracking/TruthSeedingAlgorithm.cpp @@ -151,9 +151,8 @@ ActsExamples::ProcessCode ActsExamples::TruthSeedingAlgorithm::execute( continue; } // Sort the space points - std::ranges::sort(spacePointsOnTrack, [](const SimSpacePoint* lhs, - const SimSpacePoint* rhs) { - return std::hypot(lhs->r(), lhs->z()) < std::hypot(rhs->r(), rhs->z()); + std::ranges::sort(spacePointsOnTrack, {}, [](const SimSpacePoint* s) { + return std::hypot(s->r(), s->z()); }); // Loop over the found space points to find the seed with maximum deltaR diff --git a/Examples/Algorithms/Vertexing/src/AdaptiveMultiVertexFinderAlgorithm.cpp b/Examples/Algorithms/Vertexing/src/AdaptiveMultiVertexFinderAlgorithm.cpp index 54c96d57258..c4a471669d6 100644 --- a/Examples/Algorithms/Vertexing/src/AdaptiveMultiVertexFinderAlgorithm.cpp +++ b/Examples/Algorithms/Vertexing/src/AdaptiveMultiVertexFinderAlgorithm.cpp @@ -257,10 +257,9 @@ ProcessCode AdaptiveMultiVertexFinderAlgorithm::execute( } // sort by number of particles - std::ranges::sort(vertexSeederState.truthVertices, - [&vertexParticleCount](const auto& lhs, const auto& rhs) { - return vertexParticleCount[lhs.vertexId()] > - vertexParticleCount[rhs.vertexId()]; + std::ranges::sort(vertexSeederState.truthVertices, {}, + [&vertexParticleCount](const auto& v) { + return vertexParticleCount[v.vertexId()]; }); ACTS_INFO("Got " << truthVertices.size() << " truth vertices and selected " diff --git a/Examples/Detectors/MuonSpectrometerMockupDetector/src/MockupSectorBuilder.cpp b/Examples/Detectors/MuonSpectrometerMockupDetector/src/MockupSectorBuilder.cpp index 17ede59023d..7b3323fe7af 100644 --- a/Examples/Detectors/MuonSpectrometerMockupDetector/src/MockupSectorBuilder.cpp +++ b/Examples/Detectors/MuonSpectrometerMockupDetector/src/MockupSectorBuilder.cpp @@ -167,9 +167,8 @@ ActsExamples::MockupSectorBuilder::buildSector( // sort the detector volumes by their radial distance (from // innermost---->outermost) - std::ranges::sort(detVolumes, [](const auto& detVol1, const auto& detVol2) { - return detVol1->center().y() < detVol2->center().y(); - }); + std::ranges::sort(detVolumes, {}, + [](const auto& detVol) { return detVol->center().y(); }); auto xA = detVolumes.back()->center().x() + detVolumes.back()->volumeBounds().values()[0]; diff --git a/Examples/Framework/src/Framework/Sequencer.cpp b/Examples/Framework/src/Framework/Sequencer.cpp index 5afde17c0d7..db5b856d4be 100644 --- a/Examples/Framework/src/Framework/Sequencer.cpp +++ b/Examples/Framework/src/Framework/Sequencer.cpp @@ -622,9 +622,7 @@ void Sequencer::fpeReport() const { std::transform(merged.stackTraces().begin(), merged.stackTraces().end(), std::back_inserter(sorted), [](const auto& f) -> const auto& { return f; }); - std::ranges::sort(sorted, [](const auto& a, const auto& b) { - return a.get().count > b.get().count; - }); + std::ranges::sort(sorted, {}, [](const auto& s) { return s.get().count; }); std::vector> remaining; diff --git a/Examples/Framework/src/Framework/WhiteBoard.cpp b/Examples/Framework/src/Framework/WhiteBoard.cpp index e0a633c9819..a71ac23e7b0 100644 --- a/Examples/Framework/src/Framework/WhiteBoard.cpp +++ b/Examples/Framework/src/Framework/WhiteBoard.cpp @@ -68,8 +68,7 @@ std::vector ActsExamples::WhiteBoard::similarNames( } } - std::ranges::sort( - names, [&](const auto &a, const auto &b) { return a.first < b.first; }); + std::ranges::sort(names, {}, [](const auto &n) { return n.first; }); std::vector selected_names; for (std::size_t i = 0; i < std::min(names.size(), maxNumber); ++i) { diff --git a/Examples/Framework/src/Utilities/EventDataTransforms.cpp b/Examples/Framework/src/Utilities/EventDataTransforms.cpp index 55c3d4b66ec..ab94a4a61a1 100644 --- a/Examples/Framework/src/Utilities/EventDataTransforms.cpp +++ b/Examples/Framework/src/Utilities/EventDataTransforms.cpp @@ -69,8 +69,7 @@ ActsExamples::SimSeed ActsExamples::prototrackToSeed( std::transform(track.begin(), track.end(), std::back_inserter(ps), findSpacePoint); - std::ranges::sort( - ps, [](const auto& a, const auto& b) { return a->r() < b->r(); }); + std::ranges::sort(ps, {}, [](const auto& p) { return p->r(); }); // Simply use r = m*z + t and solve for r=0 to find z vertex position... // Probably not the textbook way to do diff --git a/Examples/Framework/src/Validation/TrackClassification.cpp b/Examples/Framework/src/Validation/TrackClassification.cpp index 29d4edbebbc..8102f0bc9c9 100644 --- a/Examples/Framework/src/Validation/TrackClassification.cpp +++ b/Examples/Framework/src/Validation/TrackClassification.cpp @@ -40,11 +40,8 @@ inline void increaseHitCount( /// Sort hit counts by decreasing values, i.e. majority particle comes first. inline void sortHitCount( std::vector& particleHitCounts) { - std::ranges::sort(particleHitCounts, - [](const ActsExamples::ParticleHitCount& lhs, - const ActsExamples::ParticleHitCount& rhs) { - return (lhs.hitCount > rhs.hitCount); - }); + std::ranges::sort(particleHitCounts, {}, + [](const auto& p) { return p.hitCount; }); } } // namespace diff --git a/Examples/Io/Csv/src/CsvTrackWriter.cpp b/Examples/Io/Csv/src/CsvTrackWriter.cpp index c0c25dfe51a..5ac430f4b7a 100644 --- a/Examples/Io/Csv/src/CsvTrackWriter.cpp +++ b/Examples/Io/Csv/src/CsvTrackWriter.cpp @@ -1,6 +1,6 @@ // This file is part of the Acts project. // -// Copyright (C) 2021-2024 CERN for the benefit of the Acts project +// Copyright (C) 2021 CERN for the benefit of the Acts project // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this @@ -159,19 +159,19 @@ ProcessCode CsvTrackWriter::writeT(const AlgorithmContext& context, // Find duplicates std::unordered_set listGoodTracks; for (auto& [particleId, matchedTracks] : matched) { - std::ranges::sort( - matchedTracks, [](const RecoTrackInfo& lhs, const RecoTrackInfo& rhs) { - // sort by nMajorityHits - if (lhs.first.nMajorityHits != rhs.first.nMajorityHits) { - return (lhs.first.nMajorityHits > rhs.first.nMajorityHits); - } - // sort by nOutliers - if (lhs.first.nOutliers != rhs.first.nOutliers) { - return (lhs.first.nOutliers < rhs.first.nOutliers); - } - // sort by chi2 - return (lhs.first.chi2Sum < rhs.first.chi2Sum); - }); + std::sort(matchedTracks.begin(), matchedTracks.end(), + [](const RecoTrackInfo& lhs, const RecoTrackInfo& rhs) { + // sort by nMajorityHits + if (lhs.first.nMajorityHits != rhs.first.nMajorityHits) { + return (lhs.first.nMajorityHits > rhs.first.nMajorityHits); + } + // sort by nOutliers + if (lhs.first.nOutliers != rhs.first.nOutliers) { + return (lhs.first.nOutliers < rhs.first.nOutliers); + } + // sort by chi2 + return (lhs.first.chi2Sum < rhs.first.chi2Sum); + }); listGoodTracks.insert(matchedTracks.front().first.trackId); } diff --git a/Examples/Io/EDM4hep/src/EDM4hepReader.cpp b/Examples/Io/EDM4hep/src/EDM4hepReader.cpp index 885248c49c0..5409d67e233 100644 --- a/Examples/Io/EDM4hep/src/EDM4hepReader.cpp +++ b/Examples/Io/EDM4hep/src/EDM4hepReader.cpp @@ -396,8 +396,8 @@ ProcessCode EDM4hepReader::read(const AlgorithmContext& ctx) { } } - std::ranges::sort(hitIndices, [&](std::size_t a, std::size_t b) { - return simHits.nth(a)->time() < simHits.nth(b)->time(); + std::ranges::sort(hitIndices, {}, [&simHits](std::size_t h) { + return simHits.nth(h)->time(); }); for (std::size_t i = 0; i < hitIndices.size(); ++i) { diff --git a/Examples/Io/Root/src/RootSimHitReader.cpp b/Examples/Io/Root/src/RootSimHitReader.cpp index 33db881483c..65fcb446f0e 100644 --- a/Examples/Io/Root/src/RootSimHitReader.cpp +++ b/Examples/Io/Root/src/RootSimHitReader.cpp @@ -94,9 +94,8 @@ RootSimHitReader::RootSimHitReader(const RootSimHitReader::Config& config, std::get<2>(m_eventMap.back()) = nEntries; // Sort by event id - std::ranges::sort(m_eventMap, [](const auto& a, const auto& b) { - return std::get<0>(a) < std::get<0>(b); - }); + std::ranges::sort(m_eventMap, {}, + [](const auto& m) { return std::get<0>(m); }); // Re-Enable all branches m_inputChain->SetBranchStatus("*", true); diff --git a/Examples/Scripts/TrackingPerformance/defineReconstructionPerformance.C b/Examples/Scripts/TrackingPerformance/defineReconstructionPerformance.C index 78387955785..e510b013b7f 100644 --- a/Examples/Scripts/TrackingPerformance/defineReconstructionPerformance.C +++ b/Examples/Scripts/TrackingPerformance/defineReconstructionPerformance.C @@ -190,19 +190,9 @@ void defineReconstructionPerformance( for (auto& [id, matchedTracks] : matchedParticles) { // Sort all tracks matched to this particle according to majority prob // and track quality - std::ranges::sort(matchedTracks, - [](const RecoTrackInfo& lhs, const RecoTrackInfo& rhs) { - if (lhs.nMajorityHits > rhs.nMajorityHits) { - return true; - } - if (lhs.nMajorityHits < rhs.nMajorityHits) { - return false; - } - if (lhs.nMeasurements > rhs.nMeasurements) { - return true; - } - return false; - }); + std::ranges::sort(matchedTracks, {}, [](const auto& m) { + return std::tie(m.nMajorityHits, m.nMeasurements); + }); // Fill the duplication rate plots for (std::size_t k = 0; k < matchedTracks.size(); ++k) { auto eta = matchedTracks[k].eta; diff --git a/Plugins/GeoModel/src/detail/GeoIntersectionAnnulusConverter.cpp b/Plugins/GeoModel/src/detail/GeoIntersectionAnnulusConverter.cpp index cbf06328dcf..2062ae152b4 100644 --- a/Plugins/GeoModel/src/detail/GeoIntersectionAnnulusConverter.cpp +++ b/Plugins/GeoModel/src/detail/GeoIntersectionAnnulusConverter.cpp @@ -58,8 +58,8 @@ Acts::detail::GeoIntersectionAnnulusConverter::operator()( std::vector faceVertices(trapVertices.begin(), trapVertices.begin() + 4u); // to make sure they are in the right order - std::ranges::sort(faceVertices, [](const auto& a, const auto& b) { - return (VectorHelpers::phi(a) > VectorHelpers::phi(b)); + std::ranges::sort(faceVertices, {}, [](const auto& f) { + return (VectorHelpers::phi(f)); }); // Turn them into global diff --git a/Plugins/GeoModel/src/detail/GeoPolygonConverter.cpp b/Plugins/GeoModel/src/detail/GeoPolygonConverter.cpp index 3f5e1404295..6e60770f6e4 100644 --- a/Plugins/GeoModel/src/detail/GeoPolygonConverter.cpp +++ b/Plugins/GeoModel/src/detail/GeoPolygonConverter.cpp @@ -45,10 +45,7 @@ Acts::detail::GeoPolygonConverter::operator()( vertices.push_back({polygon.getXVertex(i), polygon.getYVertex(i)}); } // sort based on the y-coordinate - std::ranges::sort( - vertices, [](const std::vector& a, const std::vector& b) { - return a[1] < b[1]; - }); + std::ranges::sort(vertices, {}, [](const auto& v) { return v[1]; }); if (nVertices == 4) { double hlxnegy = fabs(vertices[0][0] - vertices[1][0]) / 2; double hlxposy = fabs(vertices[2][0] - vertices[3][0]) / 2; diff --git a/Tests/IntegrationTests/Fatras/FatrasSimulationTests.cpp b/Tests/IntegrationTests/Fatras/FatrasSimulationTests.cpp index 97703092e8f..ee84a5ce820 100644 --- a/Tests/IntegrationTests/Fatras/FatrasSimulationTests.cpp +++ b/Tests/IntegrationTests/Fatras/FatrasSimulationTests.cpp @@ -123,9 +123,8 @@ const auto dataset = // helper functions for tests template void sortByParticleId(Container& container) { - std::ranges::sort(container, [](const auto& lhs, const auto& rhs) { - return lhs.particleId() < rhs.particleId(); - }); + std::ranges::sort(container, {}, + [](const auto& c) { return c.particleId(); }); } template bool areParticleIdsUnique(const Container& sortedByParticleId) { diff --git a/Tests/UnitTests/Core/TrackFitting/GsfMixtureReductionTests.cpp b/Tests/UnitTests/Core/TrackFitting/GsfMixtureReductionTests.cpp index 9cda5545aa9..064874a1b75 100644 --- a/Tests/UnitTests/Core/TrackFitting/GsfMixtureReductionTests.cpp +++ b/Tests/UnitTests/Core/TrackFitting/GsfMixtureReductionTests.cpp @@ -146,9 +146,8 @@ BOOST_AUTO_TEST_CASE(test_mixture_reduction) { BOOST_CHECK_EQUAL(cmps.size(), 2); - std::ranges::sort(cmps, [](const auto &a, const auto &b) { - return a.boundPars[eBoundQOverP] < b.boundPars[eBoundQOverP]; - }); + std::ranges::sort(cmps, {}, + [](const auto &c) { return c.boundPars[eBoundQOverP]; }); BOOST_CHECK_CLOSE(cmps[0].boundPars[eBoundQOverP], 1.0_GeV, 1.e-8); BOOST_CHECK_CLOSE(cmps[1].boundPars[eBoundQOverP], 4.0_GeV, 1.e-8); @@ -182,8 +181,7 @@ BOOST_AUTO_TEST_CASE(test_weight_cut_reduction) { Acts::reduceMixtureLargestWeights(cmps, 2, *dummy); BOOST_CHECK_EQUAL(cmps.size(), 2); - std::ranges::sort( - cmps, [](const auto &a, const auto &b) { return a.weight < b.weight; }); + std::ranges::sort(cmps, {}, [](const auto &c) { return c.weight; }); BOOST_CHECK_EQUAL(cmps[0].weight, 3.0); BOOST_CHECK_EQUAL(cmps[1].weight, 4.0); From 16828c06e8b9f44d23d346d2a014a729cb0825c1 Mon Sep 17 00:00:00 2001 From: AJPfleger Date: Sun, 8 Sep 2024 18:24:10 +0200 Subject: [PATCH 23/32] missed things --- Core/include/Acts/Navigation/MultiLayerNavigation.hpp | 4 ++-- .../include/Acts/Seeding/detail/CylindricalSpacePointGrid.ipp | 3 +-- Core/src/TrackFitting/GsfMixtureReduction.cpp | 3 +-- .../TrackFindingExaTrkX/src/PrototracksToParameters.cpp | 2 +- 4 files changed, 5 insertions(+), 7 deletions(-) diff --git a/Core/include/Acts/Navigation/MultiLayerNavigation.hpp b/Core/include/Acts/Navigation/MultiLayerNavigation.hpp index 8ce76972878..71211f2cd34 100644 --- a/Core/include/Acts/Navigation/MultiLayerNavigation.hpp +++ b/Core/include/Acts/Navigation/MultiLayerNavigation.hpp @@ -108,8 +108,8 @@ class MultiLayerNavigation : public IInternalNavigation { std::vector& surfaces) const { // sorting the surfaces according to their radial distance std::ranges::sort(surfaces, {}, [&gctx](const auto& s) { - const auto& c = s->center(gctx); - return std::tie(c.x(), c.y(), c.z()); + return std::tie(s->center(gctx).x(), s->center(gctx).y(), + s->center(gctx).z()); }); // Remove the duplicates diff --git a/Core/include/Acts/Seeding/detail/CylindricalSpacePointGrid.ipp b/Core/include/Acts/Seeding/detail/CylindricalSpacePointGrid.ipp index bad3fc4c285..19d7beddbf7 100644 --- a/Core/include/Acts/Seeding/detail/CylindricalSpacePointGrid.ipp +++ b/Core/include/Acts/Seeding/detail/CylindricalSpacePointGrid.ipp @@ -236,7 +236,6 @@ void Acts::CylindricalSpacePointGridCreator::fillGrid( /// sort SPs in R for each filled bin for (std::size_t binIndex : rBinsIndex) { auto& rbin = grid.atPosition(binIndex); - std::ranges::sort(rbin, {}, - [](const auto& rb) -> bool { return rb->radius(); }); + std::ranges::sort(rbin, {}, [](const auto& rb) { return rb->radius(); }); } } diff --git a/Core/src/TrackFitting/GsfMixtureReduction.cpp b/Core/src/TrackFitting/GsfMixtureReduction.cpp index d0d5b2dfd79..d66f9076270 100644 --- a/Core/src/TrackFitting/GsfMixtureReduction.cpp +++ b/Core/src/TrackFitting/GsfMixtureReduction.cpp @@ -37,8 +37,7 @@ void reduceWithKLDistanceImpl(std::vector &cmpCache, } // Remove all components which are labeled with weight -1 - std::ranges::sort(cmpCache, {}, - [&](const auto &c) { return proj(c).weight; }); + std::ranges::sort(cmpCache, {}, [](const auto &c) { return proj(c).weight; }); cmpCache.erase( std::remove_if(cmpCache.begin(), cmpCache.end(), [&](const auto &a) { return proj(a).weight == -1.0; }), diff --git a/Examples/Algorithms/TrackFindingExaTrkX/src/PrototracksToParameters.cpp b/Examples/Algorithms/TrackFindingExaTrkX/src/PrototracksToParameters.cpp index ce45d49b31f..b1dc6606dc3 100644 --- a/Examples/Algorithms/TrackFindingExaTrkX/src/PrototracksToParameters.cpp +++ b/Examples/Algorithms/TrackFindingExaTrkX/src/PrototracksToParameters.cpp @@ -21,8 +21,8 @@ #include "ActsExamples/Framework/WhiteBoard.hpp" #include "ActsExamples/Utilities/EventDataTransforms.hpp" -#include #include +#include using namespace ActsExamples; using namespace Acts::UnitLiterals; From b217434fbbac6d5402b00913e89ef516981a649d Mon Sep 17 00:00:00 2001 From: AJPfleger Date: Sun, 8 Sep 2024 18:41:11 +0200 Subject: [PATCH 24/32] fix uninitilised and tie nMajorityHits --- .../Acts/Navigation/MultiLayerNavigation.hpp | 7 ++++-- Core/src/TrackFitting/GsfMixtureReduction.cpp | 3 ++- Examples/Io/Csv/src/CsvTrackWriter.cpp | 22 ++++++++----------- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Core/include/Acts/Navigation/MultiLayerNavigation.hpp b/Core/include/Acts/Navigation/MultiLayerNavigation.hpp index 71211f2cd34..b283f049587 100644 --- a/Core/include/Acts/Navigation/MultiLayerNavigation.hpp +++ b/Core/include/Acts/Navigation/MultiLayerNavigation.hpp @@ -108,8 +108,11 @@ class MultiLayerNavigation : public IInternalNavigation { std::vector& surfaces) const { // sorting the surfaces according to their radial distance std::ranges::sort(surfaces, {}, [&gctx](const auto& s) { - return std::tie(s->center(gctx).x(), s->center(gctx).y(), - s->center(gctx).z()); + // copy to prevent problem with uninitialised variables + auto centerX = s->center(gctx).x(); + auto centerY = s->center(gctx).y(); + auto centerZ = s->center(gctx).z(); + return std::tie(centerX, centerY, centerZ); }); // Remove the duplicates diff --git a/Core/src/TrackFitting/GsfMixtureReduction.cpp b/Core/src/TrackFitting/GsfMixtureReduction.cpp index d66f9076270..d0d5b2dfd79 100644 --- a/Core/src/TrackFitting/GsfMixtureReduction.cpp +++ b/Core/src/TrackFitting/GsfMixtureReduction.cpp @@ -37,7 +37,8 @@ void reduceWithKLDistanceImpl(std::vector &cmpCache, } // Remove all components which are labeled with weight -1 - std::ranges::sort(cmpCache, {}, [](const auto &c) { return proj(c).weight; }); + std::ranges::sort(cmpCache, {}, + [&](const auto &c) { return proj(c).weight; }); cmpCache.erase( std::remove_if(cmpCache.begin(), cmpCache.end(), [&](const auto &a) { return proj(a).weight == -1.0; }), diff --git a/Examples/Io/Csv/src/CsvTrackWriter.cpp b/Examples/Io/Csv/src/CsvTrackWriter.cpp index 5ac430f4b7a..f51e50c4d90 100644 --- a/Examples/Io/Csv/src/CsvTrackWriter.cpp +++ b/Examples/Io/Csv/src/CsvTrackWriter.cpp @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -159,19 +160,14 @@ ProcessCode CsvTrackWriter::writeT(const AlgorithmContext& context, // Find duplicates std::unordered_set listGoodTracks; for (auto& [particleId, matchedTracks] : matched) { - std::sort(matchedTracks.begin(), matchedTracks.end(), - [](const RecoTrackInfo& lhs, const RecoTrackInfo& rhs) { - // sort by nMajorityHits - if (lhs.first.nMajorityHits != rhs.first.nMajorityHits) { - return (lhs.first.nMajorityHits > rhs.first.nMajorityHits); - } - // sort by nOutliers - if (lhs.first.nOutliers != rhs.first.nOutliers) { - return (lhs.first.nOutliers < rhs.first.nOutliers); - } - // sort by chi2 - return (lhs.first.chi2Sum < rhs.first.chi2Sum); - }); + std::ranges::sort( + matchedTracks, [](const RecoTrackInfo& lhs, const RecoTrackInfo& rhs) { + // nMajorityHits are sorted descending, others ascending + return std::tie(rhs.first.nMajorityHits, lhs.first.nOutliers, + lhs.first.chi2Sum) < std::tie(lhs.first.nMajorityHits, + rhs.first.nOutliers, + rhs.first.chi2Sum); + }); listGoodTracks.insert(matchedTracks.front().first.trackId); } From bafc568e0afc74290d68c8415b7514a30ff3b388 Mon Sep 17 00:00:00 2001 From: AJPfleger Date: Sun, 8 Sep 2024 20:55:03 +0200 Subject: [PATCH 25/32] trying to assert --- Core/include/Acts/Navigation/MultiLayerNavigation.hpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/Core/include/Acts/Navigation/MultiLayerNavigation.hpp b/Core/include/Acts/Navigation/MultiLayerNavigation.hpp index b283f049587..bc8f0e36d89 100644 --- a/Core/include/Acts/Navigation/MultiLayerNavigation.hpp +++ b/Core/include/Acts/Navigation/MultiLayerNavigation.hpp @@ -108,11 +108,9 @@ class MultiLayerNavigation : public IInternalNavigation { std::vector& surfaces) const { // sorting the surfaces according to their radial distance std::ranges::sort(surfaces, {}, [&gctx](const auto& s) { - // copy to prevent problem with uninitialised variables - auto centerX = s->center(gctx).x(); - auto centerY = s->center(gctx).y(); - auto centerZ = s->center(gctx).z(); - return std::tie(centerX, centerY, centerZ); + assert(surface != nullptr && "Uninitialized surface"); + const auto& center = s->center(gctx); + return std::tie(center.x(), center.y(), center.z()); }); // Remove the duplicates From 561a879d255da98cfb0c3e5d2a23359c54537de1 Mon Sep 17 00:00:00 2001 From: AJPfleger Date: Sun, 8 Sep 2024 21:02:33 +0200 Subject: [PATCH 26/32] typo --- Core/include/Acts/Navigation/MultiLayerNavigation.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/include/Acts/Navigation/MultiLayerNavigation.hpp b/Core/include/Acts/Navigation/MultiLayerNavigation.hpp index bc8f0e36d89..5ae3053c988 100644 --- a/Core/include/Acts/Navigation/MultiLayerNavigation.hpp +++ b/Core/include/Acts/Navigation/MultiLayerNavigation.hpp @@ -108,7 +108,7 @@ class MultiLayerNavigation : public IInternalNavigation { std::vector& surfaces) const { // sorting the surfaces according to their radial distance std::ranges::sort(surfaces, {}, [&gctx](const auto& s) { - assert(surface != nullptr && "Uninitialized surface"); + assert(s != nullptr && "Uninitialized surface"); const auto& center = s->center(gctx); return std::tie(center.x(), center.y(), center.z()); }); From fab156c370c720590862503804d75d6715f94a96 Mon Sep 17 00:00:00 2001 From: AJPfleger Date: Sun, 8 Sep 2024 21:32:19 +0200 Subject: [PATCH 27/32] fix fatras? --- Tests/IntegrationTests/Fatras/FatrasSimulationTests.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/IntegrationTests/Fatras/FatrasSimulationTests.cpp b/Tests/IntegrationTests/Fatras/FatrasSimulationTests.cpp index ee84a5ce820..69dc85d9fd7 100644 --- a/Tests/IntegrationTests/Fatras/FatrasSimulationTests.cpp +++ b/Tests/IntegrationTests/Fatras/FatrasSimulationTests.cpp @@ -123,7 +123,7 @@ const auto dataset = // helper functions for tests template void sortByParticleId(Container& container) { - std::ranges::sort(container, {}, + std::ranges::sort(container, std::less{}, [](const auto& c) { return c.particleId(); }); } template From 0dd865895d771f053ce6089707229345e2374e60 Mon Sep 17 00:00:00 2001 From: AJPfleger Date: Sun, 8 Sep 2024 21:50:36 +0200 Subject: [PATCH 28/32] descending sorting --- Core/include/Acts/Seeding/HoughTransformUtils.ipp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/include/Acts/Seeding/HoughTransformUtils.ipp b/Core/include/Acts/Seeding/HoughTransformUtils.ipp index bf4d839a8b6..b0bfc4511e4 100644 --- a/Core/include/Acts/Seeding/HoughTransformUtils.ipp +++ b/Core/include/Acts/Seeding/HoughTransformUtils.ipp @@ -264,7 +264,7 @@ Acts::HoughTransformUtils::PeakFinders::IslandsAroundMax< } } // sort the candidate cells descending in content - std::ranges::sort(candidates, {}, [&yieldMap](const auto c) { + std::ranges::sort(candidates, std::greater{}, [&yieldMap](const auto c) { return std::tie(yieldMap[c], c); }); From 49fb1a9bb5a148ab7e431eb82f63f96d18c38626 Mon Sep 17 00:00:00 2001 From: AJPfleger Date: Sun, 8 Sep 2024 22:08:36 +0200 Subject: [PATCH 29/32] hough - type? --- Core/include/Acts/Seeding/HoughTransformUtils.ipp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/include/Acts/Seeding/HoughTransformUtils.ipp b/Core/include/Acts/Seeding/HoughTransformUtils.ipp index b0bfc4511e4..d26607d37ea 100644 --- a/Core/include/Acts/Seeding/HoughTransformUtils.ipp +++ b/Core/include/Acts/Seeding/HoughTransformUtils.ipp @@ -264,7 +264,7 @@ Acts::HoughTransformUtils::PeakFinders::IslandsAroundMax< } } // sort the candidate cells descending in content - std::ranges::sort(candidates, std::greater{}, [&yieldMap](const auto c) { + std::ranges::sort(candidates, std::greater{}, [&yieldMap](std::size_t c) { return std::tie(yieldMap[c], c); }); From f76834253a94a5b43eb0f03ec2c276509c375c18 Mon Sep 17 00:00:00 2001 From: AJPfleger Date: Sun, 8 Sep 2024 22:19:10 +0200 Subject: [PATCH 30/32] hough - projector? --- Core/include/Acts/Seeding/HoughTransformUtils.ipp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Core/include/Acts/Seeding/HoughTransformUtils.ipp b/Core/include/Acts/Seeding/HoughTransformUtils.ipp index d26607d37ea..c0bfb8e3013 100644 --- a/Core/include/Acts/Seeding/HoughTransformUtils.ipp +++ b/Core/include/Acts/Seeding/HoughTransformUtils.ipp @@ -264,9 +264,10 @@ Acts::HoughTransformUtils::PeakFinders::IslandsAroundMax< } } // sort the candidate cells descending in content - std::ranges::sort(candidates, std::greater{}, [&yieldMap](std::size_t c) { - return std::tie(yieldMap[c], c); - }); + std::ranges::sort( + candidates, [&yieldMap](std::size_t bin1, std::size_t bin2) { + return std::tie(yieldMap[bin1], bin1) > std::tie(yieldMap[bin2], bin2); + }); // now we build islands from the candidate cells, starting with the most // populated one From 8b937bd86260585567c1c6ebe11d2ca43fae6a2f Mon Sep 17 00:00:00 2001 From: AJPfleger Date: Sun, 8 Sep 2024 22:49:54 +0200 Subject: [PATCH 31/32] fix tie and exatrakx? --- Core/include/Acts/Seeding/HoughTransformUtils.ipp | 7 +++---- .../TrackFindingExaTrkX/src/PrototracksToParameters.cpp | 2 +- .../TrackFindingExaTrkX/src/TruthGraphBuilder.cpp | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/Core/include/Acts/Seeding/HoughTransformUtils.ipp b/Core/include/Acts/Seeding/HoughTransformUtils.ipp index c0bfb8e3013..7cef8f8db6b 100644 --- a/Core/include/Acts/Seeding/HoughTransformUtils.ipp +++ b/Core/include/Acts/Seeding/HoughTransformUtils.ipp @@ -264,10 +264,9 @@ Acts::HoughTransformUtils::PeakFinders::IslandsAroundMax< } } // sort the candidate cells descending in content - std::ranges::sort( - candidates, [&yieldMap](std::size_t bin1, std::size_t bin2) { - return std::tie(yieldMap[bin1], bin1) > std::tie(yieldMap[bin2], bin2); - }); + std::ranges::sort(candidates, {}, [&yieldMap](std::size_t c) { + return std::make_tuple(yieldMap[c], c); + }); // now we build islands from the candidate cells, starting with the most // populated one diff --git a/Examples/Algorithms/TrackFindingExaTrkX/src/PrototracksToParameters.cpp b/Examples/Algorithms/TrackFindingExaTrkX/src/PrototracksToParameters.cpp index b1dc6606dc3..5904b2dddc7 100644 --- a/Examples/Algorithms/TrackFindingExaTrkX/src/PrototracksToParameters.cpp +++ b/Examples/Algorithms/TrackFindingExaTrkX/src/PrototracksToParameters.cpp @@ -98,7 +98,7 @@ ProcessCode PrototracksToParameters::execute( // case, we want to keep the whole prototrack. Therefore, we operate on a // tmpTrack. std::ranges::sort(track, {}, [&](const auto &t) { - return std::tie(indexToGeoId[t].volume(), indexToGeoId[t].layer()); + return std::make_tuple(indexToGeoId[t].volume(), indexToGeoId[t].layer()); }); tmpTrack.clear(); diff --git a/Examples/Algorithms/TrackFindingExaTrkX/src/TruthGraphBuilder.cpp b/Examples/Algorithms/TrackFindingExaTrkX/src/TruthGraphBuilder.cpp index 9dc0d407862..489bf042ecd 100644 --- a/Examples/Algorithms/TrackFindingExaTrkX/src/TruthGraphBuilder.cpp +++ b/Examples/Algorithms/TrackFindingExaTrkX/src/TruthGraphBuilder.cpp @@ -85,7 +85,7 @@ std::vector TruthGraphBuilder::buildFromMeasurements( // Sort by radius (this breaks down if the particle has to low momentum) std::ranges::sort(track, {}, - [](const auto& t) { return radiusForOrdering(t); }); + [&](const auto& t) { return radiusForOrdering(t); }); if (m_cfg.uniqueModules) { auto newEnd = std::unique( From 5c15c57bb8352bf43dec5350115519cfa6330869 Mon Sep 17 00:00:00 2001 From: AJPfleger Date: Sun, 8 Sep 2024 23:27:48 +0200 Subject: [PATCH 32/32] greater - we might need better testing --- .../Acts/Navigation/MultiLayerNavigation.hpp | 2 +- Core/include/Acts/Seeding/HoughTransformUtils.ipp | 2 +- .../HepMC/src/HepMCProcessExtractor.cpp | 2 +- Examples/Framework/src/Framework/Sequencer.cpp | 3 ++- .../src/Validation/TrackClassification.cpp | 2 +- Examples/Io/Csv/src/CsvTrackWriter.cpp | 15 +++++++-------- .../defineReconstructionPerformance.C | 4 ++-- .../detail/GeoIntersectionAnnulusConverter.cpp | 2 +- 8 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Core/include/Acts/Navigation/MultiLayerNavigation.hpp b/Core/include/Acts/Navigation/MultiLayerNavigation.hpp index 5ae3053c988..12d48e5dcaa 100644 --- a/Core/include/Acts/Navigation/MultiLayerNavigation.hpp +++ b/Core/include/Acts/Navigation/MultiLayerNavigation.hpp @@ -110,7 +110,7 @@ class MultiLayerNavigation : public IInternalNavigation { std::ranges::sort(surfaces, {}, [&gctx](const auto& s) { assert(s != nullptr && "Uninitialized surface"); const auto& center = s->center(gctx); - return std::tie(center.x(), center.y(), center.z()); + return std::make_tuple(center.x(), center.y(), center.z()); }); // Remove the duplicates diff --git a/Core/include/Acts/Seeding/HoughTransformUtils.ipp b/Core/include/Acts/Seeding/HoughTransformUtils.ipp index 7cef8f8db6b..37ebe3ec9d9 100644 --- a/Core/include/Acts/Seeding/HoughTransformUtils.ipp +++ b/Core/include/Acts/Seeding/HoughTransformUtils.ipp @@ -264,7 +264,7 @@ Acts::HoughTransformUtils::PeakFinders::IslandsAroundMax< } } // sort the candidate cells descending in content - std::ranges::sort(candidates, {}, [&yieldMap](std::size_t c) { + std::ranges::sort(candidates, std::greater{}, [&yieldMap](std::size_t c) { return std::make_tuple(yieldMap[c], c); }); diff --git a/Examples/Algorithms/HepMC/src/HepMCProcessExtractor.cpp b/Examples/Algorithms/HepMC/src/HepMCProcessExtractor.cpp index 628f87f4c69..9faa55eecc6 100644 --- a/Examples/Algorithms/HepMC/src/HepMCProcessExtractor.cpp +++ b/Examples/Algorithms/HepMC/src/HepMCProcessExtractor.cpp @@ -168,7 +168,7 @@ void filterAndSort( // Sort the particles based on their momentum for (auto& interaction : interactions) { - std::ranges::sort(interaction.after, {}, + std::ranges::sort(interaction.after, std::greater{}, [](const auto& a) { return a.absoluteMomentum(); }); } } diff --git a/Examples/Framework/src/Framework/Sequencer.cpp b/Examples/Framework/src/Framework/Sequencer.cpp index db5b856d4be..ccd5007e307 100644 --- a/Examples/Framework/src/Framework/Sequencer.cpp +++ b/Examples/Framework/src/Framework/Sequencer.cpp @@ -622,7 +622,8 @@ void Sequencer::fpeReport() const { std::transform(merged.stackTraces().begin(), merged.stackTraces().end(), std::back_inserter(sorted), [](const auto& f) -> const auto& { return f; }); - std::ranges::sort(sorted, {}, [](const auto& s) { return s.get().count; }); + std::ranges::sort(sorted, std::greater{}, + [](const auto& s) { return s.get().count; }); std::vector> remaining; diff --git a/Examples/Framework/src/Validation/TrackClassification.cpp b/Examples/Framework/src/Validation/TrackClassification.cpp index 8102f0bc9c9..5763b41d369 100644 --- a/Examples/Framework/src/Validation/TrackClassification.cpp +++ b/Examples/Framework/src/Validation/TrackClassification.cpp @@ -40,7 +40,7 @@ inline void increaseHitCount( /// Sort hit counts by decreasing values, i.e. majority particle comes first. inline void sortHitCount( std::vector& particleHitCounts) { - std::ranges::sort(particleHitCounts, {}, + std::ranges::sort(particleHitCounts, std::greater{}, [](const auto& p) { return p.hitCount; }); } diff --git a/Examples/Io/Csv/src/CsvTrackWriter.cpp b/Examples/Io/Csv/src/CsvTrackWriter.cpp index f51e50c4d90..a4155e7c029 100644 --- a/Examples/Io/Csv/src/CsvTrackWriter.cpp +++ b/Examples/Io/Csv/src/CsvTrackWriter.cpp @@ -160,14 +160,13 @@ ProcessCode CsvTrackWriter::writeT(const AlgorithmContext& context, // Find duplicates std::unordered_set listGoodTracks; for (auto& [particleId, matchedTracks] : matched) { - std::ranges::sort( - matchedTracks, [](const RecoTrackInfo& lhs, const RecoTrackInfo& rhs) { - // nMajorityHits are sorted descending, others ascending - return std::tie(rhs.first.nMajorityHits, lhs.first.nOutliers, - lhs.first.chi2Sum) < std::tie(lhs.first.nMajorityHits, - rhs.first.nOutliers, - rhs.first.chi2Sum); - }); + std::ranges::sort(matchedTracks, [](const auto& lhs, const auto& rhs) { + const auto& t1 = lhs.first; + const auto& t2 = rhs.first; + // nMajorityHits are sorted descending, others ascending + return std::tie(t2.nMajorityHits, t1.nOutliers, t1.chi2Sum) < + std::tie(t1.nMajorityHits, t2.nOutliers, t2.chi2Sum); + }); listGoodTracks.insert(matchedTracks.front().first.trackId); } diff --git a/Examples/Scripts/TrackingPerformance/defineReconstructionPerformance.C b/Examples/Scripts/TrackingPerformance/defineReconstructionPerformance.C index e510b013b7f..c2c0322b609 100644 --- a/Examples/Scripts/TrackingPerformance/defineReconstructionPerformance.C +++ b/Examples/Scripts/TrackingPerformance/defineReconstructionPerformance.C @@ -190,8 +190,8 @@ void defineReconstructionPerformance( for (auto& [id, matchedTracks] : matchedParticles) { // Sort all tracks matched to this particle according to majority prob // and track quality - std::ranges::sort(matchedTracks, {}, [](const auto& m) { - return std::tie(m.nMajorityHits, m.nMeasurements); + std::ranges::sort(matchedTracks, std::greater{}, [](const auto& m) { + return std::make_tuple(m.nMajorityHits, m.nMeasurements); }); // Fill the duplication rate plots for (std::size_t k = 0; k < matchedTracks.size(); ++k) { diff --git a/Plugins/GeoModel/src/detail/GeoIntersectionAnnulusConverter.cpp b/Plugins/GeoModel/src/detail/GeoIntersectionAnnulusConverter.cpp index 2062ae152b4..4ea9e715120 100644 --- a/Plugins/GeoModel/src/detail/GeoIntersectionAnnulusConverter.cpp +++ b/Plugins/GeoModel/src/detail/GeoIntersectionAnnulusConverter.cpp @@ -58,7 +58,7 @@ Acts::detail::GeoIntersectionAnnulusConverter::operator()( std::vector faceVertices(trapVertices.begin(), trapVertices.begin() + 4u); // to make sure they are in the right order - std::ranges::sort(faceVertices, {}, [](const auto& f) { + std::ranges::sort(faceVertices, std::greater{}, [](const auto& f) { return (VectorHelpers::phi(f)); });