Skip to content

Commit

Permalink
Do not insert space points if not inside grid boundaries
Browse files Browse the repository at this point in the history
  • Loading branch information
cvarni committed Oct 7, 2024
1 parent 26a4a8f commit f83dc94
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 8 deletions.
19 changes: 19 additions & 0 deletions Core/include/Acts/Seeding/detail/CylindricalSpacePointGrid.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ struct CylindricalSpacePointGridConfig {
"Repeated conversion to internal units for "
"CylindricalSpacePointGridConfig");
}

using namespace Acts::UnitLiterals;
CylindricalSpacePointGridConfig config = *this;
config.isInInternalUnits = true;
Expand All @@ -88,6 +89,24 @@ struct CylindricalSpacePointGridConfig {
config.zMin /= 1_mm;
config.deltaRMax /= 1_mm;

if (phiMin < -M_PI || phiMax > M_PI) {
throw std::runtime_error(
"CylindricalSpacePointGridConfig: phiMin and/or phiMax are outside "
"the allowed phi range, defined as [-M_PI, M_PI]");
}
if (phiMin > phiMax) {
throw std::runtime_error(
"CylindricalSpacePointGridConfig: phiMin is bigger then phiMax");
}
if (rMin > rMax) {
throw std::runtime_error(
"CylindricalSpacePointGridConfig: rMin is bigger then rMax");
}
if (zMin > zMax) {
throw std::runtime_error(
"CylindricalSpacePointGridConfig: zMin is bigger than zMax");
}

return config;
}
};
Expand Down
15 changes: 11 additions & 4 deletions Core/include/Acts/Seeding/detail/CylindricalSpacePointGrid.ipp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// -*- C++ -*-
// This file is part of the ACTS project.
//
// Copyright (C) 2016 CERN for the benefit of the ACTS project
Expand Down Expand Up @@ -167,9 +168,11 @@ void Acts::CylindricalSpacePointGridCreator::fillGrid(

// Space points are assumed to be ALREADY CORRECTED for beamspot position
// phi, z and r space point selection comes naturally from the
// grid axis definition. No need to explicitly cut on those values.
// grid axis definition. Calling `isInside` will let us know if we are
// inside the grid range.
// If a space point is outside the validity range of these quantities
// it goes in an over- or under-flow bin.
// it goes in an over- or under-flow bin. We want to avoid to consider those
// and skip some computations.
// Additional cuts can be applied by customizing the space point selector
// in the config object.

Expand All @@ -189,8 +192,12 @@ void Acts::CylindricalSpacePointGridCreator::fillGrid(
}

// fill rbins into grid
std::size_t globIndex = grid.globalBinFromPosition(
Acts::Vector3{sp.phi(), sp.z(), sp.radius()});
Acts::Vector3 position(sp.phi(), sp.z(), sp.radius());
if (!grid.isInside(position)) {
continue;
}

std::size_t globIndex = grid.globalBinFromPosition(position);
auto& rbin = grid.at(globIndex);
rbin.push_back(&sp);

Expand Down
4 changes: 2 additions & 2 deletions Examples/Algorithms/TrackFinding/src/SeedingAlgorithm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -274,8 +274,8 @@ ActsExamples::ProcessCode ActsExamples::SeedingAlgorithm::execute(

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

// run the seeding
static thread_local std::vector<seed_type> seeds;
Expand Down
4 changes: 2 additions & 2 deletions Examples/Python/python/acts/examples/itk.py
Original file line number Diff line number Diff line change
Expand Up @@ -372,8 +372,8 @@ def itkSeedingAlgConfig(
)
zOriginWeightFactor = 1
compatSeedWeight = 100
phiMin = 0
phiMax = 2 * math.pi
phiMin = -math.pi
phiMax = math.pi
phiBinDeflectionCoverage = 3
numPhiNeighbors = 1
maxPhiBins = 200
Expand Down

0 comments on commit f83dc94

Please sign in to comment.