19 template <
typename SpacePo
int>
83 m_seedOutput =
nullptr;
94 template <
typename SpacePo
int>
95 template <
class RandIter>
99 iteration <= 0 ? m_iteration = 0 : m_iteration = iteration;
101 m_dzdrmin = m_dzdrmin0;
102 m_dzdrmax = m_dzdrmax0;
107 buildBeamFrameWork();
110 m_K = 2. / (300. * m_config.bFieldInZ);
112 m_ipt2K = m_ipt2 / (m_K * m_K);
114 m_ipt2C = m_ipt2 * m_COF;
116 m_COFK = m_COF * (m_K * m_K);
117 i_spforseed = l_spforseed.begin();
125 float irstep = 1. / r_rstep;
126 int irmax = r_size - 1;
128 for (
int i = 0;
i != m_nr; ++
i) {
138 RandIter sp = spBegin;
139 for (; sp != spEnd; ++sp) {
144 int ir = int(sps->
radius() * irstep);
148 r_Sorted[ir].push_back(sps);
153 if (r_map[ir] == 1) {
154 r_index[m_nr++] = ir;
166 template <
class SpacePo
int>
171 if ((m_state == 0) || (m_nlist != 0)) {
172 i_seede = l_seeds.begin();
181 i_seed = l_seeds.begin();
182 m_seed = m_seeds.begin();
188 template <
class SpacePo
int>
194 i_seede = l_seeds.begin();
198 i_seed = l_seeds.begin();
199 m_seed = m_seeds.begin();
206 template <
class SpacePo
int>
208 m_ptmin = fabs(m_ptmin);
210 if (m_ptmin < 100.) {
214 if (m_diversss < m_diver) {
215 m_diversss = m_diver;
217 if (m_divermax < m_diversss) {
218 m_divermax = m_diversss;
221 if (fabs(m_etamin) < .1) {
222 m_etamin = -m_etamax;
224 m_dzdrmax0 = 1. / tan(2. * atan(exp(-m_etamax)));
225 m_dzdrmin0 = 1. / tan(2. * atan(exp(-m_etamin)));
229 m_COF = 134 * .05 * 9.;
230 m_ipt = 1. / fabs(.9 * m_ptmin);
231 m_ipt2 = m_ipt * m_ipt;
235 m_nsaz = m_nsazv = m_nr = m_nrfz = 0;
239 r_size = int((r_rmax + .1) / r_rstep);
240 r_Sorted =
new std::list<Acts::Legacy::SPForSeed<SpacePoint>*>[r_size];
241 r_index =
new int[r_size];
242 r_map =
new int[r_size];
243 for (
int i = 0;
i != r_size; ++
i) {
250 const float pi2 = 2. * M_PI;
251 const int NFmax = 53;
252 const float sFmax = float(NFmax) / pi2;
253 const float m_sFmin = 100. / 60.;
263 }
else if (m_sF < m_sFmin) {
266 m_fNmax = int(pi2 * m_sF);
267 if (m_fNmax >= NFmax) {
274 for (
int i = 0;
i != 583; ++
i) {
281 for (
int f = 0;
f <= m_fNmax; ++
f) {
293 for (
int z = 0;
z != 11; ++
z) {
307 rfz_it[
a][3] = a + 1;
308 rfz_it[
a][4] = b + 1;
309 rfz_it[
a][5] = c + 1;
310 rfz_it[
a][6] = a - 1;
311 rfz_it[
a][7] = b - 1;
312 rfz_it[
a][8] = c - 1;
315 rfz_ib[
a][3] = a - 1;
316 rfz_ib[
a][4] = b - 1;
317 rfz_ib[
a][5] = c - 1;
321 rfz_it[
a][3] = a + 1;
322 rfz_it[
a][4] = b + 1;
323 rfz_it[
a][5] = c + 1;
327 rfz_ib[
a][3] = a + 1;
328 rfz_ib[
a][4] = b + 1;
329 rfz_ib[
a][5] = c + 1;
333 rfz_it[
a][3] = a - 1;
334 rfz_it[
a][4] = b - 1;
335 rfz_it[
a][5] = c - 1;
341 rfz_ib[
a][6] = a + 2;
342 rfz_ib[
a][7] = b + 2;
343 rfz_ib[
a][8] = c + 2;
346 rfz_ib[
a][6] = a - 2;
347 rfz_ib[
a][7] = b - 2;
348 rfz_ib[
a][8] = c - 2;
356 if (m_R ==
nullptr) {
357 m_R =
new float[m_maxsizeSP];
359 if (m_Tz ==
nullptr) {
360 m_Tz =
new float[m_maxsizeSP];
362 if (m_Er ==
nullptr) {
363 m_Er =
new float[m_maxsizeSP];
365 if (m_U ==
nullptr) {
366 m_U =
new float[m_maxsizeSP];
368 if (m_V ==
nullptr) {
369 m_V =
new float[m_maxsizeSP];
371 if (m_Zo ==
nullptr) {
372 m_Zo =
new float[m_maxsizeSP];
382 i_seed = l_seeds.begin();
383 i_seede = l_seeds.end();
389 template <
class SpacePo
int>
391 double bx = m_config.beamPosX;
392 double by = m_config.beamPosY;
393 double bz = m_config.beamPosZ;
403 template <
class SpacePo
int>
406 r[0] = float(sp->
x) - m_xbeam;
407 r[1] = float(sp->
y) - m_ybeam;
408 r[2] = float(sp->
z) - m_zbeam;
414 template <
class SpacePo
int>
416 const float pi2 = 2. * M_PI;
417 typename std::list<Acts::Legacy::SPForSeed<SpacePoint>*>::iterator
r, re;
423 if (m_iteration != 0) {
424 r_first =
static_cast<int>(m_config.SCT_rMin / r_rstep);
426 for (
int i = r_first;
i != r_size; ++
i) {
431 r = r_Sorted[
i].begin();
432 re = r_Sorted[
i].end();
438 if (m_iteration != 0) {
440 if (!(*r)->spacepoint->clusterList().second) {
446 }
else if (
i > 175) {
451 for (; r != re; ++
r) {
454 float F = (*r)->phi();
459 int f = int(F * m_sF);
462 }
else if (f > m_fNmax) {
494 rfz_Sorted[
n].push_back(*r);
495 if (rfz_map[n]++ == 0) {
496 rfz_index[m_nrfz++] =
n;
506 template <
class SpacePo
int>
508 for (
int i = 0;
i != m_nrfz; ++
i) {
509 int n = rfz_index[
i];
511 rfz_Sorted[
n].clear();
523 template <
class SpacePo
int>
533 const int ZI[11] = {5, 6, 7, 8, 9, 10, 4, 3, 2, 1, 0};
534 typename std::list<Acts::Legacy::SPForSeed<SpacePoint>*>::iterator rt[9],
535 rte[9],
rb[9], rbe[9];
540 for (
int f = m_fNmin;
f <= m_fNmax; ++
f) {
547 for (; z != 11; ++
z) {
548 int a =
f * 11 + ZI[
z];
549 if (rfz_map[a] == 0) {
553 for (
int i = 0;
i != rfz_b[
a]; ++
i) {
554 int an = rfz_ib[
a][
i];
556 if (rfz_map[an] == 0) {
560 rb[NB] = rfz_Sorted[an].begin();
561 rbe[NB++] = rfz_Sorted[an].end();
563 for (
int i = 0;
i != rfz_t[
a]; ++
i) {
564 int an = rfz_it[
a][
i];
566 if (rfz_map[an] == 0) {
570 rt[NT] = rfz_Sorted[an].begin();
571 rte[NT++] = rfz_Sorted[an].end();
573 production3Sp(rb, rbe, rt, rte, NB, NT, nseed);
587 template <
class SpacePo
int>
593 int NB,
int NT,
int& nseed) {
594 typename std::list<Acts::Legacy::SPForSeed<SpacePoint>*>::iterator
r0 = rb[0],
601 float ipt2K = m_ipt2K;
602 float ipt2C = m_ipt2C;
604 float imaxp = m_diver;
605 float imaxs = m_divermax;
611 for (; r0 != rbe[0]; ++
r0) {
613 m_mapOneSeeds.clear();
615 float R = (*r0)->radius();
617 const int sur0 = (*r0)->surface();
618 float X = (*r0)->x();
619 float Y = (*r0)->y();
620 float Z = (*r0)->z();
625 for (
int i = 0;
i != NB; ++
i) {
626 for (r = rb[
i]; r != rbe[
i]; ++
r) {
627 float Rb = (*r)->radius();
641 (m_iteration && (*r)->spacepoint->clusterList().second)) {
644 if ((*r)->surface() == sur0) {
648 float Tz = (Z - (*r)->z()) / dR;
649 float aTz = fabs(Tz);
651 if (aTz < m_dzdrmin || aTz > m_dzdrmax) {
657 float Zo = Z - R * Tz;
658 if (!isZCompatible(Zo)) {
662 if (++Nb == m_maxsizeSP) {
668 if ((Nb == 0) || Nb == m_maxsizeSP) {
675 for (
int i = 0;
i != NT; ++
i) {
676 for (r = rt[
i]; r != rte[
i]; ++
r) {
677 float Rt = (*r)->radius();
688 if ((*r)->surface() == sur0) {
692 float Tz = ((*r)->z() -
Z) / dR;
693 float aTz = fabs(Tz);
695 if (aTz < m_dzdrmin || aTz > m_dzdrmax) {
701 float Zo = Z - R * Tz;
702 if (!isZCompatible(Zo)) {
706 if (++Nt == m_maxsizeSP) {
713 if ((Nt - Nb) == 0) {
716 float covr0 = (*r0)->covr();
717 float covz0 = (*r0)->covz();
721 for (
int i = 0;
i != Nt; ++
i) {
724 float dx = sp->
x() -
X;
725 float dy = sp->
y() -
Y;
726 float dz = sp->
z() -
Z;
732 float x = dx * ax + dy * ay;
733 float y = dy * ax - dx * ay;
735 float r2 = 1. / (x * x + y *
y);
744 m_Zo[
i] = Z - R * tz;
748 m_Er[
i] = ((covz0 + sp->
covz()) + (tz * tz) * (covr0 + sp->
covr())) *
r2;
755 for (
int b = 0;
b != Nb; ++
b) {
758 float Rb2r = m_R[
b] * covr0;
759 float Rb2z = m_R[
b] * covz0;
764 float Tzb2 = (1. + Tzb * Tzb);
765 float sTzb2 = sqrt(Tzb2);
767 float CSA = Tzb2 * COFK;
769 float ICSA = Tzb2 * ipt2C;
771 if (m_SP[
b]->spacepoint->clusterList().second) {
775 for (
int t = Nb;
t != Nt; ++
t) {
776 float dT = ((Tzb - m_Tz[
t]) * (Tzb - m_Tz[
t]) - m_R[
t] * Rb2z -
778 (m_R[
t] * Rb2r) * ((Tzb + m_Tz[t]) * (Tzb + m_Tz[
t]));
783 float dU = m_U[
t] - Ub;
787 float A = (m_V[
t] - Vb) / dU;
788 float S2 = 1. + A *
A;
789 float B = Vb - A * Ub;
792 if (B2 > ipt2K * S2 || dT * S2 > B2 * CSA) {
796 float Im = fabs((A - B * R) * R);
802 m_R[
t] < m_R[
b] ? dr = m_R[
t] : dr = m_R[
b];
803 Im += fabs((Tzb - m_Tz[t]) / (dr * sTzb2));
805 m_CmSp.push_back(std::make_pair(B / sqrt(S2), m_SP[t]));
806 m_SP[
t]->setParam(Im);
809 if (!m_CmSp.empty()) {
810 newOneSeedWithCurvaturesComparison(m_SP[
b], (*r0), Zob);
814 nseed += m_fillOneSeeds;
815 if (nseed >= m_maxsize) {
827 template <
class SpacePo
int>
834 if (m_nOneSeeds < m_maxOneSize) {
835 m_OneSeeds[m_nOneSeeds].set(p1, p2, p3, z);
836 m_mapOneSeeds.insert(std::make_pair(q, m_OneSeeds + m_nOneSeeds));
847 typename std::multimap<
849 m_mapOneSeeds.rbegin();
851 if ((*l).first <= q) {
856 s->
set(p1, p2, p3, z);
858 typename std::multimap<
860 m_mapOneSeeds.insert(std::make_pair(q, s));
862 for (++i; i != m_mapOneSeeds.end(); ++
i) {
863 if ((*i).second == s) {
864 m_mapOneSeeds.erase(i);
874 template <
class SpacePo
int>
880 const float dC = .00003;
887 typename std::vector<
888 std::pair<float, Acts::Legacy::SPForSeed<SpacePoint>*>>::iterator
j,
889 jn,
i = m_CmSp.begin(), ie = m_CmSp.end();
892 for (; i != ie; ++
i) {
893 float u = (*i).second->param();
894 float Im = (*i).second->param();
896 bool pixt = !(*i).second->spacepoint->clusterList().second;
898 const int Sui = (*i).second->surface();
899 float Ri = (*i).second->radius();
900 float Ci1 = (*i).first - dC;
901 float Ci2 = (*i).first + dC;
912 for (j = jn; j != ie; ++
j) {
916 if ((*j).first < Ci1) {
921 if ((*j).first > Ci2) {
924 if ((*j).second->surface() == Sui) {
928 float Rj = (*j).second->radius();
929 if (fabs(Rj - Ri) < m_drmin) {
936 }
else if (Rj < Rmi) {
944 if ((Rma - Rmi) > 20.) {
961 if (u > 0. || (u > ub && u > u0 && u > (*i).second->quality())) {
970 if (!pixb && Im > m_diversss && u > Im - 500.) {
974 newOneSeed(SPb, SP0, (*i).second, Zob, u);
982 template <
class SpacePo
int>
986 typename std::multimap<float, Acts::Legacy::InternalSeed<SpacePoint>
987 *>::iterator lf = m_mapOneSeeds.begin(),
988 l = m_mapOneSeeds.begin(),
989 le = m_mapOneSeeds.end();
997 for (; l != le; ++l) {
998 float w = (*l).first;
1000 if (l != lf && s->
spacepoint0()->radius() < 43. && w > -200.) {
1007 if (i_seede != l_seeds.end()) {
1012 l_seeds.push_back(s);
1013 i_seede = l_seeds.end();
1016 if (s->
spacepoint0()->spacepoint->clusterList().second) {
1018 }
else if (s->
spacepoint1()->spacepoint->clusterList().second) {
1020 }
else if (s->
spacepoint2()->spacepoint->clusterList().second) {
1024 m_seeds.insert(std::make_pair(w, s));