Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: variable r range in orthogonal seeding #1621

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion Core/include/Acts/Seeding/SeedFinder.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ void SeedFinder<external_spacepoint_t, platform_t>::createSeedsForGroup(
float varianceRM = spM->varianceR();
float varianceZM = spM->varianceZ();

/// check if spM is outside our radial region of interest
// check if spM is outside our radial region of interest
if (m_config.useVariableMiddleSPRange) {
if (rM < rMiddleSPRange.min()) {
continue;
Expand Down Expand Up @@ -80,6 +80,16 @@ void SeedFinder<external_spacepoint_t, platform_t>::createSeedsForGroup(
}
continue;
}
} else {
if (rM > m_config.rMaxMiddle) {
continue;
}
if (rM < m_config.rMinMiddle) {
if (m_config.forceRadialSorting) {
break;
}
continue;
}
}

state.compatTopSP.clear();
Expand Down
12 changes: 9 additions & 3 deletions Core/include/Acts/Seeding/SeedFinderConfig.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,20 @@ struct SeedFinderConfig {
float deltaRMaxBottomSP = std::numeric_limits<float>::quiet_NaN();
// radial bin size for filling space point grid
float binSizeR = 1. * Acts::UnitConstants::mm;
// force sorting in R in space point grid bins

// force sorting of middle SPs in radius
bool forceRadialSorting = false;

// radial range for middle SP
std::vector<std::vector<float>> rRangeMiddleSP;
bool useVariableMiddleSPRange = false;
// variable range based on SP radius
bool useVariableMiddleSPRange = true;
float deltaRMiddleMinSPRange = 10. * Acts::UnitConstants::mm;
float deltaRMiddleMaxSPRange = 10. * Acts::UnitConstants::mm;
// range defined in vector for each z region
std::vector<std::vector<float>> rRangeMiddleSP;
// range defined by rMinMiddle and rMaxMiddle
float rMinMiddle = 60.f * Acts::UnitConstants::mm;
float rMaxMiddle = 120.f * Acts::UnitConstants::mm;

// cut to the maximum value of delta z between SPs
float deltaZMax =
Expand Down
36 changes: 27 additions & 9 deletions Core/include/Acts/Seeding/SeedFinderOrthogonal.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -458,15 +458,6 @@ void SeedFinderOrthogonal<external_spacepoint_t>::processFromMiddleSP(
*/
std::vector<internal_sp_t *> bottom_lh_v, bottom_hl_v, top_lh_v, top_hl_v;

/*
* Cut: Ensure that the middle spacepoint lies within a valid r-region for
* middle points.
*/
if (middle.radius() > m_config.rMaxMiddle ||
middle.radius() < m_config.rMinMiddle) {
return;
}

/*
* Calculate the search ranges for bottom and top candidates for this middle
* space point.
Expand Down Expand Up @@ -663,13 +654,23 @@ void SeedFinderOrthogonal<external_spacepoint_t>::createSeeds(
* take each external spacepoint, allocate a corresponding internal space
* point, and save it in a vector.
*/
Acts::Extent rRangeSPExtent;
std::vector<internal_sp_t *> internalSpacePoints;
for (const external_spacepoint_t *p : spacePoints) {
internalSpacePoints.push_back(new InternalSpacePoint<external_spacepoint_t>(
*p, {p->x(), p->y(), p->z()}, {0.0, 0.0},
{p->varianceR(), p->varianceZ()}));
// store x,y,z values in extent
rRangeSPExtent.extend({p->x(), p->y(), p->z()});
}

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

/*
* Construct the k-d tree from these points. Note that this not consume or
* take ownership of the points.
Expand All @@ -681,6 +682,23 @@ void SeedFinderOrthogonal<external_spacepoint_t>::createSeeds(
* seeing what happens if we take them to be our middle spacepoint.
*/
for (const typename tree_t::pair_t &middle_p : tree) {
internal_sp_t &middle = *middle_p.second;
auto rM = middle.radius();

/*
* Cut: Ensure that the middle spacepoint lies within a valid r-region for
* middle points.
*/
if (m_config.useVariableMiddleSPRange) {
if (rM < rMiddleSPRange.min() || rM > rMiddleSPRange.max()) {
continue;
}
} else {
if (rM > m_config.rMaxMiddle || rM < m_config.rMinMiddle) {
continue;
}
}

processFromMiddleSP(tree, out_cont, middle_p);
}

Expand Down
8 changes: 8 additions & 0 deletions Core/include/Acts/Seeding/SeedFinderOrthogonalConfig.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,14 @@ struct SeedFinderOrthogonalConfig {
// which will make seeding very slow!
float rMin = 33 * Acts::UnitConstants::mm;

// radial range for middle SP
// variable range based on SP radius
bool useVariableMiddleSPRange = true;
float deltaRMiddleMinSPRange = 10. * Acts::UnitConstants::mm;
float deltaRMiddleMaxSPRange = 10. * Acts::UnitConstants::mm;
// range defined in vector for each z region
std::vector<std::vector<float>> rRangeMiddleSP;
// range defined by rMinMiddle and rMaxMiddle
float rMinMiddle = 60.f * Acts::UnitConstants::mm;
float rMaxMiddle = 120.f * Acts::UnitConstants::mm;

Expand Down
2 changes: 1 addition & 1 deletion Examples/Algorithms/TrackFinding/src/SeedingAlgorithm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ ActsExamples::ProcessCode ActsExamples::SeedingAlgorithm::execute(
auto finder = Acts::SeedFinder<SimSpacePoint>(m_cfg.seedFinderConfig,
m_cfg.seedFinderOptions);

/// variable middle SP radial region of interest
// variable middle SP radial region of interest
const Acts::Range1D<float> rMiddleSPRange(
std::floor(rRangeSPExtent.min(Acts::binR) / 2) * 2 +
m_cfg.seedFinderConfig.deltaRMiddleMinSPRange,
Expand Down
2 changes: 2 additions & 0 deletions Examples/Python/python/acts/examples/reconstruction.py
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,8 @@ def addSeeding(
interactionPointCut=seedFinderConfigArg.interactionPointCut,
deltaZMax=seedFinderConfigArg.deltaZMax,
maxPtScattering=seedFinderConfigArg.maxPtScattering,
rRangeMiddleSP=seedFinderConfigArg.rRangeMiddleSP,
useVariableMiddleSPRange=seedFinderConfigArg.useVariableMiddleSPRange,
seedConfirmation=seedFinderConfigArg.seedConfirmation,
centralSeedConfirmationRange=seedFinderConfigArg.centralSeedConfirmationRange,
forwardSeedConfirmationRange=seedFinderConfigArg.forwardSeedConfirmationRange,
Expand Down
12 changes: 9 additions & 3 deletions Examples/Python/src/TrackFinding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,12 @@ void addTrackFinding(Context& ctx) {
ACTS_PYTHON_MEMBER(skipPreviousTopSP);
ACTS_PYTHON_MEMBER(interactionPointCut);
ACTS_PYTHON_MEMBER(zBinsCustomLooping);
ACTS_PYTHON_MEMBER(rRangeMiddleSP);
ACTS_PYTHON_MEMBER(useVariableMiddleSPRange);
ACTS_PYTHON_MEMBER(deltaRMiddleMinSPRange);
ACTS_PYTHON_MEMBER(deltaRMiddleMaxSPRange);
ACTS_PYTHON_MEMBER(rRangeMiddleSP);
ACTS_PYTHON_MEMBER(rMinMiddle);
ACTS_PYTHON_MEMBER(rMaxMiddle);
ACTS_PYTHON_MEMBER(binSizeR);
ACTS_PYTHON_MEMBER(forceRadialSorting);
ACTS_PYTHON_MEMBER(seedConfirmation);
Expand Down Expand Up @@ -154,14 +156,18 @@ void addTrackFinding(Context& ctx) {
ACTS_PYTHON_MEMBER(deltaZMax);
ACTS_PYTHON_MEMBER(skipPreviousTopSP);
ACTS_PYTHON_MEMBER(interactionPointCut);
ACTS_PYTHON_MEMBER(rMinMiddle);
ACTS_PYTHON_MEMBER(rMaxMiddle);
ACTS_PYTHON_MEMBER(deltaPhiMax);
ACTS_PYTHON_MEMBER(highland);
ACTS_PYTHON_MEMBER(maxScatteringAngle2);
ACTS_PYTHON_MEMBER(pTPerHelixRadius);
ACTS_PYTHON_MEMBER(minHelixDiameter2);
ACTS_PYTHON_MEMBER(pT2perRadius);
ACTS_PYTHON_MEMBER(useVariableMiddleSPRange);
ACTS_PYTHON_MEMBER(deltaRMiddleMinSPRange);
ACTS_PYTHON_MEMBER(deltaRMiddleMaxSPRange);
ACTS_PYTHON_MEMBER(rRangeMiddleSP);
ACTS_PYTHON_MEMBER(rMinMiddle);
ACTS_PYTHON_MEMBER(rMaxMiddle);
ACTS_PYTHON_MEMBER(seedConfirmation);
ACTS_PYTHON_MEMBER(centralSeedConfirmationRange);
ACTS_PYTHON_MEMBER(forwardSeedConfirmationRange);
Expand Down