16 TrackletCalculatorDisplaced::TrackletCalculatorDisplaced(
string name,
Settings const& settings,
Globals* global)
18 for (
unsigned int ilayer = 0; ilayer <
N_LAYER; ilayer++) {
19 vector<TrackletProjectionsMemory*>
tmp(settings.
nallstubs(ilayer),
nullptr);
23 for (
unsigned int idisk = 0; idisk <
N_DISK; idisk++) {
31 string name1 =
name.substr(1);
35 disk_ = name1[4] -
'0';
40 int iTC = name1[9] -
'A';
42 if (name1.substr(3, 6) ==
"L3L4L2")
44 else if (name1.substr(3, 6) ==
"L5L6L4")
46 else if (name1.substr(3, 6) ==
"L2L3D1")
48 else if (name1.substr(3, 6) ==
"D1D2L2")
136 for (
unsigned int i = 0;
i <
N_DISK - 2; ++
i)
143 assert(outputProj !=
nullptr);
152 if (
output ==
"trackpar") {
159 if (
output.substr(0, 7) ==
"projout") {
164 unsigned int layerdisk =
output[8] -
'1';
165 unsigned int phiregion =
output[12] -
'A';
186 throw cms::Exception(
"BadConfig") << __FILE__ <<
" " << __LINE__ <<
" Could not find output : " <<
output;
195 if (
input ==
"thirdallstubin") {
201 if (
input ==
"firstallstubin") {
207 if (
input ==
"secondallstubin") {
213 if (
input.find(
"stubtriplet") == 0) {
219 throw cms::Exception(
"BadConfig") << __FILE__ <<
" " << __LINE__ <<
" Could not find input : " <<
input;
223 unsigned int countall = 0;
224 unsigned int countsel = 0;
235 for (
unsigned int i = 0;
i < stubtriplet->nStubTriplets();
i++) {
238 const Stub* innerFPGAStub = stubtriplet->getFPGAStub1(
i);
241 const Stub* middleFPGAStub = stubtriplet->getFPGAStub2(
i);
244 const Stub* outerFPGAStub = stubtriplet->getFPGAStub3(
i);
253 bool accept =
LLLSeeding(innerFPGAStub, innerStub, middleFPGAStub, middleStub, outerFPGAStub, outerStub);
258 throw cms::Exception(
"LogicError") << __FILE__ <<
" " << __LINE__ <<
" Invalid seeding!";
263 bool accept =
DDLSeeding(innerFPGAStub, innerStub, middleFPGAStub, middleStub, outerFPGAStub, outerStub);
268 bool accept =
LLDSeeding(innerFPGAStub, innerStub, middleFPGAStub, middleStub, outerFPGAStub, outerStub);
272 throw cms::Exception(
"LogicError") << __FILE__ <<
" " << __LINE__ <<
" Invalid seeding!";
297 globals_->
ofstream(
"trackletcalculatordisplaced.txt") <<
getName() <<
" " << countall <<
" " << countsel << endl;
312 int iphivmRaw = fpgaphi.
value() >> (fpgaphi.
nbits() - 5);
330 int iphivmRaw = fpgaphi.
value() >> (fpgaphi.
nbits() - 5);
342 if (trackletprojs ==
nullptr) {
345 <<
" iphi = " <<
iphi + 1;
349 assert(trackletprojs !=
nullptr);
350 trackletprojs->
addProj(tracklet);
357 if (trackletprojs ==
nullptr) {
362 <<
" iphi = " <<
iphi + 1;
366 assert(trackletprojs !=
nullptr);
369 trackletprojs->
addProj(tracklet);
374 const Stub* middleFPGAStub,
376 const Stub* outerFPGAStub,
380 <<
" trying stub triplet in layer (L L L): " << innerFPGAStub->
layer().
value() <<
" " 385 double r1 = innerStub->
r();
386 double z1 = innerStub->
z();
387 double phi1 = innerStub->
phi();
389 double r2 = middleStub->
r();
390 double z2 = middleStub->
z();
391 double phi2 = middleStub->
phi();
393 double r3 = outerStub->
r();
394 double z3 = outerStub->
z();
395 double phi3 = outerStub->
phi();
434 << middleFPGAStub->
isBarrel() << outerFPGAStub->
isBarrel() <<
" " << phi1 <<
", " << z1
435 <<
", " << r1 <<
", " << phi2 <<
", " <<
z2 <<
", " <<
r2 <<
", " << phi3 <<
", " << z3
436 <<
", " << r3 << endl;
454 << middleFPGAStub->
isBarrel() << outerFPGAStub->
isBarrel() <<
" " << phi1 <<
", " << z1
455 <<
", " << r1 <<
", " << phi2 <<
", " <<
z2 <<
", " <<
r2 <<
", " << phi3 <<
", " << z3
456 <<
", " << r3 << endl;
458 double rinvapprox, phi0approx, d0approx, tapprox, z0approx;
460 double phiprojdiskapprox[
N_DISK], rprojdiskapprox[
N_DISK];
461 double phiderdiskapprox[
N_DISK], rderdiskapprox[
N_DISK];
496 for (
unsigned int i = 0;
i <
toR_.size(); ++
i) {
497 phiprojapprox[
i] = phiproj[
i];
498 zprojapprox[
i] = zproj[
i];
499 phiderapprox[
i] = phider[
i];
500 zderapprox[
i] = zder[
i];
503 for (
unsigned int i = 0;
i <
toZ_.size(); ++
i) {
504 phiprojdiskapprox[
i] = phiprojdisk[
i];
505 rprojdiskapprox[
i] = rprojdisk[
i];
506 phiderdiskapprox[
i] = phiderdisk[
i];
507 rderdiskapprox[
i] = rderdisk[
i];
515 edm::LogVerbatim(
"Tracklet") <<
"phi0approx: " << phi0approx <<
" phi0: " << phi0 << endl;
518 edm::LogVerbatim(
"Tracklet") <<
"z0approx: " << z0approx <<
" z0: " << z0 << endl;
521 for (
unsigned int i = 0;
i <
toR_.size(); ++
i) {
523 edm::LogVerbatim(
"Tracklet") <<
"phiprojapprox[" <<
i <<
"]: " << phiprojapprox[
i] <<
" phiproj[" <<
i 524 <<
"]: " << phiproj[
i] << endl;
525 edm::LogVerbatim(
"Tracklet") <<
"zprojapprox[" <<
i <<
"]: " << zprojapprox[
i] <<
" zproj[" <<
i 526 <<
"]: " << zproj[
i] << endl;
527 edm::LogVerbatim(
"Tracklet") <<
"phiderapprox[" <<
i <<
"]: " << phiderapprox[
i] <<
" phider[" <<
i 528 <<
"]: " << phider[
i] << endl;
529 edm::LogVerbatim(
"Tracklet") <<
"zderapprox[" <<
i <<
"]: " << zderapprox[
i] <<
" zder[" <<
i <<
"]: " << zder[
i]
534 for (
unsigned int i = 0;
i <
toZ_.size(); ++
i) {
536 edm::LogVerbatim(
"Tracklet") <<
"phiprojdiskapprox[" <<
i <<
"]: " << phiprojdiskapprox[
i] <<
" phiprojdisk[" <<
i 537 <<
"]: " << phiprojdisk[
i] << endl;
538 edm::LogVerbatim(
"Tracklet") <<
"rprojdiskapprox[" <<
i <<
"]: " << rprojdiskapprox[
i] <<
" rprojdisk[" <<
i 539 <<
"]: " << rprojdisk[
i] << endl;
540 edm::LogVerbatim(
"Tracklet") <<
"phiderdiskapprox[" <<
i <<
"]: " << phiderdiskapprox[
i] <<
" phiderdisk[" <<
i 541 <<
"]: " << phiderdisk[
i] << endl;
542 edm::LogVerbatim(
"Tracklet") <<
"rderdiskapprox[" <<
i <<
"]: " << rderdiskapprox[
i] <<
" rderdisk[" <<
i 543 <<
"]: " << rderdisk[
i] << endl;
561 int irinv, iphi0, id0, it, iz0;
566 irinv = rinvapprox / krinv;
567 iphi0 = phi0approx / kphi0;
570 iz0 = z0approx / kz0;
575 edm::LogVerbatim(
"Tracklet") <<
"TrackletCalculator::LLL Seeding irinv too large: " << rinvapprox <<
"(" << irinv
595 int phicrit = iphi0 - 2 * irinv - 2 * id0;
601 keep = (phicrit > iphicritmincut) && (phicrit < iphicritmaxcut);
604 if (
keep && !keepapprox)
605 edm::LogVerbatim(
"Tracklet") <<
"TrackletCalculatorDisplaced::LLLSeeding tracklet kept with exact phicrit cut " 606 "but not approximate, phicritapprox: " 618 for (
unsigned int i = 0;
i <
toR_.size(); ++
i) {
619 iphiproj[
i] = phiprojapprox[
i] / kphiproj;
620 izproj[
i] = zprojapprox[
i] / kzproj;
622 iphider[
i] = phiderapprox[
i] / kphider;
623 izder[
i] = zderapprox[
i] / kzder;
634 if (iphiproj[
i] <= 0)
680 for (
unsigned int i = 0;
i <
toZ_.size(); ++
i) {
681 iphiprojdisk[
i] = phiprojdiskapprox[
i] / kphiprojdisk;
682 irprojdisk[
i] = rprojdiskapprox[
i] / krprojdisk;
684 iphiderdisk[
i] = phiderdiskapprox[
i] / kphiderdisk;
685 irderdisk[
i] = rderdiskapprox[
i] / krderdisk;
688 if (iphiprojdisk[
i] <= 0)
707 phiprojdiskapprox[
i],
717 <<
layer_ <<
" , " <<
rinv <<
" , " << rinvapprox <<
" , " << phi0 <<
" , " << phi0approx <<
" , " <<
t <<
" , " 718 << tapprox <<
" , " << z0 <<
" , " << z0approx <<
" , " <<
d0 <<
" , " << d0approx << endl;
746 <<
" Found LLL tracklet in sector = " <<
iSector_ <<
" phi0 = " << phi0;
752 ofstream
fout(
"seeds.txt", ofstream::app);
760 for (
unsigned int j = 0;
j <
toR_.size();
j++) {
774 for (
unsigned int j = 0;
j <
toZ_.size();
j++) {
778 if (disk == 2 && addL5)
780 if (disk == 1 && addL6)
796 const Stub* middleFPGAStub,
798 const Stub* outerFPGAStub,
802 <<
" trying stub triplet in (L2 D1 D2): " << innerFPGAStub->
layer().
value() <<
" " 808 double r1 = innerStub->
r();
809 double z1 = innerStub->
z();
810 double phi1 = innerStub->
phi();
812 double r2 = middleStub->
r();
813 double z2 = middleStub->
z();
814 double phi2 = middleStub->
phi();
816 double r3 = outerStub->
r();
817 double z3 = outerStub->
z();
818 double phi3 = outerStub->
phi();
851 << middleFPGAStub->
isBarrel() << outerFPGAStub->
isBarrel() <<
" " << phi1 <<
", " << z1
852 <<
", " << r1 <<
", " << phi2 <<
", " <<
z2 <<
", " <<
r2 <<
", " << phi3 <<
", " << z3
853 <<
", " << r3 << endl;
871 << middleFPGAStub->
isBarrel() << outerFPGAStub->
isBarrel() <<
" " << phi1 <<
", " << z1
872 <<
", " << r1 <<
", " << phi2 <<
", " <<
z2 <<
", " <<
r2 <<
", " << phi3 <<
", " << z3
873 <<
", " << r3 << endl;
875 double rinvapprox, phi0approx, d0approx, tapprox, z0approx;
877 double phiprojdiskapprox[
N_DISK], rprojdiskapprox[
N_DISK];
878 double phiderdiskapprox[
N_DISK], rderdiskapprox[
N_DISK];
913 for (
unsigned int i = 0;
i <
toR_.size(); ++
i) {
914 phiprojapprox[
i] = phiproj[
i];
915 zprojapprox[
i] = zproj[
i];
916 phiderapprox[
i] = phider[
i];
917 zderapprox[
i] = zder[
i];
920 for (
unsigned int i = 0;
i <
toZ_.size(); ++
i) {
921 phiprojdiskapprox[
i] = phiprojdisk[
i];
922 rprojdiskapprox[
i] = rprojdisk[
i];
923 phiderdiskapprox[
i] = phiderdisk[
i];
924 rderdiskapprox[
i] = rderdisk[
i];
931 edm::LogVerbatim(
"Tracklet") <<
"phi0approx: " << phi0approx <<
" phi0: " << phi0 << endl;
934 edm::LogVerbatim(
"Tracklet") <<
"z0approx: " << z0approx <<
" z0: " << z0 << endl;
937 for (
unsigned int i = 0;
i <
toR_.size(); ++
i) {
939 edm::LogVerbatim(
"Tracklet") <<
"phiprojapprox[" <<
i <<
"]: " << phiprojapprox[
i] <<
" phiproj[" <<
i 940 <<
"]: " << phiproj[
i] << endl;
941 edm::LogVerbatim(
"Tracklet") <<
"zprojapprox[" <<
i <<
"]: " << zprojapprox[
i] <<
" zproj[" <<
i 942 <<
"]: " << zproj[
i] << endl;
943 edm::LogVerbatim(
"Tracklet") <<
"phiderapprox[" <<
i <<
"]: " << phiderapprox[
i] <<
" phider[" <<
i 944 <<
"]: " << phider[
i] << endl;
945 edm::LogVerbatim(
"Tracklet") <<
"zderapprox[" <<
i <<
"]: " << zderapprox[
i] <<
" zder[" <<
i <<
"]: " << zder[
i]
950 for (
unsigned int i = 0;
i <
toZ_.size(); ++
i) {
952 edm::LogVerbatim(
"Tracklet") <<
"phiprojdiskapprox[" <<
i <<
"]: " << phiprojdiskapprox[
i] <<
" phiprojdisk[" <<
i 953 <<
"]: " << phiprojdisk[
i] << endl;
954 edm::LogVerbatim(
"Tracklet") <<
"rprojdiskapprox[" <<
i <<
"]: " << rprojdiskapprox[
i] <<
" rprojdisk[" <<
i 955 <<
"]: " << rprojdisk[
i] << endl;
956 edm::LogVerbatim(
"Tracklet") <<
"phiderdiskapprox[" <<
i <<
"]: " << phiderdiskapprox[
i] <<
" phiderdisk[" <<
i 957 <<
"]: " << phiderdisk[
i] << endl;
958 edm::LogVerbatim(
"Tracklet") <<
"rderdiskapprox[" <<
i <<
"]: " << rderdiskapprox[
i] <<
" rderdisk[" <<
i 959 <<
"]: " << rderdisk[
i] << endl;
977 int irinv, iphi0, id0, it, iz0;
982 irinv = rinvapprox / krinv;
983 iphi0 = phi0approx / kphi0;
986 iz0 = z0approx / kz0;
991 edm::LogVerbatim(
"Tracklet") <<
"TrackletCalculator::DDL Seeding irinv too large: " << rinvapprox <<
"(" << irinv
1010 int phicrit = iphi0 - 2 * irinv - 2 * id0;
1016 keep = (phicrit > iphicritmincut) && (phicrit < iphicritmaxcut);
1019 if (
keep && !keepapprox)
1020 edm::LogVerbatim(
"Tracklet") <<
"TrackletCalculatorDisplaced::DDLSeeding tracklet kept with exact phicrit cut " 1021 "but not approximate, phicritapprox: " 1033 for (
unsigned int i = 0;
i <
toR_.size(); ++
i) {
1034 iphiproj[
i] = phiprojapprox[
i] / kphiproj;
1035 izproj[
i] = zprojapprox[
i] / kzproj;
1037 iphider[
i] = phiderapprox[
i] / kphider;
1038 izder[
i] = zderapprox[
i] / kzder;
1049 if (iphiproj[
i] <= 0)
1088 for (
unsigned int i = 0;
i <
toZ_.size(); ++
i) {
1089 iphiprojdisk[
i] = phiprojdiskapprox[
i] / kphiprojdisk;
1090 irprojdisk[
i] = rprojdiskapprox[
i] / krprojdisk;
1092 iphiderdisk[
i] = phiderdiskapprox[
i] / kphiderdisk;
1093 irderdisk[
i] = rderdiskapprox[
i] / krderdisk;
1095 if (iphiprojdisk[
i] <= 0)
1113 phiprojdiskapprox[
i],
1123 <<
layer_ <<
" , " <<
rinv <<
" , " << rinvapprox <<
" , " << phi0 <<
" , " << phi0approx <<
" , " <<
t <<
" , " 1124 << tapprox <<
" , " << z0 <<
" , " << z0approx <<
" , " <<
d0 <<
" , " << d0approx << endl;
1152 <<
" Found DDL tracklet in sector = " <<
iSector_ <<
" phi0 = " << phi0;
1158 ofstream
fout(
"seeds.txt", ofstream::app);
1164 for (
unsigned int j = 0;
j <
toR_.size();
j++) {
1173 for (
unsigned int j = 0;
j <
toZ_.size();
j++) {
1180 edm::LogVerbatim(
"Tracklet") <<
"adding disk projection " <<
j <<
"/" <<
toZ_.size() <<
" " << disk <<
" " 1192 const Stub* middleFPGAStub,
1194 const Stub* outerFPGAStub,
1198 <<
" trying stub triplet in (L2L3D1): " << middleFPGAStub->
layer().
value() <<
" " 1202 unsigned ndisks = 1;
1204 double r3 = innerStub->
r();
1205 double z3 = innerStub->
z();
1206 double phi3 = innerStub->
phi();
1208 double r1 = middleStub->
r();
1209 double z1 = middleStub->
z();
1210 double phi1 = middleStub->
phi();
1212 double r2 = outerStub->
r();
1213 double z2 = outerStub->
z();
1214 double phi2 = outerStub->
phi();
1247 << middleFPGAStub->
isBarrel() << outerFPGAStub->
isBarrel() <<
" " << phi3 <<
", " << z3
1248 <<
", " << r3 <<
", " << phi1 <<
", " << z1 <<
", " << r1 <<
", " << phi2 <<
", " <<
z2 1249 <<
", " <<
r2 << endl;
1253 z3 = innerFPGAStub->
zapprox();
1254 r3 = innerFPGAStub->
rapprox();
1257 z1 = middleFPGAStub->
zapprox();
1258 r1 = middleFPGAStub->
rapprox();
1267 << middleFPGAStub->
isBarrel() << outerFPGAStub->
isBarrel() <<
" " << phi3 <<
", " << z3
1268 <<
", " << r3 <<
", " << phi1 <<
", " << z1 <<
", " << r1 <<
", " << phi2 <<
", " <<
z2 1269 <<
", " <<
r2 << endl;
1271 double rinvapprox, phi0approx, d0approx, tapprox, z0approx;
1273 double phiprojdiskapprox[
N_DISK], rprojdiskapprox[
N_DISK];
1274 double phiderdiskapprox[
N_DISK], rderdiskapprox[
N_DISK];
1309 for (
unsigned int i = 0;
i <
toR_.size(); ++
i) {
1310 phiprojapprox[
i] = phiproj[
i];
1311 zprojapprox[
i] = zproj[
i];
1312 phiderapprox[
i] = phider[
i];
1313 zderapprox[
i] = zder[
i];
1316 for (
unsigned int i = 0;
i <
toZ_.size(); ++
i) {
1317 phiprojdiskapprox[
i] = phiprojdisk[
i];
1318 rprojdiskapprox[
i] = rprojdisk[
i];
1319 phiderdiskapprox[
i] = phiderdisk[
i];
1320 rderdiskapprox[
i] = rderdisk[
i];
1327 edm::LogVerbatim(
"Tracklet") <<
"phi0approx: " << phi0approx <<
" phi0: " << phi0 << endl;
1330 edm::LogVerbatim(
"Tracklet") <<
"z0approx: " << z0approx <<
" z0: " << z0 << endl;
1333 for (
unsigned int i = 0;
i <
toR_.size(); ++
i) {
1335 edm::LogVerbatim(
"Tracklet") <<
"phiprojapprox[" <<
i <<
"]: " << phiprojapprox[
i] <<
" phiproj[" <<
i 1336 <<
"]: " << phiproj[
i] << endl;
1337 edm::LogVerbatim(
"Tracklet") <<
"zprojapprox[" <<
i <<
"]: " << zprojapprox[
i] <<
" zproj[" <<
i 1338 <<
"]: " << zproj[
i] << endl;
1339 edm::LogVerbatim(
"Tracklet") <<
"phiderapprox[" <<
i <<
"]: " << phiderapprox[
i] <<
" phider[" <<
i 1340 <<
"]: " << phider[
i] << endl;
1341 edm::LogVerbatim(
"Tracklet") <<
"zderapprox[" <<
i <<
"]: " << zderapprox[
i] <<
" zder[" <<
i <<
"]: " << zder[
i]
1346 for (
unsigned int i = 0;
i <
toZ_.size(); ++
i) {
1348 edm::LogVerbatim(
"Tracklet") <<
"phiprojdiskapprox[" <<
i <<
"]: " << phiprojdiskapprox[
i] <<
" phiprojdisk[" <<
i 1349 <<
"]: " << phiprojdisk[
i] << endl;
1350 edm::LogVerbatim(
"Tracklet") <<
"rprojdiskapprox[" <<
i <<
"]: " << rprojdiskapprox[
i] <<
" rprojdisk[" <<
i 1351 <<
"]: " << rprojdisk[
i] << endl;
1352 edm::LogVerbatim(
"Tracklet") <<
"phiderdiskapprox[" <<
i <<
"]: " << phiderdiskapprox[
i] <<
" phiderdisk[" <<
i 1353 <<
"]: " << phiderdisk[
i] << endl;
1354 edm::LogVerbatim(
"Tracklet") <<
"rderdiskapprox[" <<
i <<
"]: " << rderdiskapprox[
i] <<
" rderdisk[" <<
i 1355 <<
"]: " << rderdisk[
i] << endl;
1373 int irinv, iphi0, id0, it, iz0;
1378 irinv = rinvapprox / krinv;
1379 iphi0 = phi0approx / kphi0;
1382 iz0 = z0approx / kz0;
1387 edm::LogVerbatim(
"Tracklet") <<
"TrackletCalculator:: LLD Seeding irinv too large: " << rinvapprox <<
"(" << irinv
1406 int phicrit = iphi0 - 2 * irinv - 2 * id0;
1412 keep = (phicrit > iphicritmincut) && (phicrit < iphicritmaxcut);
1415 if (
keep && !keepapprox)
1416 edm::LogVerbatim(
"Tracklet") <<
"TrackletCalculatorDisplaced::LLDSeeding tracklet kept with exact phicrit cut " 1417 "but not approximate, phicritapprox: " 1429 for (
unsigned int i = 0;
i <
toR_.size(); ++
i) {
1430 iphiproj[
i] = phiprojapprox[
i] / kphiproj;
1431 izproj[
i] = zprojapprox[
i] / kzproj;
1433 iphider[
i] = phiderapprox[
i] / kphider;
1434 izder[
i] = zderapprox[
i] / kzder;
1444 if (iphiproj[
i] <= 0)
1483 for (
unsigned int i = 0;
i <
toZ_.size(); ++
i) {
1484 iphiprojdisk[
i] = phiprojdiskapprox[
i] / kphiprojdisk;
1485 irprojdisk[
i] = rprojdiskapprox[
i] / krprojdisk;
1487 iphiderdisk[
i] = phiderdiskapprox[
i] / kphiderdisk;
1488 irderdisk[
i] = rderdiskapprox[
i] / krderdisk;
1491 if (iphiprojdisk[
i] <= 0)
1510 phiprojdiskapprox[
i],
1520 <<
layer_ <<
" , " <<
rinv <<
" , " << rinvapprox <<
" , " << phi0 <<
" , " << phi0approx <<
" , " <<
t <<
" , " 1521 << 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]) {
1674 double x1 = r1 *
cos(phi1);
1675 double x2 =
r2 *
cos(phi2);
1676 double x3 = r3 *
cos(phi3);
1678 double y1 = r1 *
sin(phi1);
1680 double y3 = r3 *
sin(phi3);
1682 double dy21 =
y2 -
y1;
1683 double dy32 = y3 -
y2;
1692 double k1 = -(x2 - x1) / dy21;
1693 double k2 = -(x3 - x2) / dy32;
1694 double b1 = 0.5 * (
y2 +
y1) - 0.5 * (x1 + x2) * k1;
1695 double b2 = 0.5 * (y3 +
y2) - 0.5 * (x2 + x3) * k2;
1697 double y0 = (
b1 * k2 -
b2 * k1) / (k2 - k1);
1698 double x0 = (
b1 -
b2) / (k2 - k1);
1702 double R3 =
sqrt(
pow(x3 - x0, 2) +
pow(y3 - y0, 2));
1704 double eps1 =
std::abs(R1 / R2 - 1);
1705 double eps2 =
std::abs(R3 / R2 - 1);
1706 if (eps1 > 1
e-10 || eps2 > 1
e-10)
1707 edm::LogVerbatim(
"Tracklet") <<
"&&&&&&&&&&&& bad circle! " << R1 <<
"\t" << R2 <<
"\t" << R3;
1713 phi0 = 0.5 *
M_PI + atan2(y0, x0);
1717 d0 = -R1 +
sqrt(x0 * x0 + y0 * y0);
1733 double t12 = (
z2 - z1) /
std::abs(beta2 - beta1) / R1;
1734 double z12 = (z1 * beta2 -
z2 * beta1) / (beta2 - beta1);
1735 double t13 = (z3 - z1) /
std::abs(beta3 - beta1) / R1;
1736 double z13 = (z1 * beta3 - z3 * beta1) / (beta3 - beta1);
1748 for (
unsigned int i = 0;
i <
toR_.size();
i++) {
1749 exactproj(
toR_[
i],
rinv, phi0,
d0,
t, z0,
sqrt(x0 * x0 + y0 * y0), phiproj[
i], zproj[
i], phider[
i], zder[
i]);
1752 for (
unsigned int i = 0;
i <
toZ_.size();
i++) {
1753 exactprojdisk(
toZ_[
i],
rinv, phi0,
d0,
t, z0, x0, y0, phiprojdisk[
i], rprojdisk[
i], phiderdisk[
i], rderdisk[
i]);
1757 edm::LogVerbatim(
"Tracklet") <<
"exact tracklet: " <<
rinv <<
" " << phi0 <<
" " <<
t <<
" " << z0 <<
" " <<
d0;
1777 double rmeanInv = 1.0 / rmean;
1779 phiproj = phi0 + rmean * (-halfRinv + 2.0 * d0_0 * halfRinv_0 * halfRinv_0) +
1780 rmeanInv * (-
d0 + halfRinv_0 * d0_0 * d0_0) +
sixth *
pow(-rmean * halfRinv_0 - rmeanInv * d0_0, 3);
1781 phiprojder = -halfRinv +
d0 * rmeanInv * rmeanInv;
1783 zproj = z0 +
t * rmean - 0.5 * rmeanInv *
t * d0_0 * d0_0 -
t * rmean * halfRinv *
d0 +
1784 sixth *
pow(rmean, 3) *
t * halfRinv_0 * halfRinv_0;
1790 edm::LogVerbatim(
"Tracklet") <<
"approx proj layer at " << rmean <<
" : " << phiproj <<
" " << zproj << endl;
1814 double zmeanInv = 1.0 / zmean, rstar = (zmean - z0) /
t,
1815 epsilon = 0.5 * zmeanInv * zmeanInv * d0_0 * d0_0 *
t *
t + halfRinv *
d0 -
1816 sixth * rstar * rstar * halfRinv_0 * halfRinv_0;
1818 rproj = rstar * (1 +
epsilon);
1821 double A = rproj * halfRinv;
1822 double B = -
d0 *
t * zmeanInv * (1 + z0 * zmeanInv) * (1 -
epsilon);
1823 double C = -
d0 * halfRinv;
1824 double A_0 = rproj * halfRinv_0;
1825 double B_0 = -d0_0 *
t * zmeanInv * (1 + z0 * zmeanInv) * (1 -
epsilon);
1828 phiproj = phi0 -
A +
B * (1 +
C - 2 * A_0 * A_0) +
sixth *
pow(-A_0 + B_0, 3);
1829 phiprojder = -halfRinv /
t +
d0 *
t * zmeanInv * zmeanInv;
1834 edm::LogVerbatim(
"Tracklet") <<
"approx proj disk at" << zmean <<
" : " << phiproj <<
" " << rproj << endl;
1857 double phiprojdisk[5],
1858 double rprojdisk[5],
1859 double phiderdisk[5],
1860 double rderdisk[5]) {
1861 double a = 1.0 / ((r1 -
r2) * (r1 - r3));
1862 double b = 1.0 / ((r1 -
r2) * (
r2 - r3));
1863 double c = 1.0 / ((r1 - r3) * (
r2 - r3));
1866 double halfRinv_0 = -phi1 * r1 *
a + phi2 *
r2 *
b - phi3 * r3 *
c;
1867 double d0_0 = r1 *
r2 * r3 * (-phi1 *
a + phi2 *
b - phi3 *
c);
1870 double r =
r2, z =
z2;
1874 double d0OverR1 = d0_0 *
rzmeanInv_[0] * (ndisks > 2 ?
std::abs((z - z1) / (r - r1)) : 1.0);
1875 double d0OverR2 = d0_0 *
rzmeanInv_[1] * (ndisks > 1 ?
std::abs((z - z1) / (r - r1)) : 1.0);
1876 double d0OverR3 = d0_0 *
rzmeanInv_[2] * (ndisks > 0 ?
std::abs((z - z1) / (r - r1)) : 1.0);
1878 double d0OverR = d0OverR2;
1882 double c1 = d0_0 * halfRinv_0 * d0OverR1 + 2.0 * d0_0 * halfRinv_0 * r1 * halfRinv_0 +
1883 sixth *
pow(-r1 * halfRinv_0 - d0OverR1, 3);
1884 double c2 = d0_0 * halfRinv_0 * d0OverR2 + 2.0 * d0_0 * halfRinv_0 *
r2 * halfRinv_0 +
1886 double c3 = d0_0 * halfRinv_0 * d0OverR3 + 2.0 * d0_0 * halfRinv_0 * r3 * halfRinv_0 +
1887 sixth *
pow(-r3 * halfRinv_0 - d0OverR3, 3);
1889 double phi1c = phi1 -
c1;
1890 double phi2c = phi2 - c2;
1891 double phi3c = phi3 - c3;
1894 double halfRinv = -phi1c * r1 *
a + phi2c *
r2 *
b - phi3c * r3 *
c;
1895 phi0 = -phi1c * r1 * (
r2 + r3) *
a + phi2c *
r2 * (r1 + r3) *
b - phi3c * r3 * (r1 +
r2) *
c;
1896 d0 = r1 *
r2 * r3 * (-phi1c *
a + phi2c *
b - phi3c *
c);
1898 t = ((z - z1) / (r - r1)) *
1899 (1. +
d0 * halfRinv - 0.5 * d0OverR1 * d0OverR -
sixth * (r1 * r1 +
r2 *
r2 + r1 *
r2) * halfRinv_0 * halfRinv_0);
1900 z0 = z1 -
t * r1 * (1.0 - d0_0 * halfRinv_0 - 0.5 * d0OverR1 * d0OverR1 +
sixth * r1 * r1 * halfRinv_0 * halfRinv_0);
1902 rinv = 2.0 * halfRinv;
1907 for (
unsigned int i = 0;
i <
toR_.size();
i++) {
1922 for (
unsigned int i = 0;
i <
toZ_.size();
i++) {
1944 edm::LogVerbatim(
"Tracklet") <<
"TCD approx tracklet: " <<
rinv <<
" " << phi0 <<
" " <<
t <<
" " << z0 <<
" " <<
d0
Log< level::Info, true > LogVerbatim
std::vector< AllStubsMemory * > middleallstubs_
unsigned int maxStep(std::string module) const
int PS_rderD_shift() const
int PS_zderL_shift() const
std::vector< StubTripletsMemory * > stubtriplets_
void exactproj(double rproj, double rinv, double phi0, double d0, double t, double z0, double r0, double &phiproj, double &zproj, double &phider, double &zder)
constexpr T reduceRange(T x)
bool addLayerProj(Tracklet *tracklet, int layer)
double phiapprox(double phimin, double) const
std::vector< AllStubsMemory * > innerallstubs_
void addInput(MemoryBase *memory, std::string input) override
double disp_z0cut() const
double phicritmaxmc() const
Sin< T >::type sin(const T &t)
Projection & proj(int layerdisk)
Settings const & settings_
void addProjection(int layer, int iphi, TrackletProjectionsMemory *trackletprojs, Tracklet *tracklet)
double rmindiskvm() const
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
unsigned int nTracklets() const
double phicritminmc() const
const FPGAWord & fpgaphiproj() const
static std::string const input
const FPGAWord & disk() const
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)
std::vector< std::vector< TrackletProjectionsMemory * > > trackletprojlayers_
void init(Settings const &settings, unsigned int layerdisk, int iphiproj, int irzproj, int iphider, int irzder, double phiproj, double rzproj, double phiprojder, double rzprojder, double phiprojapprox, double rzprojapprox, double phiprojderapprox, double rzprojderapprox, bool isPSseed)
unsigned int nbitsphiprojderL456() 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])
unsigned int nzbitsstub(unsigned int layerdisk) const
unsigned int nphibitsstub(unsigned int layerdisk) const
std::vector< double > toR_
double rmean(unsigned int iLayer) const
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)
Cos< T >::type cos(const T &t)
bool LLLSeeding(const Stub *innerFPGAStub, const L1TStub *innerStub, const Stub *middleFPGAStub, const L1TStub *middleStub, const Stub *outerFPGAStub, const L1TStub *outerStub)
Abs< T >::type abs(const T &t)
IMATH_TrackletCalculator * ITC_L1L2()
double zproj_[N_DISK - 2]
void execute(unsigned int iSector, double phimin, double phimax)
std::string const & getName() const
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])
bool writeMonitorData(std::string module) const
unsigned int layerdisk() const
double zmean(unsigned int iDisk) const
void setTCIndex(int index)
int SS_phiD_shift() const
unsigned int nallstubs(unsigned int layerdisk) const
bool debugTracklet() const
double rproj_[N_LAYER - 2]
int SS_phiderD_shift() const
void addTracklet(Tracklet *tracklet)
static constexpr float d0
bool DDLSeeding(const Stub *innerFPGAStub, const L1TStub *innerStub, const Stub *middleFPGAStub, const L1TStub *middleStub, const Stub *outerFPGAStub, const L1TStub *outerStub)
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)
void addDiskProj(Tracklet *tracklet, int disk)
void setTrackletIndex(unsigned int index)
double rinv(double phi1, double phi2, double r1, double r2)
constexpr valType make0To2pi(valType angle)
int SS_phiderL_shift() const
unsigned int nbitsphiprojderL123() const
const FPGAWord & fpgarzproj() const
double rzmeanInv_[N_DISK - 2]
void addProj(Tracklet *tracklet)
std::ofstream & ofstream(std::string fname)
unsigned int ntrackletmax() const
std::vector< AllStubsMemory * > outerallstubs_
double krprojshiftdisk() const
void addOutputProjection(TrackletProjectionsMemory *&outputProj, MemoryBase *memory)
const FPGAWord & layer() const
bool usephicritapprox() const
std::string const & getName() const
int SS_phiL_shift() const
void addProjectionDisk(int disk, int iphi, TrackletProjectionsMemory *trackletprojs, Tracklet *tracklet)
std::vector< double > toZ_
void addOutput(MemoryBase *memory, std::string output) override
TrackletParametersMemory * trackletpars_
bool validProj(int layerdisk) const