19 template <
typename SpacePo
int>
94 template <
class SpacePo
int>
108 for (i_seed = l_seeds.begin(); i_seed != l_seeds.end(); ++i_seed) {
113 i_spforseed = l_spforseed.begin();
114 for (; i_spforseed != l_spforseed.end(); ++i_spforseed) {
150 template <
typename SpacePo
int>
151 template <
class RandIter>
155 iteration <= 0 ? m_iteration = 0 : m_iteration = iteration;
157 m_dzdrmin = m_dzdrmin0;
158 m_dzdrmax = m_dzdrmax0;
163 buildBeamFrameWork();
166 m_K = 2. / (300. * m_config.bFieldInZ);
168 m_ipt2K = m_ipt2 / (m_K * m_K);
170 m_ipt2C = m_ipt2 * m_COF;
172 m_COFK = m_COF * (m_K * m_K);
173 i_spforseed = l_spforseed.begin();
181 float irstep = 1. / r_rstep;
182 int irmax = r_size - 1;
184 for (
int i = 0; i != m_nr; ++i) {
194 RandIter
sp = spBegin;
195 for (; sp != spEnd; ++
sp) {
204 r_Sorted[ir].push_back(sps);
209 if (r_map[ir] == 1) {
210 r_index[m_nr++] = ir;
222 template <
class SpacePo
int>
227 if ((m_state == 0) || m_nlist) {
228 i_seede = l_seeds.begin();
237 i_seed = l_seeds.begin();
238 m_seed = m_seeds.begin();
244 template <
class SpacePo
int>
250 i_seede = l_seeds.begin();
254 i_seed = l_seeds.begin();
255 m_seed = m_seeds.begin();
262 template <
class SpacePo
int>
264 m_ptmin = fabs(m_ptmin);
266 if (m_ptmin < 100.) {
270 if (m_diversss < m_diver) {
271 m_diversss = m_diver;
273 if (m_divermax < m_diversss) {
274 m_divermax = m_diversss;
277 if (fabs(m_etamin) < .1) {
278 m_etamin = -m_etamax;
280 m_dzdrmax0 = 1. / tan(2. * atan(exp(-m_etamax)));
281 m_dzdrmin0 = 1. / tan(2. * atan(exp(-m_etamin)));
285 m_COF = 134 * .05 * 9.;
286 m_ipt = 1. / fabs(.9 * m_ptmin);
287 m_ipt2 = m_ipt * m_ipt;
291 m_nsaz = m_nsazv = m_nr = m_nrfz = 0;
295 r_size =
int((r_rmax + .1) / r_rstep);
296 r_Sorted =
new std::list<Acts::Legacy::SPForSeed<SpacePoint>*>[r_size];
297 r_index =
new int[r_size];
298 r_map =
new int[r_size];
299 for (
int i = 0; i != r_size; ++i) {
307 const int NFmax = 53;
308 const float sFmax = float(NFmax) /
pi2;
309 const float m_sFmin = 100. / 60.;
319 }
else if (m_sF < m_sFmin) {
322 m_fNmax =
int(pi2 * m_sF);
323 if (m_fNmax >= NFmax) {
330 for (
int i = 0; i != 583; ++i) {
337 for (
int f = 0;
f <= m_fNmax; ++
f) {
349 for (
int z = 0;
z != 11; ++
z) {
363 rfz_it[
a][3] = a + 1;
364 rfz_it[
a][4] = b + 1;
365 rfz_it[
a][5] = c + 1;
366 rfz_it[
a][6] = a - 1;
367 rfz_it[
a][7] = b - 1;
368 rfz_it[
a][8] = c - 1;
371 rfz_ib[
a][3] = a - 1;
372 rfz_ib[
a][4] = b - 1;
373 rfz_ib[
a][5] = c - 1;
377 rfz_it[
a][3] = a + 1;
378 rfz_it[
a][4] = b + 1;
379 rfz_it[
a][5] = c + 1;
383 rfz_ib[
a][3] = a + 1;
384 rfz_ib[
a][4] = b + 1;
385 rfz_ib[
a][5] = c + 1;
389 rfz_it[
a][3] = a - 1;
390 rfz_it[
a][4] = b - 1;
391 rfz_it[
a][5] = c - 1;
397 rfz_ib[
a][6] = a + 2;
398 rfz_ib[
a][7] = b + 2;
399 rfz_ib[
a][8] = c + 2;
402 rfz_ib[
a][6] = a - 2;
403 rfz_ib[
a][7] = b - 2;
404 rfz_ib[
a][8] = c - 2;
412 if (m_R ==
nullptr) {
413 m_R =
new float[m_maxsizeSP];
415 if (m_Tz ==
nullptr) {
416 m_Tz =
new float[m_maxsizeSP];
418 if (m_Er ==
nullptr) {
419 m_Er =
new float[m_maxsizeSP];
421 if (m_U ==
nullptr) {
422 m_U =
new float[m_maxsizeSP];
424 if (m_V ==
nullptr) {
425 m_V =
new float[m_maxsizeSP];
427 if (m_Zo ==
nullptr) {
428 m_Zo =
new float[m_maxsizeSP];
438 i_seed = l_seeds.begin();
439 i_seede = l_seeds.end();
445 template <
class SpacePo
int>
447 double bx = m_config.beamPosX;
448 double by = m_config.beamPosY;
449 double bz = m_config.beamPosZ;
459 template <
class SpacePo
int>
462 r[0] = float(sp->
x) - m_xbeam;
463 r[1] = float(sp->
y) - m_ybeam;
464 r[2] = float(sp->
z) - m_zbeam;
470 template <
class SpacePo
int>
473 typename std::list<Acts::Legacy::SPForSeed<SpacePoint>*>::iterator
r, re;
480 r_first = m_config.SCT_rMin / r_rstep;
482 for (
int i = r_first; i != r_size; ++i) {
487 r = r_Sorted[i].begin();
488 re = r_Sorted[i].end();
496 if (!(*r)->spacepoint->clusterList().second) {
502 }
else if (i > 175) {
507 for (; r != re; ++
r) {
510 float F = (*r)->phi();
515 int f =
int(F * m_sF);
518 }
else if (f > m_fNmax) {
533 : Z < 2500. ? z = 9 : z = 10;
540 : Z > -1400. ? z = 2 : Z > -2500. ? z = 1 : z = 0;
549 rfz_Sorted[
n].push_back(*r);
551 rfz_index[m_nrfz++] =
n;
561 template <
class SpacePo
int>
563 for (
int i = 0; i != m_nrfz; ++i) {
564 int n = rfz_index[i];
566 rfz_Sorted[
n].clear();
578 template <
class SpacePo
int>
588 const int ZI[11] = {5, 6, 7, 8, 9, 10, 4, 3, 2, 1, 0};
589 typename std::list<Acts::Legacy::SPForSeed<SpacePoint>*>::iterator rt[9],
590 rte[9],
rb[9], rbe[9];
595 for (
int f = m_fNmin;
f <= m_fNmax; ++
f) {
602 for (; z != 11; ++
z) {
603 int a =
f * 11 + ZI[
z];
608 for (
int i = 0; i != rfz_b[
a]; ++i) {
609 int an = rfz_ib[
a][i];
615 rb[NB] = rfz_Sorted[
an].begin();
616 rbe[NB++] = rfz_Sorted[
an].end();
618 for (
int i = 0; i != rfz_t[
a]; ++i) {
619 int an = rfz_it[
a][i];
625 rt[NT] = rfz_Sorted[
an].begin();
626 rte[NT++] = rfz_Sorted[
an].end();
628 production3Sp(rb, rbe, rt, rte, NB, NT, nseed);
642 template <
class SpacePo
int>
648 int NB,
int NT,
int& nseed) {
649 typename std::list<Acts::Legacy::SPForSeed<SpacePoint>*>::iterator r0 = rb[0],
656 float ipt2K = m_ipt2K;
657 float ipt2C = m_ipt2C;
659 float imaxp = m_diver;
660 float imaxs = m_divermax;
666 for (; r0 != rbe[0]; ++r0) {
668 m_mapOneSeeds.clear();
670 float R = (*r0)->radius();
672 const int sur0 = (*r0)->surface();
673 float X = (*r0)->x();
674 float Y = (*r0)->y();
675 float Z = (*r0)->z();
680 for (
int i = 0; i != NB; ++i) {
681 for (r = rb[i]; r != rbe[i]; ++
r) {
682 float Rb = (*r)->radius();
696 (m_iteration && (*r)->spacepoint->clusterList().second)) {
699 if ((*r)->surface() == sur0) {
703 float Tz = (Z - (*r)->z()) / dR;
704 float aTz = fabs(Tz);
706 if (aTz < m_dzdrmin || aTz > m_dzdrmax) {
712 float Zo = Z - R * Tz;
713 if (!isZCompatible(Zo)) {
717 if (++Nb == m_maxsizeSP) {
723 if ((Nb == 0) || Nb == m_maxsizeSP) {
730 for (
int i = 0; i != NT; ++i) {
731 for (r = rt[i]; r != rte[i]; ++
r) {
732 float Rt = (*r)->radius();
743 if ((*r)->surface() == sur0) {
747 float Tz = ((*r)->z() -
Z) / dR;
748 float aTz = fabs(Tz);
750 if (aTz < m_dzdrmin || aTz > m_dzdrmax) {
756 float Zo = Z - R * Tz;
757 if (!isZCompatible(Zo)) {
761 if (++Nt == m_maxsizeSP) {
768 if ((Nt - Nb) == 0) {
771 float covr0 = (*r0)->covr();
772 float covz0 = (*r0)->covz();
776 for (
int i = 0; i != Nt; ++i) {
779 float dx = sp->
x() -
X;
780 float dy = sp->
y() -
Y;
781 float dz = sp->
z() -
Z;
787 float x = dx * ax + dy * ay;
788 float y = dy * ax - dx * ay;
790 float r2 = 1. / (x * x + y *
y);
799 m_Zo[i] = Z - R * tz;
803 m_Er[i] = ((covz0 + sp->
covz()) + (tz * tz) * (covr0 + sp->
covr())) *
r2;
810 for (
int b = 0;
b != Nb; ++
b) {
813 float Rb2r = m_R[
b] * covr0;
814 float Rb2z = m_R[
b] * covz0;
819 float Tzb2 = (1. + Tzb * Tzb);
820 float sTzb2 = sqrt(Tzb2);
822 float CSA = Tzb2 * COFK;
824 float ICSA = Tzb2 * ipt2C;
826 if (m_SP[
b]->spacepoint->clusterList().second) {
830 for (
int t = Nb;
t != Nt; ++
t) {
831 float dT = ((Tzb - m_Tz[
t]) * (Tzb - m_Tz[
t]) - m_R[
t] * Rb2z -
833 (m_R[
t] * Rb2r) * ((Tzb + m_Tz[t]) * (Tzb + m_Tz[
t]));
838 float dU = m_U[
t] - Ub;
842 float A = (m_V[
t] - Vb) / dU;
843 float S2 = 1. + A *
A;
844 float B = Vb - A * Ub;
847 if (B2 > ipt2K * S2 || dT * S2 > B2 * CSA) {
851 float Im = fabs((A - B * R) * R);
857 m_R[
t] < m_R[
b] ? dr = m_R[
t] : dr = m_R[
b];
858 Im += fabs((Tzb - m_Tz[t]) / (dr * sTzb2));
860 m_CmSp.push_back(std::make_pair(B / sqrt(S2), m_SP[t]));
861 m_SP[
t]->setParam(Im);
864 if (!m_CmSp.empty()) {
865 newOneSeedWithCurvaturesComparison(m_SP[
b], (*r0), Zob);
869 nseed += m_fillOneSeeds;
870 if (nseed >= m_maxsize) {
882 template <
class SpacePo
int>
889 if (m_nOneSeeds < m_maxOneSize) {
890 m_OneSeeds[m_nOneSeeds].set(p1, p2, p3, z);
891 m_mapOneSeeds.insert(std::make_pair(q, m_OneSeeds + m_nOneSeeds));
902 typename std::multimap<
904 m_mapOneSeeds.rbegin();
906 if ((*l).first <= q) {
911 s->
set(p1, p2, p3, z);
913 typename std::multimap<
915 m_mapOneSeeds.insert(std::make_pair(q, s));
917 for (++i; i != m_mapOneSeeds.end(); ++i) {
918 if ((*i).second == s) {
919 m_mapOneSeeds.erase(i);
929 template <
class SpacePo
int>
935 const float dC = .00003;
942 typename std::vector<
943 std::pair<float, Acts::Legacy::SPForSeed<SpacePoint>*>>::iterator j,
944 jn, i = m_CmSp.begin(), ie = m_CmSp.end();
947 for (; i != ie; ++i) {
948 float u = (*i).second->param();
949 float Im = (*i).second->param();
951 bool pixt = !(*i).second->spacepoint->clusterList().second;
953 const int Sui = (*i).second->surface();
954 float Ri = (*i).second->radius();
955 float Ci1 = (*i).first - dC;
956 float Ci2 = (*i).first + dC;
967 for (j = jn; j != ie; ++j) {
971 if ((*j).first < Ci1) {
976 if ((*j).first > Ci2) {
979 if ((*j).second->surface() == Sui) {
983 float Rj = (*j).second->radius();
984 if (fabs(Rj - Ri) < m_drmin) {
991 }
else if (Rj < Rmi) {
999 if ((Rma - Rmi) > 20.) {
1016 if (u > 0. || (u > ub && u > u0 && u > (*i).second->quality())) {
1025 if (!pixb && Im > m_diversss && u > Im - 500.) {
1029 newOneSeed(SPb, SP0, (*i).second, Zob, u);
1037 template <
class SpacePo
int>
1041 typename std::multimap<float, Acts::Legacy::InternalSeed<SpacePoint>
1042 *>::iterator lf = m_mapOneSeeds.begin(),
1043 l = m_mapOneSeeds.begin(),
1044 le = m_mapOneSeeds.end();
1052 for (; l !=
le; ++l) {
1053 float w = (*l).first;
1055 if (l != lf && s->
spacepoint0()->radius() < 43. && w > -200.) {
1062 if (i_seede != l_seeds.end()) {
1067 l_seeds.push_back(s);
1068 i_seede = l_seeds.end();
1071 if (s->
spacepoint0()->spacepoint->clusterList().second) {
1073 }
else if (s->
spacepoint1()->spacepoint->clusterList().second) {
1075 }
else if (s->
spacepoint2()->spacepoint->clusterList().second) {
1079 m_seeds.insert(std::make_pair(w, s));