27 (
const std::string&
t,
const std::string&
n,
const IInterface*
p)
91 double f[3], gP[3] ={10.,10.,0.};
98 if (fieldCondObj ==
nullptr) {
102 fieldCondObj->getInitializedCache (fieldCache);
107 data.K = 2./(300.*
f[2]);
109 data.K = 2./(300.* 5.);
112 data.i_spforseed =
data.l_spforseed.begin();
122 if (spacepointsPixel.isValid()) {
132 int ir =
static_cast<int>(sps->
radius()*irstep);
133 if (
ir>irmax)
ir = irmax;
134 data.r_Sorted[
ir].push_back(sps);
148 if (spacepointsSCT.isValid()) {
158 int ir =
static_cast<int>(sps->
radius()*irstep);
159 if (
ir>irmax)
ir = irmax;
160 data.r_Sorted[
ir].push_back(sps);
173 if (spacepointsOverlap.isValid()) {
182 int ir =
static_cast<int>(sps->
radius()*irstep);
183 if (
ir>irmax)
ir = irmax;
184 data.r_Sorted[
ir].push_back(sps);
200 (
const EventContext& ctx,
EventData&
data,
const std::vector<IdentifierHash>& vPixel,
const std::vector<IdentifierHash>& vSCT)
const
204 data.trigger =
false;
210 double f[3], gP[3] ={10.,10.,0.};
217 if (fieldCondObj ==
nullptr) {
221 fieldCondObj->getInitializedCache (fieldCache);
226 data.K = 2./(300.*
f[2]);
228 data.K = 2./(300.* 5.);
231 data.i_spforseed =
data.l_spforseed.begin();
238 if (
m_pixel && !vPixel.empty()) {
241 if (spacepointsPixel.isValid()) {
246 const auto *
w = spacepointsPixel->indexFindPtr(
l);
247 if (
w==
nullptr)
continue;
252 int ir =
static_cast<int>(sps->
radius()*irstep);
253 if (
ir>irmax)
ir = irmax;
254 data.r_Sorted[
ir].push_back(sps);
265 if (
m_sct && !vSCT.empty()) {
268 if (spacepointsSCT.isValid()) {
273 const auto *
w = spacepointsSCT->indexFindPtr(
l);
274 if (
w==
nullptr)
continue;
279 int ir =
static_cast<int>(sps->
radius()*irstep);
280 if (
ir>irmax)
ir = irmax;
281 data.r_Sorted[
ir].push_back(sps);
298 const std::vector<IdentifierHash>& vPixel,
const std::vector<IdentifierHash>& vSCT,
312 data.zminU =
data.zminB+550.f*dzdrmin;
313 data.zmaxU =
data.zmaxB+550.f*dzdrmax;
316 if (fmin > fmax) fmin-=(2.*
M_PI);
317 data.ftrig = (fmin+fmax)*.5;
318 data.ftrigW = (fmax-fmin)*.5;
331 if (lv.begin()!=lv.end())
mode = 1;
336 data.i_seede =
data.l_seeds.begin();
365 if (lv.begin()!=lv.end())
mode = 3;
370 data.i_seede =
data.l_seeds.begin();
407 if (lv.begin()!=lv.end())
mode = 6;
412 data.i_seede =
data.l_seeds.begin();
452 std::string
s2;
for (
int i=0;
i<
n; ++
i)
s2.append(
" ");
s2.append(
"|");
454 std::string
s3;
for (
int i=0;
i<
n; ++
i)
s3.append(
" ");
s3.append(
"|");
456 std::string
s4;
for (
int i=0;
i<
n; ++
i)
s4.append(
" ");
s4.append(
"|");
458 std::string s5;
for (
int i=0;
i<
n; ++
i) s5.append(
" "); s5.append(
"|");
461 out<<
"|---------------------------------------------------------------------|"
475 <<std::setw(12)<<
m_sct
480 out<<
"| maxSizeSP | "
483 out<<
"| pTmin (mev) | "
484 <<std::setw(12)<<std::setprecision(5)<<
m_ptmin
487 <<std::setw(12)<<std::setprecision(5)<<
m_etamax
489 out<<
"| max radius SP | "
490 <<std::setw(12)<<std::setprecision(5)<<
m_r_rmax
492 out<<
"| radius step | "
493 <<std::setw(12)<<std::setprecision(5)<<
m_r_rstep
495 out<<
"| min Z-vertex position | "
496 <<std::setw(12)<<std::setprecision(5)<<
m_zmin
498 out<<
"| max Z-vertex position | "
499 <<std::setw(12)<<std::setprecision(5)<<
m_zmax
501 out<<
"| min radius first SP(3) | "
502 <<std::setw(12)<<std::setprecision(5)<<
m_r1min
504 out<<
"| min radius second SP(3) | "
505 <<std::setw(12)<<std::setprecision(5)<<
m_r2min
507 out<<
"| min radius last SP(3) | "
508 <<std::setw(12)<<std::setprecision(5)<<
m_r3min
510 out<<
"| max radius first SP(3) | "
511 <<std::setw(12)<<std::setprecision(4)<<
m_r1max
513 out<<
"| max radius second SP(3) | "
514 <<std::setw(12)<<std::setprecision(5)<<
m_r2max
516 out<<
"| max radius last SP(3) | "
517 <<std::setw(12)<<std::setprecision(5)<<
m_r3max
519 out<<
"| min radius first SP(2) | "
520 <<std::setw(12)<<std::setprecision(5)<<
m_r1minv
522 out<<
"| min radius second SP(2) | "
523 <<std::setw(12)<<std::setprecision(5)<<
m_r2minv
525 out<<
"| max radius first SP(2) | "
526 <<std::setw(12)<<std::setprecision(5)<<
m_r1maxv
528 out<<
"| max radius second SP(2) | "
529 <<std::setw(12)<<std::setprecision(5)<<
m_r2maxv
531 out<<
"| min space points dR | "
532 <<std::setw(12)<<std::setprecision(5)<<
m_drmin
534 out<<
"| max space points dR | "
535 <<std::setw(12)<<std::setprecision(5)<<
m_drmax
537 out<<
"| max dZ impact | "
538 <<std::setw(12)<<std::setprecision(5)<<
m_dzver
540 out<<
"| max dZ/dR impact | "
541 <<std::setw(12)<<std::setprecision(5)<<
m_dzdrver
543 out<<
"| max impact | "
544 <<std::setw(12)<<std::setprecision(5)<<
m_diver
546 out<<
"| max impact pps | "
547 <<std::setw(12)<<std::setprecision(5)<<
m_diverpps
549 out<<
"| max impact sss | "
550 <<std::setw(12)<<std::setprecision(5)<<
m_diversss
552 out<<
"|---------------------------------------------------------------------|"
554 out<<
"| Beam X center | "
555 <<std::setw(12)<<std::setprecision(5)<<
data.xbeam[0]
557 out<<
"| Beam Y center | "
558 <<std::setw(12)<<std::setprecision(5)<<
data.ybeam[0]
560 out<<
"| Beam Z center | "
561 <<std::setw(12)<<std::setprecision(5)<<
data.zbeam[0]
563 out<<
"| Beam X-axis direction | "
564 <<std::setw(12)<<std::setprecision(5)<<
data.xbeam[1]
565 <<std::setw(12)<<std::setprecision(5)<<
data.xbeam[2]
566 <<std::setw(12)<<std::setprecision(5)<<
data.xbeam[3]
568 out<<
"| Beam Y-axis direction | "
569 <<std::setw(12)<<std::setprecision(5)<<
data.ybeam[1]
570 <<std::setw(12)<<std::setprecision(5)<<
data.ybeam[2]
571 <<std::setw(12)<<std::setprecision(5)<<
data.ybeam[3]
573 out<<
"| Beam Z-axis direction | "
574 <<std::setw(12)<<std::setprecision(5)<<
data.zbeam[1]
575 <<std::setw(12)<<std::setprecision(5)<<
data.zbeam[2]
576 <<std::setw(12)<<std::setprecision(5)<<
data.zbeam[3]
578 out<<
"|---------------------------------------------------------------------|"
589 out<<
"|---------------------------------------------------------------------|"
592 <<std::setw(12)<<
data.ns
594 out<<
"| data.nsaz | "
595 <<std::setw(12)<<
data.nsaz
597 out<<
"| data.nsazv | "
598 <<std::setw(12)<<
data.nsazv
601 <<std::setw(12)<<
data.l_seeds.size()
603 out<<
"|---------------------------------------------------------------------|"
614 if (
data.endlist)
return;
616 data.i_seede =
data.l_seeds.begin();
634 unsigned int s1 =
data.l_vertex.size();
635 unsigned int s2 = lV.size();
637 if (s1==0 &&
s2==0)
return false;
639 data.l_vertex.clear();
642 data.l_vertex.insert(
static_cast<float>(
v.position().z()));
672 const float sFmax =
static_cast<float>(NFmax)/
pi2;
673 const float sFmin = 100./60.;
677 else if (
m_sF < sFmin)
m_sF = sFmin;
683 const int NFtmax = 100;
684 const float sFvmax =
static_cast<float>(NFtmax)/
pi2;
805 double tx =
std::tan(beamSpotHandle->beamTilt(0));
806 double ty =
std::tan(beamSpotHandle->beamTilt(1));
808 double ph = std::atan2(ty,
tx);
809 double th = std::acos(1./std::sqrt(1.+
tx*
tx+ty*ty));
810 double sint =
sin(
th);
812 double sinp =
sin(ph);
813 double cosp =
cos(ph);
815 data.xbeam[0] =
static_cast<float>(cb.x());
816 data.xbeam[1] =
static_cast<float>(
cost*cosp*cosp+sinp*sinp);
817 data.xbeam[2] =
static_cast<float>(
cost*sinp*cosp-sinp*cosp);
818 data.xbeam[3] = -
static_cast<float>(sint*cosp );
820 data.ybeam[0] =
static_cast<float>(cb.y());
821 data.ybeam[1] =
static_cast<float>(
cost*cosp*sinp-sinp*cosp);
822 data.ybeam[2] =
static_cast<float>(
cost*sinp*sinp+cosp*cosp);
823 data.ybeam[3] = -
static_cast<float>(sint*sinp );
825 data.zbeam[0] =
static_cast<float>(cb.z());
826 data.zbeam[1] =
static_cast<float>(sint*cosp);
827 data.zbeam[2] =
static_cast<float>(sint*sinp);
828 data.zbeam[3] =
static_cast<float>(
cost);
854 if (!
data.r_map[
i])
continue;
855 r =
data.r_Sorted[
i].begin();
857 while (
r!=
data.r_Sorted[
i].end()) {
861 float F = (*r)->phi();
864 int f =
static_cast<int>(
F*
m_sF);
873 if (Z>0.) {Z < 250.?
z=5 :
z=6;}
874 else {Z >-250.?
z=5 :
z=4;}
877 data.rfz_Sorted[
n].push_back(*
r);
880 if ((*r)->spacepoint->clusterList().second == 0 &&
z>=3 &&
z<=7) {
881 z<=4 ? z=0 : z>=6 ?
z=2 :
z=1;
891 data.rfzv_Sorted[
n].push_back(*
r);
894 data.r_Sorted[
i].erase(
r++);
908 for (
int i=0;
i!=
data.nr; ++
i) {
911 data.r_Sorted[
n].clear();
914 for (
int i=0;
i!=
data.nrfz; ++
i) {
915 int n =
data.rfz_index[
i];
917 data.rfz_Sorted[
n].clear();
920 for (
int i=0;
i!=
data.nrfzv; ++
i) {
921 int n =
data.rfzv_index[
i];
922 data.rfzv_map[
n] = 0;
923 data.rfzv_Sorted[
n].clear();
940 if (
data.nsazv<2)
return;
956 if (!
data.rfzv_map[
a])
continue;
957 r0 =
data.rfzv_Sorted[
a].begin();
958 r0e =
data.rfzv_Sorted[
a].end ();
967 for (; r0!=r0e; ++r0) {
969 float X = (*r0)->x();
970 float Y = (*r0)->y();
971 float R = (*r0)->radius();
974 float Z = (*r0)->z();
981 for (
int i=0;
i!=NB; ++
i) {
984 if (!
data.rfzv_map[an])
continue;
986 r =
data.rfzv_Sorted[an].begin();
987 re =
data.rfzv_Sorted[an].end ();
991 float Rb =(*r)->radius();
997 float dZ = Z-(*r)->z();
999 if (Tz<m_dzdrmin || Tz>
m_dzdrmax)
continue;
1008 float dx =(*r)->x()-
X;
1009 float dy =(*r)->y()-
Y;
1012 float xy =
x*
x+
y*
y;
if (xy == 0.)
continue;
1016 float UR = Ut*R+1.;
if (UR == 0.)
continue;
1019 if (std::abs(B*
data.K) >
m_ipt*std::sqrt(1.f+
A*
A))
continue;
1021 newSeed(
data, (*r)->spacepoint, (*r0)->spacepoint, Zo);
1033 data.endlist =
true;
1042 data.mapSeeds.clear();
1043 if (
data.nsaz<3)
return;
1045 const int ZI[
SizeZ]= {5,6,7,8,9,10,4,3,2,1,0};
1061 if (!
data.rfz_map[
a])
continue;
1066 if (!
data.rfz_map[an])
continue;
1067 rb [NB] =
data.rfz_Sorted[an].begin();
1068 rbe[NB++] =
data.rfz_Sorted[an].end();
1073 if (!
data.rfz_map[an])
continue;
1074 rt [NT] =
data.rfz_Sorted[an].begin();
1075 rte[NT++] =
data.rfz_Sorted[an].end();
1079 if (!
data.endlist) {
1086 data.endlist =
true;
1099 int NB,
int NT,
int& nseed)
const
1102 if (!
data.endlist) {
1104 data.endlist =
true;
1109 for (; r0!=rbe[0]; ++r0) {
1112 data.mapOneSeeds.erase(
data.mapOneSeeds.begin(),
data.mapOneSeeds.end());
1114 float R = (*r0)->radius();
1123 float X = (*r0)->x();
1124 float Y = (*r0)->y();
1125 float Z = (*r0)->z();
1130 for (
int i=0;
i!=NB; ++
i) {
1132 for (
r=
rb[
i];
r!=rbe[
i]; ++
r) {
1134 float Rb =(*r)->radius();
1144 if (dR >
m_drmax || (*r)->sur()==sur0)
continue;
1146 if ( !
pix && !(*r)->spacepoint->clusterList().second)
continue;
1148 float Tz = (Z-(*r)->z())/dR;
1150 if (Tz < m_dzdrmin || Tz >
m_dzdrmax)
continue;
1166 for (
int i=0;
i!=NT; ++
i) {
1168 for (
r=rt[
i];
r!=rte[
i]; ++
r) {
1170 float Rt =(*r)->radius();
1178 if ( (*r)->sur()==sur0)
continue;
1180 float Tz = ((*r)->z()-Z)/dR;
1182 if (Tz < m_dzdrmin || Tz >
m_dzdrmax)
continue;
1194 if (!(Nt-Nb))
continue;
1196 float covr0 = (*r0)->covr ();
1197 float covz0 = (*r0)->covz ();
1202 for (
int i=0;
i!=Nt; ++
i) {
1206 float dx = sp->
x()-
X;
1207 float dy = sp->
y()-
Y;
1208 float dz = sp->
z()-Z;
1211 float r2 = 1.f/(
x*
x+
y*
y);
1212 float dr = std::sqrt(r2);
1214 if (
i < Nb) tz = -tz;
1217 data.Zo[
i] = Z-R*tz;
1221 data.Er[
i] = (covz0+sp->
covz()+tz*tz*(covr0+sp->
covr()))*r2;
1230 float ipt2K = ipt2/K2;
1231 float ipt2C = ipt2*COF;
1232 float COFK = COF*K2;
1238 for (
int b=0;
b!=Nb; ++
b) {
1242 float Zob =
data.Zo[
b];
1243 float Tzb =
data.Tz[
b];
1244 float Rb2r =
data.R [
b]*covr0;
1245 float Rb2z =
data.R [
b]*covz0;
1246 float Erb =
data.Er[
b];
1247 float Vb =
data.V [
b];
1248 float Ub =
data.U [
b];
1249 float Tzb2 = (1.f+Tzb*Tzb);
1250 float CSA = Tzb2*COFK;
1251 float ICSA = Tzb2*ipt2C;
1253 float Iz = (dZ*dZ)/Tzb2;
1255 for (
int t=Nb;
t!=Nt; ++
t) {
1257 float Ts = .5*(Tzb+
data.Tz[
t]);
1260 if ( dT > ICSA)
continue;
1261 float dU =
data.U[
t]-Ub;
1262 if (dU == 0.)
continue;
1263 float A = (
data.V[
t]-Vb)/dU;
1267 if (B2 > ipt2K*
S2 || dT*
S2 > B2*CSA)
continue;
1268 float Im = std::abs((
A-B*R)*R);
1270 if (Im > imc )
continue;
1273 if (
data.SP[
t]->spacepoint->clusterList().second && Im > imcs)
continue;
1280 nseed +=
data.mapOneSeeds.size();
1301 int NB,
int NT,
int& nseed)
const
1303 constexpr
float pi2 = 2.*
M_PI;
1306 if (!
data.endlist) {
1308 data.endlist =
true;
1313 for (; r0!=rbe[0]; ++r0) {
1316 data.mapOneSeeds.erase(
data.mapOneSeeds.begin(),
data.mapOneSeeds.end());
1318 float R = (*r0)->radius();
1327 float X = (*r0)->x();
1328 float Y = (*r0)->y();
1329 float Z = (*r0)->z();
1334 for (
int i=0;
i!=NB; ++
i) {
1336 for (
r=
rb[
i];
r!=rbe[
i]; ++
r) {
1338 float Rb =(*r)->radius();
1348 if (dR >
m_drmax || (*r)->sur()==sur0)
continue;
1350 if ( !
pix && !(*r)->spacepoint->clusterList().second)
continue;
1354 float Tz = (Z-(*r)->z())/dR;
1356 if (Zo < data.zminB || Zo >
data.zmaxB)
continue;
1357 float Zu = Z+(550.f-R)*Tz;
1358 if (Zu < data.zminU || Zu >
data.zmaxU)
continue;
1369 for (
int i=0;
i!=NT; ++
i) {
1371 for (
r=rt[
i];
r!=rte[
i]; ++
r) {
1373 float Rt =(*r)->radius();
1381 if ( (*r)->sur()==sur0)
continue;
1385 float Tz = ((*r)->z()-Z)/dR;
1387 if (Zo < data.zminB || Zo >
data.zmaxB)
continue;
1388 float Zu = Z+(550.f-R)*Tz;
1389 if (Zu < data.zminU || Zu >
data.zmaxU)
continue;
1396 if (!(Nt-Nb))
continue;
1398 float covr0 = (*r0)->covr ();
1399 float covz0 = (*r0)->covz ();
1404 for (
int i=0;
i!=Nt; ++
i) {
1408 float dx = sp->
x()-
X;
1409 float dy = sp->
y()-
Y;
1410 float dz = sp->
z()-Z;
1413 float r2 = 1.f/(
x*
x+
y*
y);
1414 float dr = std::sqrt(r2);
1416 if (
i < Nb) tz = -tz;
1419 data.Zo[
i] = Z-R*tz;
1423 data.Er[
i] = (covz0+sp->
covz()+tz*tz*(covr0+sp->
covr()))*r2;
1432 float ipt2K = ipt2/K2;
1433 float ipt2C = ipt2*COF;
1434 float COFK = COF*K2;
1440 for (
int b=0;
b!=Nb; ++
b) {
1444 float Zob =
data.Zo[
b];
1445 float Tzb =
data.Tz[
b];
1446 float Rb2r =
data.R [
b]*covr0;
1447 float Rb2z =
data.R [
b]*covz0;
1448 float Erb =
data.Er[
b];
1449 float Vb =
data.V [
b];
1450 float Ub =
data.U [
b];
1451 float Tzb2 = (1.f+Tzb*Tzb);
1452 float CSA = Tzb2*COFK;
1453 float ICSA = Tzb2*ipt2C;
1455 float Iz = (dZ*dZ)/Tzb2;
1457 for (
int t=Nb;
t!=Nt; ++
t) {
1459 float Ts = .5f*(Tzb+
data.Tz[
t]);
1462 if ( dT > ICSA)
continue;
1463 float dU =
data.U[
t]-Ub;
1464 if (dU == 0.)
continue;
1465 float A = (
data.V[
t]-Vb)/dU;
1469 if (B2 > ipt2K*
S2 || dT*
S2 > B2*CSA)
continue;
1470 float Im = std::abs((
A-B*R)*R);
1472 if (Im > imc )
continue;
1474 if (
data.SP[
t]->spacepoint->clusterList().second && Im > imcs)
continue;
1482 float x = 2.f*B*R-
A;
1485 if (
df >
data.ftrigW)
continue;
1490 nseed +=
data.mapOneSeeds.size();
1512 data.OneSeeds[
data.nOneSeeds].erase();
1516 data.OneSeeds[
data.nOneSeeds].setZVertex(
static_cast<double>(
z));
1517 data.mapOneSeeds.insert(std::make_pair(
q, &(
data.OneSeeds[
data.nOneSeeds])));
1520 std::multimap<float,InDet::SiSpacePointsSeed*>::reverse_iterator
1521 l =
data.mapOneSeeds.rbegin();
1522 if ((*l).first <=
q)
return;
1529 s->setZVertex(
static_cast<double>(
z));
1531 i =
data.mapOneSeeds.insert(std::make_pair(
q,
s));
1533 for (++
i;
i!=
data.mapOneSeeds.end(); ++
i) {
1534 if ((*i).second==
s) {
1535 data.mapOneSeeds.erase(
i);
1549 if (
data.i_seed==
data.i_seede)
return nullptr;
1551 if (
data.mode==0 ||
data.mode==1)
return &(*
data.i_seed++);
1553 return (*
data.seed++).second;
1559 if (Zv < m_zmin || Zv >
m_zmax)
return false;
1561 if (
data.l_vertex.empty())
return true;
1564 for (
const float&
v :
data.l_vertex) {
1565 float dZ = std::abs(
v-Zv);
1566 if (dZ<dZmin) dZmin=dZ;
1573 if (
data.l_vertex.empty())
return 0.;
1576 for (
const float&
v :
data.l_vertex) {
1577 float dZ = std::abs(
v-Z);
1578 if (dZ<dZmin) dZmin = dZ;
1595 if (
data.i_spforseed!=
data.l_spforseed.end()) {
1596 sps = &(*
data.i_spforseed++);
1599 data.l_spforseed.emplace_back(sp,
r);
1600 sps = &(
data.l_spforseed.back());
1601 data.i_spforseed =
data.l_spforseed.end();
1616 if (
data.i_seede!=
data.l_seeds.end()) {
1621 s->setZVertex(
static_cast<double>(
z));
1635 l =
data.mapOneSeeds.begin(),
1636 le =
data.mapOneSeeds.end ();
1638 for (;
l!=le; ++
l) {
1639 float q = (*l).first;
1642 if ((*s0->spacePoints().rbegin())->clusterList().second) {
1643 (*s0->spacePoints().begin())->clusterList().second ?
q+=1000. :
q+=10000.;
1646 if (
data.i_seede!=
data.l_seeds.end()) {
1649 data.mapSeeds.insert(std::make_pair(
q,
s));
1651 data.l_seeds.emplace_back(*s0);
1654 data.mapSeeds.insert(std::make_pair(
q,
s));
1660 data.initialize(EventData::ToolType::Trigger,