33 (
const std::string&
t,
const std::string&
n,
const IInterface*
p)
34 : base_class(
t,
n,
p),
35 m_thistSvc(
"THistSvc",
n),
36 m_outputTree(nullptr),
38 m_treeFolder(
"/valNtuples/")
79 m_treeName = (std::string(
"SeedTree_")+
name());
80 std::replace( m_treeName.begin(), m_treeName.end(),
'.',
'_' );
82 m_outputTree =
new TTree( m_treeName.c_str() ,
"SeedMakerValTool");
109 TString fullTreeName = m_treeFolder + m_treeName;
136 data.trigger =
false;
140 data.iteration = iteration;
141 if (iteration <=0)
data.iteration = 0;
149 if (
data.iteration == 0) {
155 double magField[3]{0,0,0};
156 double globalPos[3] ={10.,10.,0.};
162 if (fieldCondObj ==
nullptr) {
166 fieldCondObj->getInitializedCache (fieldCache);
183 data.K = 2.f/(300.f* 5.f );
195 data.i_spforseed =
data.l_spforseed.begin();
228 for (
int i=0;
i<
data.nr; ++
i) {
231 data.r_Sorted[
n].clear();
240 if (!prd_to_track_map.
isValid()) {
243 prd_to_track_map_cptr = prd_to_track_map.
cptr();
257 if (spacepointsPixel.isValid()) {
264 if ((prd_to_track_map_cptr &&
isUsed(sp,*prd_to_track_map_cptr)) || sp->r() >
m_r_rmax)
continue;
270 if (!de || de->
isDBM())
continue;
282 int radiusBin =
static_cast<int>(sps->
radius()*oneOverBinSizeR);
284 if (radiusBin>maxBinR) radiusBin = maxBinR;
287 data.r_Sorted[radiusBin].push_back(sps);
289 ++
data.r_map[radiusBin];
292 if (
data.r_map[radiusBin]==1)
data.r_index[
data.nr++] = radiusBin;
294 if (radiusBin >
data.r_first)
data.r_first = radiusBin;
307 if (spacepointsSCT.isValid()) {
313 if ((prd_to_track_map_cptr &&
isUsed(sp,*prd_to_track_map_cptr)) || sp->r() >
m_r_rmax)
continue;
321 int radiusBin =
static_cast<int>(sps->
radius()*oneOverBinSizeR);
322 if (radiusBin>maxBinR) radiusBin = maxBinR;
324 data.r_Sorted[radiusBin].push_back(sps);
326 ++
data.r_map[radiusBin];
328 if (
data.r_map[radiusBin]==1)
data.r_index[
data.nr++] = radiusBin;
339 if (spacepointsOverlap.isValid()) {
343 if ((prd_to_track_map_cptr &&
isUsed(sp, *prd_to_track_map_cptr)) || sp->r() >
m_r_rmax)
continue;
350 int radiusBin =
static_cast<int>(sps->
radius()*oneOverBinSizeR);
351 if (radiusBin>maxBinR) radiusBin = maxBinR;
353 data.r_Sorted[radiusBin].push_back(sps);
355 ++
data.r_map[radiusBin];
357 if (
data.r_map[radiusBin]==1)
data.r_index[
data.nr++] = radiusBin;
366 if (iteration < 0)
data.r_first = 0;
380 const std::vector<IdentifierHash>& vPixel,
const std::vector<IdentifierHash>& vSCT)
const
385 data.trigger =
false;
397 double magField[3]{0,0,0};
398 double globalPos[3] ={10.,10.,0.};
405 if (fieldCondObj ==
nullptr) {
409 fieldCondObj->getInitializedCache (fieldCache);
417 data.K = 2.f/(300.f* 5.f );
424 data.i_spforseed =
data.l_spforseed.begin();
430 data.checketa =
false;
432 for (
int i=0;
i<
data.nr; ++
i) {
435 data.r_Sorted[
n].clear();
441 if (
m_pixel && !vPixel.empty()) {
444 if ( spacepointsPixel.isValid() ) {
449 const auto *
w = spacepointsPixel->indexFindPtr(
l);
450 if (
w==
nullptr)
continue;
455 int ir =
static_cast<int>(sps->
radius()*oneOverBinSizeR);
456 if (
ir>maxBinR)
ir = maxBinR;
457 data.r_Sorted[
ir].push_back(sps);
468 if (
m_sct && !vSCT.empty()) {
471 if (spacepointsSCT.isValid()) {
476 const auto *
w = spacepointsSCT->indexFindPtr(
l);
477 if (
w==
nullptr)
continue;
482 int ir =
static_cast<int>(sps->
radius()*oneOverBinSizeR);
483 if (
ir>maxBinR)
ir = maxBinR;
484 data.r_Sorted[
ir].push_back(sps);
501 const std::vector<IdentifierHash>& vPixel,
const std::vector<IdentifierHash>& vSCT,
504 constexpr
float twoPi = 2.*
M_PI;
520 if (fmin > fmax) fmin -= twoPi;
521 data.ftrig = (fmin+fmax)*.5
f;
522 data.ftrigW = (fmax-fmin)*.5
f;
538 if (lv.begin()!=lv.end())
mode = 1;
542 data.i_seede_Pro =
data.l_seeds_Pro.begin();
553 data.i_seed_Pro =
data.l_seeds_Pro.begin();
576 if (lv.begin()!=lv.end())
mode = 3;
584 data.i_seede_Pro =
data.l_seeds_Pro.begin();
597 data.i_seed_Pro =
data.l_seeds_Pro.begin();
617 data.zminU = ZVertex[0];
619 data.zmaxU = ZVertex[1];
624 if (lv.begin()!=lv.end())
mode = 3;
632 data.i_seede_Pro =
data.l_seeds_Pro.begin();
645 data.i_seed_Pro =
data.l_seeds_Pro.begin();
667 if (lv.begin()!=lv.end())
mode = 6;
671 data.i_seede_Pro =
data.l_seeds_Pro.begin();
682 data.i_seed_Pro =
data.l_seeds_Pro.begin();
710 for (
int i=0;
i<
n; ++
i)
s2.append(
" ");
714 for (
int i=0;
i<
n; ++
i)
s3.append(
" ");
718 for (
int i=0;
i<
n; ++
i)
s4.append(
" ");
722 for (
int i=0;
i<
n; ++
i) s5.append(
" ");
725 out<<
"|---------------------------------------------------------------------|"
739 <<std::setw(12)<<
m_sct
744 out<<
"| maxSizeSP | "
747 out<<
"| pTmin (mev) | "
748 <<std::setw(12)<<std::setprecision(5)<<
m_ptmin
750 out<<
"| max radius SP | "
751 <<std::setw(12)<<std::setprecision(5)<<
m_r_rmax
753 out<<
"| radius step | "
754 <<std::setw(12)<<std::setprecision(5)<<
m_binSizeR
756 out<<
"| min Z-vertex position | "
757 <<std::setw(12)<<std::setprecision(5)<<
m_zmin
759 out<<
"| max Z-vertex position | "
760 <<std::setw(12)<<std::setprecision(5)<<
m_zmax
762 out<<
"| min radius first SP(2) | "
763 <<std::setw(12)<<std::setprecision(5)<<
m_r1minv
765 out<<
"| min radius second SP(2) | "
766 <<std::setw(12)<<std::setprecision(5)<<
m_r2minv
768 out<<
"| max radius first SP(2) | "
769 <<std::setw(12)<<std::setprecision(5)<<
m_r1maxv
771 out<<
"| max radius second SP(2) | "
772 <<std::setw(12)<<std::setprecision(5)<<
m_r2maxv
774 out<<
"| min space points dR | "
775 <<std::setw(12)<<std::setprecision(5)<<
m_drmin
777 out<<
"| max space points dR | "
778 <<std::setw(12)<<std::setprecision(5)<<
m_drmax
780 out<<
"| max dZ impact | "
781 <<std::setw(12)<<std::setprecision(5)<<
m_dzver
783 out<<
"| max dZ/dR impact | "
784 <<std::setw(12)<<std::setprecision(5)<<
m_dzdrver
786 out<<
"| max impact | "
789 out<<
"| max impact sss | "
792 out<<
"|---------------------------------------------------------------------|"
794 out<<
"| Beam X center | "
795 <<std::setw(12)<<std::setprecision(5)<<
data.xbeam[0]
797 out<<
"| Beam Y center | "
798 <<std::setw(12)<<std::setprecision(5)<<
data.ybeam[0]
800 out<<
"| Beam Z center | "
801 <<std::setw(12)<<std::setprecision(5)<<
data.zbeam[0]
803 out<<
"| Beam X-axis direction | "
804 <<std::setw(12)<<std::setprecision(5)<<
data.xbeam[1]
805 <<std::setw(12)<<std::setprecision(5)<<
data.xbeam[2]
806 <<std::setw(12)<<std::setprecision(5)<<
data.xbeam[3]
808 out<<
"| Beam Y-axis direction | "
809 <<std::setw(12)<<std::setprecision(5)<<
data.ybeam[1]
810 <<std::setw(12)<<std::setprecision(5)<<
data.ybeam[2]
811 <<std::setw(12)<<std::setprecision(5)<<
data.ybeam[3]
813 out<<
"| Beam Z-axis direction | "
814 <<std::setw(12)<<std::setprecision(5)<<
data.zbeam[1]
815 <<std::setw(12)<<std::setprecision(5)<<
data.zbeam[2]
816 <<std::setw(12)<<std::setprecision(5)<<
data.zbeam[3]
818 out<<
"|---------------------------------------------------------------------|"
829 out<<
"|---------------------------------------------------------------------|"
832 <<std::setw(12)<<
data.ns
835 <<std::setw(12)<<
data.nsaz
838 <<std::setw(12)<<
data.nsazv
841 <<std::setw(12)<<
data.l_seeds_Pro.size()
843 out<<
"|---------------------------------------------------------------------|"
854 if (
data.endlist)
return;
856 data.i_seede_Pro =
data.l_seeds_Pro.begin();
862 data.i_seed_Pro =
data.l_seeds_Pro.begin();
872 unsigned int s1 =
data.l_vertex.size();
873 unsigned int s2 = lV.size();
876 data.isvertex =
false;
879 if (s1==0 &&
s2==0)
return false;
882 data.l_vertex.clear();
884 if (
s2 == 0)
return false;
887 data.isvertex =
true;
889 data.l_vertex.insert(
static_cast<float>(
v.position().z()));
896 data.zmaxU = (*
data.l_vertex.rbegin())+20.
f;
942 constexpr
float twoPi = 2.f*
M_PI;
947 const float inverseSizePhiMax =
static_cast<float>(nPhiBinsMax)/twoPi;
956 constexpr
float inverseSizePhiMin = 100./60.;
966 constexpr
float radiusPixelStart = 33.;
967 constexpr
float radiusPixelEnd = 150.;
973 constexpr
float radiusSctStart = 295.; ;
974 constexpr
float radiusSctEnd = 560.;
1000 const float inverseBinSizePhiVertexMax =
static_cast<float>(nPhiBinsVertexMax)/twoPi;
1128 int phiBinBelow =
phiBin-1;
1131 int phiBinTop =
phiBin+1;
1138 int twoDbinLowerPhi = phiBinBelow*
arraySizeZV+zbin;
1139 int twoDbinHigherPhi = phiBinTop*
arraySizeZV+zbin;
1174 double tx =
std::tan(beamSpotHandle->beamTilt(0));
1175 double ty =
std::tan(beamSpotHandle->beamTilt(1));
1177 double phi = std::atan2(ty,
tx);
1178 double theta = std::acos(1./std::sqrt(1.+
tx*
tx+ty*ty));
1184 data.xbeam[0] =
static_cast<float>(bsCentre.x());
1185 data.xbeam[1] =
static_cast<float>(cosTheta*cosPhi*cosPhi+sinPhi*sinPhi);
1186 data.xbeam[2] =
static_cast<float>(cosTheta*sinPhi*cosPhi-sinPhi*cosPhi);
1187 data.xbeam[3] =-
static_cast<float>(sinTheta*cosPhi );
1189 data.ybeam[0] =
static_cast<float>(bsCentre.y());
1190 data.ybeam[1] =
static_cast<float>(cosTheta*cosPhi*sinPhi-sinPhi*cosPhi);
1191 data.ybeam[2] =
static_cast<float>(cosTheta*sinPhi*sinPhi+cosPhi*cosPhi);
1192 data.ybeam[3] =-
static_cast<float>(sinTheta*sinPhi );
1194 data.zbeam[0] =
static_cast<float>(bsCentre.z());
1195 data.zbeam[1] =
static_cast<float>(sinTheta*cosPhi);
1196 data.zbeam[2] =
static_cast<float>(sinTheta*sinPhi);
1197 data.zbeam[3] =
static_cast<float>(cosTheta);
1218 constexpr
float twoPi = 2.*
M_PI;
1220 int firstRadialBin = 0;
1236 const std::map<float, int> ztoBin{
1250 for (
int radialBin=
data.r_first; radialBin<
m_nBinsR; ++radialBin) {
1253 if (!
data.r_map[radialBin])
continue;
1255 if (firstRadialBin == 0) firstRadialBin = radialBin;
1258 if (
data.iteration) {
1265 if (!
data.r_Sorted[radialBin].front()->spacepoint->clusterList().second) {
1280 else if (radialBin > 175) {
1289 float Phi = SP->phi();
1307 auto bound = ztoBin.lower_bound(Z);
1309 if (bound == ztoBin.end()){
1320 data.rfz_Sorted[twoDbin].push_back(SP);
1324 if (!
data.rfz_map[twoDbin]++)
data.rfz_index[
data.nrfz++] = twoDbin;
1348 float Rm =
pTmin/.6f;
1356 float worstCaseD0 = maxd0;
1357 if (maxd0 >
Rmin) worstCaseD0 =
Rmin;
1359 float sI = std::abs(std::asin(worstCaseD0/
Rmin) - std::asin(worstCaseD0/Rmax));
1360 float sF = std::abs(std::asin(
std::min(1.
f,Rmax/(2.
f*Rm))) -
1373 for (
int i=0;
i<
data.nrfz; ++
i) {
1374 int n =
data.rfz_index[
i];
1375 data.rfz_map[
n] = 0;
1376 data.rfz_Sorted[
n].clear();
1379 for (
int i=0;
i<
data.nrfzv; ++
i) {
1380 int n =
data.rfzv_index[
i];
1381 data.rfzv_map[
n] = 0;
1382 data.rfzv_Sorted[
n].clear();
1403 if (
data.nsazv<2)
return;
1419 if (!
data.rfzv_map[
a])
continue;
1420 r0 =
data.rfzv_Sorted[
a].begin();
1421 r0e =
data.rfzv_Sorted[
a].end ();
1423 if (!
data.endlist) {
1425 data.endlist =
true;
1430 for (; r0!=r0e; ++r0) {
1432 float X = (*r0)->x();
1433 float Y = (*r0)->y();
1434 float R = (*r0)->radius();
1437 float Z = (*r0)->z();
1444 for (
int i=0;
i<numberBottomCells; ++
i) {
1447 if (!
data.rfzv_map[an])
continue;
1449 r =
data.rfzv_Sorted[an].begin();
1450 re =
data.rfzv_Sorted[an].end();
1452 for (;
r!=
re; ++
r) {
1454 float Rb =(*r)->radius();
1460 float dZ = Z-(*r)->z();
1462 if (Tz<data.dzdrmin || Tz>
data.dzdrmax)
continue;
1471 float dx =(*r)->x()-
X;
1472 float dy =(*r)->y()-
Y;
1476 if (xy == 0.)
continue;
1480 float UR = Ut*R+1.f;
1481 if (UR == 0.)
continue;
1484 if (std::abs(B*
data.K) >
m_ipt*std::sqrt(1.f+
A*
A))
continue;
1498 data.endlist =
true;
1509 if (
data.nsaz<3)
return;
1532 const std::array<int,arraySizeZ> zBinIndex {5,6,7,8,9,10,4,3,2,1,0};
1544 data.endlist =
true;
1562 if (!
data.rfz_map[phiZbin])
continue;
1566 int numberBottomCells = 0;
1567 int numberTopCells = 0;
1573 for (
int neighbourCellNumber=0; neighbourCellNumber<
m_nNeighbourCellsBottom[phiZbin]; ++neighbourCellNumber) {
1577 if (!
data.rfz_map[theNeighbourCell])
continue;
1579 iter_bottomCands [numberBottomCells] =
data.rfz_Sorted[theNeighbourCell].begin();
1580 iter_endBottomCands[numberBottomCells++] =
data.rfz_Sorted[theNeighbourCell].end();
1587 for (
int neighbourCellNumber=0; neighbourCellNumber<
m_nNeighbourCellsTop[phiZbin]; ++neighbourCellNumber) {
1591 if (!
data.rfz_map[theNeighbourCell])
continue;
1593 iter_topCands [numberTopCells] =
data.rfz_Sorted[theNeighbourCell].begin();
1594 iter_endTopCands[numberTopCells++] =
data.rfz_Sorted[theNeighbourCell].end();
1598 if (!
data.trigger)
production3Sp (
data, iter_bottomCands, iter_endBottomCands, iter_topCands, iter_endTopCands, numberBottomCells, numberTopCells, nseed,zBinIndex[
z]);
1599 else production3SpTrigger(
data, iter_bottomCands, iter_endBottomCands, iter_topCands, iter_endTopCands, numberBottomCells, numberTopCells, nseed);
1615 data.endlist =
true;
1628 const int numberBottomCells,
const int numberTopCells,
int& nseed,
const int zbin)
const
1646 bool isStrip = ((*iter_centralSP)->spacepoint->clusterList().second);
1651 bool isBarrelRegion = (zbin >=4 && zbin <= 6);
1652 bool isTransitionRegion = (zbin == 3 || zbin == 7);
1656 if (isBarrelRegion){
1664 if (isBarrelRegion){
1668 else if (isTransitionRegion){
1676 for(; iter_centralSP!=iter_endBottomCands[0]; ++iter_centralSP) {
1677 if((*iter_centralSP)->radius() > rmin)
break;
1682 iter_topCands[0] = iter_centralSP;
1686 const float ipt2K =
data.ipt2K;
1687 const float ipt2C =
data.ipt2C;
1688 const float COFK =
data.COFK;
1693 const float dzdrmax =
data.dzdrmax;
1694 const float dzdrmin =
data.dzdrmin;
1699 size_t SPcapacity =
data.SP.size();
1702 for (; iter_centralSP!=iter_endBottomCands[0]; ++iter_centralSP) {
1704 const float& R = (*iter_centralSP)->radius();
1708 const float&
X = (*iter_centralSP)->x();
1709 const float&
Y = (*iter_centralSP)->y();
1710 const float& Z = (*iter_centralSP)->z();
1714 double absZ = std::abs(Z);
1716 if (
isStrip && absZ > 2650. )
continue;
1718 if (!
isStrip && absZ > 600.)
continue;
1720 if (
isStrip && isTransitionRegion && absZ < 750. && R > 450.)
continue;
1730 for (iter_otherSP=iter_bottomCands[
cell]; iter_otherSP!=iter_endBottomCands[
cell]; ++iter_otherSP) {
1733 const float& Rb =(*iter_otherSP)->radius();
1739 iter_bottomCands[
cell]=iter_otherSP;
1744 if (dR <
m_drmin || (
data.iteration && (*iter_otherSP)->spacepoint->clusterList().second))
break;
1747 const float dZdR = (Z-(*iter_otherSP)->z())/dR;
1749 const float absdZdR = std::abs(dZdR);
1751 if (absdZdR < dzdrmin or absdZdR > dzdrmax)
continue;
1755 const float z0 = Z-R*dZdR;
1758 data.SP[Nb] = (*iter_otherSP);
1763 if (++Nb==SPcapacity){
1764 data.resizeSPCont();
1765 SPcapacity=
data.SP.size();
1783 for (iter_otherSP=iter_topCands[
cell];iter_otherSP!=iter_endTopCands[
cell]; ++iter_otherSP) {
1786 float Rt =(*iter_otherSP)->radius();
1791 iter_topCands[
cell]=iter_otherSP;
1798 float dZdR = ((*iter_otherSP)->z()-Z)/dR;
1799 float absdZdR = std::abs(dZdR);
1800 if (absdZdR < dzdrmin or absdZdR > dzdrmax)
continue;
1804 float z0 = Z-R*dZdR;
1807 data.SP[Nt] = (*iter_otherSP);
1812 if (++Nt==SPcapacity) {
1813 data.resizeSPCont();
1814 SPcapacity=
data.SP.size();
1820 if (!(Nt-Nb))
continue;
1823 float covr0 = (*iter_centralSP)->covr ();
1824 float covz0 = (*iter_centralSP)->covz ();
1832 for (
size_t i=0;
i<Nt; ++
i) {
1838 float dx = sp->
x()-
X;
1839 float dy = sp->
y()-
Y;
1840 float dz = sp->
z()-Z;
1845 float r2 = 1.f/(
x*
x+
y*
y);
1847 float dr = std::sqrt(r2);
1854 if (
i < Nb) tz = -tz;
1858 data.Zo[
i] = Z-R*tz;
1862 data.Er[
i] = ((covz0+sp->
covz())+(tz*tz)*(covr0+sp->
covr()))*r2;
1866 data.mapOneSeeds_Pro.clear();
1870 for (
size_t b=0;
b<Nb; ++
b) {
1873 float Zob =
data.Zo[
b];
1874 float Tzb =
data.Tz[
b];
1875 float Erb =
data.Er[
b];
1876 float Vb =
data.V [
b];
1877 float Ub =
data.U [
b];
1878 float Tzb2 = (1.f+Tzb*Tzb);
1879 float sTzb2 = std::sqrt(Tzb2);
1880 float sigmaSquaredScatteringPtDependent = Tzb2*COFK;
1881 float sigmaSquaredScatteringMinPt = Tzb2*ipt2C;
1882 float d0max = maxd0cut;
1886 if (
data.SP[
b]->spacepoint->clusterList().second) d0max = maxd0cutstrips;
1889 for (
size_t t=Nb;
t<Nt; ++
t) {
1897 float meanOneOverTanTheta = (Tzb+
data.Tz[
t])/2.
f;
1904 float sigmaSquaredSpacePointErrors = Erb+
data.Er[
t]
1906 + 2.f * covr0 *
data.R[
t]*
data.R[
b] * meanOneOverTanTheta * meanOneOverTanTheta;
1908 float remainingSquaredDelta = (Tzb-
data.Tz[
t])*(Tzb-
data.Tz[
t]) - sigmaSquaredSpacePointErrors;
1912 if (remainingSquaredDelta - sigmaSquaredScatteringMinPt > 0 )
continue;
1935 float deltaU =
data.U[
t]-Ub;
1936 if (deltaU == 0.)
continue;
1937 float A = (
data.V[
t]-Vb)/deltaU;
1939 float onePlusAsquare = 1.f+
A*
A;
1940 float BSquare = B*B;
1954 if (BSquare > ipt2K*onePlusAsquare || remainingSquaredDelta*onePlusAsquare > BSquare*sigmaSquaredScatteringPtDependent)
continue;
1972 if(std::abs(B) < 1
e-10)
d0 = std::abs((
A-B*R)*R);
1975 float x0 = -
A/(2.f*B);
1976 float rTrack = std::sqrt(onePlusAsquare/BSquare)*.5f;
1977 d0 = std::abs(-rTrack + std::sqrt(rTrack*rTrack +2.
f*x0*R +R*R));
1988 data.SP[
t]->setScorePenalty(std::abs((Tzb-
data.Tz[
t])/(
dr*sTzb2)));
1994 data.SP[
t]->setPt(std::sqrt(onePlusAsquare/BSquare)/(1000.
f*
data.K));
1997 data.CmSp.emplace_back(B/std::sqrt(onePlusAsquare),
data.SP[
t]);
2003 if (!
data.CmSp.empty()) {
2010 nseed +=
data.fillOneSeeds;
2025 const int numberBottomCells,
const int numberTopCells,
int& nseed)
const
2027 constexpr
float twoPi = 2.*
M_PI;
2033 if((*r0)->spacepoint->clusterList().second) {
2038 for(; r0!=rbe[0]; ++r0) {
if((*r0)->radius() > rmin)
break;}
2039 rt[0] = r0; ++rt[0];
2041 float ipt2K =
data.ipt2K;
2042 float ipt2C =
data.ipt2C;
2043 float COFK =
data.COFK;
2051 for (; r0!=rbe[0]; ++r0) {
2054 data.mapOneSeeds_Pro.clear();
2056 float R = (*r0)->radius();
2060 float X = (*r0)->x();
2061 float Y = (*r0)->y();
2062 float Z = (*r0)->z();
2067 for (
int i=0;
i<numberBottomCells; ++
i) {
2069 for (
r=
rb[
i];
r!=rbe[
i]; ++
r) {
2071 float Rb =(*r)->radius();
2078 if ((*r)->sur()==sur0)
continue;
2080 if (dR <
m_drmin || (
data.iteration && (*r)->spacepoint->clusterList().second))
break;
2084 float Tz = (Z-(*r)->z())/dR;
2086 if (Zo < data.zminB || Zo >
data.zmaxB)
continue;
2087 float Zu = Z+(550.f-R)*Tz;
2088 if (Zu < data.zminU || Zu >
data.zmaxU)
continue;
2099 for (
int i=0;
i<numberTopCells; ++
i) {
2101 for (
r=rt[
i];
r!=rte[
i]; ++
r) {
2103 float Rt =(*r)->radius();
2111 if ((*r)->sur()==sur0)
continue;
2115 float Tz = ((*r)->z()-Z)/dR;
2117 if (Zo < data.zminB || Zo >
data.zmaxB)
continue;
2118 float Zu = Z+(550.f-R)*Tz;
2119 if (Zu < data.zminU || Zu >
data.zmaxU)
continue;
2126 if (!(Nt-Nb))
continue;
2127 float covr0 = (*r0)->covr ();
2128 float covz0 = (*r0)->covz ();
2133 for (
int i=0;
i<Nt; ++
i) {
2137 float dx = sp->
x()-
X;
2138 float dy = sp->
y()-
Y;
2139 float dz = sp->
z()-Z;
2142 float r2 = 1.f/(
x*
x+
y*
y);
2143 float dr = std::sqrt(r2);
2145 if (
i < Nb) tz = -tz;
2148 data.Zo[
i] = Z-R*tz;
2152 data.Er[
i] = ((covz0+sp->
covz())+(tz*tz)*(covr0+sp->
covr()))*r2;
2159 for (
int b=0;
b<Nb; ++
b) {
2161 float Zob =
data.Zo[
b];
2162 float Tzb =
data.Tz[
b];
2163 float Rb2r =
data.R [
b]*covr0;
2164 float Rb2z =
data.R [
b]*covz0;
2165 float Erb =
data.Er[
b];
2166 float Vb =
data.V [
b];
2167 float Ub =
data.U [
b];
2168 float Tzb2 = (1.f+Tzb*Tzb);
2169 float CSA = Tzb2*COFK;
2170 float ICSA = Tzb2*ipt2C;
2171 float d0max = maxd0cut;
2172 if (
data.SP[
b]->spacepoint->clusterList().second) d0max = maxd0cutstrips;
2174 for (
int t=Nb;
t<Nt; ++
t) {
2177 if ( dT > ICSA)
continue;
2179 float deltaU =
data.U[
t]-Ub;
2180 if (deltaU == 0.)
continue;
2181 float A = (
data.V[
t]-Vb)/deltaU;
2182 float onePlusAsquare = 1.f+
A*
A;
2184 float BSquare = B*B;
2185 if (BSquare > ipt2K*onePlusAsquare || dT*onePlusAsquare > BSquare*CSA)
continue;
2187 float Im = std::abs((
A-B*R)*R);
2188 if (Im > d0max)
continue;
2193 float x = 2.f*B*R-
A;
2196 if (
df >
data.ftrigW)
continue;
2197 data.CmSp.emplace_back(B/std::sqrt(onePlusAsquare),
data.SP[
t]);
2198 data.SP[
t]->setParam(Im);
2200 if (!
data.CmSp.empty()) {
2205 nseed +=
data.fillOneSeeds;
2221 if (!
data.mapOneSeeds_Pro.empty()) {
2222 std::multimap<float,InDet::SiSpacePointsProSeed*>::reverse_iterator
l =
data.mapOneSeeds_Pro.rbegin();
2223 worstQualityInMap = (*l).first;
2224 worstSeedSoFar = (*l).second;
2228 if (
data.nOneSeeds <
data.maxSeedsPerSP
2231 || (
data.keepAllConfirmedSeeds && worstQualityInMap <= seedCandidateQuality &&
isConfirmedSeed(
p1,
p3,seedCandidateQuality) &&
data.nOneSeeds <
data.seedPerSpCapacity)
2237 data.mapOneSeeds_Pro.insert(std::make_pair(seedCandidateQuality, &
data.OneSeeds_Pro[
data.nOneSeeds]));
2241 else if (worstQualityInMap > seedCandidateQuality){
2246 i =
data.mapOneSeeds_Pro.insert(std::make_pair(seedCandidateQuality,worstSeedSoFar));
2248 for (++
i;
i!=
data.mapOneSeeds_Pro.end(); ++
i) {
2249 if ((*i).second==worstSeedSoFar) {
2250 data.mapOneSeeds_Pro.erase(
i);
2262 float computeEta(
float r,
float z) {
2263 if (
r <= 10
e-9)
return 0;
2272 constexpr
float curvatureInterval = .00003;
2275 float bottomSPQuality = SPb->
quality();
2276 float centralSPQuality = SP0->
quality();
2281 float bottomR=SPb->
radius();
2282 float bottomZ=SPb->
z();
2284 std::vector<std::pair<float,InDet::SiSpacePointForSeed*>>
::iterator it_otherSP;
2285 std::vector<std::pair<float,InDet::SiSpacePointForSeed*>>
::iterator it_commonTopSP =
data.CmSp.begin(),
ie =
data.CmSp.end();
2286 std::vector<std::pair<float,InDet::SiSpacePointForSeed*>>
::iterator it_startInnerLoop=it_commonTopSP;
2289 for (; it_commonTopSP!=
ie; ++it_commonTopSP) {
2292 float seedIP = (*it_commonTopSP).second->param();
2293 float seedQuality = seedIP + (*it_commonTopSP).second->scorePenalty();
2294 float originalSeedQuality = seedQuality;
2302 float topR=(*it_commonTopSP).second->radius();
2303 float topZ=(*it_commonTopSP).second->z();
2305 float Zot = std::abs(topR - bottomR) > 10
e-9 ?
2306 bottomZ - (bottomR - originalSeedQuality) * ((topZ - bottomZ) / (topR - bottomR)) : bottomZ;
2308 float eta1 = computeEta(topR - bottomR, topZ - bottomZ);
2309 float eta0 = computeEta(seedIP, Zot);
2314 seedQuality*=(1.f-
f)/300.
f;
2318 bool topSPisPixel = !(*it_commonTopSP).second->spacepoint->clusterList().second;
2321 const Trk::Surface* surfaceTopSP = (*it_commonTopSP).second->sur ();
2322 float radiusTopSP = (*it_commonTopSP).second->radius();
2324 float minCurvature =(*it_commonTopSP).first-curvatureInterval;
2325 float maxCurvature =(*it_commonTopSP).first+curvatureInterval;
2346 for (it_otherSP=it_startInnerLoop; it_otherSP!=
ie; ++it_otherSP) {
2348 if ( it_otherSP == it_commonTopSP )
continue;
2351 if ( (*it_otherSP).first < minCurvature ) {
2352 it_startInnerLoop=it_otherSP;
2353 ++it_startInnerLoop;
2357 if ( (*it_otherSP).first > maxCurvature )
break;
2359 if ( (*it_otherSP).second->sur()==surfaceTopSP)
continue;
2361 float radiusOtherSP = (*it_otherSP).second->radius();
2362 if (std::abs(radiusOtherSP-radiusTopSP) <
m_drmin)
continue;
2370 if (seedQuality >
data.maxScore)
continue;
2374 if (bottomSPisPixel!=topSPisPixel) {
2375 if (seedQuality > 0. ||
2376 (seedQuality > bottomSPQuality && seedQuality > centralSPQuality && seedQuality > (*it_commonTopSP).second->quality())
2386 if (seedIP > maxdImpact)
continue;
2389 newOneSeed(
data, SPb, SP0, (*it_commonTopSP).second, Zob, seedQuality);
2401 data.fillOneSeeds = 0;
2408 if (it_seedCandidate==it_endSeedCandidates)
return;
2413 for (; it_seedCandidate!=it_endSeedCandidates; ++it_seedCandidate) {
2416 float quality = (*it_seedCandidate).first;
2417 theSeed = (*it_seedCandidate).second;
2421 if (!theSeed->setQuality(quality))
continue;
2424 if (
data.i_seede_Pro!=
data.l_seeds_Pro.end()) {
2425 theSeed = &(*
data.i_seede_Pro++);
2426 *theSeed = *(*it_seedCandidate).second;
2429 data.l_seeds_Pro.emplace_back(*(*it_seedCandidate).second);
2430 theSeed = &(
data.l_seeds_Pro.back());
2431 data.i_seede_Pro =
data.l_seeds_Pro.end();
2434 ++
data.fillOneSeeds;
2443 if (
data.nspoint==3) {
2446 if (
data.i_seed_Pro==
data.i_seede_Pro) {
2454 if (
data.i_seed_Pro==
data.i_seede_Pro)
return nullptr;
2457 }
while (!(*
data.i_seed_Pro++).set3(
data.seedOutput));
2460 return &
data.seedOutput;
2463 if (
data.i_seed_Pro==
data.i_seede_Pro) {
2466 if (
data.i_seed_Pro==
data.i_seede_Pro)
return nullptr;
2468 (*
data.i_seed_Pro++).set2(
data.seedOutput);
2469 return &
data.seedOutput;
2480 std::lock_guard<std::mutex> lock(
m_mutex);
2482 if(
track !=
nullptr) {
2483 m_trackPt = (
track->trackParameters()->front()->pT())/1000.
f;
2484 m_trackEta = std::abs(
track->trackParameters()->front()->eta());
2491 m_z0 = seed->zVertex();
2492 m_eta = seed->eta();
2506 m_dzdr_b = seed->dzdr_b();
2507 m_dzdr_t = seed->dzdr_t();
2509 m_givesTrack = !(
track ==
nullptr);
2521 (
EventData&
data,
const float Zv,
const float R,
const float T)
const
2523 if (Zv < data.zminU or Zv >
data.zmaxU)
return false;
2524 if (not
data.isvertex)
return true;
2525 if (
data.l_vertex.empty())
return false;
2528 for (
const float&
v:
data.l_vertex) {
2529 float dZ = std::abs(
v-Zv);
2530 if (dZ >= dZmin)
break;
2550 std::array<float,3>
r{0,0,0};
2554 if (
data.checketa) {
2556 float x =
r[0]*
data.dzdrmin;
2557 float y =
r[1]*
data.dzdrmin;
2558 if ((
z*
z )<(
x*
x+
y*
y))
return sps;
2563 if (
data.i_spforseed!=
data.l_spforseed.end()) {
2565 sps = &(*
data.i_spforseed++);
2568 sps->
set(sp,&(
r[0]));
2571 data.l_spforseed.emplace_back(sp, &(
r[0]));
2573 sps = &(
data.l_spforseed.back());
2575 data.i_spforseed =
data.l_spforseed.end();
2590 if (
data.i_seede_Pro!=
data.l_seeds_Pro.end()) {
2595 data.i_seede_Pro =
data.l_seeds_Pro.end();
2602 data.initialize(EventData::ToolType::ATLxk,
2624 else return (quality < 0.);