38 : base_class(t, n, p),
57 StatusCode
sc = AlgTool::initialize();
86 m_treeName = (std::string(
"SeedTree_")+name());
91 m_outputTree->Branch(
"eventNumber", &m_eventNumber,
"eventNumber/L");
132 return AlgTool::finalize();
145 if (not data.initialized)
150 data.trigger =
false;
152 data.iteration = iteration;
156 data.checketa = data.dzdrmin > 1.;
166 data.i_ITkSpacePointForSeed = data.l_ITkSpacePointForSeed.begin();
183 if (!prd_to_track_map.
isValid()) {
186 prd_to_track_map_cptr = prd_to_track_map.
cptr();
190 if (spacepointsStrip.
isValid()) {
203 int radiusBin =
static_cast<int>(sps->
radius() * oneOverBinSizeR);
204 if (radiusBin > maxBinR)
207 data.r_ITkSorted[radiusBin].push_back(sps);
209 ++data.r_map[radiusBin];
211 if (data.r_map[radiusBin] == 1)
212 data.r_index[data.nr++] = radiusBin;
221 if (spacepointsOverlap.
isValid()) {
233 int radiusBin =
static_cast<int>(sps->
radius() * oneOverBinSizeR);
234 if (radiusBin > maxBinR)
237 data.r_ITkSorted[radiusBin].push_back(sps);
239 ++data.r_map[radiusBin];
241 if (data.r_map[radiusBin] == 1)
242 data.r_index[data.nr++] = radiusBin;
261 if (!prd_to_track_map.
isValid()) {
264 prd_to_track_map_cptr = prd_to_track_map.
cptr();
268 if (spacepointsPixel.
isValid()) {
288 int radiusBin =
static_cast<int>(sps->
radius() * oneOverBinSizeR);
290 if (radiusBin > maxBinR)
294 data.r_ITkSorted[radiusBin].push_back(sps);
296 ++data.r_map[radiusBin];
299 if (data.r_map[radiusBin] == 1)
300 data.r_index[data.nr++] = radiusBin;
314 const std::vector<IdentifierHash> &vPixel,
const std::vector<IdentifierHash> &vStrip)
const
319 if (not data.initialized)
323 data.trigger =
false;
328 data.checketa =
false;
335 data.i_ITkSpacePointForSeed = data.l_ITkSpacePointForSeed.begin();
342 if (!prd_to_track_map.
isValid())
346 prd_to_track_map_cptr = prd_to_track_map.
cptr();
351 if (
m_pixel && !vPixel.empty())
355 if (spacepointsPixel.
isValid())
363 const auto *w = spacepointsPixel->indexFindPtr(l);
372 int ir =
static_cast<int>(sps->
radius() * oneOverBinSizeR);
375 data.r_ITkSorted[
ir].push_back(sps);
377 if (data.r_map[
ir] == 1)
378 data.r_index[data.nr++] =
ir;
387 if (
m_strip && !vStrip.empty())
392 if (spacepointsStrip.
isValid())
399 const auto *w = spacepointsStrip->indexFindPtr(l);
408 int ir =
static_cast<int>(sps->
radius() * oneOverBinSizeR);
411 data.r_ITkSorted[
ir].push_back(sps);
413 if (data.r_map[
ir] == 1)
414 data.r_index[data.nr++] =
ir;
426 const std::vector<IdentifierHash> &vPixel,
const std::vector<IdentifierHash> &vStrip,
const IRoiDescriptor &IRD)
const
428 constexpr float twoPi = 2. *
M_PI;
433 double dzdrmin = 1. / std::tan(2. * std::atan(std::exp(-IRD.
etaMinus())));
434 double dzdrmax = 1. / std::tan(2. * std::atan(std::exp(-IRD.
etaPlus())));
436 data.zminB = IRD.
zedMinus() - data.zbeam[0];
437 data.zmaxB = IRD.
zedPlus() - data.zbeam[0];
438 data.zminU = data.zminB + 550. * dzdrmin;
439 data.zmaxU = data.zmaxB + 550. * dzdrmax;
444 data.ftrig = (fmin + fmax) * .5;
445 data.ftrigW = (fmax - fmin) * .5;
456 ATH_MSG_WARNING(
"ITk::SiSpacePointsSeedMaker::find2Sp not implemented!");
466 if (not data.initialized)
477 if (lv.begin() != lv.end())
485 if (newv || !data.state || data.nspoint != 3 || data.mode != mode || data.nlist)
487 data.i_ITkSeedEnd = data.i_ITkSeeds.begin();
501 data.i_ITkSeed = data.i_ITkSeeds.begin();
503 if (msgLvl(MSG::DEBUG))
517 if (not data.initialized)
525 data.zminU = ZVertex[0];
528 data.zmaxU = ZVertex[1];
534 if (lv.begin() != lv.end())
542 if (newv || !data.state || data.nspoint != 3 || data.mode != mode || data.nlist)
544 data.i_ITkSeedEnd = data.i_ITkSeeds.begin();
557 data.i_ITkSeed = data.i_ITkSeeds.begin();
559 if (msgLvl(MSG::DEBUG))
575 if (not data.initialized)
585 if (lv.begin() != lv.end())
589 if (newv || !data.state || data.nspoint != 4 || data.mode != mode || data.nlist)
591 data.i_ITkSeedEnd = data.i_ITkSeeds.begin();
602 data.i_ITkSeed = data.i_ITkSeeds.begin();
604 if (msgLvl(MSG::DEBUG))
630 for (
int i=0; i<n; ++i) s2.append(
" ");
634 for (
int i=0; i<n; ++i) s3.append(
" ");
638 for (
int i=0; i<n; ++i) s4.append(
" ");
642 for (
int i=0; i<n; ++i) s5.append(
" ");
645 out<<
"|---------------------------------------------------------------------|"
664 out<<
"| maxSizeSP | "
667 out<<
"| pTmin (mev) | "
668 <<std::setw(12)<<std::setprecision(5)<<
m_ptmin
670 out<<
"| max radius SP | "
671 <<std::setw(12)<<std::setprecision(5)<<
m_r_rmax
673 out<<
"| radius step | "
674 <<std::setw(12)<<std::setprecision(5)<<
m_binSizeR
676 out<<
"| min Z-vertex position | "
677 <<std::setw(12)<<std::setprecision(5)<<
m_zmin
679 out<<
"| max Z-vertex position | "
680 <<std::setw(12)<<std::setprecision(5)<<
m_zmax
682 out<<
"| min space points dR SSS | "
683 <<std::setw(12)<<std::setprecision(5)<<
m_drminSSS
685 out<<
"| max space points dR SSS | "
686 <<std::setw(12)<<std::setprecision(5)<<
m_drmaxSSS
688 out<<
"| min space points dR PPP | "
689 <<std::setw(12)<<std::setprecision(5)<<
m_drminPPP
691 out<<
"| max space points dR PPP | "
692 <<std::setw(12)<<std::setprecision(5)<<
m_drmaxPPP
694 out<<
"| max dZ impact | "
695 <<std::setw(12)<<std::setprecision(5)<<
m_dzver
697 out<<
"| max dZ/dR impact | "
698 <<std::setw(12)<<std::setprecision(5)<<
m_dzdrver
700 out<<
"| max impact | "
703 out<<
"| max impact sss | "
706 out<<
"|---------------------------------------------------------------------|"
708 out<<
"| Beam X center | "
709 <<std::setw(12)<<std::setprecision(5)<<data.xbeam[0]
711 out<<
"| Beam Y center | "
712 <<std::setw(12)<<std::setprecision(5)<<data.ybeam[0]
714 out<<
"| Beam Z center | "
715 <<std::setw(12)<<std::setprecision(5)<<data.zbeam[0]
717 out<<
"| Beam X-axis direction | "
718 <<std::setw(12)<<std::setprecision(5)<<data.xbeam[1]
719 <<std::setw(12)<<std::setprecision(5)<<data.xbeam[2]
720 <<std::setw(12)<<std::setprecision(5)<<data.xbeam[3]
722 out<<
"| Beam Y-axis direction | "
723 <<std::setw(12)<<std::setprecision(5)<<data.ybeam[1]
724 <<std::setw(12)<<std::setprecision(5)<<data.ybeam[2]
725 <<std::setw(12)<<std::setprecision(5)<<data.ybeam[3]
727 out<<
"| Beam Z-axis direction | "
728 <<std::setw(12)<<std::setprecision(5)<<data.zbeam[1]
729 <<std::setw(12)<<std::setprecision(5)<<data.zbeam[2]
730 <<std::setw(12)<<std::setprecision(5)<<data.zbeam[3]
732 out<<
"|---------------------------------------------------------------------|"
745 out<<
"|---------------------------------------------------------------------|"
748 <<std::setw(12)<<data.ns
751 <<std::setw(12)<<data.nsaz
754 <<std::setw(12)<<data.nsazv
757 <<std::setw(12)<<data.i_ITkSeeds.size()
759 out<<
"|---------------------------------------------------------------------|"
774 data.i_ITkSeedEnd = data.i_ITkSeeds.begin();
776 if (data.mode == 2 || data.mode == 3 || data.mode == 5 || data.mode == 6)
779 data.i_ITkSeed = data.i_ITkSeeds.begin();
790 unsigned int s1 = data.l_vertex.size();
791 unsigned int s2 = lV.size();
794 data.isvertex =
false;
797 if (s1 == 0 && s2 == 0)
801 data.l_vertex.clear();
807 data.isvertex =
true;
810 data.l_vertex.insert(
static_cast<float>(v.position().z()));
815 data.zminU = (*data.l_vertex.begin()) - 20.;
818 data.zmaxU = (*data.l_vertex.rbegin()) + 20.;
869 constexpr float twoPi = 2. *
M_PI;
873 const float inverseSizePhiMax =
static_cast<float>(nPhiBinsMax) / twoPi;
874 constexpr float inverseSizePhiMin = 10. / twoPi;
927 const float inverseBinSizePhiVertexMax =
static_cast<float>(nPhiBinsVertexMax)/twoPi;
948 std::array<int, arraySizePhiZ> &nNeighbourCellsTop,
949 std::array<std::array<int, arraySizeNeighbourBins>,
arraySizePhiZ> &neighbourCellsBottom,
950 std::array<std::array<int, arraySizeNeighbourBins>,
arraySizePhiZ> &neighbourCellsTop,
951 int maxPhiBin,
bool isSSS)
958 for (
int phiBin = 0; phiBin <= maxPhiBin; ++phiBin)
961 int phiBelow = phiBin - 1;
962 if (phiBelow < 0) phiBelow = maxPhiBin;
964 int phiAbove = phiBin + 1;
965 if (phiAbove > maxPhiBin) phiAbove = 0;
977 nNeighbourCellsBottom[twoDbinSamePhi] = 3;
978 nNeighbourCellsTop[twoDbinSamePhi] = 3;
980 neighbourCellsBottom[twoDbinSamePhi][0] = twoDbinSamePhi;
981 neighbourCellsTop[twoDbinSamePhi][0] = twoDbinSamePhi;
983 neighbourCellsBottom[twoDbinSamePhi][1] = twoDbinLowerPhi;
984 neighbourCellsTop[twoDbinSamePhi][1] = twoDbinLowerPhi;
986 neighbourCellsBottom[twoDbinSamePhi][2] = twoDbinHigherPhi;
987 neighbourCellsTop[twoDbinSamePhi][2] = twoDbinHigherPhi;
999 nNeighbourCellsTop[twoDbinSamePhi] = 9;
1003 neighbourCellsTop[twoDbinSamePhi][3] = twoDbinSamePhi + 1;
1004 neighbourCellsTop[twoDbinSamePhi][4] = twoDbinLowerPhi + 1;
1005 neighbourCellsTop[twoDbinSamePhi][5] = twoDbinHigherPhi + 1;
1006 neighbourCellsTop[twoDbinSamePhi][6] = twoDbinSamePhi - 1;
1007 neighbourCellsTop[twoDbinSamePhi][7] = twoDbinLowerPhi - 1;
1008 neighbourCellsTop[twoDbinSamePhi][8] = twoDbinHigherPhi - 1;
1016 nNeighbourCellsBottom[twoDbinSamePhi] = 6;
1017 neighbourCellsBottom[twoDbinSamePhi][3] = twoDbinSamePhi - 1;
1018 neighbourCellsBottom[twoDbinSamePhi][4] = twoDbinLowerPhi - 1;
1019 neighbourCellsBottom[twoDbinSamePhi][5] = twoDbinHigherPhi - 1;
1028 nNeighbourCellsTop[twoDbinSamePhi] = 6;
1029 neighbourCellsTop[twoDbinSamePhi][3] = twoDbinSamePhi + 1;
1030 neighbourCellsTop[twoDbinSamePhi][4] = twoDbinLowerPhi + 1;
1031 neighbourCellsTop[twoDbinSamePhi][5] = twoDbinHigherPhi + 1;
1041 nNeighbourCellsBottom[twoDbinSamePhi] = 6;
1042 neighbourCellsBottom[twoDbinSamePhi][3] = twoDbinSamePhi + 1;
1043 neighbourCellsBottom[twoDbinSamePhi][4] = twoDbinLowerPhi + 1;
1044 neighbourCellsBottom[twoDbinSamePhi][5] = twoDbinHigherPhi + 1;
1050 nNeighbourCellsTop[twoDbinSamePhi] = 6;
1051 neighbourCellsTop[twoDbinSamePhi][3] = twoDbinSamePhi - 1;
1052 neighbourCellsTop[twoDbinSamePhi][4] = twoDbinLowerPhi - 1;
1053 neighbourCellsTop[twoDbinSamePhi][5] = twoDbinHigherPhi - 1;
1067 nNeighbourCellsBottom[twoDbinSamePhi] = 9;
1068 neighbourCellsBottom[twoDbinSamePhi][6] = twoDbinSamePhi + 2;
1069 neighbourCellsBottom[twoDbinSamePhi][7] = twoDbinLowerPhi + 2;
1070 neighbourCellsBottom[twoDbinSamePhi][8] = twoDbinHigherPhi + 2;
1074 nNeighbourCellsBottom[twoDbinSamePhi] = 9;
1075 neighbourCellsBottom[twoDbinSamePhi][6] = twoDbinSamePhi - 2;
1076 neighbourCellsBottom[twoDbinSamePhi][7] = twoDbinLowerPhi - 2;
1077 neighbourCellsBottom[twoDbinSamePhi][8] = twoDbinHigherPhi - 2;
1089 std::array<std::array<int, arraySizeNeighbourBinsVertex>,
arraySizePhiZV> &neighbourCells,
1092 for (
int phiBin=0; phiBin<=maxPhiBin; ++phiBin) {
1094 int phiBinBelow = phiBin-1;
1095 if (phiBinBelow<0) phiBinBelow=maxPhiBin;
1097 int phiBinTop = phiBin+1;
1098 if (phiBinTop>maxPhiBin) phiBinTop=0;
1104 int twoDbinLowerPhi = phiBinBelow*
arraySizeZV+zbin;
1105 int twoDbinHigherPhi = phiBinTop*
arraySizeZV+zbin;
1108 nNeighbourCells[twoDbinSamePhi] = 3;
1109 neighbourCells[twoDbinSamePhi][0] = twoDbinSamePhi;
1110 neighbourCells[twoDbinSamePhi][1] = twoDbinLowerPhi;
1111 neighbourCells[twoDbinSamePhi][2] = twoDbinHigherPhi;
1115 nNeighbourCells[twoDbinSamePhi] = 6;
1116 neighbourCells[twoDbinSamePhi][3] = twoDbinSamePhi-1;
1117 neighbourCells[twoDbinSamePhi][4] = twoDbinLowerPhi-1;
1118 neighbourCells[twoDbinSamePhi][5] = twoDbinHigherPhi-1;
1122 nNeighbourCells[twoDbinSamePhi] = 6;
1123 neighbourCells[twoDbinSamePhi][3] = twoDbinSamePhi+1;
1124 neighbourCells[twoDbinSamePhi][4] = twoDbinLowerPhi+1;
1125 neighbourCells[twoDbinSamePhi][5] = twoDbinHigherPhi+1;
1136 float Rm = pTmin / .6;
1144 float worstCaseD0 = maxd0;
1148 float sI = std::abs(std::asin(worstCaseD0 / Rmin) - std::asin(worstCaseD0 / Rmax));
1149 float sF = std::abs(std::asin(std::min(1., Rmax / (2. * Rm))) -
1150 std::asin(std::min(1., Rmin / (2. * Rm))));
1163 double tx = std::tan(beamSpotHandle->beamTilt(0));
1164 double ty = std::tan(beamSpotHandle->beamTilt(1));
1166 double phi = std::atan2(ty, tx);
1167 double theta = std::acos(1. / std::sqrt(1. + tx * tx + ty * ty));
1168 double sinTheta = std::sin(
theta);
1169 double cosTheta = std::cos(
theta);
1170 double sinPhi = std::sin(
phi);
1171 double cosPhi = std::cos(
phi);
1173 data.xbeam[0] =
static_cast<float>(cb.x());
1174 data.xbeam[1] =
static_cast<float>(cosTheta * cosPhi * cosPhi + sinPhi * sinPhi);
1175 data.xbeam[2] =
static_cast<float>(cosTheta * sinPhi * cosPhi - sinPhi * cosPhi);
1176 data.xbeam[3] = -
static_cast<float>(sinTheta * cosPhi);
1178 data.ybeam[0] =
static_cast<float>(cb.y());
1179 data.ybeam[1] =
static_cast<float>(cosTheta * cosPhi * sinPhi - sinPhi * cosPhi);
1180 data.ybeam[2] =
static_cast<float>(cosTheta * sinPhi * sinPhi + cosPhi * cosPhi);
1181 data.ybeam[3] = -
static_cast<float>(sinTheta * sinPhi);
1183 data.zbeam[0] =
static_cast<float>(cb.z());
1184 data.zbeam[1] =
static_cast<float>(sinTheta * cosPhi);
1185 data.zbeam[2] =
static_cast<float>(sinTheta * sinPhi);
1186 data.zbeam[3] =
static_cast<float>(cosTheta);
1194 r[0] =
static_cast<float>(
sp->globalPosition().
x()) - data.xbeam[0];
1195 r[1] =
static_cast<float>(
sp->globalPosition().
y()) - data.ybeam[0];
1196 r[2] =
static_cast<float>(
sp->globalPosition().
z()) - data.zbeam[0];
1205 constexpr float twoPi = 2. *
M_PI;
1207 int firstRadialBin = 0;
1208 int lastRadialBin = 0;
1209 bool endcap =
false;
1224 const std::map<float, int> ztoBin{
1243 for (
int radialBin = data.r_first; radialBin <
m_nBinsR; ++radialBin)
1246 if (!data.r_map[radialBin])
1250 std::vector<SiSpacePointForSeed *>::iterator SP_first = data.r_ITkSorted[radialBin].begin();
1251 if (isPixel && (*SP_first)->spacepoint->clusterList().second)
1255 if (firstRadialBin == 0)
1256 firstRadialBin = radialBin;
1257 lastRadialBin = radialBin;
1265 float Phi = SP->phi();
1268 int phiBin =
static_cast<int>(Phi * inverseBinSizePhi);
1274 else if (phiBin > nPhiBins)
1280 endcap = (std::abs(Z) > 1490);
1288 auto bound = ztoBin.lower_bound(Z);
1290 if (bound == ztoBin.end())
1294 zBin = bound->second;
1302 data.rfz_ITkSorted[twoDbin].push_back(SP);
1307 if (!data.rfz_map[twoDbin]++)
1308 data.rfz_index[data.nrfz++] = twoDbin;
1318 if (data.rfz_ITkSorted[twoDbin].size() > 1) {
1354 r[3] = float(
Tp(0, 2));
1355 r[4] = float(
Tp(1, 2));
1356 r[5] = float(
Tp(2, 2));
1373 std::pair<Amg::Vector3D, Amg::Vector3D> e0 =
1375 std::pair<Amg::Vector3D, Amg::Vector3D> e1 =
1386 r[3] = float(b0[0]);
1387 r[4] = float(b0[1]);
1388 r[5] = float(b0[2]);
1391 r[6] = float(b1[0]);
1392 r[7] = float(b1[1]);
1393 r[8] = float(b1[2]);
1396 r[9] = float(d02[0]);
1397 r[10] = float(d02[1]);
1398 r[11] = float(d02[2]);
1401 r[12] = float(
s0[0]) - data.xbeam[0];
1402 r[13] = float(
s0[1]) - data.ybeam[0];
1403 r[14] = float(
s0[2]) - data.zbeam[0];
1412 for (
int i = 0; i < data.nrfz; ++i)
1414 int n = data.rfz_index[i];
1415 data.rfz_map[n] = 0;
1416 data.rfz_ITkSorted[n].clear();
1419 for (
int i = 0; i < data.nrfzv; ++i)
1421 int n = data.rfzv_index[i];
1422 data.rfzv_map[n] = 0;
1423 data.rfzv_ITkSorted[n].clear();
1426 for (
int i = 0; i < data.nr; ++i) {
1427 int n = data.r_index[i];
1429 data.r_ITkSorted[n].clear();
1447 ATH_MSG_WARNING(
"ITk::SiSpacePointsSeedMaker::production2Sp not implemented!");
1478 const std::array<int, arraySizeZ> zBinIndex_SSS{5, 6, 4, 7, 3, 8, 2, 9, 1, 10, 0};
1479 const std::array<int, arraySizeZ> zBinIndex_PPP_fast{0, 10, 1, 9, 2, 8, 5, 3, 7, 4, 6};
1480 const std::array<int, arraySizeZ> zBinIndex_PPP_long{0, 1, 2, 3, 10, 9, 8, 7, 5, 4, 6};
1481 const auto zBinIndex_PPP =
m_fastTracking ? zBinIndex_PPP_fast : zBinIndex_PPP_long;
1485 const auto zBinIndex = isPixel ? zBinIndex_PPP : zBinIndex_SSS;
1487 const float RTmax[11] = { 80., 200., 200., 200., 250., 250., 250., 200., 200., 200., 80.};
1488 const float RTmin[11] = { 40., 40., 70., 70., 70., 70., 70., 70., 70., 40., 40.};
1498 std::array<int, arraySizePhiZ> nNeighbourCellsBottom{};
1499 std::array<int, arraySizePhiZ> nNeighbourCellsTop{};
1501 std::array<std::array<int, arraySizeNeighbourBins>,
arraySizePhiZ> neighbourCellsBottom{};
1504 std::array<std::array<int, arraySizeNeighbourBins>,
arraySizePhiZ> neighbourCellsTop{};
1526 data.endlist =
true;
1529 for (
int phiBin = data.fNmin; phiBin <= nPhiBins; ++phiBin)
1546 data.RTmax = RTmax[ zBinIndex[
z] ];
1547 data.RTmin = RTmin[ zBinIndex[
z] ];
1553 if (!data.rfz_map[phiZbin])
1558 int numberBottomCells = 0;
1559 int numberTopCells = 0;
1565 for (
int neighbourCellNumber = 0; neighbourCellNumber < nNeighbourCellsBottom[phiZbin]; ++neighbourCellNumber)
1568 int theNeighbourCell = neighbourCellsBottom[phiZbin][neighbourCellNumber];
1570 if (!data.rfz_map[theNeighbourCell])
1573 iter_bottomCands[numberBottomCells] = data.rfz_ITkSorted[theNeighbourCell].begin();
1574 iter_endBottomCands[numberBottomCells++] = data.rfz_ITkSorted[theNeighbourCell].end();
1581 for (
int neighbourCellNumber = 0; neighbourCellNumber < nNeighbourCellsTop[phiZbin]; ++neighbourCellNumber)
1584 int theNeighbourCell = neighbourCellsTop[phiZbin][neighbourCellNumber];
1586 if (!data.rfz_map[theNeighbourCell])
1589 iter_topCands[numberTopCells] = data.rfz_ITkSorted[theNeighbourCell].begin();
1590 iter_endTopCands[numberTopCells++] = data.rfz_ITkSorted[theNeighbourCell].end();
1597 production3SpPPP(data, iter_bottomCands, iter_endBottomCands, iter_topCands, iter_endTopCands, numberBottomCells, numberTopCells, nseed);
1599 production3SpSSS(data, iter_bottomCands, iter_endBottomCands, iter_topCands, iter_endTopCands, numberBottomCells, numberTopCells, nseed);
1602 production3SpTrigger(data, iter_bottomCands, iter_endBottomCands, iter_topCands, iter_endTopCands, numberBottomCells, numberTopCells, nseed);
1613 data.endlist =
false;
1614 data.fNmin = phiBin + 1;
1620 data.endlist =
true;
1632 const int numberBottomCells,
const int numberTopCells,
int &nseed)
const
1642 std::vector<SiSpacePointForSeed *>::iterator iter_centralSP = iter_bottomCands[0];
1651 for (; iter_centralSP != iter_endBottomCands[0]; ++iter_centralSP)
1653 if((*iter_centralSP)->radius() > data.RTmin)
break;
1658 iter_topCands[0] = iter_centralSP;
1662 const float &ipt2K = data.ipt2K;
1663 const float &ipt2C = data.ipt2C;
1664 const float &COFK = data.COFK;
1666 const float &zmax = data.zmaxU;
1667 const float &dzdrmax = data.dzdrmax;
1668 data.ITkCmSp.clear();
1672 size_t SPcapacity = data.ITkSP.size();
1675 for (; iter_centralSP != iter_endBottomCands[0]; ++iter_centralSP)
1677 const float &R = (*iter_centralSP)->radius();
1683 const float &X = (*iter_centralSP)->x();
1684 const float &Y = (*iter_centralSP)->y();
1685 const float &Z = (*iter_centralSP)->z();
1689 double absZ = std::abs(Z);
1693 float covr0 = (*iter_centralSP)->covr();
1694 float covz0 = (*iter_centralSP)->covz();
1698 float VR = maxd0cut / (R * R);
1709 for (
int cell = 0; cell < numberTopCells; ++cell)
1711 std::vector<SiSpacePointForSeed *>::iterator iter_otherSP = iter_topCands[cell], iter_otherSPend = iter_endTopCands[cell];
1712 if (iter_otherSP == iter_otherSPend)
continue;
1714 for(; iter_otherSP!=iter_otherSPend; ++iter_otherSP) {
1715 if(( (*iter_otherSP)->radius()- R ) >=
m_drminPPP)
break;
1717 iter_topCands[cell]=iter_otherSP;
1720 for (; iter_otherSP != iter_endTopCands[cell]; ++iter_otherSP)
1723 float Rt = (*iter_otherSP)->radius();
1726 const float dz = (*iter_otherSP)->z() - Z;
1727 const float dZdR = dz / dR;
1730 const float z0 = Z - R * dZdR;
1731 if (std::abs(z0) > zmax)
1734 float dx = (*iter_otherSP)->x() - X;
1735 float dy = (*iter_otherSP)->y() - Y;
1736 float x = dx * ax + dy * ay;
1737 float y = dy * ax - dx * ay;
1738 float dxy =
x *
x +
y *
y;
1739 float r2 = 1. / dxy;
1743 if (std::abs(R *
y) > maxd0cut *
x)
1746 y < 0. ? V0 = VR : V0 = -VR;
1747 float A = (v - V0) / (u + 1. / R);
1748 float B = V0 +
A / R;
1749 if ((B * B) > (ipt2K * (1. +
A *
A)))
1753 const float dr = std::sqrt(r2);
1754 const float tz = dz * dr;
1756 if (std::abs(tz) > dzdrmax)
1760 data.ITkSP[Nt] = (*iter_otherSP);
1764 data.Er[Nt] = ((covz0 + (*iter_otherSP)->covz()) + (tz * tz) * (covr0 + (*iter_otherSP)->covr())) * r2;
1765 data.ITkSP[Nt]->setDR(std::sqrt(dxy + dz * dz));
1766 data.ITkSP[Nt]->setDZDR(dZdR);
1767 data.Tn[Nt].Fl = tz;
1768 data.Tn[Nt].In = Nt;
1773 if (++Nt == SPcapacity)
1775 size_t increment = 50;
1777 SPcapacity = data.ITkSP.size();
1792 for (
int cell = 0; cell < numberBottomCells; ++cell)
1795 std::vector<SiSpacePointForSeed*>::iterator iter_otherSP = iter_bottomCands[cell];
1797 for(; iter_otherSP!=iter_endBottomCands[cell]; ++iter_otherSP) {
1798 if( (R - (*iter_otherSP)->radius()) <=
m_drmaxPPP)
break;
1800 iter_bottomCands[cell]=iter_otherSP;
1803 for (; iter_otherSP != iter_endBottomCands[cell]; ++iter_otherSP)
1806 const float &Rb = (*iter_otherSP)->radius();
1813 const float dz = Z - (*iter_otherSP)->z();
1814 const float dZdR = dz / dR;
1817 const float z0 = Z - R * dZdR;
1818 if (std::abs(z0) > zmax)
1821 float dx = (*iter_otherSP)->x() - X;
1822 float dy = (*iter_otherSP)->y() - Y;
1823 float x = dx * ax + dy * ay;
1824 float y = dy * ax - dx * ay;
1825 float dxy = (
x *
x +
y *
y );
1826 float r2 = 1. / dxy;
1830 if (std::abs(R *
y) > -maxd0cut *
x)
1833 y > 0. ? V0 = VR : V0 = -VR;
1834 float A = (v - V0) / (u + 1. / R);
1835 float B = V0 +
A / R;
1836 if ((B * B) > (ipt2K * (1. +
A *
A)))
1840 const float dr = std::sqrt(r2);
1841 const float tz = dz * dr;
1843 if (std::abs(tz) > dzdrmax)
1847 if (
m_fastTracking && (*iter_otherSP)->radius() < 45. && std::abs(tz) > 1.5)
1851 data.ITkSP[Nb] = (*iter_otherSP);
1855 data.Er[Nb] = ((covz0 + (*iter_otherSP)->covz()) + (tz * tz) * (covr0 + (*iter_otherSP)->covr())) * r2;
1856 data.ITkSP[Nb]->setDR(std::sqrt(dxy + dz * dz));
1857 data.ITkSP[Nb]->setDZDR(dZdR);
1858 data.Tn[Nb].Fl = tz;
1859 data.Tn[Nb].In = Nb;
1864 if (++Nb == SPcapacity)
1866 size_t increment = 50;
1868 SPcapacity = data.ITkSP.size();
1879 sort(data.Tn,Nt,Nb-Nt);
1882 data.nOneSeedsQ = 0;
1883 data.ITkMapOneSeeds.clear();
1884 data.ITkMapOneSeedsQ.clear();
1889 for (
size_t ib = Nt; ib < Nb; ++ib)
1896 float Tzb = data.Tn[ib].Fl;
1897 int b = data.Tn[ib].In;
1899 float Rb2r = data.R[b] * covr0;
1900 float Rb2z = data.R[b] * covz0;
1901 float Erb = data.Er[b];
1902 float Vb = data.V[b];
1903 float Ub = data.U[b];
1904 float Tzb2 = (1. + Tzb * Tzb);
1905 float sTzb2 = std::sqrt(Tzb2);
1907 float sigmaSquaredScatteringPtDependent = Tzb2 * COFK;
1908 float sigmaSquaredScatteringMinPt = Tzb2 * ipt2C;
1911 float d0max = maxd0cut;
1914 if (data.ITkSP[b]->radius() >
m_rmaxPPP){
1917 if (data.nOneSeedsQ)
1921 for (
size_t it = it0; it < Nt; ++it)
1924 int t = data.Tn[it].In;
1925 float Tzt = data.Tn[it].Fl;
1933 float meanOneOverTanThetaSquare = Tzb * Tzt;
1936 float sigmaSquaredSpacePointErrors = Erb + data.Er[t]
1937 + 2 * Rb2z * data.R[t]
1938 + 2 * Rb2r * data.R[t] * meanOneOverTanThetaSquare;
1941 float remainingSquaredDelta = (Tzb - Tzt) * (Tzb - Tzt) - sigmaSquaredSpacePointErrors;
1945 if (remainingSquaredDelta - sigmaSquaredScatteringMinPt > 0)
1975 float dU = data.U[t] - Ub;
1978 float A = (data.V[t] - Vb) / dU;
1979 float onePlusAsquare = 1. +
A *
A;
1980 float B = Vb -
A * Ub;
1981 float BSquare = B * B;
1995 if (BSquare > ipt2K * onePlusAsquare)
1997 if (remainingSquaredDelta * onePlusAsquare > BSquare * sigmaSquaredScatteringPtDependent)
2021 float d0 = std::abs((
A - B * R) * R);
2027 float dr = data.R[b];
2028 if (data.R[t] < data.R[b])
2033 data.ITkSP[t]->setScorePenalty(std::abs((Tzb - Tzt) / (dr * sTzb2)));
2034 data.ITkSP[t]->setParam(d0);
2037 data.ITkCmSp.emplace_back(B / std::sqrt(onePlusAsquare), data.ITkSP[t]);
2039 if (data.ITkCmSp.size() == 500)
2046 if (data.ITkCmSp.size() > Nc)
2050 data.ITkCmSp.clear();
2054 nseed += data.fillOneSeeds;
2068 const int numberBottomCells,
const int numberTopCells,
int &nseed)
const
2078 std::vector<SiSpacePointForSeed *>::iterator iter_centralSP = iter_bottomCands[0];
2079 std::vector<SiSpacePointForSeed *>::iterator iter_otherSP;
2088 for (; iter_centralSP != iter_endBottomCands[0]; ++iter_centralSP)
2090 if((*iter_centralSP)->radius() > data.RTmin)
break;
2095 iter_topCands[0] = iter_centralSP;
2099 const float ipt2K = data.ipt2K;
2100 const float ipt2C = data.ipt2C;
2101 const float COFK = data.COFK;
2103 const float zmax = data.zmaxU;
2104 data.ITkCmSp.clear();
2108 size_t SPcapacity = data.ITkSP.size();
2111 for (; iter_centralSP != iter_endBottomCands[0]; ++iter_centralSP)
2114 const float &R = (*iter_centralSP)->radius();
2116 if(R > data.RTmax)
break;
2119 const float &X = (*iter_centralSP)->x();
2120 const float &Y = (*iter_centralSP)->y();
2121 const float &Z = (*iter_centralSP)->z();
2125 double absZ = std::abs(Z);
2136 for (
int cell = 0; cell < numberTopCells; ++cell)
2139 for (iter_otherSP = iter_topCands[cell]; iter_otherSP != iter_endTopCands[cell]; ++iter_otherSP)
2142 float Rt = (*iter_otherSP)->radius();
2147 iter_topCands[cell] = iter_otherSP;
2150 for (iter_otherSP = iter_topCands[cell]; iter_otherSP != iter_endTopCands[cell]; ++iter_otherSP)
2154 float Rt = (*iter_otherSP)->radius();
2160 const float dz = (*iter_otherSP)->z() - Z;
2161 const float dZdR = dz / dR;
2165 const float z0 = Z - R * dZdR;
2166 if (std::abs(dz) >
m_dzmaxSSS || std::abs(z0) > zmax)
2172 const float ax = X*Ri;
2173 const float ay = Y*Ri;
2175 float dx = (*iter_otherSP)->x() - X;
2176 float dy = (*iter_otherSP)->y() - Y;
2177 float x = dx * ax + dy * ay;
2178 float y = dy * ax - dx * ay;
2180 if(std::abs(R*
y) > maxd0cut *
x) {
2181 float r2 = 1. / (
x *
x +
y *
y);
2184 const float V0 = (
y < 0.) ? VR: -VR;
2185 float A = (v-V0)/(u+Ri) ;
2187 if((B*B) > (ipt2K*(1.+
A*
A)))
continue;
2192 data.ITkSP[Nt] = (*iter_otherSP);
2193 data.ITkSP[Nt]->setDZDR(dZdR);
2197 if (++Nt == SPcapacity)
2199 data.resizeSPCont();
2200 SPcapacity = data.ITkSP.size();
2216 for (
int cell = 0; cell < numberBottomCells; ++cell)
2219 for(iter_otherSP=iter_bottomCands[cell]; iter_otherSP!=iter_endBottomCands[cell]; ++iter_otherSP) {
2220 if((R-(*iter_otherSP)->radius()) <=
m_drmaxSSS)
break;
2222 iter_bottomCands[cell]=iter_otherSP;
2225 for (; iter_otherSP != iter_endBottomCands[cell]; ++iter_otherSP)
2229 const float &Rb = (*iter_otherSP)->radius();
2236 const float dz = Z - (*iter_otherSP)->z();
2237 const float dZdR = dz / dR;
2241 const float z0 = Z - R * dZdR;
2242 if (std::abs(dz) >
m_dzmaxSSS || std::abs(z0) > zmax)
2248 const float ax = X*Ri;
2249 const float ay = Y*Ri;
2251 float dx = (*iter_otherSP)->x() - X;
2252 float dy = (*iter_otherSP)->y() - Y;
2253 float x = dx * ax + dy * ay;
2254 float y = dy * ax - dx * ay;
2256 if(std::abs(R*
y) > -maxd0cut *
x) {
2257 float r2 = 1. / (
x *
x +
y *
y);
2260 const float V0 = (
y < 0.) ? VR: -VR;
2261 float A = (v-V0)/(u+Ri) ;
2263 if((B*B) > (ipt2K*(1.+
A*
A)))
continue;
2268 data.ITkSP[Nb] = (*iter_otherSP);
2269 data.ITkSP[Nb]->setDZDR(dZdR);
2273 if (++Nb == SPcapacity)
2275 data.resizeSPCont();
2276 SPcapacity = data.ITkSP.size();
2286 float covr0 = (*iter_centralSP)->covr();
2287 float covz0 = (*iter_centralSP)->covz();
2295 for (
size_t i = 0; i < Nb; ++i)
2302 float dx =
sp->x() - X;
2303 float dy =
sp->y() - Y;
2304 float dz =
sp->z() - Z;
2305 float x = dx * ax + dy * ay;
2306 float y = dy * ax - dx * ay;
2309 float r2 = 1. / (
x *
x +
y *
y);
2311 float dr = std::sqrt(r2);
2325 data.Zo[i] = Z - R * tz;
2329 data.Er[i] = ((covz0 +
sp->covz()) + (tz * tz) * (covr0 +
sp->covr())) * r2;
2333 data.nOneSeedsQ = 0;
2334 data.ITkMapOneSeeds.clear();
2335 data.ITkMapOneSeedsQ.clear();
2339 for (
size_t b = Nt; b < Nb; ++b)
2343 float Zob = data.Zo[b];
2344 float Tzb = data.Tz[b];
2345 float Rb2r = data.R[b] * covr0;
2346 float Rb2z = data.R[b] * covz0;
2347 float Erb = data.Er[b];
2348 float Vb = data.V[b];
2349 float Ub = data.U[b];
2350 float Tzb2 = (1. + Tzb * Tzb);
2351 float sTzb2 = std::sqrt(Tzb2);
2352 float Se = 1. / std::sqrt(Tzb2);
2353 float Ce = Se * Tzb;
2357 float sigmaSquaredScatteringPtDependent = Tzb2 * COFK;
2358 float sigmaSquaredScatteringMinPt = Tzb2 * ipt2C;
2361 float d0max = maxd0cut;
2364 for (
size_t t = 0; t < Nt; ++t)
2391 float dU0 = data.U[t] - Ub;
2394 float A0 = (data.V[t] - Vb) / dU0;
2396 float Cn = Ce * std::sqrt(1. + A0 * A0);
2398 float dn[3] = {Sx - Sy * A0, Sx * A0 + Sy, Cn};
2400 if (!(*iter_centralSP)->coordinates(dn, rn))
2405 float B0 = 2. * (Vb - A0 * Ub);
2406 float Cb = 1. -
B0 * data.Y[b];
2407 float Sb = A0 +
B0 * data.X[b];
2408 float db[3] = {Sx * Cb - Sy * Sb, Sx * Sb + Sy * Cb, Cn};
2410 if (!data.ITkSP[b]->coordinates(db, rb))
2415 float Ct = 1. -
B0 * data.Y[t];
2416 float St = A0 +
B0 * data.X[t];
2417 float dt[3] = {Sx * Ct - Sy * St, Sx * St + Sy * Ct, Cn};
2419 if (!data.ITkSP[t]->coordinates(dt, rt))
2422 float xb = rb[0] - rn[0];
2423 float yb = rb[1] - rn[1];
2424 float zb = rb[2] - rn[2];
2425 float xt = rt[0] - rn[0];
2426 float yt = rt[1] - rn[1];
2427 float zt = rt[2] - rn[2];
2429 float rb2 = 1. / (xb * xb + yb * yb);
2430 float rt2 = 1. / (
xt *
xt +
yt *
yt);
2432 float tb = -zb * std::sqrt(rb2);
2433 float tz =
zt * std::sqrt(rt2);
2441 float meanOneOverTanTheta = (tb + tz) / 2.;
2444 float sigmaSquaredSpacePointErrors = Erb + data.Er[t]
2445 + 2 * Rb2z * data.R[t]
2446 + 2 * Rb2r * data.R[t] * meanOneOverTanTheta * meanOneOverTanTheta;
2449 float remainingSquaredDelta = (tb - tz) * (tb - tz) - sigmaSquaredSpacePointErrors;
2453 if (remainingSquaredDelta - sigmaSquaredScatteringMinPt > 0)
2456 float Rn = std::sqrt(rn[0] * rn[0] + rn[1] * rn[1]);
2457 float Ax = rn[0] / Rn;
2458 float Ay = rn[1] / Rn;
2460 float ub = (xb * Ax + yb * Ay) * rb2;
2461 float vb = (yb * Ax - xb * Ay) * rb2;
2462 float ut = (
xt * Ax +
yt * Ay) * rt2;
2463 float vt = (
yt * Ax -
xt * Ay) * rt2;
2468 float A = (vt - vb) / dU;
2469 float onePlusAsquare = 1. +
A *
A;
2470 float B = vb -
A * ub;
2471 float BSquare = B * B;
2485 if (BSquare > ipt2K * onePlusAsquare || remainingSquaredDelta * onePlusAsquare > BSquare * sigmaSquaredScatteringPtDependent)
2504 float d0 = std::abs((
A - B * Rn) * Rn);
2510 float dr = std::sqrt(1 / rb2);
2511 if (data.R[t] < data.R[b])
2512 dr = std::sqrt(1 / rt2);
2516 data.ITkSP[t]->setScorePenalty(std::abs((tb - tz) / (dr * sTzb2)));
2517 data.ITkSP[t]->setParam(d0);
2519 data.ITkSP[t]->setDR(DR);
2522 data.ITkCmSp.emplace_back(B / std::sqrt(onePlusAsquare), data.ITkSP[t]);
2524 if (data.ITkCmSp.size() == 500)
2530 if (!data.ITkCmSp.empty())
2537 nseed += data.fillOneSeeds;
2551 const int ,
const int ,
int &)
const
2553 ATH_MSG_WARNING(
"ITk::SiSpacePointsSeedMaker::production3SpTrigger not implemented!");
2565 float worstQualityInMap = std::numeric_limits<float>::min();
2567 if (!data.ITkMapOneSeeds.empty())
2569 std::multimap<float, SiSpacePointsProSeed *>::reverse_iterator l = data.ITkMapOneSeeds.rbegin();
2570 worstQualityInMap = (*l).first;
2571 worstSeedSoFar = (*l).second;
2575 if (data.nOneSeeds < data.maxSeedsPerSP
2578 || (
m_useSeedConfirmation && data.keepAllConfirmedSeeds && worstQualityInMap <= seedCandidateQuality &&
isConfirmedSeed(p1, p3, seedCandidateQuality) && data.nOneSeeds < data.seedPerSpCapacity)
2583 data.ITkOneSeeds[data.nOneSeeds].set(p1, p2, p3,
z);
2584 data.ITkMapOneSeeds.insert(std::make_pair(seedCandidateQuality, &data.ITkOneSeeds[data.nOneSeeds]));
2589 else if (worstQualityInMap > seedCandidateQuality)
2592 worstSeedSoFar->
set(p1, p2, p3,
z);
2594 std::multimap<float, SiSpacePointsProSeed *>::iterator
2595 i = data.ITkMapOneSeeds.insert(std::make_pair(seedCandidateQuality, worstSeedSoFar));
2597 for (++i; i != data.ITkMapOneSeeds.end(); ++i)
2599 if ((*i).second == worstSeedSoFar)
2601 data.ITkMapOneSeeds.erase(i);
2614 float worstQualityInMap = std::numeric_limits<float>::min();
2616 if (!data.ITkMapOneSeedsQ.empty())
2618 std::multimap<float, SiSpacePointsProSeed *>::reverse_iterator l = data.ITkMapOneSeedsQ.rbegin();
2619 worstQualityInMap = (*l).first;
2620 worstSeedSoFar = (*l).second;
2624 if (data.nOneSeedsQ < data.maxSeedsPerSP
2627 || (
m_useSeedConfirmation && data.keepAllConfirmedSeeds && worstQualityInMap <= seedCandidateQuality &&
isConfirmedSeed(p1, p3, seedCandidateQuality) && data.nOneSeedsQ < data.seedPerSpCapacity)
2632 data.ITkOneSeedsQ[data.nOneSeedsQ].set(p1, p2, p3,
z);
2633 data.ITkMapOneSeedsQ.insert(std::make_pair(seedCandidateQuality, &data.ITkOneSeedsQ[data.nOneSeedsQ]));
2638 else if (worstQualityInMap > seedCandidateQuality)
2641 worstSeedSoFar->
set(p1, p2, p3,
z);
2643 std::multimap<float, SiSpacePointsProSeed *>::iterator
2644 i = data.ITkMapOneSeedsQ.insert(std::make_pair(seedCandidateQuality, worstSeedSoFar));
2646 for (++i; i != data.ITkMapOneSeedsQ.end(); ++i)
2648 if ((*i).second == worstSeedSoFar)
2650 data.ITkMapOneSeedsQ.erase(i);
2665 const float dC = .00003;
2670 std::vector<std::pair<float, SiSpacePointForSeed *>>
::iterator j, jn, i = data.ITkCmSp.begin(), ie = data.ITkCmSp.end();
2673 for (; i != ie; ++i)
2675 float u = (*i).second->param();
2676 bool pixt = !(*i).second->spacepoint->clusterList().second;
2677 if (pixt && std::abs(SPb->
z() - (*i).second->z()) >
m_dzmaxPPP)
2681 float Ri = (*i).second->radius();
2682 float Ci1 = (*i).first - dC;
2683 float Ci2 = (*i).first + dC;
2693 for (j = jn; j != ie; ++j)
2697 if ((*j).first < Ci1)
2703 if ((*j).first > Ci2)
2705 if ((*j).second->sur() == Sui)
2708 float Rj = (*j).second->radius();
2709 if (std::abs(Rj - Ri) <
m_drmin)
2720 if ((Rma - Rmi) > 20.)
2736 newOneSeed(data, SPb, SP0, (*i).second, Zob, u);
2738 data.ITkCmSp.clear();
2751 data.fillOneSeeds = 0;
2753 std::multimap<float, SiSpacePointsProSeed *>::iterator it_seedCandidate = data.ITkMapOneSeeds.begin();
2754 std::multimap<float, SiSpacePointsProSeed *>::iterator it_endSeedCandidates = data.ITkMapOneSeeds.end();
2756 if (data.nOneSeedsQ){
2757 it_seedCandidate = data.ITkMapOneSeedsQ.begin();
2758 it_endSeedCandidates = data.ITkMapOneSeedsQ.end();
2762 if (it_seedCandidate == it_endSeedCandidates)
2768 for (; it_seedCandidate != it_endSeedCandidates; ++it_seedCandidate)
2772 float quality = (*it_seedCandidate).first;
2773 theSeed = (*it_seedCandidate).second;
2780 if (data.i_ITkSeedEnd != data.i_ITkSeeds.end())
2782 theSeed = &(*data.i_ITkSeedEnd++);
2783 *theSeed = *(*it_seedCandidate).second;
2788 data.i_ITkSeeds.emplace_back(*(*it_seedCandidate).second);
2791 data.i_ITkSeedEnd = data.i_ITkSeeds.end();
2794 ++data.fillOneSeeds;
2801 if (not data.initialized)
2804 if (data.nspoint == 3)
2809 if (data.i_ITkSeed == data.i_ITkSeedEnd)
2818 if (data.i_ITkSeed == data.i_ITkSeedEnd)
2823 }
while (!(*data.i_ITkSeed++).set3(data.seedOutput, 1./(1000. * data.K)));
2825 return &data.seedOutput;
2830 if (data.i_ITkSeed == data.i_ITkSeedEnd)
2834 if (data.i_ITkSeed == data.i_ITkSeedEnd)
2837 (*data.i_ITkSeed++).set2(data.seedOutput);
2838 return &data.seedOutput;
2844 float Zv,
float R,
float T)
const
2846 if (Zv < data.zminU || Zv > data.zmaxU)
2851 float dZmin = std::numeric_limits<float>::max();
2852 for (
const float &v : data.l_vertex)
2854 float dZ = std::abs(v - Zv);
2868 std::array<float, 15>
r;
2884 float z = (std::abs(
r[2]) +
m_zmax);
2885 float x =
r[0] * data.dzdrmin;
2886 float y =
r[1] * data.dzdrmin;
2887 if ((
z *
z) < (
x *
x +
y *
y))
2893 float R2 =
r[0] *
r[0] +
r[1] *
r[1];
2897 if (std::abs(
r[2]) -
m_zmax > data.dzdrmax * std::sqrt(R2))
2901 if (usePixStripInform)
2903 if (!
sp->clusterList().second)
2912 if (data.i_ITkSpacePointForSeed != data.l_ITkSpacePointForSeed.end())
2915 sps = &(*data.i_ITkSpacePointForSeed++);
2923 data.l_ITkSpacePointForSeed.emplace_back(
sp,
r);
2925 sps = &(data.l_ITkSpacePointForSeed.back());
2927 data.i_ITkSpacePointForSeed = data.l_ITkSpacePointForSeed.end();
2942 if (data.i_ITkSeedEnd != data.i_ITkSeeds.end())
2945 s->set(p1, p2, p3,
z);
2949 data.i_ITkSeeds.emplace_back(p1, p2, p3,
z);
2950 data.i_ITkSeedEnd = data.i_ITkSeeds.end();
2958 seedArrayPerSPSize = 50;
2972 double magField[3]{0, 0, 0};
2973 double globalPos[3] = {10., 10., 0.};
2978 if (fieldCondObj ==
nullptr) {
2998 data.K = 2. / (300. * magField[2]);
3000 data.K = 2. / (300. * 5.);
3007 data.ipt2K =
m_ipt2 / (data.K * data.K);
3010 data.COFK =
m_COF * (data.K * data.K);
3012 data.bField[0] = magField[0];
3013 data.bField[1] = magField[1];
3014 data.bField[2] = magField[2];
3034 static const float curvatureInterval = .00003;
3037 if (data.ITkCmSp.size() > 2)
3040 std::vector<std::pair<float, SiSpacePointForSeed *>>
::iterator it_otherSP;
3041 std::vector<std::pair<float, SiSpacePointForSeed *>>
::iterator it_commonTopSP = data.ITkCmSp.begin(), ie = data.ITkCmSp.end();
3042 std::vector<std::pair<float, SiSpacePointForSeed *>>
::iterator it_startInnerLoop = it_commonTopSP;
3047 for (; it_commonTopSP != ie; ++it_commonTopSP)
3053 float seedIP = SPt->
param();
3056 float minCurvature = (*it_commonTopSP).first - curvatureInterval;
3057 float maxCurvature = (*it_commonTopSP).first + curvatureInterval;
3065 for (it_otherSP = it_startInnerLoop; it_otherSP != ie; ++it_otherSP)
3068 if (it_otherSP == it_commonTopSP)
3072 if ((*it_otherSP).first < minCurvature)
3074 it_startInnerLoop = it_otherSP;
3075 ++it_startInnerLoop;
3079 if ((*it_otherSP).first > maxCurvature)
3082 float L = (*it_otherSP).second->dR();
3085 for (; k != NT; ++k)
3087 if (std::abs(L - Lt[k]) < 20.)
3099 float Q = seedIP - float(NT) * 100.;
3105 data.ITkCmSp.clear();
3121 static const float curvatureInterval = .00003;
3124 if (data.ITkCmSp.size() > 2)
3127 std::vector<std::pair<float, SiSpacePointForSeed *>>
::iterator it_otherSP;
3128 std::vector<std::pair<float, SiSpacePointForSeed *>>
::iterator it_commonTopSP = data.ITkCmSp.begin(), ie = data.ITkCmSp.end();
3129 std::vector<std::pair<float, SiSpacePointForSeed *>>
::iterator it_startInnerLoop = it_commonTopSP;
3134 float Rb = 2. * SPb->
radius();
3141 bool Qm = Rb < 120. || std::abs(Zob) > 150.;
3144 for (; it_commonTopSP != ie; ++it_commonTopSP)
3150 float seedIP = SPt->
param();
3153 float minCurvature = (*it_commonTopSP).first - curvatureInterval;
3154 float maxCurvature = (*it_commonTopSP).first + curvatureInterval;
3162 for (it_otherSP = it_startInnerLoop; it_otherSP != ie; ++it_otherSP)
3165 if (it_otherSP == it_commonTopSP)
3169 if ((*it_otherSP).first < minCurvature)
3171 it_startInnerLoop = it_otherSP;
3172 ++it_startInnerLoop;
3176 if ((*it_otherSP).first > maxCurvature)
3179 float L = (*it_otherSP).second->dR();
3182 for (; k != NT; ++k)
3184 if (std::abs(L - Lt[k]) < 20.)
3196 if (dN < 0 || (data.nOneSeedsQ && !dN))
3198 if (Qm && !dN && seedIP > 1.)
3202 float Q = 100. * seedIP + (std::abs(Zob) - float(NT) * 100.);
3214 if (SPmin && !data.nOneSeedsQ)
3215 newOneSeed(data, SPb, SP0, SPmin, Zob, Qmin);
3216 data.ITkCmSp.clear();
3223 static const float curvatureInterval = .00003;
3225 float bottomSPQuality = SPb->
quality();
3226 float centralSPQuality = SP0->
quality();
3229 if (data.ITkCmSp.size() > 2)
3232 float bottomR = SPb->
radius();
3233 float bottomZ = SPb->
z();
3235 std::vector<std::pair<float, SiSpacePointForSeed *>>
::iterator it_otherSP;
3236 std::vector<std::pair<float, SiSpacePointForSeed *>>
::iterator it_commonTopSP = data.ITkCmSp.begin(), ie = data.ITkCmSp.end();
3237 std::vector<std::pair<float, SiSpacePointForSeed *>>
::iterator it_startInnerLoop = it_commonTopSP;
3240 for (; it_commonTopSP != ie; ++it_commonTopSP)
3245 float seedIP = SPt->
param();
3247 float originalSeedQuality = seedQuality;
3252 float topR = SPt->
radius();
3253 float topZ = SPt->
z();
3255 float Zot = std::abs(topR - bottomR) > 10e-9 ? bottomZ - (bottomR - originalSeedQuality) * ((topZ - bottomZ) / (topR - bottomR)) : bottomZ;
3257 float theta1 = std::abs(topR - bottomR) > 10e-9 ? std::atan2(topR - bottomR, topZ - bottomZ) : 0.;
3258 float eta1 = theta1 > 0 ? -std::log(std::tan(.5 * theta1)) : 0.;
3260 float theta0 = seedIP > 0 ? std::atan2(seedIP, Zot) : 0;
3261 float eta0 = theta0 > 0 ? -std::log(std::tan(.5 * theta0)) : 0.;
3263 float deltaEta = std::abs(eta1 - eta0);
3265 float f = std::min(0.5, originalSeedQuality / 200.);
3266 seedQuality *= (1 - f) / 300.;
3267 seedQuality += f * deltaEta / 2.5;
3274 float radiusTopSP = SPt->
radius();
3276 float minCurvature = (*it_commonTopSP).first - curvatureInterval;
3277 float maxCurvature = (*it_commonTopSP).first + curvatureInterval;
3287 if (!bottomSPisPixel)
3290 else if (topSPisPixel)
3299 for (it_otherSP = it_startInnerLoop; it_otherSP != ie; ++it_otherSP)
3302 if (it_otherSP == it_commonTopSP)
3306 if ((*it_otherSP).first < minCurvature)
3308 it_startInnerLoop = it_otherSP;
3309 ++it_startInnerLoop;
3313 if ((*it_otherSP).first > maxCurvature)
3316 if ((*it_otherSP).second->sur() == surfaceTopSP)
3319 float radiusOtherSP = (*it_otherSP).second->radius();
3329 if (seedQuality > data.maxScore)
3334 if (bottomSPisPixel != topSPisPixel)
3336 if (seedQuality > 0. ||
3337 (seedQuality > bottomSPQuality && seedQuality > centralSPQuality && seedQuality > SPt->
quality()))
3347 if (!bottomSPisPixel)
3349 if (seedIP > maxdImpact)
3353 newOneSeed(data, SPb, SP0, SPt, Zob, seedQuality);
3355 data.ITkCmSp.clear();
3374 return (quality < 0.);
3382 if(track !=
nullptr) {
3383 m_trackPt = (track->trackParameters()->front()->pT())/1000.f;
3384 m_trackEta = std::abs(track->trackParameters()->front()->eta());
3391 m_z0 = seed->zVertex();
3392 m_eta = seed->eta();
3406 m_dzdr_b = seed->dzdr_b();
3407 m_dzdr_t = seed->dzdr_t();
3409 m_givesTrack = !(track ==
nullptr);
3410 m_eventNumber = eventNumber;
Scalar phi() const
phi method
Scalar theta() const
theta method
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_WARNING(x)
virtual void lock()=0
Interface to allow an object to lock itself when made const in SG.
Define macros for attributes used to control the static checker.
void getInitializedCache(MagField::AtlasFieldCache &cache) const
get B field cache for evaluation as a function of 2-d or 3-d position.
Describes the API of the Region of Ineterest geometry.
virtual double phiPlus() const =0
extreme phi values
virtual double zedPlus() const =0
the zed and eta values at the most forward and most rear ends of the RoI
virtual double phiMinus() const =0
virtual double zedMinus() const =0
virtual double etaMinus() const =0
virtual double etaPlus() const =0
const Trk::SpacePoint * spacepoint
float scorePenalty() const
const Trk::Surface * sur() const
distance between top and central SP
float dR() const
penalty term in the seed score
void set(const Trk::SpacePoint *, std::span< float const, 15 >)
SiSpacePointForSeed * spacepoint2()
SiSpacePointForSeed * spacepoint0()
void set(SiSpacePointForSeed *&, SiSpacePointForSeed *&, SiSpacePointForSeed *&, float)
IntegerProperty m_maxsize
SG::ReadHandleKey< SpacePointContainer > m_spacepointsPixel
float m_seedScoreThresholdSSSConfirmationSeed
max (score is assigned negative sign) score for SSS seeds with confirmation seed requirement.
static MsgStream & dumpEvent(EventData &data, MsgStream &out)
float m_inverseBinSizePhiSSS
bool isZCompatible(EventData &data, float Zv, float R, float T) const
std::array< std::array< int, arraySizeNeighbourBins >, arraySizePhiZ > m_neighbourCellsBottomSSS
void newOneSeedWithCurvaturesComparisonPPP(EventData &data, SiSpacePointForSeed *&SPb, SiSpacePointForSeed *&SP0, float Zob) const
std::array< int, arraySizePhiZ > m_nNeighbourCellsTopSSS
static void pixInform(const Trk::SpacePoint *sp, float *r)
void fillLists(EventData &data) const
ServiceHandle< ITHistSvc > m_thistSvc
Flag to write validation ntuples. Turned off by default.
BooleanProperty m_fastTracking
virtual MsgStream & dump(EventData &data, MsgStream &out) const override
virtual StatusCode finalize() override
FloatProperty m_maxdImpact
SiSpacePointForSeed * newSpacePoint(EventData &data, const Trk::SpacePoint *const &sp) const
Create a SiSpacePointForSeed from the space point.
virtual const InDet::SiSpacePointsSeed * next(const EventContext &ctx, EventData &data) const override
void production3SpPPP(EventData &data, std::array< std::vector< SiSpacePointForSeed * >::iterator, arraySizeNeighbourBins > &iter_bottomCands, std::array< std::vector< SiSpacePointForSeed * >::iterator, arraySizeNeighbourBins > &iter_endBottomCands, std::array< std::vector< SiSpacePointForSeed * >::iterator, arraySizeNeighbourBins > &iter_topCands, std::array< std::vector< SiSpacePointForSeed * >::iterator, arraySizeNeighbourBins > &iter_endTopCands, const int numberBottomCells, const int numberTopCells, int &nseed) const
bool isConfirmedSeed(const SiSpacePointForSeed *bottomSP, const SiSpacePointForSeed *topSP, float quality) const
Helper method to determine if a seed is 'confirmed' - this means that a second seed exists with compa...
FloatProperty m_maxdImpactSSS
SG::ReadCondHandleKey< InDet::BeamSpotData > m_beamSpotKey
IntegerProperty m_maxOneSizePPP
void newOneSeed(EventData &data, SiSpacePointForSeed *&, SiSpacePointForSeed *&, SiSpacePointForSeed *&, float, float) const
BooleanProperty m_optimisePhiBinning
static void buildConnectionMapsVertex(std::array< int, arraySizePhiZV > &nNeighbourCells, std::array< std::array< int, arraySizeNeighbourBinsVertex >, arraySizePhiZV > &neighbourCells, int maxPhiBin)
Build maps for radius-azimuthal-Z sorted collections for Z Similar logic to the above,...
static float azimuthalStep(const float pTmin, const float maxd0, const float Rmin, const float Rmax)
Determine the expected azimuthal trajectory displacement in phi in presence of the magnetic field for...
virtual StatusCode initialize() override
void newOneSeedWithCurvaturesComparison(EventData &data, SiSpacePointForSeed *&, SiSpacePointForSeed *&, float) const
void production3SpTrigger(EventData &, std::array< std::vector< SiSpacePointForSeed * >::iterator, arraySizeNeighbourBins > &, std::array< std::vector< SiSpacePointForSeed * >::iterator, arraySizeNeighbourBins > &, std::array< std::vector< SiSpacePointForSeed * >::iterator, arraySizeNeighbourBins > &, std::array< std::vector< SiSpacePointForSeed * >::iterator, arraySizeNeighbourBins > &, const int, const int, int &) const
as above, but for the trigger
std::array< int, arraySizePhiZ > m_nNeighbourCellsBottomSSS
BooleanProperty m_alwaysKeepConfirmedStripSeeds
IntegerProperty m_maxOneSizeSSS
FloatProperty m_seedScoreBonusSSS
BooleanProperty m_useSeedConfirmation
void findNext(EventData &data) const
bool newVertices(EventData &data, const std::list< Trk::Vertex > &) const
FloatProperty m_seedScoreBonusConfirmationSeed
@ arraySizeZ
capacity of the 1D z arrays
@ arraySizeNeighbourBins
array size to store neighbouring phi-z-regions in the seed finding
@ arraySizePhiV
array size in phi for vertexing
@ arraySizeZV
array size in z for vertexing
@ arraySizePhiZV
array size in phi-Z 2D for the vertexing
@ arraySizePhi
capacity of the 1D phi arrays
@ arraySizePhiZ
capacity for the 2D phi-z arrays
float m_inverseBinSizePhiPPP
cache the inverse bin size in phi which we use - needed to evaluate phi bin locations
virtual void writeNtuple(const InDet::SiSpacePointsSeed *seed, const Trk::Track *track, int seedType, long eventNumber) const override
void production3Sp(EventData &data) const
bool isUsed(const Trk::SpacePoint *, const Trk::PRDtoTrackMap &prd_to_track_map) const
std::array< std::array< int, arraySizeNeighbourBins >, arraySizePhiZ > m_neighbourCellsBottomPPP
mapping of neighbour cells in the 2D phi-z binning to consider for the "bottom SP" search for central...
virtual void findVSp(const EventContext &ctx, EventData &data, const std::list< Trk::Vertex > &lv) const override
with variable number space points with or without vertex constraint Variable means (2,...
static void newSeed(EventData &data, SiSpacePointForSeed *&, SiSpacePointForSeed *&, float)
IntegerProperty m_maxsizeSP
void newOneSeedQ(EventData &data, SiSpacePointForSeed *&, SiSpacePointForSeed *&, SiSpacePointForSeed *&, float, float) const
SG::ReadHandleKey< Trk::PRDtoTrackMap > m_prdToTrackMap
SiSpacePointsSeedMaker()=delete
int m_maxPhiBinPPP
number of bins in phi
void sort(std::vector< InDet::FloatInt > &s, int start, int size) const
float m_d0 ATLAS_THREAD_SAFE
static void fillSeeds(EventData &data)
IntegerProperty m_maxOneSize
std::array< int, arraySizePhiZ > m_nNeighbourCellsTopPPP
number of neighbouring phi-z bins to consider when looking for "top SP" candidates for each phi-z bin
void newOneSeedWithCurvaturesComparisonSSS(EventData &data, SiSpacePointForSeed *&SPb, SiSpacePointForSeed *&SP0, float Zob) const
This creates all possible seeds with the passed central and bottom SP, using all top SP candidates wh...
std::array< std::array< int, arraySizeNeighbourBinsVertex >, arraySizePhiZV > m_neighboursVertexPhiZ
FloatProperty m_dImpactCutSlopeUnconfirmedSSS
MsgStream & dumpConditions(EventData &data, MsgStream &out) const
virtual void find2Sp(EventData &data, const std::list< Trk::Vertex > &lv) const override
with two space points with or without vertex constraint
float m_inverseBinSizePhiVertex
float m_seedScoreThresholdPPPConfirmationSeed
Seed score thresholds defined based on the modifiers defined as configurables above.
BooleanProperty m_alwaysKeepConfirmedPixelSeeds
FloatProperty m_seedScoreBonusPPP
std::array< int, arraySizePhiZ > m_nNeighbourCellsBottomPPP
arrays associating bins to each other for SP formation
static void stripInform(EventData &data, const Trk::SpacePoint *sp, float *r)
std::array< std::array< int, arraySizeNeighbourBins >, arraySizePhiZ > m_neighbourCellsTopSSS
virtual bool getWriteNtupleBoolProperty() const override
std::array< int, arraySizePhiZV > m_nNeighboursVertexPhiZ
SG::ReadHandleKey< SpacePointOverlapCollection > m_spacepointsOverlap
virtual void newEvent(const EventContext &ctx, EventData &data, int iteration) const override
Gaudi::Property< bool > m_writeNtuple
SG::ReadHandleKey< SpacePointContainer > m_spacepointsStrip
static void convertToBeamFrameWork(EventData &data, const Trk::SpacePoint *, float *)
void production3SpSSS(EventData &data, std::array< std::vector< SiSpacePointForSeed * >::iterator, arraySizeNeighbourBins > &iter_bottomCands, std::array< std::vector< SiSpacePointForSeed * >::iterator, arraySizeNeighbourBins > &iter_endBottomCands, std::array< std::vector< SiSpacePointForSeed * >::iterator, arraySizeNeighbourBins > &iter_topCands, std::array< std::vector< SiSpacePointForSeed * >::iterator, arraySizeNeighbourBins > &iter_endTopCands, const int numberBottomCells, const int numberTopCells, int &nseed) const
: Seed production from space points.
SG::ReadCondHandleKey< AtlasFieldCacheCondObj > m_fieldCondObjInputKey
void initializeEventData(EventData &data, const EventContext &ctx) const
std::array< std::array< int, arraySizeNeighbourBins >, arraySizePhiZ > m_neighbourCellsTopPPP
mapping of neighbour cells in the 2D phi-z binning to consider for the "top SP" search for central SP...
virtual void newRegion(const EventContext &ctx, EventData &data, const std::vector< IdentifierHash > &vPixel, const std::vector< IdentifierHash > &vStrip) const override
void newOneSeedWithCurvaturesComparisonSeedConfirmation(EventData &data, SiSpacePointForSeed *&SPb, SiSpacePointForSeed *&SP0, float Zob) const
FloatProperty m_dImpactCutSlopeUnconfirmedPPP
void buildBeamFrameWork(EventData &data) const
static void erase(EventData &data)
virtual void find3Sp(const EventContext &ctx, EventData &data, const std::list< Trk::Vertex > &lv) const override
with three space points with or without vertex constraint
int m_nBinsR
number of bins in the radial coordinate
static void buildConnectionMaps(std::array< int, arraySizePhiZ > &nNeighbourCellsBottom, std::array< int, arraySizePhiZ > &nNeighbourCellsTop, std::array< std::array< int, arraySizeNeighbourBins >, arraySizePhiZ > &neighbourCellsBottom, std::array< std::array< int, arraySizeNeighbourBins >, arraySizePhiZ > &neighbourCellsTop, int maxPhiBin, bool isSSS)
void production2Sp(EventData &data) const
BooleanProperty m_checketa
BooleanProperty m_useOverlap
This is a "hash" representation of an Identifier.
Class to hold geometrical description of a silicon detector element.
Class to represent a position in the natural frame of a silicon sensor, for Pixel and SCT For Pixel: ...
Trk::Surface & surface()
Element Surface.
@ ITk
ITk::SiSpacePointsSeedMaker.
Local cache for magnetic field (based on MagFieldServices/AtlasFieldSvcTLS.h).
bool solenoidOn() const
status of the magnets
void getFieldZR(const double *ATH_RESTRICT xyz, double *ATH_RESTRICT bxyz, double *ATH_RESTRICT deriv=nullptr)
get B field valaue on the z-r plane at given position works only inside the solenoid.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
const_pointer_type cptr()
Dereference the pointer.
const std::pair< const PrepRawData *, const PrepRawData * > & clusterList() const
return the pair of cluster pointers by reference
Abstract Base Class for tracking surfaces.
const Amg::Transform3D & transform() const
Returns HepGeom::Transform3D by reference.
This class is a simplest representation of a vertex candidate.
int ir
counter of the current depth
Eigen::Affine3d Transform3D
Eigen::Matrix< double, 2, 1 > Vector2D
Eigen::Matrix< double, 3, 1 > Vector3D
InDet::SiSpacePointsSeedMakerEventData EventData
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.
hold the test vectors and ease the comparison