diff --git a/Core/include/Acts/Seeding/PathSeeder.hpp b/Core/include/Acts/Seeding/PathSeeder.hpp index 1d3fd49f66b..d4475c022df 100644 --- a/Core/include/Acts/Seeding/PathSeeder.hpp +++ b/Core/include/Acts/Seeding/PathSeeder.hpp @@ -9,10 +9,13 @@ #pragma once #include "Acts/EventData/SourceLink.hpp" +#include "Acts/EventData/TrackParameters.hpp" +#include "Acts/Seeding/detail/UtilityFunctions.hpp" #include "Acts/Surfaces/Surface.hpp" #include "Acts/Utilities/Delegate.hpp" +#include "Acts/Utilities/GridIterator.hpp" -namespace Acts::Experimental { +namespace Acts { /// @brief Seeding algorigthm that extracts /// the IP parameters and sorts the source links @@ -23,7 +26,7 @@ namespace Acts::Experimental { /// source links -- as follows: First the source links /// are sorted into a user-defined grid. Then, iteration over the source links /// is performed. If a source link is attached to a surface that is -/// in the first tracking layer, as defined by the user, the IP parameters +/// in the reference tracking layer, as defined by the user, the IP parameters /// are estimated and the tracking layers are intersected to construct the /// core of the "Path". The source links in the subsequent layers are then /// added to the seed if they lie within the path width of the core. @@ -39,84 +42,34 @@ namespace Acts::Experimental { /// /// @note Handling of the rotated surfaces has to happen /// in the user-defined delegate functions. - -template class PathSeeder { public: - using GridType = grid_t; - - /// @brief The seed struct - /// - /// The seed struct contains the IP parameters - /// and the source links that are associated with - /// the seed. - struct Seed { - /// The IP momentum magnitude - ActsScalar ipP; - - /// The IP momentum direction - Vector3 ipDir; - - /// The IP vertex position - Vector3 ipVertex; - - /// The source links associated with the seed - std::vector sourceLinks; - - Seed() = delete; - Seed(ActsScalar ipPmag, Vector3 ipPdir, Vector3 ipPos, - std::vector sls) - : ipP(ipPmag), - ipDir(std::move(ipPdir)), - ipVertex(std::move(ipPos)), - sourceLinks(std::move(sls)) {}; - }; - - /// @brief Delegate to provide the relevant grid - /// filled with source links for the given geometry - /// member - /// - /// @arg The geometry identifier to use - /// - /// @return The grid filled with source links - using SourceLinkGridLookup = Delegate; + using PathSeed = + std::pair>; /// @brief Delegate to estimate the IP parameters - /// and the momentum direction at the first tracking layer - /// - /// @arg The geometry context to use - /// @arg The global position of the pivot source link - /// - /// @return Particle charge, the IP momentum magnitude, the IP vertex position, - /// the IP momentum direction, the momentum direction at the - /// first tracking layer - using TrackEstimator = - Delegate( - const GeometryContext&, const Vector3&)>; - - /// @brief Delegate to transform the source link to the - /// appropriate global frame. + /// and the momentum direction at the reference tracking layer /// - /// @arg The geometry context to use - /// @arg The source link to calibrate + /// @arg Geometry context to use + /// @arg Pivot source link /// - /// @return The global position of the source link measurement - using SourceLinkCalibrator = - Delegate; + /// @return Pair of the track parameters at the IP and + /// the reference tracking layer + using TrackEstimator = Delegate< + std::pair( + const GeometryContext&, const SourceLink&)>; /// @brief Delegate to find the intersections for the given pivot /// source link /// /// @arg The geometry context to use - /// @arg The global position of the pivot source link - /// @arg The momentum direction of the pivot source link - /// at the first tracking layer - /// @arg The IP momentum magnitude - /// @arg The particle charge + /// @arg Track parameters at the reference tracking layer + /// + /// @return Vector of pairs of the geometry identifier + /// and the local intersection point using IntersectionLookup = - Delegate>( - const GeometryContext&, const Vector3&, const Vector3&, - const ActsScalar&, const ActsScalar&)>; + Delegate>( + const GeometryContext&, const CurvilinearTrackParameters&)>; /// @brief Delegate to provide the path width around /// the intersection point to pull the source links @@ -133,24 +86,18 @@ class PathSeeder { /// @brief The nested configuration struct struct Config { - /// Binned SourceLink provider - SourceLinkGridLookup sourceLinkGridLookup; /// Parameters estimator TrackEstimator trackEstimator; - /// SourceLink calibrator - SourceLinkCalibrator sourceLinkCalibrator; /// Intersection finder IntersectionLookup intersectionFinder; /// Path width provider PathWidthLookup pathWidthProvider; - /// First layer extent - Extent firstLayerExtent; - /// Direction of the telescope extent - BinningValue orientation = BinningValue::binX; + /// Reference layer IDs + std::vector refLayerIds; }; /// @brief Constructor - PathSeeder(const Config& config) : m_cfg(std::move(config)) {}; + PathSeeder(const Config& config) : m_cfg(config) {}; /// @brief Destructor ~PathSeeder() = default; @@ -159,101 +106,86 @@ class PathSeeder { /// sort the source links into the seeds /// /// @param gctx The geometry context - /// @param sourceLinks The source links to seed + /// @param sourceLinkGridLookup The lookup table for the source links + /// @param seedCollection The collection of seeds to fill /// /// @return The vector of seeds - std::vector getSeeds(const GeometryContext& gctx, - const std::vector& sourceLinks) const { - // Get plane of the telescope - // sensitive surfaces - int bin0 = static_cast(BinningValue::binX); - int bin1 = static_cast(BinningValue::binY); - if (m_cfg.orientation == BinningValue::binX) { - bin0 = static_cast(BinningValue::binY); - bin1 = static_cast(BinningValue::binZ); - } else if (m_cfg.orientation == BinningValue::binY) { - bin0 = static_cast(BinningValue::binX); - bin1 = static_cast(BinningValue::binZ); - } - + template + void findSeeds(const GeometryContext& gctx, + const std::unordered_map& + sourceLinkGridLookup, + container_t& seedCollection) const { // Create the seeds - std::vector seeds; - for (const auto& sl : sourceLinks) { - Vector3 globalPos = m_cfg.sourceLinkCalibrator(gctx, sl); - - // Check if the hit is in the - // first tracking layer - if (!m_cfg.firstLayerExtent.contains(globalPos)) { - continue; - } - - // Get the IP parameters - auto [q, ipP, ipVertex, ipDir, flDir] = - m_cfg.trackEstimator(gctx, globalPos); - - // Intersect with the surfaces - std::vector> intersections = - m_cfg.intersectionFinder(gctx, globalPos, flDir, ipP, q); - - // Continue if no intersections - if (intersections.empty()) { - continue; - } - // Vector to store the source links - std::vector seedSourceLinks; - - // Store the pivot source link - seedSourceLinks.push_back(sl); + for (auto& refGeoId : m_cfg.refLayerIds) { + auto refGrid = sourceLinkGridLookup.at(refGeoId); - // Iterate over the intersections - // and get the source links - // in the subsequent layers - for (auto& [geoId, refPoint] : intersections) { - // Get the path width - auto [pathWidth0, pathWidth1] = m_cfg.pathWidthProvider(gctx, geoId); + for (auto it = refGrid.begin(); it != refGrid.end(); it++) { + std::vector pivotSourceLinks = *it; - // Get the bounds of the path - ActsScalar top0 = refPoint[bin0] + pathWidth0; - ActsScalar bot0 = refPoint[bin0] - pathWidth0; - ActsScalar top1 = refPoint[bin1] + pathWidth1; - ActsScalar bot1 = refPoint[bin1] - pathWidth1; + for (const auto& pivot : pivotSourceLinks) { + // Get the IP parameters + auto [ipParameters, refLayerParameters] = + m_cfg.trackEstimator(gctx, pivot); - // Get the lookup table for the source links - auto grid = m_cfg.sourceLinkGridLookup(geoId); + // Intersect with the surfaces + std::vector> intersections = + m_cfg.intersectionFinder(gctx, refLayerParameters); - // Get the range of bins to search for source links - auto botLeftBin = grid.localBinsFromPosition(Vector2(bot0, bot1)); - auto topRightBin = grid.localBinsFromPosition(Vector2(top0, top1)); - - // Get the source links from the lookup table - // by iterating over the bin ranges - auto currentBin = botLeftBin; - while (currentBin.at(1) <= topRightBin.at(1)) { - while (currentBin.at(0) <= topRightBin.at(0)) { - auto sourceLinksToAdd = grid.atLocalBins(currentBin); + // Continue if no intersections + if (intersections.empty()) { + continue; + } - seedSourceLinks.insert(seedSourceLinks.end(), - sourceLinksToAdd.begin(), - sourceLinksToAdd.end()); - currentBin.at(0)++; + // Iterate over the intersections + // and get the source links + // in the subsequent layers + std::vector seedSourceLinks; + for (auto& [geoId, refPoint] : intersections) { + // Get the path width + auto [pathWidth0, pathWidth1] = + m_cfg.pathWidthProvider(gctx, geoId); + + // Get the bounds of the path + ActsScalar top0 = refPoint[0] + pathWidth0; + ActsScalar bot0 = refPoint[0] - pathWidth0; + ActsScalar top1 = refPoint[1] + pathWidth1; + ActsScalar bot1 = refPoint[1] - pathWidth1; + + // Get the lookup table for the source links + auto grid = sourceLinkGridLookup.at(geoId); + + // Get the range of bins to search for source links + auto botLeftBin = grid.localBinsFromPosition(Vector2(bot0, bot1)); + auto topRightBin = grid.localBinsFromPosition(Vector2(top0, top1)); + + // Get the source links from the lookup table + // by iterating over the bin ranges + auto currentBin = botLeftBin; + while (currentBin.at(1) <= topRightBin.at(1)) { + while (currentBin.at(0) <= topRightBin.at(0)) { + auto sourceLinksToAdd = grid.atLocalBins(currentBin); + + seedSourceLinks.insert(seedSourceLinks.end(), + sourceLinksToAdd.begin(), + sourceLinksToAdd.end()); + + currentBin.at(0)++; + } + currentBin.at(1)++; + currentBin.at(0) = botLeftBin.at(0); + } } - currentBin.at(1)++; - currentBin.at(0) = botLeftBin.at(0); + PathSeed seed = {ipParameters, seedSourceLinks}; + + // Add the seed to the collection + Acts::detail::pushBackOrInsertAtEnd(seedCollection, seed); } } - - // Store the IP parameters and - // add the source links to the seed - Seed seed{ipP, ipDir, ipVertex, seedSourceLinks}; - - // Add the seed to the list - seeds.push_back(seed); } - return seeds; - }; + } private: Config m_cfg; }; -} // namespace Acts::Experimental +} // namespace Acts diff --git a/Core/include/Acts/Seeding/detail/UtilityFunctions.hpp b/Core/include/Acts/Seeding/detail/UtilityFunctions.hpp index 9cc61c4fe3f..b4fa190fa37 100644 --- a/Core/include/Acts/Seeding/detail/UtilityFunctions.hpp +++ b/Core/include/Acts/Seeding/detail/UtilityFunctions.hpp @@ -8,6 +8,8 @@ #pragma once +#include "Acts/EventData/SourceLink.hpp" + #include namespace Acts::detail { @@ -29,6 +31,10 @@ concept isCollectionThatSupportsInsert = coll.insert(std::ranges::end(coll), val); }; +template +concept SourceLinkGrid = + std::same_as>; + // Define some functions template diff --git a/Core/include/Acts/Utilities/BoundingBox.ipp b/Core/include/Acts/Utilities/BoundingBox.ipp index 330353014fa..d989507fa85 100644 --- a/Core/include/Acts/Utilities/BoundingBox.ipp +++ b/Core/include/Acts/Utilities/BoundingBox.ipp @@ -346,8 +346,7 @@ template Acts::AxisAlignedBoundingBox Acts::AxisAlignedBoundingBox::transformed( const transform_type& trf) const { - VertexType vmin, vmax; - std::tie(vmin, vmax) = transformVertices(trf); + const auto [vmin, vmax] = transformVertices(trf); return self_t(m_entity, vmin, vmax); } @@ -463,8 +462,7 @@ box_t* octree_inner(std::vector>& store, std::array, 8> octants; // calc center of boxes - VertexType vmin, vmax; - std::tie(vmin, vmax) = box_t::wrap(lprims); + const auto [vmin, vmax] = box_t::wrap(lprims); VertexType glob_ctr = (vmin + vmax) / 2.; for (auto* box : lprims) { diff --git a/Core/include/Acts/Utilities/GridAxisGenerators.hpp b/Core/include/Acts/Utilities/GridAxisGenerators.hpp index 2ebeb78406f..18e6a1cdd2e 100644 --- a/Core/include/Acts/Utilities/GridAxisGenerators.hpp +++ b/Core/include/Acts/Utilities/GridAxisGenerators.hpp @@ -110,7 +110,7 @@ struct EqEq { nBins0); Acts::Axis bEq(range1[0u], range1[1u], nBins1); - return std::tie(aEq, bEq); + return {aEq, bEq}; } }; @@ -160,7 +160,7 @@ struct EqVar { Acts::Axis eqA(range[0u], range[1u], nBins); Acts::Axis varB(edges); - return std::tie(eqA, varB); + return {eqA, varB}; } }; @@ -210,7 +210,7 @@ struct VarEq { Acts::Axis varA(edges); Acts::Axis eqB(range[0u], range[1u], nBins); - return std::tie(varA, eqB); + return {varA, eqB}; } }; @@ -257,7 +257,7 @@ struct VarVar { return_type operator()() const { Acts::Axis varA(edges0); Acts::Axis varB(edges1); - return std::tie(varA, varB); + return {varA, varB}; } }; diff --git a/Core/include/Acts/Utilities/Helpers.hpp b/Core/include/Acts/Utilities/Helpers.hpp index 2308d2a3014..4bf9d1c89c3 100644 --- a/Core/include/Acts/Utilities/Helpers.hpp +++ b/Core/include/Acts/Utilities/Helpers.hpp @@ -179,7 +179,7 @@ std::tuple range_medium(const T& tseries) { auto [minIt, maxIt] = std::ranges::minmax_element(tseries); typename T::value_type range = (*maxIt - *minIt); ActsScalar medium = static_cast((*maxIt + *minIt) * 0.5); - return std::tie(range, medium); + return {range, medium}; } template diff --git a/Core/include/Acts/Vertexing/detail/KalmanVertexUpdaterImpl.hpp b/Core/include/Acts/Vertexing/detail/KalmanVertexUpdaterImpl.hpp index 4c08820e693..f8f99b98f20 100644 --- a/Core/include/Acts/Vertexing/detail/KalmanVertexUpdaterImpl.hpp +++ b/Core/include/Acts/Vertexing/detail/KalmanVertexUpdaterImpl.hpp @@ -254,9 +254,7 @@ void updateVertexWithTrackImpl(Vertex& vtx, TrackAtVertex& trk, int sign) { calculateUpdate(vtx, trk.linearizedState, trackWeight, sign, cache); // Get fit quality parameters wrt to old vertex - double chi2 = 0.; - double ndf = 0.; - std::tie(chi2, ndf) = vtx.fitQuality(); + auto [chi2, ndf] = vtx.fitQuality(); // Chi2 of the track parameters double trkChi2 = trackParametersChi2(trk.linearizedState, cache); diff --git a/Core/src/Detector/detail/CuboidalDetectorHelper.cpp b/Core/src/Detector/detail/CuboidalDetectorHelper.cpp index 114b8512e7f..ac2acd2482a 100644 --- a/Core/src/Detector/detail/CuboidalDetectorHelper.cpp +++ b/Core/src/Detector/detail/CuboidalDetectorHelper.cpp @@ -373,7 +373,7 @@ Acts::Experimental::detail::CuboidalDetectorHelper::xyzBoundaries( } for (auto [im, map] : enumerate(valueMaps)) { - for (auto [key, value] : map) { + for (auto [key, _] : map) { boundaries[im].push_back(key); } std::ranges::sort(boundaries[im]); diff --git a/Core/src/MagneticField/BFieldMapUtils.cpp b/Core/src/MagneticField/BFieldMapUtils.cpp index 14bc273966b..e7216aa3bf9 100644 --- a/Core/src/MagneticField/BFieldMapUtils.cpp +++ b/Core/src/MagneticField/BFieldMapUtils.cpp @@ -254,12 +254,9 @@ Acts::solenoidFieldMap(std::pair rlim, std::pair zlim, std::pair nbins, const SolenoidBField& field) { - double rMin = 0, rMax = 0, zMin = 0, zMax = 0; - std::tie(rMin, rMax) = rlim; - std::tie(zMin, zMax) = zlim; - - std::size_t nBinsR = 0, nBinsZ = 0; - std::tie(nBinsR, nBinsZ) = nbins; + auto [rMin, rMax] = rlim; + auto [zMin, zMax] = zlim; + const auto [nBinsR, nBinsZ] = nbins; double stepZ = std::abs(zMax - zMin) / (nBinsZ - 1); double stepR = std::abs(rMax - rMin) / (nBinsR - 1); diff --git a/Core/src/Material/BinnedSurfaceMaterialAccumulater.cpp b/Core/src/Material/BinnedSurfaceMaterialAccumulater.cpp index ca2a460d4d2..a4d2366b743 100644 --- a/Core/src/Material/BinnedSurfaceMaterialAccumulater.cpp +++ b/Core/src/Material/BinnedSurfaceMaterialAccumulater.cpp @@ -119,9 +119,9 @@ void Acts::BinnedSurfaceMaterialAccumulater::accumulate( } // After mapping this track, average the touched bins - for (auto tmapBin : touchedMapBins) { - std::vector> trackBins = {tmapBin.second}; - tmapBin.first->trackAverage(trackBins, true); + for (const auto& [key, value] : touchedMapBins) { + std::vector> trackBins = {value}; + key->trackAverage(trackBins, true); } // Empty bin correction diff --git a/Core/src/Material/SurfaceMaterialMapper.cpp b/Core/src/Material/SurfaceMaterialMapper.cpp index 4890354217a..f4ad7ecc6f9 100644 --- a/Core/src/Material/SurfaceMaterialMapper.cpp +++ b/Core/src/Material/SurfaceMaterialMapper.cpp @@ -416,19 +416,19 @@ void Acts::SurfaceMaterialMapper::mapInteraction( } // After mapping this track, average the touched bins - for (auto tmapBin : touchedMapBins) { - std::vector> trackBins = {tmapBin.second}; + for (const auto& [key, value] : touchedMapBins) { + std::vector> trackBins = {value}; if (m_cfg.computeVariance) { // This only makes sense for the binned material auto binnedMaterial = dynamic_cast( - touchedMaterialBin[tmapBin.first].get()); + touchedMaterialBin[key].get()); if (binnedMaterial != nullptr) { - tmapBin.first->trackVariance( + key->trackVariance( trackBins, binnedMaterial->fullMaterial()[trackBins[0][1]][trackBins[0][0]]); } } - tmapBin.first->trackAverage(trackBins); + key->trackAverage(trackBins); } // After mapping this track, average the untouched but intersected bins @@ -493,14 +493,14 @@ void Acts::SurfaceMaterialMapper::mapSurfaceInteraction( } // After mapping this track, average the touched bins - for (auto tmapBin : touchedMapBins) { - std::vector> trackBins = {tmapBin.second}; + for (const auto& [key, value] : touchedMapBins) { + std::vector> trackBins = {value}; if (m_cfg.computeVariance) { // This only makes sense for the binned material auto binnedMaterial = dynamic_cast( - touchedMaterialBin[tmapBin.first].get()); + touchedMaterialBin[key].get()); if (binnedMaterial != nullptr) { - tmapBin.first->trackVariance( + key->trackVariance( trackBins, binnedMaterial->fullMaterial()[trackBins[0][1]][trackBins[0][0]], true); @@ -508,6 +508,6 @@ void Acts::SurfaceMaterialMapper::mapSurfaceInteraction( } // No need to do an extra pass for untouched surfaces they would have been // added to the material interaction in the initial mapping - tmapBin.first->trackAverage(trackBins, true); + key->trackAverage(trackBins, true); } } diff --git a/Core/src/TrackFinding/AmbiguityTrackClustering.cpp b/Core/src/TrackFinding/AmbiguityTrackClustering.cpp index ca6b39571af..ff0e95cbb3d 100644 --- a/Core/src/TrackFinding/AmbiguityTrackClustering.cpp +++ b/Core/src/TrackFinding/AmbiguityTrackClustering.cpp @@ -22,26 +22,26 @@ Acts::detail::clusterDuplicateTracks( std::unordered_map hitToTrack; // Loop over all the tracks - for (auto track = trackMap.rbegin(); track != trackMap.rend(); ++track) { - std::vector hits = track->second.second; + for (const auto& [_, trackValue] : trackMap) { + std::vector hits = trackValue.second; auto matchedTrack = hitToTrack.end(); // Loop over all the hits in the track - for (auto hit = hits.begin(); hit != hits.end(); hit++) { + for (const auto& hit : hits) { // Check if the hit is already associated to a track - matchedTrack = hitToTrack.find(*hit); + matchedTrack = hitToTrack.find(hit); if (matchedTrack != hitToTrack.end()) { // Add the track to the cluster associated to the matched track - cluster.at(matchedTrack->second).push_back(track->second.first); + cluster.at(matchedTrack->second).push_back(trackValue.first); break; } } // None of the hits have been matched to a track create a new cluster if (matchedTrack == hitToTrack.end()) { - cluster.emplace(track->second.first, - std::vector(1, track->second.first)); + cluster.emplace(trackValue.first, + std::vector(1, trackValue.first)); for (const auto& hit : hits) { // Add the hits of the new cluster to the hitToTrack - hitToTrack.emplace(hit, track->second.first); + hitToTrack.emplace(hit, trackValue.first); } } } diff --git a/Core/src/TrackFinding/GbtsConnector.cpp b/Core/src/TrackFinding/GbtsConnector.cpp index acebffa9f74..d947894871c 100644 --- a/Core/src/TrackFinding/GbtsConnector.cpp +++ b/Core/src/TrackFinding/GbtsConnector.cpp @@ -9,6 +9,7 @@ // TODO: update to C++17 style #include "Acts/TrackFinding/GbtsConnector.hpp" +#include #include #include #include @@ -57,15 +58,8 @@ GbtsConnector::GbtsConnector(std::ifstream &inFile) { continue; } - std::map>::iterator it = - m_connMap.find(stage); - - if (it == m_connMap.end()) { - std::vector v(1, pC); - m_connMap.insert(std::make_pair(stage, v)); - } else { - (*it).second.push_back(pC); - } + auto &connections = m_connMap[stage]; + connections.push_back(pC); } // re-arrange the connection stages @@ -74,9 +68,8 @@ GbtsConnector::GbtsConnector(std::ifstream &inFile) { std::map> newConnMap; - for (const auto &conn : m_connMap) { - std::copy(conn.second.begin(), conn.second.end(), - std::back_inserter(lConns)); + for (const auto &[_, value] : m_connMap) { + std::ranges::copy(value, std::back_inserter(lConns)); } int stageCounter = 0; @@ -111,19 +104,19 @@ GbtsConnector::GbtsConnector(std::ifstream &inFile) { std::set zeroLayers; - for (const auto &layerCounts : mCounter) { - if (layerCounts.second.second != 0) { + for (const auto &[key, value] : mCounter) { + if (value.second != 0) { continue; } - zeroLayers.insert(layerCounts.first); + zeroLayers.insert(key); } // remove connections which use zeroLayer as destination std::vector theStage; - std::list::iterator cIt = lConns.begin(); + auto cIt = lConns.begin(); while (cIt != lConns.end()) { if (zeroLayers.contains((*cIt)->m_dst)) { @@ -144,10 +137,9 @@ GbtsConnector::GbtsConnector(std::ifstream &inFile) { // the doublet making is done using "outside-in" approach hence the reverse // iterations - for (std::map>::reverse_iterator it = - newConnMap.rbegin(); - it != newConnMap.rend(); ++it, currentStage++) { - const std::vector &vConn = (*it).second; + for (auto it = newConnMap.rbegin(); it != newConnMap.rend(); + it++, currentStage++) { + const auto &[_, vConn] = *it; // loop over links, extract all connections for the stage, group sources by // L1 (dst) index @@ -157,8 +149,7 @@ GbtsConnector::GbtsConnector(std::ifstream &inFile) { for (const auto *conn : vConn) { unsigned int dst = conn->m_dst; - std::map>::iterator - l1MapIt = l1ConnMap.find(dst); + auto l1MapIt = l1ConnMap.find(dst); if (l1MapIt != l1ConnMap.end()) { (*l1MapIt).second.push_back(conn); } else { @@ -171,8 +162,8 @@ GbtsConnector::GbtsConnector(std::ifstream &inFile) { lgv.reserve(l1ConnMap.size()); - for (const auto &l1Group : l1ConnMap) { - lgv.push_back(LayerGroup(l1Group.first, l1Group.second)); + for (const auto &[key, value] : l1ConnMap) { + lgv.emplace_back(LayerGroup(key, value)); } m_layerGroups.insert(std::make_pair(currentStage, lgv)); @@ -183,12 +174,9 @@ GbtsConnector::GbtsConnector(std::ifstream &inFile) { GbtsConnector::~GbtsConnector() { m_layerGroups.clear(); - for (std::map>::iterator it = - m_connMap.begin(); - it != m_connMap.end(); ++it) { - for (std::vector::iterator cIt = (*it).second.begin(); - cIt != (*it).second.end(); ++cIt) { - delete (*cIt); + for (const auto &[_, connections] : m_connMap) { + for (auto *conn : connections) { + delete conn; } } } diff --git a/Core/src/Vertexing/AdaptiveMultiVertexFinder.cpp b/Core/src/Vertexing/AdaptiveMultiVertexFinder.cpp index 34d20e32e0a..dddd49e715a 100644 --- a/Core/src/Vertexing/AdaptiveMultiVertexFinder.cpp +++ b/Core/src/Vertexing/AdaptiveMultiVertexFinder.cpp @@ -589,10 +589,10 @@ Result AdaptiveMultiVertexFinder::deleteLastVertex( return removeResult.error(); } - for (auto& entry : fitterState.tracksAtVerticesMap) { + for (auto& [key, value] : fitterState.tracksAtVerticesMap) { // Delete all linearized tracks for current (bad) vertex - if (entry.first.second == &vtx) { - entry.second.isLinearized = false; + if (key.second == &vtx) { + value.isLinearized = false; } } diff --git a/Examples/Framework/src/Validation/TrackClassification.cpp b/Examples/Framework/src/Validation/TrackClassification.cpp index a89f7c2a07a..d1e79d15835 100644 --- a/Examples/Framework/src/Validation/TrackClassification.cpp +++ b/Examples/Framework/src/Validation/TrackClassification.cpp @@ -53,8 +53,9 @@ void ActsExamples::identifyContributingParticles( for (auto hitIndex : protoTrack) { // register all particles that generated this hit - for (auto hitParticle : makeRange(hitParticlesMap.equal_range(hitIndex))) { - increaseHitCount(particleHitCounts, hitParticle.second); + for (const auto& [_, value] : + makeRange(hitParticlesMap.equal_range(hitIndex))) { + increaseHitCount(particleHitCounts, value); } } sortHitCount(particleHitCounts); @@ -79,8 +80,9 @@ void ActsExamples::identifyContributingParticles( IndexSourceLink sl = state.getUncalibratedSourceLink().template get(); auto hitIndex = sl.index(); - for (auto hitParticle : makeRange(hitParticlesMap.equal_range(hitIndex))) { - increaseHitCount(particleHitCounts, hitParticle.second); + for (const auto& [_, value] : + makeRange(hitParticlesMap.equal_range(hitIndex))) { + increaseHitCount(particleHitCounts, value); } return true; }); @@ -102,8 +104,9 @@ void ActsExamples::identifyContributingParticles( IndexSourceLink sl = state.getUncalibratedSourceLink().template get(); auto hitIndex = sl.index(); - for (auto hitParticle : makeRange(hitParticlesMap.equal_range(hitIndex))) { - increaseHitCount(particleHitCounts, hitParticle.second); + for (const auto& [_, value] : + makeRange(hitParticlesMap.equal_range(hitIndex))) { + increaseHitCount(particleHitCounts, value); } } sortHitCount(particleHitCounts); diff --git a/Examples/Io/Root/src/RootNuclearInteractionParametersWriter.cpp b/Examples/Io/Root/src/RootNuclearInteractionParametersWriter.cpp index e0d635443e5..995f7bdf57d 100644 --- a/Examples/Io/Root/src/RootNuclearInteractionParametersWriter.cpp +++ b/Examples/Io/Root/src/RootNuclearInteractionParametersWriter.cpp @@ -227,7 +227,7 @@ std::pair, std::vector> buildMap( } /// @brief This method builds decomposed cumulative probability distributions -/// out of a vector of proability distributions +/// out of a vector of probability distributions /// /// @param [in] histos Vector of probability distributions /// @@ -410,27 +410,27 @@ ActsExamples::RootNuclearInteractionParametersWriter::finalize() { gDirectory->WriteObject(&mapNIprob.second, "NuclearInteractionBinContents"); ACTS_DEBUG("Nuclear interaction probability parametrised"); - ACTS_DEBUG("Starting calulcation of probability of interaction type"); - // Write the interaction type proability + ACTS_DEBUG("Starting calculation of probability of interaction type"); + // Write the interaction type probability const auto softProbability = Parametrisation::softProbability(m_eventFractionCollection); gDirectory->WriteObject(&softProbability, "SoftInteraction"); - ACTS_DEBUG("Calulcation of probability of interaction type finished"); + ACTS_DEBUG("Calculation of probability of interaction type finished"); // Write the PDG id production distribution ACTS_DEBUG( - "Starting calulcation of transition probabilities between PDG IDs"); + "Starting calculation of transition probabilities between PDG IDs"); const auto pdgIdMap = Parametrisation::cumulativePDGprobability(m_eventFractionCollection); std::vector branchingPdgIds; std::vector targetPdgIds; std::vector targetPdgProbability; - for (const auto& targetPdgIdMap : pdgIdMap) { - for (const auto& producedPdgIdMap : targetPdgIdMap.second) { - branchingPdgIds.push_back(targetPdgIdMap.first); - targetPdgIds.push_back(producedPdgIdMap.first); - targetPdgProbability.push_back(producedPdgIdMap.second); + for (const auto& [targetKey, targetValue] : pdgIdMap) { + for (const auto& [producedKey, producedValue] : targetValue) { + branchingPdgIds.push_back(targetKey); + targetPdgIds.push_back(producedKey); + targetPdgProbability.push_back(producedValue); } } @@ -438,7 +438,7 @@ ActsExamples::RootNuclearInteractionParametersWriter::finalize() { gDirectory->WriteObject(&targetPdgIds, "TargetPdgIds"); gDirectory->WriteObject(&targetPdgProbability, "TargetPdgProbability"); ACTS_DEBUG( - "Calulcation of transition probabilities between PDG IDs finished"); + "Calculation of transition probabilities between PDG IDs finished"); // Write the multiplicity and kinematics distribution ACTS_DEBUG("Starting parametrisation of multiplicity probabilities"); diff --git a/Plugins/ActSVG/include/Acts/Plugins/ActSVG/IndexedSurfacesSvgConverter.hpp b/Plugins/ActSVG/include/Acts/Plugins/ActSVG/IndexedSurfacesSvgConverter.hpp index 79397aba878..788ac36aca5 100644 --- a/Plugins/ActSVG/include/Acts/Plugins/ActSVG/IndexedSurfacesSvgConverter.hpp +++ b/Plugins/ActSVG/include/Acts/Plugins/ActSVG/IndexedSurfacesSvgConverter.hpp @@ -170,7 +170,7 @@ ProtoIndexedSurfaceGrid convertImpl(const GeometryContext& gctx, } } } - return std::tie(pSurfaces, pGrid, highlightIndices); + return {pSurfaces, pGrid, highlightIndices}; } /// @brief Convert the single delegate if it is of the type of the reference diff --git a/Plugins/ActSVG/include/Acts/Plugins/ActSVG/SvgUtils.hpp b/Plugins/ActSVG/include/Acts/Plugins/ActSVG/SvgUtils.hpp index 38189871efb..d2326694b5d 100644 --- a/Plugins/ActSVG/include/Acts/Plugins/ActSVG/SvgUtils.hpp +++ b/Plugins/ActSVG/include/Acts/Plugins/ActSVG/SvgUtils.hpp @@ -59,7 +59,7 @@ struct Style { str._hl_width = highlightStrokeWidth; str._dasharray = strokeDasharray; - return std::tie(fll, str); + return {fll, str}; } /// Conversion to fill, stroke and font diff --git a/Plugins/ActSVG/src/SurfaceArraySvgConverter.cpp b/Plugins/ActSVG/src/SurfaceArraySvgConverter.cpp index 794bb1d43b5..5cffbe73a1a 100644 --- a/Plugins/ActSVG/src/SurfaceArraySvgConverter.cpp +++ b/Plugins/ActSVG/src/SurfaceArraySvgConverter.cpp @@ -206,5 +206,5 @@ Acts::Svg::SurfaceArrayConverter::convert( // Return the surfaces and the grid std::vector pSurfaceBatches = {pSurfaces}; std::vector pAssociationBatchs = {pAssociations}; - return std::tie(pSurfaceBatches, pGrid, pAssociationBatchs); + return {pSurfaceBatches, pGrid, pAssociationBatchs}; } diff --git a/Plugins/DD4hep/src/DD4hepDetectorStructure.cpp b/Plugins/DD4hep/src/DD4hepDetectorStructure.cpp index ca4ae439004..00a5017fca9 100644 --- a/Plugins/DD4hep/src/DD4hepDetectorStructure.cpp +++ b/Plugins/DD4hep/src/DD4hepDetectorStructure.cpp @@ -75,7 +75,7 @@ Acts::Experimental::DD4hepDetectorStructure::construct( detail::BlueprintDrawer::dotStream(bpf, *dd4hepBlueprint); bpf.close(); // Return without building - return std::tie(detector, detectorStore); + return {detector, detectorStore}; } // Create a Cylindrical detector builder from this blueprint @@ -100,5 +100,5 @@ Acts::Experimental::DD4hepDetectorStructure::construct( "DD4hepDetectorStructure: Only cylindrical detectors are (currently) " "supported."); } - return std::tie(detector, detectorStore); + return {detector, detectorStore}; } diff --git a/Plugins/Json/include/Acts/Plugins/Json/IndexedGridJsonHelper.hpp b/Plugins/Json/include/Acts/Plugins/Json/IndexedGridJsonHelper.hpp index b7717073036..581130a8852 100644 --- a/Plugins/Json/include/Acts/Plugins/Json/IndexedGridJsonHelper.hpp +++ b/Plugins/Json/include/Acts/Plugins/Json/IndexedGridJsonHelper.hpp @@ -83,7 +83,7 @@ updator_type generateFromJson(const nlohmann::json& jUpdater, -> std::tuple, std::size_t> { std::array range = jAxis["range"]; std::size_t bins = jAxis["bins"]; - return std::make_tuple(range, bins); + return {range, bins}; }; /// Helper extractor for variable axis diff --git a/Plugins/Json/src/DetrayJsonHelper.cpp b/Plugins/Json/src/DetrayJsonHelper.cpp index aa61a9d8aeb..e902657da21 100644 --- a/Plugins/Json/src/DetrayJsonHelper.cpp +++ b/Plugins/Json/src/DetrayJsonHelper.cpp @@ -50,7 +50,7 @@ std::tuple> maskFromBounds( break; } } - return std::tie(type, boundaries); + return {type, boundaries}; } void addVolumeLink(nlohmann::json& jSurface, int vLink) { diff --git a/Plugins/Json/src/MaterialMapJsonConverter.cpp b/Plugins/Json/src/MaterialMapJsonConverter.cpp index 76fc01f8569..2424156ec1d 100644 --- a/Plugins/Json/src/MaterialMapJsonConverter.cpp +++ b/Plugins/Json/src/MaterialMapJsonConverter.cpp @@ -253,8 +253,8 @@ nlohmann::json Acts::MaterialMapJsonConverter::materialMapsToJson( VolumeMaterialMap volumeMap = maps.second; std::vector> mapVolumeInit; - for (auto it = volumeMap.begin(); it != volumeMap.end(); it++) { - mapVolumeInit.push_back({it->first, it->second.get()}); + for (const auto& [key, value] : volumeMap) { + mapVolumeInit.push_back({key, value.get()}); } GeometryHierarchyMap hierarchyVolumeMap( mapVolumeInit); @@ -263,8 +263,8 @@ nlohmann::json Acts::MaterialMapJsonConverter::materialMapsToJson( SurfaceMaterialMap surfaceMap = maps.first; std::vector> mapSurfaceInit; - for (auto it = surfaceMap.begin(); it != surfaceMap.end(); it++) { - mapSurfaceInit.push_back({it->first, it->second.get()}); + for (const auto& [key, value] : surfaceMap) { + mapSurfaceInit.push_back({key, value.get()}); } GeometryHierarchyMap hierarchySurfaceMap( mapSurfaceInit); diff --git a/Tests/UnitTests/Core/Seeding/PathSeederTest.cpp b/Tests/UnitTests/Core/Seeding/PathSeederTest.cpp index 70a8f9ebaa0..e8338925747 100644 --- a/Tests/UnitTests/Core/Seeding/PathSeederTest.cpp +++ b/Tests/UnitTests/Core/Seeding/PathSeederTest.cpp @@ -38,6 +38,8 @@ using namespace Acts::UnitLiterals; using Axis = Acts::Axis; using Grid = Acts::Grid, Axis, Axis>; +using TrackParameters = CurvilinearTrackParameters; + GeometryContext gctx; // Parameters for the geometry @@ -46,6 +48,12 @@ const ActsScalar halfZ = 10.; const ActsScalar deltaX = 10.; const ActsScalar deltaYZ = 1.; +const Vector4 trueVertex(-5., 0., 0., 0); +const std::vector truePhis = {-0.15, -0.1, -0.05, 0, + 0.05, 0.1, 0.15}; +const ActsScalar trueTheta = M_PI_2; +const ActsScalar trueQOverP = 1. / 1._GeV; + // Intersection finding to get the // region of interest for seeding class NoFieldIntersectionFinder { @@ -57,11 +65,13 @@ class NoFieldIntersectionFinder { // Find the intersections along the path // and return them in the order of the path // length - std::vector> operator()( - const GeometryContext& geoCtx, const Vector3& position, - const Vector3& direction, [[maybe_unused]] const ActsScalar& Pmag = 0, - [[maybe_unused]] const ActsScalar& Charge = 0) const { - std::vector> sIntersections; + std::vector> operator()( + const GeometryContext& geoCtx, + const TrackParameters& trackParameters) const { + Vector3 position = trackParameters.position(); + Vector3 direction = trackParameters.direction(); + + std::vector> sIntersections; // Intersect the surfaces for (auto& surface : m_surfaces) { // Get the intersection @@ -76,7 +86,11 @@ class NoFieldIntersectionFinder { if (closestForward.status() == IntersectionStatus::reachable && closestForward.pathLength() > 0.0) { sIntersections.push_back( - {closestForward.object()->geometryId(), closestForward.position()}); + {closestForward.object()->geometryId(), + surface + ->globalToLocal(geoCtx, closestForward.position(), + Vector3{0, 1, 0}) + .value()}); continue; } } @@ -84,92 +98,85 @@ class NoFieldIntersectionFinder { } }; -// Grid to store the source links for -// the seeding fast lookup -class SourceLinkGrid { +// A simple path width provider to set +// the grid lookup boundaries around the +// intersection point +class PathWidthProvider { + public: + std::pair width; + + std::pair operator()( + const GeometryContext& /*gctx*/, + const GeometryIdentifier& /*geoId*/) const { + return width; + } +}; + +// Estimator of the particle's energy, +// vertex, momentum direction at the IP +// and the direction at the first hit +class TrackEstimator { public: - using GridType = Grid; + Vector3 m_ip; + SourceLinkSurfaceAccessor m_surfaceAccessor; + + std::pair operator()( + const GeometryContext& geoCtx, const SourceLink& pivot) const { + auto testSourceLink = pivot.get(); + Vector3 pivot3 = m_surfaceAccessor(pivot)->localToGlobal( + geoCtx, testSourceLink.parameters, Vector3{0, 1, 0}); + + Vector3 direction = (pivot3 - m_ip).normalized(); - /// Lookup table collection - std::unordered_map m_lookupTables; + Vector4 ip = {m_ip.x(), m_ip.y(), m_ip.z(), 0}; + ActsScalar qOverP = 1_e / 1._GeV; + ActsScalar phi = Acts::VectorHelpers::phi(direction); + ActsScalar theta = Acts::VectorHelpers::theta(direction); + ParticleHypothesis particle = ParticleHypothesis::electron(); + + TrackParameters ipParams(ip, phi, theta, qOverP, std::nullopt, particle); + TrackParameters firstLayerParams(ip, phi, theta, qOverP, std::nullopt, + particle); + + return {ipParams, firstLayerParams}; + } +}; - /// Surface accessor +// Construct grid with the source links +struct ConstructSourceLinkGrid { SourceLinkSurfaceAccessor m_surfaceAccessor; - void initialize(const GeometryContext& geoCtx, - std::vector sourceLinks) { + std::unordered_map construct( + std::vector sourceLinks) { // Lookup table for each layer - std::unordered_map lookupTable; + std::unordered_map lookupTable; // Construct a binned grid for each layer for (int i : {14, 15, 16, 17}) { - Axis xAxis(-halfY, halfY, 50); - Axis yAxis(-halfZ, halfZ, 50); + Axis xAxis(-halfY, halfY, 100); + Axis yAxis(-halfZ, halfZ, 100); + + Grid grid(std::make_tuple(xAxis, yAxis)); + + GeometryIdentifier geoId; + + geoId.setSensitive(i); - GridType grid(std::make_tuple(xAxis, yAxis)); - lookupTable.insert({i, grid}); + lookupTable.insert({geoId, grid}); } // Fill the grid with source links for (auto& sl : sourceLinks) { - auto ssl = sl.get(); - auto id = ssl.m_geometryId; + auto tsl = sl.get(); + auto id = tsl.m_geometryId; - // Grid works with global positions - Vector3 globalPos = m_surfaceAccessor(sl)->localToGlobal( - geoCtx, ssl.parameters, Vector3{0, 1, 0}); - - auto bin = - lookupTable.at(id.sensitive()) - .localBinsFromPosition(Vector2(globalPos.y(), globalPos.z())); - lookupTable.at(id.sensitive()).atLocalBins(bin).push_back(sl); + auto bin = lookupTable.at(id).localBinsFromPosition(tsl.parameters); + lookupTable.at(id).atLocalBins(bin).push_back(sl); } - m_lookupTables = lookupTable; - }; - - // Get the source link grid for a given geometry id - GridType operator()(const GeometryIdentifier& geoId) const { - return m_lookupTables.at(geoId.sensitive()); - } -}; - -// A simple path width provider to set -// the grid lookup boundaries around the -// intersection point -std::pair getPathWidth( - const GeometryContext& /*gctx*/, const GeometryIdentifier& /*geoId*/) { - return {0.1, 0.1}; -} - -// Calibrator to transform the source links -// to global coordinates -class SourceLinkCalibrator { - public: - SourceLinkSurfaceAccessor m_surfaceAccessor; - - Vector3 operator()(const GeometryContext& geoCtx, - const SourceLink& sourceLink) const { - auto ssl = sourceLink.get(); - auto res = m_surfaceAccessor(sourceLink) - ->localToGlobal(geoCtx, ssl.parameters, Vector3{0, 1, 0}); - return res; + return lookupTable; } }; -// Estimator of the particle's energy, -// vertex, momentum direction at the IP -// and the direction at the first hit -class TrackEstimator { - public: - Vector3 ip; - - std::tuple operator()( - const GeometryContext& /*geoCtx*/, const Vector3& pivot) const { - Vector3 direction = (pivot - ip).normalized(); - return {1_e, 1._GeV, ip, direction, direction}; - }; -}; - // Construct a simple telescope detector std::shared_ptr constructTelescopeDetector() { RotationMatrix3 rotation; @@ -257,7 +264,7 @@ std::shared_ptr constructTelescopeDetector() { // Connect the volumes auto portalContainer = Experimental::detail::CuboidalDetectorHelper::connect( - gctx, volumes, BinningValue::binX, {}, Logging::VERBOSE); + gctx, volumes, BinningValue::binX, {}, Logging::INFO); // Make sure that the geometry ids are // independent of the potential Id generation @@ -302,23 +309,19 @@ std::vector createSourceLinks( } } - Vector3 vertex(-5., 0., 0.); - std::vector phis = {-0.15, -0.1, -0.05, 0, 0.05, 0.1, 0.15}; - std::vector sourceLinks; - for (ActsScalar phi : phis) { - Vector3 direction(cos(phi), sin(phi), 0.); + for (ActsScalar phi : truePhis) { + TrackParameters trackParameters(trueVertex, phi, trueTheta, trueQOverP, + std::nullopt, + ParticleHypothesis::electron()); - auto intersections = intersectionFinder(geoCtx, vertex, direction); + auto intersections = intersectionFinder(geoCtx, trackParameters); SquareMatrix2 cov = SquareMatrix2::Identity(); for (auto& [id, refPoint] : intersections) { - auto surf = *detector.sensitiveHierarchyMap().find(id); - Vector2 val = surf->globalToLocal(geoCtx, refPoint, direction).value(); - - detail::Test::TestSourceLink sourceLink(eBoundLoc0, eBoundLoc1, val, cov, - id, id.value()); + detail::Test::TestSourceLink sourceLink(eBoundLoc0, eBoundLoc1, refPoint, + cov, id, id.value()); SourceLink sl{sourceLink}; sourceLinks.push_back(sl); @@ -339,30 +342,27 @@ BOOST_AUTO_TEST_CASE(PathSeederZeroField) { auto sourceLinks = createSourceLinks(gctx, *detector); // Prepare the PathSeeder - auto pathSeederCfg = Acts::Experimental::PathSeeder::Config(); + auto pathSeederCfg = Acts::PathSeeder::Config(); // Grid to bin the source links SurfaceAccessor surfaceAccessor{*detector}; - SourceLinkGrid sourceLinkGrid; - sourceLinkGrid.m_surfaceAccessor.connect<&SurfaceAccessor::operator()>( - &surfaceAccessor); - pathSeederCfg.sourceLinkGridLookup.connect<&SourceLinkGrid::operator()>( - &sourceLinkGrid); + auto sourceLinkGridConstructor = ConstructSourceLinkGrid(); + sourceLinkGridConstructor.m_surfaceAccessor + .connect<&SurfaceAccessor::operator()>(&surfaceAccessor); + + // Create the grid + std::unordered_map sourceLinkGrid = + sourceLinkGridConstructor.construct(sourceLinks); // Estimator of the IP and first hit // parameters of the track TrackEstimator trackEstimator; - trackEstimator.ip = Vector3(-5., 0., 0.); + trackEstimator.m_ip = Vector3(-5., 0., 0.); + trackEstimator.m_surfaceAccessor.connect<&SurfaceAccessor::operator()>( + &surfaceAccessor); pathSeederCfg.trackEstimator.connect<&TrackEstimator::operator()>( &trackEstimator); - // Transforms the source links to global coordinates - SourceLinkCalibrator sourceLinkCalibrator; - sourceLinkCalibrator.m_surfaceAccessor.connect<&SurfaceAccessor::operator()>( - &surfaceAccessor); - pathSeederCfg.sourceLinkCalibrator.connect<&SourceLinkCalibrator::operator()>( - &sourceLinkCalibrator); - // Intersection finder NoFieldIntersectionFinder intersectionFinder; for (auto volume : detector->volumes()) { @@ -374,29 +374,35 @@ BOOST_AUTO_TEST_CASE(PathSeederZeroField) { .connect<&NoFieldIntersectionFinder::operator()>(&intersectionFinder); // Path width provider - pathSeederCfg.pathWidthProvider.connect<&getPathWidth>(); + PathWidthProvider pathWidthProvider; - // First tracking layer - Extent firstLayerExtent; - firstLayerExtent.set(BinningValue::binX, -0.1, 0.1); - firstLayerExtent.set(BinningValue::binY, -halfY - deltaYZ, halfY + deltaYZ); - firstLayerExtent.set(BinningValue::binZ, -halfZ - deltaYZ, halfZ + deltaYZ); + pathSeederCfg.pathWidthProvider.connect<&PathWidthProvider::operator()>( + &pathWidthProvider); - pathSeederCfg.firstLayerExtent = firstLayerExtent; + GeometryIdentifier geoId; + geoId.setSensitive(14); + pathSeederCfg.refLayerIds.push_back(geoId); // Create the PathSeeder - Acts::Experimental::PathSeeder pathSeeder(pathSeederCfg); + Acts::PathSeeder pathSeeder(pathSeederCfg); // Get the seeds - sourceLinkGrid.initialize(gctx, sourceLinks); - auto seeds = pathSeeder.getSeeds(gctx, sourceLinks); + pathWidthProvider.width = {1e-3, 1e-3}; + + std::vector seeds; + + // SeedTreeContainer seeds; + pathSeeder.findSeeds(gctx, sourceLinkGrid, seeds); // Check the seeds BOOST_CHECK_EQUAL(seeds.size(), 7); - for (auto& seed : seeds) { - BOOST_CHECK_EQUAL(seed.sourceLinks.size(), 4); - BOOST_CHECK_EQUAL(seed.ipVertex, Vector3(-5., 0., 0.)); - BOOST_CHECK_EQUAL(seed.ipP, 1._GeV); + + for (std::size_t i = 0; i < seeds.size(); i++) { + auto seed = seeds.at(i); + BOOST_CHECK_EQUAL(seed.second.size(), 4); + BOOST_CHECK_EQUAL(seed.first.phi(), truePhis.at(i)); + BOOST_CHECK_EQUAL(seed.first.theta(), trueTheta); + BOOST_CHECK_EQUAL(seed.first.qOverP(), trueQOverP); } } diff --git a/Tests/UnitTests/Core/Utilities/KDTreeTests.cpp b/Tests/UnitTests/Core/Utilities/KDTreeTests.cpp index b1a70c399c7..15146e2eb60 100644 --- a/Tests/UnitTests/Core/Utilities/KDTreeTests.cpp +++ b/Tests/UnitTests/Core/Utilities/KDTreeTests.cpp @@ -482,12 +482,10 @@ BOOST_FIXTURE_TEST_CASE(range_search_combinatorial, TreeFixture3DDoubleInt2) { std::vector valid; - for (const std::pair, int>& i : - test_vector) { - const std::array& c = i.first; + for (const auto& [c, value] : test_vector) { if (xmin <= c[0] && c[0] < xmax && ymin <= c[1] && c[1] < ymax && zmin <= c[2] && c[2] < zmax) { - valid.push_back(i.second); + valid.push_back(value); } }