13 template <
typename external_spacepo
int_t>
17 : m_cfg(config), m_experimentCuts(expCuts) {}
22 template <
typename external_spacepo
int_t>
24 float, std::unique_ptr<const InternalSeed<external_spacepoint_t>>>>
29 std::vector<float>& invHelixDiameterVec,
30 std::vector<float>& impactParametersVec,
float zOrigin)
const {
32 float, std::unique_ptr<const InternalSeed<external_spacepoint_t>>>>
35 for (
size_t i = 0; i < topSpVec.size(); i++) {
39 std::vector<float> compatibleSeedR;
41 float invHelixDiameter = invHelixDiameterVec[i];
42 float lowerLimitCurv = invHelixDiameter - m_cfg.deltaInvHelixDiameter;
43 float upperLimitCurv = invHelixDiameter + m_cfg.deltaInvHelixDiameter;
44 float currentTop_r = topSpVec[i]->radius();
45 float impact = impactParametersVec[i];
47 float weight = -(impact * m_cfg.impactWeightFactor);
48 for (
size_t j = 0; j < topSpVec.size(); j++) {
53 float otherTop_r = topSpVec[j]->radius();
54 float deltaR = currentTop_r - otherTop_r;
55 if (
std::abs(deltaR) < m_cfg.deltaRMin) {
61 if (invHelixDiameterVec[j] < lowerLimitCurv) {
64 if (invHelixDiameterVec[j] > upperLimitCurv) {
67 bool newCompSeed =
true;
68 for (
float previousDiameter : compatibleSeedR) {
73 if (
std::abs(previousDiameter - otherTop_r) < m_cfg.deltaRMin) {
79 compatibleSeedR.push_back(otherTop_r);
80 weight += m_cfg.compatSeedWeight;
82 if (compatibleSeedR.size() >= m_cfg.compatSeedLimit) {
87 if (m_experimentCuts !=
nullptr) {
89 weight += m_experimentCuts->seedWeight(bottomSP, middleSP, *topSpVec[i]);
91 if (!m_experimentCuts->singleSeedCut(weight, bottomSP, middleSP,
96 selectedSeeds.push_back(std::make_pair(
98 bottomSP, middleSP, *topSpVec[i], zOrigin)));
100 return selectedSeeds;
104 template <
typename external_spacepo
int_t>
112 std::sort((seedsPerSpM.begin()), (seedsPerSpM.end()),
114 external_spacepoint_t>>>& i1,
116 external_spacepoint_t>>>& i2) {
117 if (i1.first != i2.first) {
118 return i1.first > i2.first;
124 for (
int i = 0; i < 3; i++) {
125 seed1_sum += pow(i1.second->sp[i]->sp().y(), 2) +
126 pow(i1.second->sp[i]->sp().z(), 2);
127 seed2_sum += pow(i2.second->sp[i]->sp().y(), 2) +
128 pow(i2.second->sp[i]->sp().z(), 2);
130 return seed1_sum > seed2_sum;
133 if (m_experimentCuts !=
nullptr) {
134 seedsPerSpM = m_experimentCuts->cutPerMiddleSP(std::move(seedsPerSpM));
136 unsigned int maxSeeds = seedsPerSpM.size();
138 if (maxSeeds > m_cfg.maxSeedsPerSpM) {
139 maxSeeds = m_cfg.maxSeedsPerSpM + 1;
141 auto itBegin = seedsPerSpM.begin();
142 auto it = seedsPerSpM.begin();
146 for (;
it < itBegin + maxSeeds; ++
it) {
148 (*it).second->sp[0]->sp(), (*it).second->sp[1]->sp(),
149 (*it).second->sp[2]->sp(), (*it).second->z()));