Skip to content

Commit

Permalink
feat: minimum number of compatible top SPs to trigger filterSeeds_2Sp…
Browse files Browse the repository at this point in the history
…Fixed (#1930)

This is intended to reduce the number of filter iterations by setting a minimum number of compatible top SP candidates that are necessary to run the seed confirmation.
It should not affect the physics performance
  • Loading branch information
LuisFelipeCoelho committed Mar 15, 2023
1 parent 58bb693 commit c9d32bd
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 5 deletions.
4 changes: 4 additions & 0 deletions Core/include/Acts/Seeding/SeedFilter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ struct SeedFilterState {
float zOrigin = 0;
// number of minimum top SPs in seed confirmation
size_t nTopSeedConf = 0;
// radius of bottom component of seed that is used to define the number of
// compatible top required
float rMaxSeedConf =
std::numeric_limits<float>::max(); // Acts::UnitConstants::mm
// number of high quality seeds in seed confirmation
std::size_t numQualitySeeds = 0;
// number of seeds that did not pass the quality confirmation but were still
Expand Down
18 changes: 17 additions & 1 deletion Core/include/Acts/Seeding/SeedFinder.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,9 @@ void SeedFinder<external_spacepoint_t, platform_t>::createSeedsForGroup(
seedFilterState.nTopSeedConf = rM > seedConfRange.rMaxSeedConf
? seedConfRange.nTopForLargeR
: seedConfRange.nTopForSmallR;
// set max bottom radius for seed confirmation
seedFilterState.rMaxSeedConf = seedConfRange.rMaxSeedConf;
// continue if number of top SPs is smaller than minimum
if (state.compatTopSP.size() < seedFilterState.nTopSeedConf) {
continue;
}
Expand Down Expand Up @@ -368,6 +371,18 @@ void SeedFinder<external_spacepoint_t, platform_t>::filterCandidates(
rotationTermsUVtoXY[1] = spM.y() * sinTheta / spM.radius();
}

// minimum number of compatible top SPs to trigger the filter for a certain
// middle bottom pair if seedConfirmation is false we always ask for at
// least one compatible top to trigger the filter
size_t minCompatibleTopSPs = 2;
if (!m_config.seedConfirmation or
state.compatBottomSP[b]->radius() > seedFilterState.rMaxSeedConf) {
minCompatibleTopSPs = 1;
}
if (m_config.seedConfirmation and seedFilterState.numQualitySeeds) {
minCompatibleTopSPs++;
}

for (size_t index_t = t0; index_t < numTopSP; index_t++) {
const std::size_t& t = sorted_tops[index_t];

Expand Down Expand Up @@ -587,7 +602,8 @@ void SeedFinder<external_spacepoint_t, platform_t>::filterCandidates(
state.ptVec.push_back(pT);
} // loop on tops

if (state.topSpVec.empty()) {
// continue if number of top SPs is smaller than minimum required for filter
if (state.topSpVec.size() < minCompatibleTopSPs) {
continue;
}

Expand Down
26 changes: 22 additions & 4 deletions Core/include/Acts/Seeding/SeedFinderOrthogonal.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,9 @@ void SeedFinderOrthogonal<external_spacepoint_t>::filterCandidates(
seedFilterState.nTopSeedConf = rM > seedConfRange.rMaxSeedConf
? seedConfRange.nTopForLargeR
: seedConfRange.nTopForSmallR;
// set max bottom radius for seed confirmation
seedFilterState.rMaxSeedConf = seedConfRange.rMaxSeedConf;
// continue if number of top SPs is smaller than minimum
if (top.size() < seedFilterState.nTopSeedConf) {
return;
}
Expand Down Expand Up @@ -331,6 +334,18 @@ void SeedFinderOrthogonal<external_spacepoint_t>::filterCandidates(
// multiply the squared sigma onto the squared scattering
scatteringInRegion2 *= m_config.sigmaScattering * m_config.sigmaScattering;

// minimum number of compatible top SPs to trigger the filter for a certain
// middle bottom pair if seedConfirmation is false we always ask for at
// least one compatible top to trigger the filter
size_t minCompatibleTopSPs = 2;
if (!m_config.seedConfirmation or
bottom[b]->radius() > seedFilterState.rMaxSeedConf) {
minCompatibleTopSPs = 1;
}
if (m_config.seedConfirmation and seedFilterState.numQualitySeeds) {
minCompatibleTopSPs++;
}

// clear all vectors used in each inner for loop
top_valid.clear();
curvatures.clear();
Expand Down Expand Up @@ -431,11 +446,14 @@ void SeedFinderOrthogonal<external_spacepoint_t>::filterCandidates(
}
}

if (!top_valid.empty()) {
m_config.seedFilter->filterSeeds_2SpFixed(
*bottom[b], middle, top_valid, curvatures, impactParameters,
seedFilterState, candidates_collector);
// continue if number of top SPs is smaller than minimum required for filter
if (top.size() < minCompatibleTopSPs) {
continue;
}
m_config.seedFilter->filterSeeds_2SpFixed(
*bottom[b], middle, top_valid, curvatures, impactParameters,
seedFilterState, candidates_collector);

} // loop on bottoms
}

Expand Down

0 comments on commit c9d32bd

Please sign in to comment.