15 template <
typename external_spacepo
int_t>
19 :
m_cfg(config), m_experimentCuts(expCuts) {
21 throw std::runtime_error(
22 "SeedFilterConfig not in ACTS internal units in SeedFilter");
28 template <
typename external_spacepo
int_t>
35 const std::vector<float>& invHelixDiameterVec,
36 const std::vector<float>& impactParametersVec,
39 candidates_collector)
const {
42 if (
m_cfg.seedConfirmation) {
45 (bottomSP.
z() >
m_cfg.centralSeedConfirmationRange.zMaxSeedConf ||
46 bottomSP.
z() <
m_cfg.centralSeedConfirmationRange.zMinSeedConf)
47 ?
m_cfg.forwardSeedConfirmationRange
48 :
m_cfg.centralSeedConfirmationRange;
57 size_t maxWeightSeedIndex = 0;
58 bool maxWeightSeed =
false;
59 float weightMax = std::numeric_limits<float>::lowest();
60 float zOrigin = seedFilterState.
zOrigin;
63 std::vector<size_t> topSPIndexVec(topSpVec.size());
64 for (std::size_t
i(0);
i < topSPIndexVec.size(); ++
i) {
68 if (topSpVec.size() > 2) {
70 std::sort(topSPIndexVec.begin(), topSPIndexVec.end(),
71 [&invHelixDiameterVec](
const size_t i1,
const size_t i2) {
72 return invHelixDiameterVec[i1] < invHelixDiameterVec[i2];
77 std::vector<float> compatibleSeedR;
78 compatibleSeedR.reserve(
m_cfg.compatSeedLimit);
80 size_t beginCompTopIndex = 0;
82 for (
const std::size_t topSPIndex : topSPIndexVec) {
85 compatibleSeedR.clear();
87 float invHelixDiameter = invHelixDiameterVec[topSPIndex];
88 float lowerLimitCurv = invHelixDiameter -
m_cfg.deltaInvHelixDiameter;
89 float upperLimitCurv = invHelixDiameter +
m_cfg.deltaInvHelixDiameter;
92 m_cfg.useDeltaRorTopRadius
93 ? spacePointData.
deltaR(topSpVec[topSPIndex]->
index())
94 : topSpVec[topSPIndex]->radius();
95 float impact = impactParametersVec[topSPIndex];
97 float weight = -(impact *
m_cfg.impactWeightFactor);
100 for (
size_t variableCompTopIndex = beginCompTopIndex;
101 variableCompTopIndex < topSPIndexVec.size(); variableCompTopIndex++) {
102 size_t compatibleTopSPIndex = topSPIndexVec[variableCompTopIndex];
103 if (compatibleTopSPIndex == topSPIndex) {
108 m_cfg.useDeltaRorTopRadius
109 ? spacePointData.
deltaR(topSpVec[compatibleTopSPIndex]->
index())
110 : topSpVec[compatibleTopSPIndex]->radius();
113 if (invHelixDiameterVec[compatibleTopSPIndex] < lowerLimitCurv) {
115 beginCompTopIndex = variableCompTopIndex + 1;
118 if (invHelixDiameterVec[compatibleTopSPIndex] > upperLimitCurv) {
123 float deltaR = currentTopR - otherTopR;
124 if (std::abs(deltaR) <
m_cfg.deltaRMin) {
127 bool newCompSeed =
true;
128 for (
const float previousDiameter : compatibleSeedR) {
133 if (std::abs(previousDiameter - otherTopR) <
m_cfg.deltaRMin) {
139 compatibleSeedR.push_back(otherTopR);
140 weight +=
m_cfg.compatSeedWeight;
142 if (compatibleSeedR.size() >=
m_cfg.compatSeedLimit) {
147 if (m_experimentCuts !=
nullptr) {
149 weight += m_experimentCuts->seedWeight(bottomSP, middleSP,
150 *topSpVec[topSPIndex]);
152 if (!m_experimentCuts->singleSeedCut(weight, bottomSP, middleSP,
153 *topSpVec[topSPIndex])) {
160 if (compatibleSeedR.size() >
m_cfg.numSeedIncrement) {
161 weight +=
m_cfg.seedWeightIncrement;
164 if (
m_cfg.seedConfirmation) {
170 compatibleSeedR.size() + 1 - seedFilterState.
nTopSeedConf;
171 if (deltaSeedConf < 0 ||
178 if (seedRangeCuts and deltaSeedConf == 0 and
184 weight += -(std::abs(zOrigin) *
m_cfg.zOriginWeightFactor) +
185 m_cfg.compatSeedWeight;
191 weight < spacePointData.
quality(topSpVec[topSPIndex]->index())) {
195 if (deltaSeedConf > 0) {
202 candidates_collector.push(bottomSP, middleSP, *topSpVec[topSPIndex],
203 weight, zOrigin,
true);
209 }
else if (weight > weightMax) {
212 maxWeightSeedIndex = topSPIndex;
213 maxWeightSeed =
true;
220 candidates_collector.push(bottomSP, middleSP, *topSpVec[topSPIndex],
221 weight, zOrigin,
false);
230 if (
m_cfg.seedConfirmation and maxWeightSeed and
235 candidates_collector.push(bottomSP, middleSP, *topSpVec[maxWeightSeedIndex],
236 weightMax, zOrigin,
false);
246 template <
typename external_spacepo
int_t>
250 candidates_collector,
251 const std::size_t numQualitySeeds,
257 auto extended_collection = candidates_collector.storage();
258 filterSeeds_1SpFixed(spacePointData, extended_collection, numQualitySeeds,
262 template <
typename external_spacepo
int_t>
268 const std::size_t numQualitySeeds,
271 if (m_experimentCuts !=
nullptr) {
272 candidates = m_experimentCuts->cutPerMiddleSP(
std::move(candidates));
275 unsigned int maxSeeds = candidates.size();
277 if (maxSeeds >
m_cfg.maxSeedsPerSpM) {
278 maxSeeds =
m_cfg.maxSeedsPerSpM + 1;
284 unsigned int numTotalSeeds = 0;
285 for (
const auto& [bottom, medium, top, bestSeedQuality, zOrigin,
286 qualitySeed] : candidates) {
288 if (numTotalSeeds >= maxSeeds) {
292 if (
m_cfg.seedConfirmation) {
294 if (numQualitySeeds > 0 and not qualitySeed) {
297 if (bestSeedQuality < spacePointData.
quality(bottom->index()) and
298 bestSeedQuality < spacePointData.
quality(medium->index()) and
299 bestSeedQuality < spacePointData.
quality(top->index())) {
305 spacePointData.
setQuality(bottom->index(), bestSeedQuality);
306 spacePointData.
setQuality(medium->index(), bestSeedQuality);
307 spacePointData.
setQuality(top->index(), bestSeedQuality);
310 zOrigin, bestSeedQuality};