|
|
Go to the documentation of this file.
16 TrackletCalculatorDisplaced::TrackletCalculatorDisplaced(
string name,
21 for (
unsigned int ilayer = 0; ilayer <
N_LAYER; ilayer++) {
22 vector<TrackletProjectionsMemory*>
tmp(settings.
nallstubs(ilayer),
nullptr);
26 for (
unsigned int idisk = 0; idisk <
N_DISK; idisk++) {
34 string name1 =
name.substr(1);
38 disk_ = name1[4] -
'0';
43 int iTC = name1[9] -
'A';
45 if (name1.substr(3, 6) ==
"L3L4L2")
47 else if (name1.substr(3, 6) ==
"L5L6L4")
49 else if (name1.substr(3, 6) ==
"L2L3D1")
51 else if (name1.substr(3, 6) ==
"D1D2L2")
64 if (iSeed == 8 || iSeed == 9) {
103 if (iSeed == 10 || iSeed == 11) {
139 for (
unsigned int i = 0;
i <
N_DISK - 2; ++
i)
145 outputProj = dynamic_cast<TrackletProjectionsMemory*>(
memory);
146 assert(outputProj !=
nullptr);
154 if (
output ==
"trackpar") {
155 auto*
tmp = dynamic_cast<TrackletParametersMemory*>(
memory);
161 if (
output.substr(0, 7) ==
"projout") {
163 auto*
tmp = dynamic_cast<TrackletProjectionsMemory*>(
memory);
166 unsigned int layerdisk =
output[8] -
'1';
167 unsigned int phiregion =
output[12] -
'A';
188 throw cms::Exception(
"BadConfig") << __FILE__ <<
" " << __LINE__ <<
" Could not find output : " <<
output;
196 if (
input ==
"thirdallstubin") {
197 auto*
tmp = dynamic_cast<AllStubsMemory*>(
memory);
202 if (
input ==
"firstallstubin") {
203 auto*
tmp = dynamic_cast<AllStubsMemory*>(
memory);
208 if (
input ==
"secondallstubin") {
209 auto*
tmp = dynamic_cast<AllStubsMemory*>(
memory);
214 if (
input.find(
"stubtriplet") == 0) {
215 auto*
tmp = dynamic_cast<StubTripletsMemory*>(
memory);
220 throw cms::Exception(
"BadConfig") << __FILE__ <<
" " << __LINE__ <<
" Could not find input : " <<
input;
224 unsigned int countall = 0;
225 unsigned int countsel = 0;
232 for (
unsigned int i = 0;
i < stubtriplet->nStubTriplets();
i++) {
235 const Stub* innerFPGAStub = stubtriplet->getFPGAStub1(
i);
238 const Stub* middleFPGAStub = stubtriplet->getFPGAStub2(
i);
241 const Stub* outerFPGAStub = stubtriplet->getFPGAStub3(
i);
249 bool accept =
LLLSeeding(innerFPGAStub, innerStub, middleFPGAStub, middleStub, outerFPGAStub, outerStub);
252 }
else if (innerFPGAStub->
isDisk() && middleFPGAStub->
isDisk() && outerFPGAStub->
isDisk()) {
253 throw cms::Exception(
"LogicError") << __FILE__ <<
" " << __LINE__ <<
" Invalid seeding!";
257 bool accept =
DDLSeeding(innerFPGAStub, innerStub, middleFPGAStub, middleStub, outerFPGAStub, outerStub);
261 bool accept =
LLDSeeding(innerFPGAStub, innerStub, middleFPGAStub, middleStub, outerFPGAStub, outerStub);
265 throw cms::Exception(
"LogicError") << __FILE__ <<
" " << __LINE__ <<
" Invalid seeding!";
290 globals_->
ofstream(
"trackletcalculatordisplaced.txt") <<
getName() <<
" " << countall <<
" " << countsel << endl;
304 int iphivmRaw = fpgaphi.
value() >> (fpgaphi.
nbits() - 5);
322 int iphivmRaw = fpgaphi.
value() >> (fpgaphi.
nbits() - 5);
334 if (trackletprojs ==
nullptr) {
337 <<
" iphi = " <<
iphi + 1;
341 assert(trackletprojs !=
nullptr);
342 trackletprojs->
addProj(tracklet);
349 if (trackletprojs ==
nullptr) {
354 <<
" iphi = " <<
iphi + 1;
358 assert(trackletprojs !=
nullptr);
361 trackletprojs->
addProj(tracklet);
366 const Stub* middleFPGAStub,
368 const Stub* outerFPGAStub,
372 <<
" trying stub triplet in layer (L L L): " << innerFPGAStub->
layer().
value() <<
" "
377 double r1 = innerStub->
r();
378 double z1 = innerStub->
z();
379 double phi1 = innerStub->
phi();
381 double r2 = middleStub->
r();
382 double z2 = middleStub->
z();
383 double phi2 = middleStub->
phi();
385 double r3 = outerStub->
r();
386 double z3 = outerStub->
z();
387 double phi3 = outerStub->
phi();
427 << middleFPGAStub->
isBarrel() << outerFPGAStub->
isBarrel() <<
" " << phi1 <<
", " << z1
428 <<
", " <<
r1 <<
", " << phi2 <<
", " <<
z2 <<
", " <<
r2 <<
", " << phi3 <<
", " << z3
429 <<
", " << r3 << endl;
447 << middleFPGAStub->
isBarrel() << outerFPGAStub->
isBarrel() <<
" " << phi1 <<
", " << z1
448 <<
", " <<
r1 <<
", " << phi2 <<
", " <<
z2 <<
", " <<
r2 <<
", " << phi3 <<
", " << z3
449 <<
", " << r3 << endl;
451 double rinvapprox, phi0approx, d0approx, tapprox, z0approx;
453 double phiprojdiskapprox[
N_DISK], rprojdiskapprox[
N_DISK];
454 double phiderdiskapprox[
N_DISK], rderdiskapprox[
N_DISK];
489 for (
unsigned int i = 0;
i <
toR_.size(); ++
i) {
490 phiprojapprox[
i] = phiproj[
i];
491 zprojapprox[
i] = zproj[
i];
492 phiderapprox[
i] = phider[
i];
493 zderapprox[
i] = zder[
i];
496 for (
unsigned int i = 0;
i <
toZ_.size(); ++
i) {
497 phiprojdiskapprox[
i] = phiprojdisk[
i];
498 rprojdiskapprox[
i] = rprojdisk[
i];
499 phiderdiskapprox[
i] = phiderdisk[
i];
500 rderdiskapprox[
i] = rderdisk[
i];
508 edm::LogVerbatim(
"Tracklet") <<
"phi0approx: " << phi0approx <<
" phi0: " << phi0 << endl;
514 for (
unsigned int i = 0;
i <
toR_.size(); ++
i) {
516 edm::LogVerbatim(
"Tracklet") <<
"phiprojapprox[" <<
i <<
"]: " << phiprojapprox[
i] <<
" phiproj[" <<
i
517 <<
"]: " << phiproj[
i] << endl;
518 edm::LogVerbatim(
"Tracklet") <<
"zprojapprox[" <<
i <<
"]: " << zprojapprox[
i] <<
" zproj[" <<
i
519 <<
"]: " << zproj[
i] << endl;
520 edm::LogVerbatim(
"Tracklet") <<
"phiderapprox[" <<
i <<
"]: " << phiderapprox[
i] <<
" phider[" <<
i
521 <<
"]: " << phider[
i] << endl;
522 edm::LogVerbatim(
"Tracklet") <<
"zderapprox[" <<
i <<
"]: " << zderapprox[
i] <<
" zder[" <<
i <<
"]: " << zder[
i]
527 for (
unsigned int i = 0;
i <
toZ_.size(); ++
i) {
529 edm::LogVerbatim(
"Tracklet") <<
"phiprojdiskapprox[" <<
i <<
"]: " << phiprojdiskapprox[
i] <<
" phiprojdisk[" <<
i
530 <<
"]: " << phiprojdisk[
i] << endl;
531 edm::LogVerbatim(
"Tracklet") <<
"rprojdiskapprox[" <<
i <<
"]: " << rprojdiskapprox[
i] <<
" rprojdisk[" <<
i
532 <<
"]: " << rprojdisk[
i] << endl;
533 edm::LogVerbatim(
"Tracklet") <<
"phiderdiskapprox[" <<
i <<
"]: " << phiderdiskapprox[
i] <<
" phiderdisk[" <<
i
534 <<
"]: " << phiderdisk[
i] << endl;
535 edm::LogVerbatim(
"Tracklet") <<
"rderdiskapprox[" <<
i <<
"]: " << rderdiskapprox[
i] <<
" rderdisk[" <<
i
536 <<
"]: " << rderdisk[
i] << endl;
554 int irinv, iphi0, id0, it, iz0;
559 irinv = rinvapprox / krinv;
560 iphi0 = phi0approx / kphi0;
563 iz0 = z0approx / kz0;
568 edm::LogVerbatim(
"Tracklet") <<
"TrackletCalculator::LLL Seeding irinv too large: " << rinvapprox <<
"(" << irinv
586 double phicritapprox = phi0approx - asin(0.5 *
settings_.
rcrit() * rinvapprox);
587 int phicrit = iphi0 - 2 * irinv;
593 keep = (phicrit > iphicritmincut) && (phicrit < iphicritmaxcut);
596 if (
keep && !keepapprox)
597 edm::LogVerbatim(
"Tracklet") <<
"TrackletCalculatorDisplaced::LLLSeeding tracklet kept with exact phicrit cut "
598 "but not approximate, phicritapprox: "
608 for (
unsigned int i = 0;
i <
toR_.size(); ++
i) {
609 iphiproj[
i] = phiprojapprox[
i] / kphiproj;
610 izproj[
i] = zprojapprox[
i] / kzproj;
612 iphider[
i] = phiderapprox[
i] / kphider;
613 izder[
i] = zderapprox[
i] / kzder;
624 if (iphiproj[
i] <= 0)
670 for (
unsigned int i = 0;
i <
toZ_.size(); ++
i) {
671 iphiprojdisk[
i] = phiprojdiskapprox[
i] / kphiprojdisk;
672 irprojdisk[
i] = rprojdiskapprox[
i] / krprojdisk;
674 iphiderdisk[
i] = phiderdiskapprox[
i] / kphiderdisk;
675 irderdisk[
i] = rderdiskapprox[
i] / krderdisk;
678 if (iphiprojdisk[
i] <= 0)
698 phiprojdiskapprox[
i],
707 <<
layer_ <<
" , " <<
rinv <<
" , " << rinvapprox <<
" , " << phi0 <<
" , " << phi0approx <<
" , " <<
t <<
" , "
708 << tapprox <<
" , " <<
z0 <<
" , " << z0approx <<
" , " <<
d0 <<
" , " << d0approx << endl;
739 <<
" Found LLL tracklet in sector = " <<
iSector_ <<
" phi0 = " << phi0;
745 ofstream
fout(
"seeds.txt", ofstream::app);
753 for (
unsigned int j = 0;
j <
toR_.size();
j++) {
766 for (
unsigned int j = 0;
j <
toZ_.size();
j++) {
770 if (disk == 2 && addL5)
772 if (disk == 1 && addL6)
788 const Stub* middleFPGAStub,
790 const Stub* outerFPGAStub,
794 <<
" trying stub triplet in (L2 D1 D2): " << innerFPGAStub->
layer().
value() <<
" "
800 double r1 = innerStub->
r();
801 double z1 = innerStub->
z();
802 double phi1 = innerStub->
phi();
804 double r2 = middleStub->
r();
805 double z2 = middleStub->
z();
806 double phi2 = middleStub->
phi();
808 double r3 = outerStub->
r();
809 double z3 = outerStub->
z();
810 double phi3 = outerStub->
phi();
843 << middleFPGAStub->
isBarrel() << outerFPGAStub->
isBarrel() <<
" " << phi1 <<
", " << z1
844 <<
", " <<
r1 <<
", " << phi2 <<
", " <<
z2 <<
", " <<
r2 <<
", " << phi3 <<
", " << z3
845 <<
", " << r3 << endl;
863 << middleFPGAStub->
isBarrel() << outerFPGAStub->
isBarrel() <<
" " << phi1 <<
", " << z1
864 <<
", " <<
r1 <<
", " << phi2 <<
", " <<
z2 <<
", " <<
r2 <<
", " << phi3 <<
", " << z3
865 <<
", " << r3 << endl;
867 double rinvapprox, phi0approx, d0approx, tapprox, z0approx;
869 double phiprojdiskapprox[
N_DISK], rprojdiskapprox[
N_DISK];
870 double phiderdiskapprox[
N_DISK], rderdiskapprox[
N_DISK];
905 for (
unsigned int i = 0;
i <
toR_.size(); ++
i) {
906 phiprojapprox[
i] = phiproj[
i];
907 zprojapprox[
i] = zproj[
i];
908 phiderapprox[
i] = phider[
i];
909 zderapprox[
i] = zder[
i];
912 for (
unsigned int i = 0;
i <
toZ_.size(); ++
i) {
913 phiprojdiskapprox[
i] = phiprojdisk[
i];
914 rprojdiskapprox[
i] = rprojdisk[
i];
915 phiderdiskapprox[
i] = phiderdisk[
i];
916 rderdiskapprox[
i] = rderdisk[
i];
923 edm::LogVerbatim(
"Tracklet") <<
"phi0approx: " << phi0approx <<
" phi0: " << phi0 << endl;
929 for (
unsigned int i = 0;
i <
toR_.size(); ++
i) {
931 edm::LogVerbatim(
"Tracklet") <<
"phiprojapprox[" <<
i <<
"]: " << phiprojapprox[
i] <<
" phiproj[" <<
i
932 <<
"]: " << phiproj[
i] << endl;
933 edm::LogVerbatim(
"Tracklet") <<
"zprojapprox[" <<
i <<
"]: " << zprojapprox[
i] <<
" zproj[" <<
i
934 <<
"]: " << zproj[
i] << endl;
935 edm::LogVerbatim(
"Tracklet") <<
"phiderapprox[" <<
i <<
"]: " << phiderapprox[
i] <<
" phider[" <<
i
936 <<
"]: " << phider[
i] << endl;
937 edm::LogVerbatim(
"Tracklet") <<
"zderapprox[" <<
i <<
"]: " << zderapprox[
i] <<
" zder[" <<
i <<
"]: " << zder[
i]
942 for (
unsigned int i = 0;
i <
toZ_.size(); ++
i) {
944 edm::LogVerbatim(
"Tracklet") <<
"phiprojdiskapprox[" <<
i <<
"]: " << phiprojdiskapprox[
i] <<
" phiprojdisk[" <<
i
945 <<
"]: " << phiprojdisk[
i] << endl;
946 edm::LogVerbatim(
"Tracklet") <<
"rprojdiskapprox[" <<
i <<
"]: " << rprojdiskapprox[
i] <<
" rprojdisk[" <<
i
947 <<
"]: " << rprojdisk[
i] << endl;
948 edm::LogVerbatim(
"Tracklet") <<
"phiderdiskapprox[" <<
i <<
"]: " << phiderdiskapprox[
i] <<
" phiderdisk[" <<
i
949 <<
"]: " << phiderdisk[
i] << endl;
950 edm::LogVerbatim(
"Tracklet") <<
"rderdiskapprox[" <<
i <<
"]: " << rderdiskapprox[
i] <<
" rderdisk[" <<
i
951 <<
"]: " << rderdisk[
i] << endl;
969 int irinv, iphi0, id0, it, iz0;
974 irinv = rinvapprox / krinv;
975 iphi0 = phi0approx / kphi0;
978 iz0 = z0approx / kz0;
983 edm::LogVerbatim(
"Tracklet") <<
"TrackletCalculator::DDL Seeding irinv too large: " << rinvapprox <<
"(" << irinv
1001 double phicritapprox = phi0approx - asin(0.5 *
settings_.
rcrit() * rinvapprox);
1002 int phicrit = iphi0 - 2 * irinv;
1008 keep = (phicrit > iphicritmincut) && (phicrit < iphicritmaxcut);
1011 if (
keep && !keepapprox)
1012 edm::LogVerbatim(
"Tracklet") <<
"TrackletCalculatorDisplaced::DDLSeeding tracklet kept with exact phicrit cut "
1013 "but not approximate, phicritapprox: "
1026 for (
unsigned int i = 0;
i <
toR_.size(); ++
i) {
1027 iphiproj[
i] = phiprojapprox[
i] / kphiproj;
1028 izproj[
i] = zprojapprox[
i] / kzproj;
1030 iphider[
i] = phiderapprox[
i] / kphider;
1031 izder[
i] = zderapprox[
i] / kzder;
1042 if (iphiproj[
i] <= 0)
1081 for (
unsigned int i = 0;
i <
toZ_.size(); ++
i) {
1082 iphiprojdisk[
i] = phiprojdiskapprox[
i] / kphiprojdisk;
1083 irprojdisk[
i] = rprojdiskapprox[
i] / krprojdisk;
1085 iphiderdisk[
i] = phiderdiskapprox[
i] / kphiderdisk;
1086 irderdisk[
i] = rderdiskapprox[
i] / krderdisk;
1088 if (iphiprojdisk[
i] <= 0)
1107 phiprojdiskapprox[
i],
1116 <<
layer_ <<
" , " <<
rinv <<
" , " << rinvapprox <<
" , " << phi0 <<
" , " << phi0approx <<
" , " <<
t <<
" , "
1117 << tapprox <<
" , " <<
z0 <<
" , " << z0approx <<
" , " <<
d0 <<
" , " << d0approx << endl;
1148 <<
" Found DDL tracklet in sector = " <<
iSector_ <<
" phi0 = " << phi0;
1154 ofstream
fout(
"seeds.txt", ofstream::app);
1160 for (
unsigned int j = 0;
j <
toR_.size();
j++) {
1169 for (
unsigned int j = 0;
j <
toZ_.size();
j++) {
1176 edm::LogVerbatim(
"Tracklet") <<
"adding disk projection " <<
j <<
"/" <<
toZ_.size() <<
" " << disk <<
" "
1188 const Stub* middleFPGAStub,
1190 const Stub* outerFPGAStub,
1194 <<
" trying stub triplet in (L2L3D1): " << middleFPGAStub->
layer().
value() <<
" "
1198 unsigned ndisks = 1;
1200 double r3 = innerStub->
r();
1201 double z3 = innerStub->
z();
1202 double phi3 = innerStub->
phi();
1204 double r1 = middleStub->
r();
1205 double z1 = middleStub->
z();
1206 double phi1 = middleStub->
phi();
1208 double r2 = outerStub->
r();
1209 double z2 = outerStub->
z();
1210 double phi2 = outerStub->
phi();
1243 << middleFPGAStub->
isBarrel() << outerFPGAStub->
isBarrel() <<
" " << phi3 <<
", " << z3
1244 <<
", " << r3 <<
", " << phi1 <<
", " << z1 <<
", " <<
r1 <<
", " << phi2 <<
", " <<
z2
1245 <<
", " <<
r2 << endl;
1249 z3 = innerFPGAStub->
zapprox();
1250 r3 = innerFPGAStub->
rapprox();
1253 z1 = middleFPGAStub->
zapprox();
1263 << middleFPGAStub->
isBarrel() << outerFPGAStub->
isBarrel() <<
" " << phi3 <<
", " << z3
1264 <<
", " << r3 <<
", " << phi1 <<
", " << z1 <<
", " <<
r1 <<
", " << phi2 <<
", " <<
z2
1265 <<
", " <<
r2 << endl;
1267 double rinvapprox, phi0approx, d0approx, tapprox, z0approx;
1269 double phiprojdiskapprox[
N_DISK], rprojdiskapprox[
N_DISK];
1270 double phiderdiskapprox[
N_DISK], rderdiskapprox[
N_DISK];
1305 for (
unsigned int i = 0;
i <
toR_.size(); ++
i) {
1306 phiprojapprox[
i] = phiproj[
i];
1307 zprojapprox[
i] = zproj[
i];
1308 phiderapprox[
i] = phider[
i];
1309 zderapprox[
i] = zder[
i];
1312 for (
unsigned int i = 0;
i <
toZ_.size(); ++
i) {
1313 phiprojdiskapprox[
i] = phiprojdisk[
i];
1314 rprojdiskapprox[
i] = rprojdisk[
i];
1315 phiderdiskapprox[
i] = phiderdisk[
i];
1316 rderdiskapprox[
i] = rderdisk[
i];
1323 edm::LogVerbatim(
"Tracklet") <<
"phi0approx: " << phi0approx <<
" phi0: " << phi0 << endl;
1329 for (
unsigned int i = 0;
i <
toR_.size(); ++
i) {
1331 edm::LogVerbatim(
"Tracklet") <<
"phiprojapprox[" <<
i <<
"]: " << phiprojapprox[
i] <<
" phiproj[" <<
i
1332 <<
"]: " << phiproj[
i] << endl;
1333 edm::LogVerbatim(
"Tracklet") <<
"zprojapprox[" <<
i <<
"]: " << zprojapprox[
i] <<
" zproj[" <<
i
1334 <<
"]: " << zproj[
i] << endl;
1335 edm::LogVerbatim(
"Tracklet") <<
"phiderapprox[" <<
i <<
"]: " << phiderapprox[
i] <<
" phider[" <<
i
1336 <<
"]: " << phider[
i] << endl;
1337 edm::LogVerbatim(
"Tracklet") <<
"zderapprox[" <<
i <<
"]: " << zderapprox[
i] <<
" zder[" <<
i <<
"]: " << zder[
i]
1342 for (
unsigned int i = 0;
i <
toZ_.size(); ++
i) {
1344 edm::LogVerbatim(
"Tracklet") <<
"phiprojdiskapprox[" <<
i <<
"]: " << phiprojdiskapprox[
i] <<
" phiprojdisk[" <<
i
1345 <<
"]: " << phiprojdisk[
i] << endl;
1346 edm::LogVerbatim(
"Tracklet") <<
"rprojdiskapprox[" <<
i <<
"]: " << rprojdiskapprox[
i] <<
" rprojdisk[" <<
i
1347 <<
"]: " << rprojdisk[
i] << endl;
1348 edm::LogVerbatim(
"Tracklet") <<
"phiderdiskapprox[" <<
i <<
"]: " << phiderdiskapprox[
i] <<
" phiderdisk[" <<
i
1349 <<
"]: " << phiderdisk[
i] << endl;
1350 edm::LogVerbatim(
"Tracklet") <<
"rderdiskapprox[" <<
i <<
"]: " << rderdiskapprox[
i] <<
" rderdisk[" <<
i
1351 <<
"]: " << rderdisk[
i] << endl;
1369 int irinv, iphi0, id0, it, iz0;
1374 irinv = rinvapprox / krinv;
1375 iphi0 = phi0approx / kphi0;
1378 iz0 = z0approx / kz0;
1383 edm::LogVerbatim(
"Tracklet") <<
"TrackletCalculator:: LLD Seeding irinv too large: " << rinvapprox <<
"(" << irinv
1401 double phicritapprox = phi0approx - asin(0.5 *
settings_.
rcrit() * rinvapprox);
1402 int phicrit = iphi0 - 2 * irinv;
1408 keep = (phicrit > iphicritmincut) && (phicrit < iphicritmaxcut);
1411 if (
keep && !keepapprox)
1412 edm::LogVerbatim(
"Tracklet") <<
"TrackletCalculatorDisplaced::LLDSeeding tracklet kept with exact phicrit cut "
1413 "but not approximate, phicritapprox: "
1426 for (
unsigned int i = 0;
i <
toR_.size(); ++
i) {
1427 iphiproj[
i] = phiprojapprox[
i] / kphiproj;
1428 izproj[
i] = zprojapprox[
i] / kzproj;
1430 iphider[
i] = phiderapprox[
i] / kphider;
1431 izder[
i] = zderapprox[
i] / kzder;
1441 if (iphiproj[
i] <= 0)
1480 for (
unsigned int i = 0;
i <
toZ_.size(); ++
i) {
1481 iphiprojdisk[
i] = phiprojdiskapprox[
i] / kphiprojdisk;
1482 irprojdisk[
i] = rprojdiskapprox[
i] / krprojdisk;
1484 iphiderdisk[
i] = phiderdiskapprox[
i] / kphiderdisk;
1485 irderdisk[
i] = rderdiskapprox[
i] / krderdisk;
1488 if (iphiprojdisk[
i] <= 0)
1508 phiprojdiskapprox[
i],
1517 <<
layer_ <<
" , " <<
rinv <<
" , " << rinvapprox <<
" , " << phi0 <<
" , " << phi0approx <<
" , " <<
t <<
" , "
1518 << tapprox <<
" , " <<
z0 <<
" , " << z0approx <<
" , " <<
d0 <<
" , " << d0approx << endl;
1549 <<
" Found LLD tracklet in sector = " <<
iSector_ <<
" phi0 = " << phi0;
1555 ofstream
fout(
"seeds.txt", ofstream::app);
1561 for (
unsigned int j = 0;
j <
toR_.size();
j++) {
1569 for (
unsigned int j = 0;
j <
toZ_.size();
j++) {
1576 edm::LogVerbatim(
"Tracklet") <<
"adding disk projection " <<
j <<
"/" <<
toZ_.size() <<
" " << disk;
1596 double rho = 1 /
rinv;
1600 phiproj = phi0 - asin((rproj * rproj + r0 * r0 - rho * rho) / (2 * rproj * r0));
1601 double beta = acos((rho * rho + r0 * r0 - rproj * rproj) / (2 * r0 * rho));
1605 phider = -0.5 *
rinv /
sqrt(1 -
pow(0.5 * rproj *
rinv, 2)) +
d0 / (rproj * rproj);
1609 edm::LogVerbatim(
"Tracklet") <<
"exact proj layer at " << rproj <<
" : " << phiproj <<
" " << zproj;
1630 double beta = (zproj -
z0) / (
t * rho);
1631 double phiV = atan2(-y0, -x0);
1632 double c =
rinv > 0 ? -1 : 1;
1634 double x = x0 + rho *
cos(phiV +
c *
beta);
1635 double y = y0 + rho *
sin(phiV +
c *
beta);
1637 phiproj = atan2(y, x);
1641 rproj =
sqrt(x * x + y * y);
1643 phider =
c /
t / (x * x + y * y) * (rho + x0 *
cos(phiV +
c *
beta) + y0 *
sin(phiV +
c *
beta));
1647 edm::LogVerbatim(
"Tracklet") <<
"exact proj disk at" << zproj <<
" : " << phiproj <<
" " << rproj;
1667 double phiprojdisk[
N_DISK],
1668 double rprojdisk[
N_DISK],
1671 double phiderdisk[
N_DISK],
1672 double rderdisk[
N_DISK]) {
1676 double x3 = r3 *
cos(phi3);
1680 double y3 = r3 *
sin(phi3);
1682 double k1 = -(
x2 -
x1) / (
y2 -
y1);
1683 double k2 = -(x3 -
x2) / (y3 -
y2);
1684 double b1 = 0.5 * (
y2 +
y1) - 0.5 * (
x1 +
x2) * k1;
1685 double b2 = 0.5 * (y3 +
y2) - 0.5 * (
x2 + x3) * k2;
1687 double y0 = (
b1 * k2 -
b2 * k1) / (k2 - k1);
1688 double x0 = (
b1 -
b2) / (k2 - k1);
1692 double R3 =
sqrt(
pow(x3 - x0, 2) +
pow(y3 - y0, 2));
1694 double eps1 =
std::abs(R1 / R2 - 1);
1695 double eps2 =
std::abs(R3 / R2 - 1);
1696 if (eps1 > 1
e-10 || eps2 > 1
e-10)
1697 edm::LogVerbatim(
"Tracklet") <<
"&&&&&&&&&&&& bad circle! " << R1 <<
"\t" << R2 <<
"\t" << R3;
1703 phi0 = 0.5 *
M_PI + atan2(y0, x0);
1707 d0 = -R1 +
sqrt(x0 * x0 + y0 * y0);
1723 double t12 = (
z2 - z1) /
std::abs(beta2 - beta1) / R1;
1724 double z12 = (z1 * beta2 -
z2 * beta1) / (beta2 - beta1);
1725 double t13 = (z3 - z1) /
std::abs(beta3 - beta1) / R1;
1726 double z13 = (z1 * beta3 - z3 * beta1) / (beta3 - beta1);
1738 for (
unsigned int i = 0;
i <
toR_.size();
i++) {
1739 exactproj(
toR_[
i],
rinv, phi0,
d0,
t,
z0,
sqrt(x0 * x0 + y0 * y0), phiproj[
i], zproj[
i], phider[
i], zder[
i]);
1742 for (
unsigned int i = 0;
i <
toZ_.size();
i++) {
1743 exactprojdisk(
toZ_[
i],
rinv, phi0,
d0,
t,
z0, x0, y0, phiprojdisk[
i], rprojdisk[
i], phiderdisk[
i], rderdisk[
i]);
1767 double rmeanInv = 1.0 / rmean;
1769 phiproj = phi0 + rmean * (-halfRinv + 2.0 * d0_0 * halfRinv_0 * halfRinv_0) +
1770 rmeanInv * (-
d0 + halfRinv_0 * d0_0 * d0_0) +
sixth *
pow(-rmean * halfRinv_0 - rmeanInv * d0_0, 3);
1771 phiprojder = -halfRinv +
d0 * rmeanInv * rmeanInv;
1773 zproj =
z0 +
t * rmean - 0.5 * rmeanInv *
t * d0_0 * d0_0 -
t * rmean * halfRinv *
d0 +
1774 sixth *
pow(rmean, 3) *
t * halfRinv_0 * halfRinv_0;
1780 edm::LogVerbatim(
"Tracklet") <<
"approx proj layer at " << rmean <<
" : " << phiproj <<
" " << zproj << endl;
1804 double zmeanInv = 1.0 / zmean, rstar = (zmean -
z0) /
t,
1805 epsilon = 0.5 * zmeanInv * zmeanInv * d0_0 * d0_0 *
t *
t + halfRinv *
d0 -
1806 sixth * rstar * rstar * halfRinv_0 * halfRinv_0;
1808 rproj = rstar * (1 +
epsilon);
1811 double A = rproj * halfRinv;
1812 double B = -
d0 *
t * zmeanInv * (1 +
z0 * zmeanInv) * (1 -
epsilon);
1813 double C = -
d0 * halfRinv;
1814 double A_0 = rproj * halfRinv_0;
1815 double B_0 = -d0_0 *
t * zmeanInv * (1 +
z0 * zmeanInv) * (1 -
epsilon);
1818 phiproj = phi0 -
A +
B * (1 +
C - 2 * A_0 * A_0) +
sixth *
pow(-A_0 + B_0, 3);
1819 phiprojder = -halfRinv /
t -
d0 *
t *
t * zmeanInv * zmeanInv;
1824 edm::LogVerbatim(
"Tracklet") <<
"approx proj disk at" << zmean <<
" : " << phiproj <<
" " << rproj << endl;
1847 double phiprojdisk[5],
1848 double rprojdisk[5],
1849 double phiderdisk[5],
1850 double rderdisk[5]) {
1851 double a = 1.0 / ((
r1 -
r2) * (
r1 - r3));
1852 double b = 1.0 / ((
r1 -
r2) * (
r2 - r3));
1853 double c = 1.0 / ((
r1 - r3) * (
r2 - r3));
1856 double halfRinv_0 = -phi1 *
r1 *
a + phi2 *
r2 *
b - phi3 * r3 *
c;
1857 double d0_0 =
r1 *
r2 * r3 * (-phi1 *
a + phi2 *
b - phi3 *
c);
1860 double r =
r2, z =
z2;
1868 double d0OverR = d0OverR2;
1872 double c1 = d0_0 * halfRinv_0 * d0OverR1 + 2.0 * d0_0 * halfRinv_0 *
r1 * halfRinv_0 +
1874 double c2 = d0_0 * halfRinv_0 * d0OverR2 + 2.0 * d0_0 * halfRinv_0 *
r2 * halfRinv_0 +
1876 double c3 = d0_0 * halfRinv_0 * d0OverR3 + 2.0 * d0_0 * halfRinv_0 * r3 * halfRinv_0 +
1877 sixth *
pow(-r3 * halfRinv_0 - d0OverR3, 3);
1879 double phi1c = phi1 -
c1;
1880 double phi2c = phi2 - c2;
1881 double phi3c = phi3 - c3;
1884 double halfRinv = -phi1c *
r1 *
a + phi2c *
r2 *
b - phi3c * r3 *
c;
1885 phi0 = -phi1c *
r1 * (
r2 + r3) *
a + phi2c *
r2 * (
r1 + r3) *
b - phi3c * r3 * (
r1 +
r2) *
c;
1886 d0 =
r1 *
r2 * r3 * (-phi1c *
a + phi2c *
b - phi3c *
c);
1888 t = ((z - z1) / (
r -
r1)) *
1889 (1. +
d0 * halfRinv - 0.5 * d0OverR1 * d0OverR -
sixth * (
r1 *
r1 +
r2 *
r2 +
r1 *
r2) * halfRinv_0 * halfRinv_0);
1890 z0 = z1 -
t *
r1 * (1.0 - d0_0 * halfRinv_0 - 0.5 * d0OverR1 * d0OverR1 +
sixth *
r1 *
r1 * halfRinv_0 * halfRinv_0);
1892 rinv = 2.0 * halfRinv;
1897 for (
unsigned int i = 0;
i <
toR_.size();
i++) {
1912 for (
unsigned int i = 0;
i <
toZ_.size();
i++) {
std::vector< double > toZ_
std::vector< AllStubsMemory * > outerallstubs_
double phicritmaxmc() const
double rmindiskvm() const
unsigned int ntrackletmax() const
static const std::string input
void addProjection(int layer, int iphi, TrackletProjectionsMemory *trackletprojs, Tracklet *tracklet)
double krprojshiftdisk() const
std::vector< AllStubsMemory * > innerallstubs_
const FPGAWord & fpgaphiprojdisk(int disk) const
void addTracklet(Tracklet *tracklet)
std::vector< StubTripletsMemory * > stubtriplets_
void init(Settings const &settings, int projlayer, double rproj, int iphiproj, int izproj, int iphider, int izder, double phiproj, double zproj, double phiprojder, double zprojder, double phiprojapprox, double zprojapprox, double phiprojderapprox, double zprojderapprox, bool isPSseed=false)
int SS_phiL_shift() const
double phicritminmc() const
bool addLayerProj(Tracklet *tracklet, int layer)
std::vector< AllStubsMemory * > middleallstubs_
double rmean(unsigned int iLayer) const
Settings const & settings_
double phiapprox(double phimin, double) const
static constexpr float b2
bool validProj(int layer) const
int PS_rderD_shift() const
Sin< T >::type sin(const T &t)
void approxprojdisk(double halfRinv, double phi0, double d0, double t, double z0, double halfRinv_0, double d0_0, double zmean, double &phiproj, double &phiprojder, double &rproj, double &rprojder)
static constexpr float b1
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
const FPGAWord & fpgazproj(int layer) const
Cos< T >::type cos(const T &t)
const FPGAWord & disk() const
std::string const & getName() const
std::vector< std::vector< TrackletProjectionsMemory * > > trackletprojlayers_
double rzmeanInv_[N_DISK - 2]
double zmean(unsigned int iDisk) const
void exacttracklet(double r1, double z1, double phi1, double r2, double z2, double phi2, double r3, double z3, double phi3, int take3, double &rinv, double &phi0, double &d0, double &t, double &z0, double phiproj[N_LAYER - 2], double zproj[N_LAYER - 2], double phiprojdisk[N_DISK], double rprojdisk[N_DISK], double phider[N_LAYER - 2], double zder[N_LAYER - 2], double phiderdisk[N_DISK], double rderdisk[N_DISK])
int SS_phiderD_shift() const
constexpr std::array< uint8_t, layerIndexSize > layer
void exactprojdisk(double zproj, double rinv, double, double, double t, double z0, double x0, double y0, double &phiproj, double &rproj, double &phider, double &rder)
bool LLDSeeding(const Stub *innerFPGAStub, const L1TStub *innerStub, const Stub *middleFPGAStub, const L1TStub *middleStub, const Stub *outerFPGAStub, const L1TStub *outerStub)
void setTrackletIndex(unsigned int index)
unsigned int nbitsphiprojderL456() const
void addDiskProj(Tracklet *tracklet, int disk)
double rinv(double phi1, double phi2, double r1, double r2)
bool LLLSeeding(const Stub *innerFPGAStub, const L1TStub *innerStub, const Stub *middleFPGAStub, const L1TStub *middleStub, const Stub *outerFPGAStub, const L1TStub *outerStub)
IMATH_TrackletCalculator * ITC_L1L2()
unsigned int nzbitsstub(unsigned int layerdisk) const
int SS_phiderL_shift() const
unsigned int nphibitsstub(unsigned int layerdisk) const
double zproj_[N_DISK - 2]
double rproj_[N_LAYER - 2]
constexpr valType make0To2pi(valType angle)
std::vector< std::vector< TrackletProjectionsMemory * > > trackletprojdisks_
void approxtracklet(double r1, double z1, double phi1, double r2, double z2, double phi2, double r3, double z3, double phi3, bool take3, unsigned ndisks, double &rinv, double &phi0, double &d0, double &t, double &z0, double phiproj[4], double zproj[4], double phider[4], double zder[4], double phiprojdisk[5], double rprojdisk[5], double phiderdisk[5], double rderdisk[5])
void approxproj(double halfRinv, double phi0, double d0, double t, double z0, double halfRinv_0, double d0_0, double rmean, double &phiproj, double &phiprojder, double &zproj, double &zprojder)
bool writeMonitorData(std::string module) const
static const std::string B
std::vector< double > toR_
bool usephicritapprox() const
unsigned int nTracklets() const
void setTCIndex(int index)
std::ofstream & ofstream(std::string fname)
int SS_phiD_shift() const
void addProj(Tracklet *tracklet)
void exactproj(double rproj, double rinv, double phi0, double d0, double t, double z0, double r0, double &phiproj, double &zproj, double &phider, double &zder)
Log< level::Info, true > LogVerbatim
bool DDLSeeding(const Stub *innerFPGAStub, const L1TStub *innerStub, const Stub *middleFPGAStub, const L1TStub *middleStub, const Stub *outerFPGAStub, const L1TStub *outerStub)
void addOutput(MemoryBase *memory, std::string output) override
TrackletParametersMemory * trackletpars_
std::string const & getName() const
const FPGAWord & fpgaphiproj(int layer) const
unsigned int nallstubs(unsigned int layerdisk) const
bool debugTracklet() const
void addInput(MemoryBase *memory, std::string input) override
const FPGAWord & fpgarprojdisk(int disk) const
unsigned int maxStep(std::string module) const
int PS_zderL_shift() const
Power< A, B >::type pow(const A &a, const B &b)
Abs< T >::type abs(const T &t)
unsigned int nbitsphiprojderL123() const
const FPGAWord & layer() const
bool validProjDisk(int disk) const
static constexpr float d0
void addOutputProjection(TrackletProjectionsMemory *&outputProj, MemoryBase *memory)
double disp_z0cut() const
void addProjectionDisk(int disk, int iphi, TrackletProjectionsMemory *trackletprojs, Tracklet *tracklet)
constexpr T reduceRange(T x)
void init(Settings const &settings, int projdisk, double zproj, int iphiproj, int irproj, int iphider, int irder, double phiproj, double rproj, double phiprojder, double rprojder, double phiprojapprox, double rprojapprox, double phiprojderapprox, double rprojderapprox)