Skip to content

Commit

Permalink
Do not use geometry extent during seeding
Browse files Browse the repository at this point in the history
  • Loading branch information
cvarni committed Oct 3, 2024
1 parent b0fcfb4 commit d62e73c
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

#pragma once

#include "Acts/Geometry/Extent.hpp"
#include "Acts/Seeding/BinnedGroup.hpp"
#include "Acts/Seeding/SeedFinderConfig.hpp"
#include "Acts/Utilities/Grid.hpp"
Expand Down Expand Up @@ -121,7 +120,7 @@ class CylindricalSpacePointGridCreator {
const Acts::SeedFinderOptions& options,
Acts::CylindricalSpacePointGrid<external_spacepoint_t>& grid,
external_spacepoint_iterator_t spBegin,
external_spacepoint_iterator_t spEnd, Acts::Extent& rRangeSPExtent);
external_spacepoint_iterator_t spEnd);
};

} // namespace Acts
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ void Acts::CylindricalSpacePointGridCreator::fillGrid(
const Acts::SeedFinderOptions& options,
Acts::CylindricalSpacePointGrid<external_spacepoint_t>& grid,
external_spacepoint_iterator_t spBegin,
external_spacepoint_iterator_t spEnd, Acts::Extent& rRangeSPExtent) {
external_spacepoint_iterator_t spEnd) {
using iterated_value_t =
typename std::iter_value_t<external_spacepoint_iterator_t>;
using iterated_t = typename std::remove_const_t<
Expand Down Expand Up @@ -185,9 +185,6 @@ void Acts::CylindricalSpacePointGridCreator::fillGrid(
float spY = sp.y();
float spZ = sp.z();

// store x,y,z values in extent
rRangeSPExtent.extend({spX, spY, spZ});

// remove SPs according to experiment specific cuts
if (!config.spacePointSelector(sp)) {
continue;
Expand Down
29 changes: 21 additions & 8 deletions Examples/Algorithms/TrackFinding/src/SeedingAlgorithm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#include "Acts/Definitions/Algebra.hpp"
#include "Acts/EventData/Seed.hpp"
#include "Acts/EventData/SpacePointData.hpp"
#include "Acts/Geometry/Extent.hpp"
#include "Acts/Seeding/BinnedGroup.hpp"
#include "Acts/Seeding/SeedFilter.hpp"
#include "Acts/Utilities/BinningType.hpp"
Expand Down Expand Up @@ -243,16 +242,31 @@ ActsExamples::ProcessCode ActsExamples::SeedingAlgorithm::execute(
using value_type = typename decltype(spContainer)::SpacePointProxyType;
using seed_type = Acts::Seed<value_type>;

// extent used to store r range for middle spacepoint
Acts::Extent rRangeSPExtent;

Acts::CylindricalSpacePointGrid<value_type> grid =
Acts::CylindricalSpacePointGridCreator::createGrid<value_type>(
m_cfg.gridConfig, m_cfg.gridOptions);

Acts::CylindricalSpacePointGridCreator::fillGrid(
m_cfg.seedFinderConfig, m_cfg.seedFinderOptions, grid,
spContainer.begin(), spContainer.end(), rRangeSPExtent);
spContainer.begin(), spContainer.end());

// Compute radius Range
// we rely on the fact the grid is storing the proxies
// with a sorting in the radius
double minRange = std::numeric_limits<double>::max();
double maxRange = std::numeric_limits<double>::lowest();
for (const auto& coll : grid) {
if (coll.empty())
continue;
const auto* firstEl = coll.front();
const auto* lastEl = coll.back();
if (firstEl->radius() < minRange) {
minRange = firstEl->radius();
}
if (lastEl->radius() > maxRange) {
maxRange = lastEl->radius();
}
}

std::array<std::vector<std::size_t>, 2ul> navigation;
navigation[1ul] = m_cfg.seedFinderConfig.zBinsCustomLooping;
Expand All @@ -262,12 +276,11 @@ ActsExamples::ProcessCode ActsExamples::SeedingAlgorithm::execute(
std::move(navigation));

// safely clamp double to float
float up = Acts::clampValue<float>(
std::floor(rRangeSPExtent.max(Acts::BinningValue::binR) / 2) * 2);
float up = Acts::clampValue<float>(std::floor(maxRange / 2) * 2);

/// variable middle SP radial region of interest
const Acts::Range1D<float> rMiddleSPRange(
std::floor(rRangeSPExtent.min(Acts::BinningValue::binR) / 2) * 2 +
std::floor(minRange / 2) * 2 +
m_cfg.seedFinderConfig.deltaRMiddleMinSPRange,
up - m_cfg.seedFinderConfig.deltaRMiddleMaxSPRange);

Expand Down
28 changes: 21 additions & 7 deletions Examples/Algorithms/TrackFinding/src/SeedingAlgorithmHashing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#include "Acts/Definitions/Algebra.hpp"
#include "Acts/EventData/Seed.hpp"
#include "Acts/EventData/SpacePointData.hpp"
#include "Acts/Geometry/Extent.hpp"
#include "Acts/Plugins/Hashing/HashingAlgorithm.hpp"
#include "Acts/Plugins/Hashing/HashingTraining.hpp"
#include "Acts/Seeding/BinnedGroup.hpp"
Expand Down Expand Up @@ -269,15 +268,31 @@ ActsExamples::ProcessCode ActsExamples::SeedingAlgorithmHashing::execute(
Acts::SpacePointContainer<decltype(container), Acts::detail::RefHolder>
spContainer(spConfig, spOptions, container);

// extent used to store r range for middle spacepoint
Acts::Extent rRangeSPExtent;
// construct the seeding tools
Acts::CylindricalSpacePointGrid<value_type> grid =
Acts::CylindricalSpacePointGridCreator::createGrid<value_type>(
m_cfg.gridConfig, m_cfg.gridOptions);
Acts::CylindricalSpacePointGridCreator::fillGrid(
m_cfg.seedFinderConfig, m_cfg.seedFinderOptions, grid,
spContainer.begin(), spContainer.end(), rRangeSPExtent);
spContainer.begin(), spContainer.end());

// Compute radius Range
// we rely on the fact the grid is storing the proxies
// with a sorting in the radius
double minRange = std::numeric_limits<double>::max();
double maxRange = std::numeric_limits<double>::lowest();
for (const auto& coll : grid) {
if (coll.empty())
continue;
const auto* firstEl = coll.front();
const auto* lastEl = coll.back();
if (firstEl->radius() < minRange) {
minRange = firstEl->radius();
}
if (lastEl->radius() > maxRange) {
maxRange = lastEl->radius();
}
}

std::array<std::vector<std::size_t>, 2ul> navigation;
navigation[1ul] = m_cfg.seedFinderConfig.zBinsCustomLooping;
Expand All @@ -288,12 +303,11 @@ ActsExamples::ProcessCode ActsExamples::SeedingAlgorithmHashing::execute(
std::move(navigation));

// safely clamp double to float
float up = Acts::clampValue<float>(
std::floor(rRangeSPExtent.max(Acts::BinningValue::binR) / 2) * 2);
float up = Acts::clampValue<float>(std::floor(maxRange / 2) * 2);

/// variable middle SP radial region of interest
const Acts::Range1D<float> rMiddleSPRange(
std::floor(rRangeSPExtent.min(Acts::BinningValue::binR) / 2) * 2 +
std::floor(minRange / 2) * 2 +
m_cfg.seedFinderConfig.deltaRMiddleMinSPRange,
up - m_cfg.seedFinderConfig.deltaRMiddleMaxSPRange);

Expand Down

0 comments on commit d62e73c

Please sign in to comment.