14 TrackletProcessor::TrackletProcessor(
string name,
Settings const& settings,
Globals* globals,
unsigned int iSector)
28 for (
unsigned int ilayer = 0; ilayer <
N_LAYER; ilayer++) {
33 for (
unsigned int idisk = 0; idisk <
N_DISK; idisk++) {
43 if (
name_[3] ==
'L') {
56 else if (
name_[7] ==
'B')
58 else if (
name_[7] ==
'C')
60 else if (
name_[7] ==
'D')
62 else if (
name_[7] ==
'E')
64 else if (
name_[7] ==
'F')
66 else if (
name_[7] ==
'G')
68 else if (
name_[7] ==
'H')
70 else if (
name_[7] ==
'I')
72 else if (
name_[7] ==
'J')
74 else if (
name_[7] ==
'K')
76 else if (
name_[7] ==
'L')
78 else if (
name_[7] ==
'M')
80 else if (
name_[7] ==
'N')
82 else if (
name_[7] ==
'O')
88 if (
name_.substr(3, 4) ==
"L1L2")
90 else if (
name_.substr(3, 4) ==
"L3L4")
92 else if (
name_.substr(3, 4) ==
"L5L6")
94 else if (
name_.substr(3, 4) ==
"D1D2")
96 else if (
name_.substr(3, 4) ==
"D3D4")
98 else if (
name_.substr(3, 4) ==
"D1L1")
100 else if (
name_.substr(3, 4) ==
"D1L2")
102 else if (
name_.substr(3, 4) ==
"L1D1")
104 else if (
name_.substr(3, 4) ==
"L2D1")
106 else if (
name_.substr(3, 4) ==
"L2L3")
117 double phicritFactor =
119 if (
std::abs(phicritFactor - 2.) > 0.25)
121 <<
"TrackletProcessor::TrackletProcessor phicrit approximation may be invalid! Please check.";
126 outputProj = dynamic_cast<TrackletProjectionsMemory*>(
memory);
127 assert(outputProj !=
nullptr);
135 if (
output ==
"trackpar") {
136 auto*
tmp = dynamic_cast<TrackletParametersMemory*>(
memory);
142 if (
output.substr(0, 7) ==
"projout") {
144 auto*
tmp = dynamic_cast<TrackletProjectionsMemory*>(
memory);
147 unsigned int layerdisk =
output[8] -
'1';
148 unsigned int phiregion =
output[12] -
'A';
169 throw cms::Exception(
"BadConfig") << __FILE__ <<
" " << __LINE__ <<
" Could not find output : " <<
output;
178 if (
input ==
"innervmstubin") {
179 auto*
tmp = dynamic_cast<VMStubsTEMemory*>(
memory);
185 if (
input ==
"outervmstubin") {
186 auto*
tmp = dynamic_cast<VMStubsTEMemory*>(
memory);
192 if (
input ==
"innerallstubin") {
193 auto*
tmp = dynamic_cast<AllStubsMemory*>(
memory);
198 if (
input ==
"outerallstubin") {
199 auto*
tmp = dynamic_cast<AllStubsMemory*>(
memory);
204 throw cms::Exception(
"BadConfig") << __FILE__ <<
" " << __LINE__ <<
" Could not find input : " <<
input;
208 unsigned int countall = 0;
209 unsigned int countsel = 0;
211 unsigned int countteall = 0;
212 unsigned int counttepass = 0;
223 for (
unsigned int ivmmem = 0; ivmmem <
innervmstubs_.size(); ivmmem++) {
227 unsigned phiindex = 32 * innerphibin + outerphibin;
236 int rdiffmax = (lookupbits >> 7);
237 int newbin = (lookupbits & 127);
238 int bin = newbin / 8;
240 int rbinfirst = newbin & 7;
245 for (
int ibin =
start; ibin <=
last; ibin++) {
250 for (
unsigned int j = 0;
j <
outervmstubs_[ivmmem]->nVMStubsBinned(ibin);
j++) {
258 if ((rbin < rbinfirst) || (rbin - rbinfirst > rdiffmax)) {
261 <<
getName() <<
" layer-disk stub pair rejected because rbin cut : " << rbin <<
" " << rbinfirst
267 int ir = ((
start & 3) << 3) + rbinfirst;
283 edm::LogVerbatim(
"Tracklet") <<
"Stub pair rejected because of tracklet pt cut";
296 edm::LogVerbatim(
"Tracklet") <<
"Stub pair rejected because of stub pt cut bends : "
306 ofstream
fout(
"seeds.txt", ofstream::app);
329 int zdiffmax = (lookupbits >> 7);
330 int newbin = (lookupbits & 127);
331 int bin = newbin / 8;
333 int zbinfirst = newbin & 7;
345 for (
int ibin =
start; ibin <=
last; ibin++) {
346 for (
unsigned int j = 0;
j <
outervmstubs_[ivmmem]->nVMStubsBinned(ibin);
j++) {
361 if (zbin < zbinfirst || zbin - zbinfirst > zdiffmax) {
363 edm::LogVerbatim(
"Tracklet") <<
"Stubpair rejected because of wrong fine z";
384 edm::LogVerbatim(
"Tracklet") <<
"Stub pair rejected because of tracklet pt cut";
398 <<
"Stub pair rejected because of stub pt cut bends : "
408 ofstream
fout(
"seeds.txt", ofstream::app);
429 int rdiffmax = (lookupbits >> 6);
430 int newbin = (lookupbits & 63);
431 int bin = newbin / 8;
433 int rbinfirst = newbin & 7;
439 for (
int ibin =
start; ibin <=
last; ibin++) {
443 for (
unsigned int j = 0;
j <
outervmstubs_[ivmmem]->nVMStubsBinned(ibin);
j++) {
450 int rbin = (vmbits & 7);
453 if (rbin < rbinfirst)
455 if (rbin - rbinfirst > rdiffmax)
465 constexpr
unsigned int n_barrelseed = 3;
466 if (
iSeed_ > n_barrelseed) {
467 int ir = ((ibin & n_barrelseed) << 1) + (rzbin >> 2);
474 unsigned int ptinnerindex = (
index << innerbend.
nbits()) + innerbend.
value();
475 unsigned int ptouterindex = (
index << outerbend.
nbits()) + outerbend.
value();
483 <<
"Stub pair rejected because of stub pt cut bends : "
486 <<
" pass : " <<
pttableinner_[phiindex][ptinnerindex] <<
" "
495 ofstream
fout(
"seeds.txt", ofstream::app);
535 if (outerFPGAStub->
isDisk()) {
543 if (outerFPGAStub->
isDisk()) {
546 }
else if (innerFPGAStub->
isDisk()) {
550 throw cms::Exception(
"LogicError") << __FILE__ <<
" " << __LINE__ <<
" Invalid seeding!";
590 for (
unsigned int ivmmem = 0; ivmmem <
innervmstubs_.size(); ivmmem++) {
594 unsigned phiindex = 32 * innerphibin + outerphibin;
610 double innerphimin, innerphimax;
614 double outerphimin, outerphimax;
621 std::vector<bool> vmbendinner;
622 std::vector<bool> vmbendouter;
623 unsigned int nbins1 = 8;
626 for (
unsigned int i = 0;
i < nbins1;
i++) {
627 vmbendinner.push_back(
false);
630 unsigned int nbins2 = 8;
633 for (
unsigned int i = 0;
i < nbins2;
i++) {
634 vmbendouter.push_back(
false);
637 for (
int iphiinnerbin = 0; iphiinnerbin < innerphibins; iphiinnerbin++) {
638 phiinner[0] = innerphimin + iphiinnerbin * (innerphimax - innerphimin) / innerphibins;
639 phiinner[1] = innerphimin + (iphiinnerbin + 1) * (innerphimax - innerphimin) / innerphibins;
640 for (
int iphiouterbin = 0; iphiouterbin < outerphibins; iphiouterbin++) {
641 phiouter[0] = outerphimin + iphiouterbin * (outerphimax - outerphimin) / outerphibins;
642 phiouter[1] = outerphimin + (iphiouterbin + 1) * (outerphimax - outerphimin) / outerphibins;
644 double bendinnermin = 20.0;
645 double bendinnermax = -20.0;
646 double bendoutermin = 20.0;
647 double bendoutermax = -20.0;
648 double rinvmin = 1.0;
649 for (
int i1 = 0;
i1 < 2;
i1++) {
650 for (
int i2 = 0;
i2 < 2;
i2++) {
651 double rinv1 =
rinv(phiinner[
i1], phiouter[
i2], rinner, router);
656 double abendinner = -
bend(rinner, rinv1, pitchinner);
657 double abendouter = -
bend(router, rinv1, pitchouter);
658 if (abendinner < bendinnermin)
659 bendinnermin = abendinner;
660 if (abendinner > bendinnermax)
661 bendinnermax = abendinner;
662 if (abendouter < bendoutermin)
663 bendoutermin = abendouter;
664 if (abendouter > bendoutermax)
665 bendoutermax = abendouter;
677 for (
int ibend = 0; ibend < nbins1; ibend++) {
683 vmbendinner[ibend] =
true;
690 for (
int ibend = 0; ibend < nbins2; ibend++) {
696 vmbendouter[ibend] =
true;
715 int outerrbins = (1 << outerrbits);
719 double innerphimin, innerphimax;
722 double outerphimin, outerphimax;
729 std::vector<bool> vmbendinner;
730 std::vector<bool> vmbendouter;
732 for (
unsigned int i = 0;
i < 8;
i++) {
733 vmbendinner.push_back(
false);
734 vmbendouter.push_back(
false);
737 for (
int irouterbin = 0; irouterbin < outerrbins; irouterbin++) {
742 for (
int iphiinnerbin = 0; iphiinnerbin < innerphibins; iphiinnerbin++) {
743 phiinner[0] = innerphimin + iphiinnerbin * (innerphimax - innerphimin) / innerphibins;
744 phiinner[1] = innerphimin + (iphiinnerbin + 1) * (innerphimax - innerphimin) / innerphibins;
745 for (
int iphiouterbin = 0; iphiouterbin < outerphibins; iphiouterbin++) {
746 phiouter[0] = outerphimin + iphiouterbin * (outerphimax - outerphimin) / outerphibins;
747 phiouter[1] = outerphimin + (iphiouterbin + 1) * (outerphimax - outerphimin) / outerphibins;
749 double bendinnermin = 20.0;
750 double bendinnermax = -20.0;
751 double bendoutermin = 20.0;
752 double bendoutermax = -20.0;
753 double rinvmin = 1.0;
754 double rinvmax = -1.0;
755 for (
int i1 = 0;
i1 < 2;
i1++) {
756 for (
int i2 = 0;
i2 < 2;
i2++) {
757 for (
int i3 = 0;
i3 < 2;
i3++) {
759 double rinv1 =
rinv(phiinner[
i1], phiouter[
i2], rinner, router[
i3]);
764 double abendinner =
bend(rinner, rinv1, pitchinner);
765 double abendouter =
bend(router[
i3], rinv1, pitchouter);
766 if (abendinner < bendinnermin)
767 bendinnermin = abendinner;
768 if (abendinner > bendinnermax)
769 bendinnermax = abendinner;
770 if (abendouter < bendoutermin)
771 bendoutermin = abendouter;
772 if (abendouter > bendoutermax)
773 bendoutermax = abendouter;
786 for (
int ibend = 0; ibend < 8; ibend++) {
792 vmbendinner[ibend] =
true;
796 for (
int ibend = 0; ibend < 8; ibend++) {
802 vmbendouter[ibend] =
true;
818 unsigned int nrbits = 5;
823 double innerphimin, innerphimax;
826 double outerphimin, outerphimax;
833 std::vector<bool> vmbendinner;
834 std::vector<bool> vmbendouter;
836 for (
unsigned int i = 0;
i < 8;
i++) {
837 vmbendinner.push_back(
false);
838 vmbendouter.push_back(
false);
843 for (
int iphiinnerbin = 0; iphiinnerbin < innerphibins; iphiinnerbin++) {
844 phiinner[0] = innerphimin + iphiinnerbin * (innerphimax - innerphimin) / innerphibins;
845 phiinner[1] = innerphimin + (iphiinnerbin + 1) * (innerphimax - innerphimin) / innerphibins;
846 for (
int iphiouterbin = 0; iphiouterbin < outerphibins; iphiouterbin++) {
847 phiouter[0] = outerphimin + iphiouterbin * (outerphimax - outerphimin) / outerphibins;
848 phiouter[1] = outerphimin + (iphiouterbin + 1) * (outerphimax - outerphimin) / outerphibins;
849 for (
int irbin = 0; irbin < (1 << nrbits); irbin++) {
851 router[1] = router[0] +
dr;
852 double bendinnermin = 20.0;
853 double bendinnermax = -20.0;
854 double bendoutermin = 20.0;
855 double bendoutermax = -20.0;
856 double rinvmin = 1.0;
857 for (
int i1 = 0;
i1 < 2;
i1++) {
858 for (
int i2 = 0;
i2 < 2;
i2++) {
859 for (
int i3 = 0;
i3 < 2;
i3++) {
861 double rinv1 =
rinv(phiinner[
i1], phiouter[
i2], rinner, router[
i3]);
866 double abendinner =
bend(rinner, rinv1, pitchinner);
867 double abendouter =
bend(router[
i3], rinv1, pitchouter);
868 if (abendinner < bendinnermin)
869 bendinnermin = abendinner;
870 if (abendinner > bendinnermax)
871 bendinnermax = abendinner;
872 if (abendouter < bendoutermin)
873 bendoutermin = abendouter;
874 if (abendouter > bendoutermax)
875 bendoutermax = abendouter;
885 for (
int ibend = 0; ibend < 8; ibend++) {
891 vmbendinner[ibend] =
true;
895 for (
int ibend = 0; ibend < 8; ibend++) {
901 vmbendouter[ibend] =
true;
919 outptcut.open(
getName() +
"_ptcut.tab");
920 outptcut <<
"{" << endl;
925 outptcut << endl <<
"};" << endl;
928 ofstream outstubptinnercut;
929 outstubptinnercut.open(
getName() +
"_stubptinnercut.tab");
930 outstubptinnercut <<
"{" << endl;
935 outstubptinnercut << endl <<
"};" << endl;
936 outstubptinnercut.close();
938 ofstream outstubptoutercut;
939 outstubptoutercut.open(
getName() +
"_stubptoutercut.tab");
940 outstubptoutercut <<
"{" << endl;
945 outstubptoutercut << endl <<
"};" << endl;
946 outstubptoutercut.close();