38 : base_class(
t,
n,
p),
39 m_thistSvc(
"THistSvc",
n),
40 m_outputTree(nullptr),
42 m_treeFolder(
"/valNtuples/")
86 m_treeName = (std::string(
"SeedTree_")+
name());
87 std::replace( m_treeName.begin(), m_treeName.end(),
'.',
'_' );
89 m_outputTree =
new TTree( m_treeName.c_str() ,
"SeedMakerValTool");
91 m_outputTree->Branch(
"eventNumber", &m_eventNumber,
"eventNumber/L");
116 TString fullTreeName = m_treeFolder + m_treeName;
145 if (not
data.initialized)
150 data.trigger =
false;
152 data.iteration = iteration;
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()) {
195 if ((prd_to_track_map_cptr &&
isUsed(sp, *prd_to_track_map_cptr)) || sp->r() >
m_r_rmax || sp->r() <
m_r_rmin)
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()) {
224 if ((prd_to_track_map_cptr &&
isUsed(sp, *prd_to_track_map_cptr)) || sp->r() >
m_r_rmax || sp->r() <
m_r_rmin)
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()) {
274 if ((prd_to_track_map_cptr &&
isUsed(sp, *prd_to_track_map_cptr)) || sp->r() >
m_r_rmax || sp->r() <
m_r_rmin)
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);
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);
426 const std::vector<IdentifierHash> &vPixel,
const std::vector<IdentifierHash> &vStrip,
const IRoiDescriptor &IRD)
const
428 constexpr
float twoPi = 2. *
M_PI;
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())
487 data.i_ITkSeedEnd =
data.i_ITkSeeds.begin();
501 data.i_ITkSeed =
data.i_ITkSeeds.begin();
517 if (not
data.initialized)
525 data.zminU = ZVertex[0];
528 data.zmaxU = ZVertex[1];
534 if (lv.begin() != lv.end())
544 data.i_ITkSeedEnd =
data.i_ITkSeeds.begin();
557 data.i_ITkSeed =
data.i_ITkSeeds.begin();
575 if (not
data.initialized)
585 if (lv.begin() != lv.end())
591 data.i_ITkSeedEnd =
data.i_ITkSeeds.begin();
602 data.i_ITkSeed =
data.i_ITkSeeds.begin();
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();
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.;
868 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)
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,
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))) -
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));
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);
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])
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);
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) {
1373 std::pair<Amg::Vector3D, Amg::Vector3D>
e0 =
1375 std::pair<Amg::Vector3D, Amg::Vector3D>
e1 =
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) {
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{};
1500 std::array<std::array<int, arraySizeNeighbourBins>, arraySizePhiZ> neighbourCellsBottom{};
1501 std::array<std::array<int, arraySizeNeighbourBins>, arraySizePhiZ> neighbourCellsTop{};
1506 nNeighbourCellsBottom = m_nNeighbourCellsBottomPPP;
1507 nNeighbourCellsTop = m_nNeighbourCellsTopPPP;
1508 neighbourCellsBottom = m_neighbourCellsBottomPPP;
1509 neighbourCellsTop = m_neighbourCellsTopPPP;
1514 nNeighbourCellsBottom = m_nNeighbourCellsBottomSSS;
1515 nNeighbourCellsTop = m_nNeighbourCellsTopSSS;
1516 neighbourCellsBottom = m_neighbourCellsBottomSSS;
1517 neighbourCellsTop = m_neighbourCellsTopSSS;
1523 data.endlist =
true;
1530 int z = (m_fastTracking && m_pixel) ? 2 : 0;
1538 for (;
z < arraySizeZ; ++
z)
1541 if (m_fastTracking && m_pixel)
1543 data.RTmax = RTmax[ zBinIndex[
z] ];
1544 data.RTmin = RTmin[ zBinIndex[
z] ];
1547 int phiZbin =
phiBin * arraySizeZ + zBinIndex[
z];
1550 if (!
data.rfz_map[phiZbin])
1555 int numberBottomCells = 0;
1556 int numberTopCells = 0;
1562 for (
int neighbourCellNumber = 0; neighbourCellNumber < nNeighbourCellsBottom[phiZbin]; ++neighbourCellNumber)
1565 int theNeighbourCell = neighbourCellsBottom[phiZbin][neighbourCellNumber];
1567 if (!
data.rfz_map[theNeighbourCell])
1570 iter_bottomCands[numberBottomCells] =
data.rfz_ITkSorted[theNeighbourCell].begin();
1571 iter_endBottomCands[numberBottomCells++] =
data.rfz_ITkSorted[theNeighbourCell].end();
1578 for (
int neighbourCellNumber = 0; neighbourCellNumber < nNeighbourCellsTop[phiZbin]; ++neighbourCellNumber)
1581 int theNeighbourCell = neighbourCellsTop[phiZbin][neighbourCellNumber];
1583 if (!
data.rfz_map[theNeighbourCell])
1586 iter_topCands[numberTopCells] =
data.rfz_ITkSorted[theNeighbourCell].begin();
1587 iter_endTopCands[numberTopCells++] =
data.rfz_ITkSorted[theNeighbourCell].end();
1594 production3SpPPP(
data, iter_bottomCands, iter_endBottomCands, iter_topCands, iter_endTopCands, numberBottomCells, numberTopCells, nseed);
1596 production3SpSSS(
data, iter_bottomCands, iter_endBottomCands, iter_topCands, iter_endTopCands, numberBottomCells, numberTopCells, nseed);
1599 production3SpTrigger(
data, iter_bottomCands, iter_endBottomCands, iter_topCands, iter_endTopCands, numberBottomCells, numberTopCells, nseed);
1608 if (nseed >= m_maxsize)
1610 data.endlist =
false;
1617 data.endlist =
true;
1629 const int numberBottomCells,
const int numberTopCells,
int &nseed)
const
1647 for (; iter_centralSP != iter_endBottomCands[0]; ++iter_centralSP)
1650 if((*iter_centralSP)->radius() >
data.RTmin)
break;
1655 iter_topCands[0] = iter_centralSP;
1659 const float &ipt2K =
data.ipt2K;
1660 const float &ipt2C =
data.ipt2C;
1661 const float &COFK =
data.COFK;
1662 const float &maxd0cut = m_maxdImpact;
1664 const float &dzdrmax =
data.dzdrmax;
1665 data.ITkCmSp.clear();
1669 size_t SPcapacity =
data.ITkSP.size();
1672 for (; iter_centralSP != iter_endBottomCands[0]; ++iter_centralSP)
1674 const float &
R = (*iter_centralSP)->radius();
1680 const float &
X = (*iter_centralSP)->x();
1681 const float &
Y = (*iter_centralSP)->y();
1682 const float &
Z = (*iter_centralSP)->z();
1686 double absZ = std::abs(
Z);
1687 if (!m_fastTracking && absZ > m_zmaxPPP)
1690 float covr0 = (*iter_centralSP)->covr();
1691 float covz0 = (*iter_centralSP)->covz();
1695 float VR = maxd0cut / (
R *
R);
1709 if (iter_otherSP == iter_otherSPend)
continue;
1711 for(; iter_otherSP!=iter_otherSPend; ++iter_otherSP) {
1712 if(( (*iter_otherSP)->radius()-
R ) >= m_drminPPP)
break;
1714 iter_topCands[
cell]=iter_otherSP;
1717 for (; iter_otherSP != iter_endTopCands[
cell]; ++iter_otherSP)
1720 float Rt = (*iter_otherSP)->radius();
1723 const float dz = (*iter_otherSP)->z() -
Z;
1724 const float dZdR = dz / dR;
1727 const float z0 =
Z -
R * dZdR;
1731 float dx = (*iter_otherSP)->x() -
X;
1732 float dy = (*iter_otherSP)->y() -
Y;
1735 float dxy =
x *
x +
y *
y;
1736 float r2 = 1. / dxy;
1740 if (std::abs(
R *
y) > maxd0cut *
x)
1743 y < 0. ? V0 = VR : V0 = -VR;
1744 float A = (
v - V0) / (
u + 1. /
R);
1745 float B = V0 +
A /
R;
1746 if ((
B *
B) > (ipt2K * (1. +
A *
A)))
1750 const float dr = std::sqrt(r2);
1751 const float tz = dz *
dr;
1753 if (std::abs(tz) > dzdrmax)
1757 data.ITkSP[Nt] = (*iter_otherSP);
1761 data.Er[Nt] = ((covz0 + (*iter_otherSP)->covz()) + (tz * tz) * (covr0 + (*iter_otherSP)->covr())) * r2;
1762 data.ITkSP[Nt]->setDR(std::sqrt(dxy + dz * dz));
1763 data.ITkSP[Nt]->setDZDR(dZdR);
1764 data.Tn[Nt].Fl = tz;
1765 data.Tn[Nt].In = Nt;
1770 if (++Nt == SPcapacity)
1772 size_t increment = 50;
1774 SPcapacity =
data.ITkSP.size();
1794 for(; iter_otherSP!=iter_endBottomCands[
cell]; ++iter_otherSP) {
1795 if( (
R - (*iter_otherSP)->radius()) <= m_drmaxPPP)
break;
1797 iter_bottomCands[
cell]=iter_otherSP;
1800 for (; iter_otherSP != iter_endBottomCands[
cell]; ++iter_otherSP)
1803 const float &Rb = (*iter_otherSP)->radius();
1807 if (dR < m_drminPPP)
1810 const float dz =
Z - (*iter_otherSP)->z();
1811 const float dZdR = dz / dR;
1814 const float z0 =
Z -
R * dZdR;
1818 float dx = (*iter_otherSP)->x() -
X;
1819 float dy = (*iter_otherSP)->y() -
Y;
1822 float dxy = (
x *
x +
y *
y );
1823 float r2 = 1. / dxy;
1827 if (std::abs(
R *
y) > -maxd0cut *
x)
1830 y > 0. ? V0 = VR : V0 = -VR;
1831 float A = (
v - V0) / (
u + 1. /
R);
1832 float B = V0 +
A /
R;
1833 if ((
B *
B) > (ipt2K * (1. +
A *
A)))
1837 const float dr = std::sqrt(r2);
1838 const float tz = dz *
dr;
1840 if (std::abs(tz) > dzdrmax)
1842 if (m_fastTracking && (*iter_otherSP)->radius() < 50. && std::abs(tz) > 1.5)
1846 data.ITkSP[Nb] = (*iter_otherSP);
1850 data.Er[Nb] = ((covz0 + (*iter_otherSP)->covz()) + (tz * tz) * (covr0 + (*iter_otherSP)->covr())) * r2;
1851 data.ITkSP[Nb]->setDR(std::sqrt(dxy + dz * dz));
1852 data.ITkSP[Nb]->setDZDR(dZdR);
1853 data.Tn[Nb].Fl = tz;
1854 data.Tn[Nb].In = Nb;
1859 if (++Nb == SPcapacity)
1861 size_t increment = 50;
1863 SPcapacity =
data.ITkSP.size();
1874 sort(
data.Tn,Nt,Nb-Nt);
1877 data.nOneSeedsQ = 0;
1878 data.ITkMapOneSeeds.clear();
1879 data.ITkMapOneSeedsQ.clear();
1884 for (
size_t ib = Nt;
ib < Nb; ++
ib)
1891 float Tzb =
data.Tn[
ib].Fl;
1894 float Rb2r =
data.R[
b] * covr0;
1895 float Rb2z =
data.R[
b] * covz0;
1896 float Erb =
data.Er[
b];
1897 float Vb =
data.V[
b];
1898 float Ub =
data.U[
b];
1899 float Tzb2 = (1. + Tzb * Tzb);
1900 float sTzb2 = std::sqrt(Tzb2);
1902 float sigmaSquaredScatteringPtDependent = Tzb2 * COFK;
1903 float sigmaSquaredScatteringMinPt = Tzb2 * ipt2C;
1904 float d0max = maxd0cut;
1909 if (
data.ITkSP[
b]->radius() > m_rmaxPPP){
1912 if (
data.nOneSeedsQ)
1916 for (
size_t it = it0;
it < Nt; ++
it)
1920 float Tzt =
data.Tn[
it].Fl;
1928 float meanOneOverTanThetaSquare = Tzb * Tzt;
1931 float sigmaSquaredSpacePointErrors = Erb +
data.Er[
t]
1932 + 2 * Rb2z *
data.R[
t]
1933 + 2 * Rb2r *
data.R[
t] * meanOneOverTanThetaSquare;
1936 float remainingSquaredDelta = (Tzb - Tzt) * (Tzb - Tzt) - sigmaSquaredSpacePointErrors;
1940 if (remainingSquaredDelta - sigmaSquaredScatteringMinPt > 0)
1970 float dU =
data.U[
t] - Ub;
1973 float A = (
data.V[
t] - Vb) / dU;
1974 float onePlusAsquare = 1. +
A *
A;
1975 float B = Vb -
A * Ub;
1976 float BSquare =
B *
B;
1990 if (BSquare > ipt2K * onePlusAsquare)
1992 if (remainingSquaredDelta * onePlusAsquare > BSquare * sigmaSquaredScatteringPtDependent)
2016 float d0 = std::abs((
A -
B *
R) *
R);
2028 data.ITkSP[
t]->setScorePenalty(std::abs((Tzb - Tzt) / (
dr * sTzb2)));
2032 data.ITkCmSp.emplace_back(
B / std::sqrt(onePlusAsquare),
data.ITkSP[
t]);
2034 if (
data.ITkCmSp.size() == 500)
2041 if (
data.ITkCmSp.size() > Nc)
2043 newOneSeedWithCurvaturesComparisonPPP(
data,
data.ITkSP[
b], (*iter_centralSP),
Z -
R * Tzb);
2045 data.ITkCmSp.clear();
2049 nseed +=
data.fillOneSeeds;
2063 const int numberBottomCells,
const int numberTopCells,
int &nseed)
const
2082 for (; iter_centralSP != iter_endBottomCands[0]; ++iter_centralSP)
2085 if((*iter_centralSP)->radius() >
data.RTmin)
break;
2090 iter_topCands[0] = iter_centralSP;
2094 const float ipt2K =
data.ipt2K;
2095 const float ipt2C =
data.ipt2C;
2096 const float COFK =
data.COFK;
2097 const float maxd0cut = m_maxdImpactSSS;
2099 data.ITkCmSp.clear();
2103 size_t SPcapacity =
data.ITkSP.size();
2106 for (; iter_centralSP != iter_endBottomCands[0]; ++iter_centralSP)
2109 const float &
R = (*iter_centralSP)->radius();
2111 if(
R >
data.RTmax)
break;
2114 const float &
X = (*iter_centralSP)->x();
2115 const float &
Y = (*iter_centralSP)->y();
2116 const float &
Z = (*iter_centralSP)->z();
2120 double absZ = std::abs(
Z);
2122 if (absZ > m_zmaxSSS)
2134 for (iter_otherSP = iter_topCands[
cell]; iter_otherSP != iter_endTopCands[
cell]; ++iter_otherSP)
2137 float Rt = (*iter_otherSP)->radius();
2139 if (dR >= m_drminSSS)
2142 iter_topCands[
cell] = iter_otherSP;
2145 for (iter_otherSP = iter_topCands[
cell]; iter_otherSP != iter_endTopCands[
cell]; ++iter_otherSP)
2149 float Rt = (*iter_otherSP)->radius();
2152 if (dR > m_drmaxSSS)
2155 const float dz = (*iter_otherSP)->z() -
Z;
2156 const float dZdR = dz / dR;
2160 const float z0 =
Z -
R * dZdR;
2161 if (std::abs(dz) > m_dzmaxSSS || std::abs(
z0) >
zmax)
2167 const float ax =
X*Ri;
2168 const float ay =
Y*Ri;
2169 float VR = m_maxdImpact*Ri*Ri ;
2170 float dx = (*iter_otherSP)->x() -
X;
2171 float dy = (*iter_otherSP)->y() -
Y;
2175 if(std::abs(
R*
y) > maxd0cut *
x) {
2176 float r2 = 1. / (
x *
x +
y *
y);
2179 const float V0 = (
y < 0.) ? VR: -VR;
2180 float A = (
v-V0)/(
u+Ri) ;
2182 if((
B*
B) > (ipt2K*(1.+
A*
A)))
continue;
2187 data.ITkSP[Nt] = (*iter_otherSP);
2188 data.ITkSP[Nt]->setDZDR(dZdR);
2192 if (++Nt == SPcapacity)
2194 data.resizeSPCont();
2195 SPcapacity =
data.ITkSP.size();
2214 for(iter_otherSP=iter_bottomCands[
cell]; iter_otherSP!=iter_endBottomCands[
cell]; ++iter_otherSP) {
2215 if((
R-(*iter_otherSP)->radius()) <= m_drmaxSSS)
break;
2217 iter_bottomCands[
cell]=iter_otherSP;
2220 for (; iter_otherSP != iter_endBottomCands[
cell]; ++iter_otherSP)
2224 const float &Rb = (*iter_otherSP)->radius();
2228 if (dR < m_drminSSS)
2231 const float dz =
Z - (*iter_otherSP)->z();
2232 const float dZdR = dz / dR;
2236 const float z0 =
Z -
R * dZdR;
2237 if (std::abs(dz) > m_dzmaxSSS || std::abs(
z0) >
zmax)
2243 const float ax =
X*Ri;
2244 const float ay =
Y*Ri;
2245 float VR = m_maxdImpact*Ri*Ri ;
2246 float dx = (*iter_otherSP)->x() -
X;
2247 float dy = (*iter_otherSP)->y() -
Y;
2251 if(std::abs(
R*
y) > -maxd0cut *
x) {
2252 float r2 = 1. / (
x *
x +
y *
y);
2255 const float V0 = (
y < 0.) ? VR: -VR;
2256 float A = (
v-V0)/(
u+Ri) ;
2258 if((
B*
B) > (ipt2K*(1.+
A*
A)))
continue;
2263 data.ITkSP[Nb] = (*iter_otherSP);
2264 data.ITkSP[Nb]->setDZDR(dZdR);
2268 if (++Nb == SPcapacity)
2270 data.resizeSPCont();
2271 SPcapacity =
data.ITkSP.size();
2281 float covr0 = (*iter_centralSP)->covr();
2282 float covz0 = (*iter_centralSP)->covz();
2290 for (
size_t i = 0;
i < Nb; ++
i)
2297 float dx = sp->
x() -
X;
2298 float dy = sp->
y() -
Y;
2299 float dz = sp->
z() -
Z;
2304 float r2 = 1. / (
x *
x +
y *
y);
2306 float dr = std::sqrt(r2);
2324 data.Er[
i] = ((covz0 + sp->
covz()) + (tz * tz) * (covr0 + sp->
covr())) * r2;
2328 data.nOneSeedsQ = 0;
2329 data.ITkMapOneSeeds.clear();
2330 data.ITkMapOneSeedsQ.clear();
2334 for (
size_t b = Nt;
b < Nb; ++
b)
2338 float Zob =
data.Zo[
b];
2339 float Tzb =
data.Tz[
b];
2340 float Rb2r =
data.R[
b] * covr0;
2341 float Rb2z =
data.R[
b] * covz0;
2342 float Erb =
data.Er[
b];
2343 float Vb =
data.V[
b];
2344 float Ub =
data.U[
b];
2345 float Tzb2 = (1. + Tzb * Tzb);
2346 float sTzb2 = std::sqrt(Tzb2);
2347 float Se = 1. / std::sqrt(Tzb2);
2348 float Ce = Se * Tzb;
2352 float sigmaSquaredScatteringPtDependent = Tzb2 * COFK;
2353 float sigmaSquaredScatteringMinPt = Tzb2 * ipt2C;
2354 float d0max = maxd0cut;
2359 for (
size_t t = 0;
t < Nt; ++
t)
2386 float dU0 =
data.U[
t] - Ub;
2389 float A0 = (
data.V[
t] - Vb) / dU0;
2391 float Cn = Ce * std::sqrt(1. + A0 * A0);
2393 float dn[3] = {Sx - Sy * A0, Sx * A0 + Sy, Cn};
2395 if (!(*iter_centralSP)->coordinates(
dn,
rn))
2400 float B0 = 2. * (Vb - A0 * Ub);
2401 float Cb = 1. - B0 *
data.Y[
b];
2402 float Sb = A0 + B0 *
data.X[
b];
2403 float db[3] = {Sx * Cb - Sy * Sb, Sx * Sb + Sy * Cb, Cn};
2405 if (!
data.ITkSP[
b]->coordinates(
db,
rb))
2410 float Ct = 1. - B0 *
data.Y[
t];
2411 float St = A0 + B0 *
data.X[
t];
2412 float dt[3] = {Sx * Ct - Sy * St, Sx * St + Sy * Ct, Cn};
2414 if (!
data.ITkSP[
t]->coordinates(
dt, rt))
2417 float xb =
rb[0] -
rn[0];
2418 float yb =
rb[1] -
rn[1];
2419 float zb =
rb[2] -
rn[2];
2420 float xt = rt[0] -
rn[0];
2421 float yt = rt[1] -
rn[1];
2422 float zt = rt[2] -
rn[2];
2424 float rb2 = 1. / (
xb *
xb + yb * yb);
2425 float rt2 = 1. / (
xt *
xt +
yt *
yt);
2427 float tb = -zb * std::sqrt(rb2);
2428 float tz =
zt * std::sqrt(rt2);
2436 float meanOneOverTanTheta = (
tb + tz) / 2.;
2439 float sigmaSquaredSpacePointErrors = Erb +
data.Er[
t]
2440 + 2 * Rb2z *
data.R[
t]
2441 + 2 * Rb2r *
data.R[
t] * meanOneOverTanTheta * meanOneOverTanTheta;
2444 float remainingSquaredDelta = (
tb - tz) * (
tb - tz) - sigmaSquaredSpacePointErrors;
2448 if (remainingSquaredDelta - sigmaSquaredScatteringMinPt > 0)
2451 float Rn = std::sqrt(
rn[0] *
rn[0] +
rn[1] *
rn[1]);
2452 float Ax =
rn[0] / Rn;
2453 float Ay =
rn[1] / Rn;
2455 float ub = (
xb * Ax + yb * Ay) * rb2;
2456 float vb = (yb * Ax -
xb * Ay) * rb2;
2457 float ut = (
xt * Ax +
yt * Ay) * rt2;
2458 float vt = (
yt * Ax -
xt * Ay) * rt2;
2463 float A = (
vt - vb) / dU;
2464 float onePlusAsquare = 1. +
A *
A;
2465 float B = vb -
A * ub;
2466 float BSquare =
B *
B;
2480 if (BSquare > ipt2K * onePlusAsquare || remainingSquaredDelta * onePlusAsquare > BSquare * sigmaSquaredScatteringPtDependent)
2499 float d0 = std::abs((
A -
B * Rn) * Rn);
2505 float dr = std::sqrt(1 / rb2);
2507 dr = std::sqrt(1 / rt2);
2511 data.ITkSP[
t]->setScorePenalty(std::abs((
tb - tz) / (
dr * sTzb2)));
2514 data.ITkSP[
t]->setDR(DR);
2517 data.ITkCmSp.emplace_back(
B / std::sqrt(onePlusAsquare),
data.ITkSP[
t]);
2519 if (
data.ITkCmSp.size() == 500)
2524 if (!
data.ITkCmSp.empty())
2527 newOneSeedWithCurvaturesComparisonSSS(
data,
data.ITkSP[
b], (*iter_centralSP), Zob);
2532 nseed +=
data.fillOneSeeds;
2541 void SiSpacePointsSeedMaker::production3SpTrigger(
EventData &,
2546 const int ,
const int ,
int &)
const
2548 ATH_MSG_WARNING(
"ITk::SiSpacePointsSeedMaker::production3SpTrigger not implemented!");
2562 if (!
data.ITkMapOneSeeds.empty())
2564 std::multimap<float, SiSpacePointsProSeed *>::reverse_iterator
l =
data.ITkMapOneSeeds.rbegin();
2565 worstQualityInMap = (*l).first;
2566 worstSeedSoFar = (*l).second;
2570 if (
data.nOneSeeds <
data.maxSeedsPerSP
2573 || (m_useSeedConfirmation &&
data.keepAllConfirmedSeeds && worstQualityInMap <= seedCandidateQuality && isConfirmedSeed(
p1,
p3, seedCandidateQuality) &&
data.nOneSeeds <
data.seedPerSpCapacity)
2576 || (m_useSeedConfirmation &&
data.keepAllConfirmedSeeds && worstQualityInMap > seedCandidateQuality && isConfirmedSeed(worstSeedSoFar->
spacepoint0(), worstSeedSoFar->
spacepoint2(), worstQualityInMap) &&
data.nOneSeeds <
data.seedPerSpCapacity))
2579 data.ITkMapOneSeeds.insert(std::make_pair(seedCandidateQuality, &
data.ITkOneSeeds[
data.nOneSeeds]));
2584 else if (worstQualityInMap > seedCandidateQuality)
2590 i =
data.ITkMapOneSeeds.insert(std::make_pair(seedCandidateQuality, worstSeedSoFar));
2592 for (++
i;
i !=
data.ITkMapOneSeeds.end(); ++
i)
2594 if ((*i).second == worstSeedSoFar)
2596 data.ITkMapOneSeeds.erase(
i);
2611 if (!
data.ITkMapOneSeedsQ.empty())
2613 std::multimap<float, SiSpacePointsProSeed *>::reverse_iterator
l =
data.ITkMapOneSeedsQ.rbegin();
2614 worstQualityInMap = (*l).first;
2615 worstSeedSoFar = (*l).second;
2619 if (
data.nOneSeedsQ <
data.maxSeedsPerSP
2622 || (m_useSeedConfirmation &&
data.keepAllConfirmedSeeds && worstQualityInMap <= seedCandidateQuality && isConfirmedSeed(
p1,
p3, seedCandidateQuality) &&
data.nOneSeedsQ <
data.seedPerSpCapacity)
2625 || (m_useSeedConfirmation &&
data.keepAllConfirmedSeeds && worstQualityInMap > seedCandidateQuality && isConfirmedSeed(worstSeedSoFar->
spacepoint0(), worstSeedSoFar->
spacepoint2(), worstQualityInMap) &&
data.nOneSeedsQ <
data.seedPerSpCapacity))
2628 data.ITkMapOneSeedsQ.insert(std::make_pair(seedCandidateQuality, &
data.ITkOneSeedsQ[
data.nOneSeedsQ]));
2633 else if (worstQualityInMap > seedCandidateQuality)
2639 i =
data.ITkMapOneSeedsQ.insert(std::make_pair(seedCandidateQuality, worstSeedSoFar));
2641 for (++
i;
i !=
data.ITkMapOneSeedsQ.end(); ++
i)
2643 if ((*i).second == worstSeedSoFar)
2645 data.ITkMapOneSeedsQ.erase(
i);
2660 const float dC = .00003;
2665 std::vector<std::pair<float, SiSpacePointForSeed *>>
::iterator j, jn,
i =
data.ITkCmSp.begin(),
ie =
data.ITkCmSp.end();
2668 for (;
i !=
ie; ++
i)
2670 float u = (*i).second->param();
2671 bool pixt = !(*i).second->spacepoint->clusterList().second;
2672 if (pixt && std::abs(SPb->
z() - (*i).second->z()) > m_dzmaxPPP)
2676 float Ri = (*i).second->radius();
2677 float Ci1 = (*i).first - dC;
2678 float Ci2 = (*i).first + dC;
2688 for (j = jn; j !=
ie; ++j)
2692 if ((*j).first < Ci1)
2698 if ((*j).first > Ci2)
2700 if ((*j).second->sur() == Sui)
2703 float Rj = (*j).second->radius();
2704 if (std::abs(Rj - Ri) < m_drmin)
2715 if ((Rma - Rmi) > 20.)
2731 newOneSeed(
data, SPb, SP0, (*i).second, Zob,
u);
2733 data.ITkCmSp.clear();
2746 data.fillOneSeeds = 0;
2751 if (
data.nOneSeedsQ){
2752 it_seedCandidate =
data.ITkMapOneSeedsQ.begin();
2753 it_endSeedCandidates =
data.ITkMapOneSeedsQ.end();
2757 if (it_seedCandidate == it_endSeedCandidates)
2763 for (; it_seedCandidate != it_endSeedCandidates; ++it_seedCandidate)
2767 float quality = (*it_seedCandidate).first;
2768 theSeed = (*it_seedCandidate).second;
2771 if (!theSeed->setQuality(quality))
2775 if (
data.i_ITkSeedEnd !=
data.i_ITkSeeds.end())
2777 theSeed = &(*
data.i_ITkSeedEnd++);
2778 *theSeed = *(*it_seedCandidate).second;
2783 data.i_ITkSeeds.emplace_back(*(*it_seedCandidate).second);
2784 theSeed = &(
data.i_ITkSeeds.back());
2785 data.i_ITkSeedEnd =
data.i_ITkSeeds.end();
2788 ++
data.fillOneSeeds;
2795 if (not
data.initialized)
2796 initializeEventData(
data, ctx);
2798 if (
data.nspoint == 3)
2803 if (
data.i_ITkSeed ==
data.i_ITkSeedEnd)
2812 if (
data.i_ITkSeed ==
data.i_ITkSeedEnd)
2817 }
while (!(*
data.i_ITkSeed++).set3(
data.seedOutput, 1./(1000. *
data.K)));
2819 return &
data.seedOutput;
2824 if (
data.i_ITkSeed ==
data.i_ITkSeedEnd)
2828 if (
data.i_ITkSeed ==
data.i_ITkSeedEnd)
2831 (*
data.i_ITkSeed++).set2(
data.seedOutput);
2832 return &
data.seedOutput;
2838 float Zv,
float R,
float T)
const
2840 if (Zv < data.zminU || Zv >
data.zmaxU)
2846 for (
const float &
v :
data.l_vertex)
2848 float dZ = std::abs(
v - Zv);
2853 return dZmin < (m_dzver + m_dzdrver *
R) * sqrt(1. +
T *
T);
2863 return newSpacePoint(
data, sp,
r,
true);
2873 convertToBeamFrameWork(
data, sp,
r);
2878 float z = (std::abs(
r[2]) + m_zmax);
2879 float x =
r[0] *
data.dzdrmin;
2880 float y =
r[1] *
data.dzdrmin;
2881 if ((
z *
z) < (
x *
x +
y *
y))
2887 float R2 =
r[0] *
r[0] +
r[1] *
r[1];
2888 if (std::abs(
r[2]) > m_dzMaxFast && R2 < m_R2MaxFast)
2890 if (std::abs(
r[2]) - m_zmax >
data.dzdrmax * std::sqrt(R2))
2894 if (usePixStripInform)
2899 stripInform(
data, sp,
r);
2905 if (
data.i_ITkSpacePointForSeed !=
data.l_ITkSpacePointForSeed.end())
2908 sps = &(*
data.i_ITkSpacePointForSeed++);
2916 data.l_ITkSpacePointForSeed.emplace_back(sp, &(
r[0]));
2918 sps = &(
data.l_ITkSpacePointForSeed.back());
2920 data.i_ITkSpacePointForSeed =
data.l_ITkSpacePointForSeed.end();
2935 if (
data.i_ITkSeedEnd !=
data.i_ITkSeeds.end())
2943 data.i_ITkSeedEnd =
data.i_ITkSeeds.end();
2947 void SiSpacePointsSeedMaker::initializeEventData(
EventData &
data,
const EventContext& ctx)
const
2949 int seedArrayPerSPSize = (m_maxOneSizePPP > m_maxOneSizeSSS ? m_maxOneSizePPP : m_maxOneSizeSSS);
2950 if (m_alwaysKeepConfirmedStripSeeds || m_alwaysKeepConfirmedPixelSeeds)
2951 seedArrayPerSPSize = 50;
2952 data.initialize(EventData::ToolType::ITk,
2962 buildBeamFrameWork(
data);
2965 double magField[3]{0, 0, 0};
2966 double globalPos[3] = {10., 10., 0.};
2971 if (fieldCondObj ==
nullptr) {
2972 ATH_MSG_ERROR(
"ITk::SiSpacePointsSeedMaker: Failed to retrieve AtlasFieldCacheCondObj with key " << m_fieldCondObjInputKey.key());
2976 fieldCondObj->getInitializedCache(fieldCache);
2991 data.K = 2. / (300. * magField[2]);
2993 data.K = 2. / (300. * 5.);
3002 data.ipt2C = m_ipt2 * m_COF;
3005 data.bField[0] = magField[0];
3006 data.bField[1] = magField[1];
3007 data.bField[2] = magField[2];
3015 void SiSpacePointsSeedMaker::newOneSeedWithCurvaturesComparisonSSS(
EventData &
data,
3019 if (m_useSeedConfirmation)
3021 newOneSeedWithCurvaturesComparisonSeedConfirmation(
data, SPb, SP0, Zob);
3027 static const float curvatureInterval = .00003;
3030 if (
data.ITkCmSp.size() > 2)
3033 std::vector<std::pair<float, SiSpacePointForSeed *>>
::iterator it_otherSP;
3034 std::vector<std::pair<float, SiSpacePointForSeed *>>
::iterator it_commonTopSP =
data.ITkCmSp.begin(),
ie =
data.ITkCmSp.end();
3035 std::vector<std::pair<float, SiSpacePointForSeed *>>
::iterator it_startInnerLoop = it_commonTopSP;
3040 for (; it_commonTopSP !=
ie; ++it_commonTopSP)
3046 float seedIP = SPt->
param();
3049 float minCurvature = (*it_commonTopSP).first - curvatureInterval;
3050 float maxCurvature = (*it_commonTopSP).first + curvatureInterval;
3058 for (it_otherSP = it_startInnerLoop; it_otherSP !=
ie; ++it_otherSP)
3061 if (it_otherSP == it_commonTopSP)
3065 if ((*it_otherSP).first < minCurvature)
3067 it_startInnerLoop = it_otherSP;
3068 ++it_startInnerLoop;
3072 if ((*it_otherSP).first > maxCurvature)
3075 float L = (*it_otherSP).second->dR();
3078 for (;
k != NT; ++
k)
3080 if (std::abs(L - Lt[
k]) < 20.)
3092 float Q = seedIP -
float(NT) * 100.;
3096 newOneSeed(
data, SPb, SP0, SPt, Zob, Q);
3098 data.ITkCmSp.clear();
3102 void SiSpacePointsSeedMaker::newOneSeedWithCurvaturesComparisonPPP(
EventData &
data,
3106 if (m_useSeedConfirmation)
3108 newOneSeedWithCurvaturesComparisonSeedConfirmation(
data, SPb, SP0, Zob);
3114 static const float curvatureInterval = .00003;
3117 if (
data.ITkCmSp.size() > 2)
3120 std::vector<std::pair<float, SiSpacePointForSeed *>>
::iterator it_otherSP;
3121 std::vector<std::pair<float, SiSpacePointForSeed *>>
::iterator it_commonTopSP =
data.ITkCmSp.begin(),
ie =
data.ITkCmSp.end();
3122 std::vector<std::pair<float, SiSpacePointForSeed *>>
::iterator it_startInnerLoop = it_commonTopSP;
3127 float Rb = 2. * SPb->
radius();
3134 bool Qm = Rb < 120. || std::abs(Zob) > 150.;
3137 for (; it_commonTopSP !=
ie; ++it_commonTopSP)
3143 float seedIP = SPt->
param();
3146 float minCurvature = (*it_commonTopSP).first - curvatureInterval;
3147 float maxCurvature = (*it_commonTopSP).first + curvatureInterval;
3155 for (it_otherSP = it_startInnerLoop; it_otherSP !=
ie; ++it_otherSP)
3158 if (it_otherSP == it_commonTopSP)
3162 if ((*it_otherSP).first < minCurvature)
3164 it_startInnerLoop = it_otherSP;
3165 ++it_startInnerLoop;
3169 if ((*it_otherSP).first > maxCurvature)
3172 float L = (*it_otherSP).second->dR();
3175 for (;
k != NT; ++
k)
3177 if (std::abs(L - Lt[
k]) < 20.)
3189 if (dN < 0 || (
data.nOneSeedsQ && !dN))
3191 if (Qm && !dN && seedIP > 1.)
3195 float Q = 100. * seedIP + (std::abs(Zob) -
float(NT) * 100.);
3200 newOneSeedQ(
data, SPb, SP0, SPt, Zob, Q);
3207 if (SPmin && !
data.nOneSeedsQ)
3208 newOneSeed(
data, SPb, SP0, SPmin, Zob,
Qmin);
3209 data.ITkCmSp.clear();
3213 void SiSpacePointsSeedMaker::newOneSeedWithCurvaturesComparisonSeedConfirmation(
EventData &
data,
3216 static const float curvatureInterval = .00003;
3218 float bottomSPQuality = SPb->
quality();
3219 float centralSPQuality = SP0->
quality();
3222 if (
data.ITkCmSp.size() > 2)
3225 float bottomR = SPb->
radius();
3226 float bottomZ = SPb->
z();
3228 std::vector<std::pair<float, SiSpacePointForSeed *>>
::iterator it_otherSP;
3229 std::vector<std::pair<float, SiSpacePointForSeed *>>
::iterator it_commonTopSP =
data.ITkCmSp.begin(),
ie =
data.ITkCmSp.end();
3230 std::vector<std::pair<float, SiSpacePointForSeed *>>
::iterator it_startInnerLoop = it_commonTopSP;
3233 for (; it_commonTopSP !=
ie; ++it_commonTopSP)
3238 float seedIP = SPt->
param();
3240 float originalSeedQuality = seedQuality;
3242 if (m_maxdImpact > 50)
3245 float topR = SPt->
radius();
3246 float topZ = SPt->
z();
3248 float Zot = std::abs(topR - bottomR) > 10
e-9 ? bottomZ - (bottomR - originalSeedQuality) * ((topZ - bottomZ) / (topR - bottomR)) : bottomZ;
3250 float theta1 = std::abs(topR - bottomR) > 10
e-9 ? std::atan2(topR - bottomR, topZ - bottomZ) : 0.;
3253 float theta0 = seedIP > 0 ? std::atan2(seedIP, Zot) : 0;
3258 float f =
std::min(0.5, originalSeedQuality / 200.);
3259 seedQuality *= (1 -
f) / 300.;
3267 float radiusTopSP = SPt->
radius();
3269 float minCurvature = (*it_commonTopSP).first - curvatureInterval;
3270 float maxCurvature = (*it_commonTopSP).first + curvatureInterval;
3279 if (!bottomSPisPixel)
3281 seedQuality += m_seedScoreBonusSSS;
3283 else if (topSPisPixel)
3284 seedQuality += m_seedScoreBonusPPP;
3292 for (it_otherSP = it_startInnerLoop; it_otherSP !=
ie; ++it_otherSP)
3295 if (it_otherSP == it_commonTopSP)
3299 if ((*it_otherSP).first < minCurvature)
3301 it_startInnerLoop = it_otherSP;
3302 ++it_startInnerLoop;
3306 if ((*it_otherSP).first > maxCurvature)
3309 if ((*it_otherSP).second->sur() == surfaceTopSP)
3312 float radiusOtherSP = (*it_otherSP).second->radius();
3313 if (std::abs(radiusOtherSP - radiusTopSP) < m_drminSeedConf)
3316 seedQuality += m_seedScoreBonusConfirmationSeed;
3322 if (seedQuality >
data.maxScore)
3327 if (bottomSPisPixel != topSPisPixel)
3329 if (seedQuality > 0. ||
3330 (seedQuality > bottomSPQuality && seedQuality > centralSPQuality && seedQuality > SPt->
quality()))
3335 if (!isConfirmedSeed(SPb, SPt, seedQuality))
3338 double maxdImpact = m_maxdImpact - (m_dImpactCutSlopeUnconfirmedPPP * SPt->
scorePenalty());
3340 if (!bottomSPisPixel)
3341 maxdImpact = m_maxdImpactSSS - (m_dImpactCutSlopeUnconfirmedSSS * SPt->
scorePenalty());
3342 if (seedIP > maxdImpact)
3346 newOneSeed(
data, SPb, SP0, SPt, Zob, seedQuality);
3348 data.ITkCmSp.clear();
3358 return (quality < m_seedScoreThresholdSSSConfirmationSeed);
3363 return (quality < m_seedScoreThresholdPPPConfirmationSeed);
3367 return (quality < 0.);
3373 std::lock_guard<std::mutex> lock(m_mutex);
3375 if(
track !=
nullptr) {
3376 m_trackPt = (
track->trackParameters()->front()->pT())/1000.
f;
3377 m_trackEta = std::abs(
track->trackParameters()->front()->eta());
3384 m_z0 = seed->zVertex();
3385 m_eta = seed->eta();
3399 m_dzdr_b = seed->dzdr_b();
3400 m_dzdr_t = seed->dzdr_t();
3402 m_givesTrack = !(
track ==
nullptr);
3413 bool SiSpacePointsSeedMaker::getWriteNtupleBoolProperty()
const
3415 return m_writeNtuple;