14 using namespace trklet;
16 TrackletConfigBuilder::TrackletConfigBuilder(
const Settings& settings) : settings_(settings) {
39 for (
int layerdisk = 0; layerdisk < N_LAYER +
N_DISK; layerdisk++) {
63 for (
unsigned int ilayer = 0; ilayer <
N_LAYER +
N_DISK; ilayer++) {
65 for (
unsigned int iReg = 0; iReg <
NRegions_[ilayer]; iReg++) {
66 std::vector<std::pair<unsigned int, unsigned int> > emptyVec;
68 double phimin = dphi * iReg;
69 double phimax = phimin + dphi;
70 std::pair<double, double>
tmp(phimin, phimax);
72 double dphiVM = dphi /
NVMME_[ilayer];
73 for (
unsigned int iVM = 0; iVM <
NVMME_[ilayer]; iVM++) {
74 double phivmmin = phimin + iVM * dphiVM;
75 double phivmmax = phivmmin + dphiVM;
76 std::pair<double, double>
tmp(phivmmin, phivmmax);
87 for (
unsigned int iVM = 0; iVM < nVM1 *
NRegions_[l1]; iVM++) {
88 double phivmmin = iVM * dphiVM;
89 double phivmmax = phivmmin + dphiVM;
90 std::pair<double, double>
tmp(phivmmin, phivmmax);
94 for (
unsigned int iVM = 0; iVM < nVM2 * NRegions_[l2]; iVM++) {
95 double phivmmin = iVM * dphiVM;
96 double phivmmax = phivmmin + dphiVM;
97 std::pair<double, double>
tmp(phivmmin, phivmmax);
104 std::pair<unsigned int, unsigned int> seedlayers =
seedLayers(iseed);
106 unsigned int l1 = seedlayers.first;
107 unsigned int l2 = seedlayers.second;
114 }
else if (iseed < 6) {
123 return std::pair<double, double>(
r1,
r2);
127 double rinvmin = 999.9;
128 double rinvmax = -999.9;
133 std::pair<double, double> seedradii =
seedRadii(iseed);
135 for (
unsigned int i1 = 0; i1 < 2; i1++) {
136 for (
unsigned int i2 = 0; i2 < 2; i2++) {
137 double arinv =
rinv(seedradii.first, phi1[i1], seedradii.second, phi2[i2]);
156 for (
unsigned int i2 = 0; i2 <
VMStubsTE_[
iseed].second.size(); i2++) {
158 std::pair<unsigned int, unsigned int>
tmp(i1, i2);
167 for (
unsigned int iSeed = 0; iSeed <
N_SEED_PROMPT; iSeed++) {
168 unsigned int nTC =
NTC_[iSeed];
169 std::vector<std::pair<unsigned int, unsigned int> >& TEs =
TE_[iSeed];
170 std::vector<std::vector<unsigned int> >& TCs =
TC_[iSeed];
174 double invnTC = nTC * (1.0 / TEs.size());
176 for (
unsigned int iTE = 0; iTE < TEs.size(); iTE++) {
177 int iTC = invnTC * iTE;
179 if (iTC >= (
int)TCs.size()) {
180 std::vector<unsigned int>
tmp;
184 TCs[iTC].push_back(iTE);
191 std::vector<std::vector<unsigned int> >& TCs =
TC_[iSeed];
193 std::pair<double, double> seedradii =
seedRadii(iSeed);
197 for (
unsigned int iTE = 0; iTE < TCs[iTC].size(); iTE++) {
198 unsigned int theTE = TCs[iTC][iTE];
199 unsigned int l1TE =
TE_[iSeed][theTE].first;
200 unsigned int l2TE =
TE_[iSeed][theTE].second;
203 for (
unsigned int i1 = 0; i1 < 2; i1++) {
204 for (
unsigned int i2 = 0; i2 < 2; i2++) {
205 double aphi =
phi(seedradii.first, phi1[i1], seedradii.second, phi2[i2], rproj);
218 std::vector<std::vector<unsigned int> >& TCs =
TC_[
iseed];
220 for (
unsigned int ilayer = 0; ilayer <
N_LAYER +
N_DISK; ilayer++) {
223 for (
unsigned int iReg = 0; iReg <
NRegions_[ilayer]; iReg++) {
224 for (
unsigned int iTC = 0; iTC < TCs.size(); iTC++) {
229 if (phiRange.first <
allStubs_[ilayer][iReg].second && phiRange.second >
allStubs_[ilayer][iReg].first) {
230 std::pair<unsigned int, unsigned int>
tmp(
iseed, iTC);
240 double rhoinv =
rinv(r1, phi1, r2, phi2);
242 rhoinv =
rinvmax_ * rhoinv / fabs(rhoinv);
244 return phi1 + asin(0.5 * r * rhoinv) - asin(0.5 * r1 * rhoinv);
248 double deltaphi = phi1 - phi2;
249 return 2 *
sin(deltaphi) /
sqrt(r2 * r2 + r1 * r1 - 2 * r1 * r2 *
cos(deltaphi));
253 static std::string name[8] = {
"L1L2",
"L2L3",
"L3L4",
"L5L6",
"D1D2",
"D3D4",
"L1D1",
"L2D1"};
260 static std::string num[32] = {
"1",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9",
"10",
"11",
261 "12",
"13",
"14",
"15",
"16",
"17",
"18",
"19",
"20",
"21",
"22",
262 "23",
"24",
"25",
"26",
"27",
"28",
"29",
"30",
"31",
"32"};
268 static std::string name[12] = {
"A",
"B",
"C",
"D",
"E",
"F",
"G",
"H",
"I",
"J",
"K",
"L"};
277 static std::string nameOverlap[8] = {
"X",
"Y",
"Z",
"W",
"Q",
"R",
"S",
"T"};
279 static std::string nameL2L3[4] = {
"I",
"J",
"K",
"L"};
283 return nameL2L3[iReg];
287 return nameOverlap[iReg];
302 return ilayer < 6 ? (
"L" +
numStr(ilayer)) : (
"D" +
numStr(ilayer - 6));
321 for (
unsigned int ilayer = 0; ilayer <
N_LAYER +
N_DISK; ilayer++) {
322 for (
unsigned int ireg = 0; ireg <
projections_[ilayer].size(); ireg++) {
323 for (
unsigned int imem = 0; imem <
projections_[ilayer][ireg].size(); imem++) {
324 unsigned int iSeed =
projections_[ilayer][ireg][imem].first;
325 unsigned int iTC =
projections_[ilayer][ireg][imem].second;
327 memories <<
"TrackletProjections: " +
TPROJName(iSeed, iTC, ilayer, ireg) +
" [54]" << std::endl;
329 os <<
TPROJName(iSeed, iTC, ilayer, ireg) <<
" input=> " <<
TCName(iSeed, iTC) <<
".projout"
343 unsigned int iseed) {
357 unsigned int iseed) {
368 unsigned int iseed) {
379 unsigned int iseed) {
393 unsigned int l1,
unsigned int l2,
unsigned int l3,
unsigned int itc,
unsigned int projlayer,
unsigned int projreg) {
403 unsigned int l1,
unsigned int ireg1,
unsigned int l2,
unsigned int ireg2,
unsigned int iseed,
unsigned int count) {
414 unsigned int count) {
427 for (
unsigned int iSeed = 0; iSeed <
N_SEED_PROMPT; iSeed++) {
428 for (
unsigned int iTC = 0; iTC <
TC_[iSeed].size(); iTC++) {
429 for (
unsigned int iTE = 0; iTE <
TC_[iSeed][iTC].size(); iTE++) {
430 unsigned int theTE =
TC_[iSeed][iTC][iTE];
432 unsigned int TE1 =
TE_[iSeed][theTE].first;
433 unsigned int TE2 =
TE_[iSeed][theTE].second;
438 memories <<
"StubPairs: "
441 modules <<
"TrackletEngine: "
442 <<
TEName(l1, TE1 /
NVMTE_[iSeed].first, TE1, l2, TE2 /
NVMTE_[iSeed].second, TE2, iSeed) << std::endl;
444 os <<
SPName(l1, TE1 /
NVMTE_[iSeed].first, TE1, l2, TE2 /
NVMTE_[iSeed].second, TE2, iSeed) <<
" input=> "
445 <<
TEName(l1, TE1 /
NVMTE_[iSeed].first, TE1, l2, TE2 /
NVMTE_[iSeed].second, TE2, iSeed)
446 <<
".stubpairout output=> " <<
TCNAme(iSeed, iTC) <<
".stubpairin" << std::endl;
456 vector<string> stubTriplets[
N_SEED];
472 for (
unsigned int ireg1 = 0; ireg1 < nallstub1; ireg1++) {
473 for (
unsigned int ireg2 = 0; ireg2 < nallstub2; ireg2++) {
474 for (
unsigned int ireg3 = 0; ireg3 < nallstub3; ireg3++) {
476 memories <<
"StubTriplets: " <<
STName(layerdisk1, ireg1, layerdisk2, ireg2, layerdisk3, ireg3, iSeed, count)
477 <<
" [18]" << std::endl;
478 stubTriplets[iSeed].push_back(
STName(layerdisk1, ireg1, layerdisk2, ireg2, layerdisk3, ireg3, iSeed, count));
483 for (
unsigned int ireg1 = 0; ireg1 < nallstub1; ireg1++) {
484 for (
unsigned int ivm1 = 0; ivm1 < nvm1; ivm1++) {
485 for (
unsigned int ireg2 = 0; ireg2 < nallstub2; ireg2++) {
486 for (
unsigned int ivm2 = 0; ivm2 < nvm2; ivm2++) {
489 modules <<
"TrackletEngineDisplaced: "
490 <<
TEDName(layerdisk1, ireg1, ireg1 * nvm1 + ivm1, layerdisk2, ireg2, ireg2 * nvm2 + ivm2, iSeed)
493 for (
unsigned int ireg3 = 0; ireg3 < nallstub3; ireg3++) {
494 for (
unsigned int ivm3 = 0; ivm3 < nvm3; ivm3++) {
497 memories <<
"StubPairsDisplaced: "
508 <<
" [12]" << std::endl;
510 modules <<
"TripletEngine: " <<
TREName(layerdisk1, ireg1, layerdisk2, ireg2, iSeed, count)
524 <<
TEDName(layerdisk1, ireg1, ireg1 * nvm1 + ivm1, layerdisk2, ireg2, ireg2 * nvm2 + ivm2, iSeed)
525 <<
".stubpairout output=> " <<
TREName(layerdisk1, ireg1, layerdisk2, ireg2, iSeed, count)
528 <<
"in" << std::endl;
536 unsigned int nTC = 10;
537 for (
unsigned int itc = 0; itc < nTC; itc++) {
538 for (
int iproj = 0; iproj < 4; iproj++) {
542 for (
unsigned int ireg = 0; ireg < nallstub; ireg++) {
543 memories <<
"TrackletProjections: " <<
TPROJName(layerdisk1, layerdisk2, layerdisk3, itc, ilay - 1, ireg)
544 <<
" [54]" << std::endl;
551 for (
unsigned int ireg = 0; ireg < nallstub; ireg++) {
552 memories <<
"TrackletProjections: " <<
TPROJName(layerdisk1, layerdisk2, layerdisk3, itc, idisk + 5, ireg)
553 <<
" [54]" << std::endl;
555 wires <<
TPROJName(layerdisk1, layerdisk2, layerdisk3, itc, idisk + 5, ireg) <<
" input=> "
556 <<
TCDName(layerdisk1, layerdisk2, layerdisk3, itc) <<
".projout" <<
LayerName(idisk + 1) <<
"PHI"
557 <<
iTCStr(ireg) <<
" output=> "
558 <<
"PR_" <<
LayerName(idisk + 1) <<
"PHI" <<
iTCStr(ireg) <<
".projin" << std::endl;
563 memories <<
"TrackletParameters: " <<
TParName(layerdisk1, layerdisk2, layerdisk3, itc) <<
" [56]" << std::endl;
565 modules <<
"TrackletCalculatorDisplaced: " <<
TCDName(layerdisk1, layerdisk2, layerdisk3, itc) << std::endl;
568 unsigned int nST = stubTriplets[iSeed].size();
569 for (
unsigned int iST = 0; iST < nST; iST++) {
570 unsigned int iTC = (iST * nTC) / nST;
572 string stname = stubTriplets[iSeed][iST];
573 string trename =
"TRE_" + stname.substr(3, 6) +
"_";
574 unsigned int stlen = stname.size();
575 if (stname[stlen - 2] ==
'_')
576 trename += stname.substr(stlen - 1, 1);
577 if (stname[stlen - 3] ==
'_')
578 trename += stname.substr(stlen - 2, 2);
579 wires << stname <<
" input=> " << trename <<
".stubtripout output=> "
580 <<
TCDName(layerdisk1, layerdisk2, layerdisk3, iTC) <<
".stubtriplet" << ((iST * nTC) % nST) <<
"in"
584 modules <<
"FitTrack: " <<
FTName(layerdisk1, layerdisk2, layerdisk3) << std::endl;
592 for (
unsigned int ilayer = 0; ilayer <
N_LAYER +
N_DISK; ilayer++) {
593 for (
unsigned int iReg = 0; iReg <
NRegions_[ilayer]; iReg++) {
594 memories <<
"AllProj: AP_" <<
LayerName(ilayer) <<
"PHI" <<
iTCStr(iReg) <<
" [56]" << std::endl;
595 modules <<
"ProjectionRouter: PR_" <<
LayerName(ilayer) <<
"PHI" <<
iTCStr(iReg) << std::endl;
598 <<
iTCStr(iReg) <<
".allprojout output=> MC_" <<
LayerName(ilayer) <<
"PHI" <<
iTCStr(iReg) <<
".allprojin"
608 for (
unsigned int ilayer = 0; ilayer <
N_LAYER +
N_DISK; ilayer++) {
609 for (
unsigned int iME = 0; iME <
NVMME_[ilayer] *
NRegions_[ilayer]; iME++) {
610 memories <<
"CandidateMatch: CM_" <<
LayerName(ilayer) <<
"PHI" <<
iTCStr(iME /
NVMME_[ilayer]) << iME + 1
611 <<
" [12]" << std::endl;
612 modules <<
"MatchEngine: ME_" <<
LayerName(ilayer) <<
"PHI" <<
iTCStr(iME /
NVMME_[ilayer]) << iME + 1
615 os <<
"CM_" <<
LayerName(ilayer) <<
"PHI" <<
iTCStr(iME /
NVMME_[ilayer]) << iME + 1 <<
" input=> ME_"
626 for (
unsigned int ilayer = 0; ilayer <
N_LAYER +
N_DISK; ilayer++) {
627 for (
unsigned int iME = 0; iME <
NVMME_[ilayer] *
NRegions_[ilayer]; iME++) {
628 memories <<
"VMProjections: VMPROJ_" <<
LayerName(ilayer) <<
"PHI" <<
iTCStr(iME /
NVMME_[ilayer]) << iME + 1
629 <<
" [13]" << std::endl;
631 os <<
"VMPROJ_" <<
LayerName(ilayer) <<
"PHI" <<
iTCStr(iME /
NVMME_[ilayer]) << iME + 1 <<
" input=> PR_"
634 <<
iTCStr(iME /
NVMME_[ilayer]) << iME + 1 <<
".vmprojin" << std::endl;
641 for (
unsigned int ilayer = 0; ilayer <
N_LAYER +
N_DISK; ilayer++) {
642 for (
unsigned int iReg = 0; iReg <
NRegions_[ilayer]; iReg++) {
643 modules <<
"MatchProcessor: MP_" <<
LayerName(ilayer) <<
"PHI" <<
iTCStr(iReg) << std::endl;
644 for (
unsigned int iSeed = 0; iSeed <
N_SEED_PROMPT; iSeed++) {
648 <<
" [36]" << std::endl;
651 <<
".fullmatch" <<
matchport_[iSeed][ilayer] <<
"in" << iReg + 1 << std::endl;
656 for (
unsigned int ilayer = 0; ilayer <
N_LAYER +
N_DISK; ilayer++) {
657 for (
unsigned int iReg = 0; iReg <
NRegions_[ilayer]; iReg++) {
658 modules <<
"MatchCalculator: MC_" <<
LayerName(ilayer) <<
"PHI" <<
iTCStr(iReg) << std::endl;
659 for (
unsigned int iSeed = 0; iSeed <
N_SEED_PROMPT; iSeed++) {
663 <<
" [36]" << std::endl;
666 <<
".fullmatch" <<
matchport_[iSeed][ilayer] <<
"in" << iReg + 1 << std::endl;
676 for (
unsigned int ilayer = 0; ilayer <
N_LAYER +
N_DISK; ilayer++) {
677 for (
unsigned int iReg = 0; iReg <
NRegions_[ilayer]; iReg++) {
678 memories <<
"AllStubs: AS_" <<
LayerName(ilayer) <<
"PHI" <<
iTCStr(iReg) <<
"n1"
679 <<
" [42]" << std::endl;
681 modules <<
"VMRouterCM: VMR_" <<
LayerName(ilayer) <<
"PHI" <<
iTCStr(iReg) << std::endl;
683 modules <<
"VMRouter: VMR_" <<
LayerName(ilayer) <<
"PHI" <<
iTCStr(iReg) << std::endl;
686 <<
" input=> VMR_" <<
LayerName(ilayer) <<
"PHI" <<
iTCStr(iReg) <<
".allstubout output=> MP_"
687 <<
LayerName(ilayer) <<
"PHI" <<
iTCStr(iReg) <<
".allstubin" << std::endl;
692 for (
unsigned int ilayer = 0; ilayer <
N_LAYER +
N_DISK; ilayer++) {
693 for (
int iReg = 0; iReg < (int)
NRegions_[ilayer]; iReg++) {
694 unsigned int nmem = 1;
696 for (
unsigned int iSeed = 0; iSeed <
N_SEED_PROMPT; iSeed++) {
700 if (ilayer != l1 && ilayer != l2)
703 bool inner = ilayer == l1;
705 for (
unsigned int iTC = 0; iTC <
TC_[iSeed].size(); iTC++) {
708 int iTCReg = iTC / nTCReg;
710 int jTCReg = iTC % nTCReg;
721 int min = iTCReg * ratio - 1 + jTCReg;
722 int max = (iTCReg + 1) * ratio - (nTCReg - jTCReg - 1);
723 if ((
int)iReg < min || (int)iReg >
max)
726 if (max - min >= 2) {
734 if (max - min == 1) {
780 }
else if (iSeed > 5) {
788 memories <<
"AllInnerStubs: ";
790 memories <<
"AllStubs: ";
792 memories <<
"AS_" <<
LayerName(ilayer) <<
"PHI" <<
iTCStr(iReg) << ext <<
" [42]" << std::endl;
794 <<
"PHI" <<
iTCStr(iReg) <<
".all" << (inner ?
"inner" :
"") <<
"stubout output=> TP_" <<
iSeedStr(iSeed)
797 os <<
".innerallstubin" << std::endl;
799 os <<
".outerallstubin" << std::endl;
807 for (
unsigned int ilayer = 0; ilayer <
N_LAYER +
N_DISK; ilayer++) {
808 for (
unsigned int iReg = 0; iReg <
NRegions_[ilayer]; iReg++) {
809 memories <<
"AllStubs: AS_" <<
LayerName(ilayer) <<
"PHI" <<
iTCStr(iReg) <<
"n1"
810 <<
" [42]" << std::endl;
812 modules <<
"VMRouterCM: VMR_" <<
LayerName(ilayer) <<
"PHI" <<
iTCStr(iReg) << std::endl;
814 modules <<
"VMRouter: VMR_" <<
LayerName(ilayer) <<
"PHI" <<
iTCStr(iReg) << std::endl;
817 <<
" input=> VMR_" <<
LayerName(ilayer) <<
"PHI" <<
iTCStr(iReg) <<
".allstubout output=> MC_"
818 <<
LayerName(ilayer) <<
"PHI" <<
iTCStr(iReg) <<
".allstubin" << std::endl;
823 for (
unsigned int ilayer = 0; ilayer <
N_LAYER +
N_DISK; ilayer++) {
824 for (
unsigned int iReg = 0; iReg <
NRegions_[ilayer]; iReg++) {
825 unsigned int nmem = 1;
827 for (
unsigned int iSeed = 0; iSeed <
N_SEED_PROMPT; iSeed++) {
831 if (ilayer != l1 && ilayer != l2)
834 for (
unsigned int iTC = 0; iTC <
TC_[iSeed].size(); iTC++) {
836 for (
unsigned int iTE = 0; iTE <
TC_[iSeed][iTC].size(); iTE++) {
837 unsigned int theTE =
TC_[iSeed][iTC][iTE];
839 unsigned int TE1 =
TE_[iSeed][theTE].first;
840 unsigned int TE2 =
TE_[iSeed][theTE].second;
842 if (l1 == ilayer && iReg == TE1 /
NVMTE_[iSeed].
first)
850 memories <<
"AllStubs: AS_" <<
LayerName(ilayer) <<
"PHI" <<
iTCStr(iReg) <<
"n" << nmem <<
" [42]"
852 os <<
"AS_" <<
LayerName(ilayer) <<
"PHI" <<
iTCStr(iReg) <<
"n" << nmem <<
" input=> VMR_"
856 os <<
".innerallstubin" << std::endl;
858 os <<
".outerallstubin" << std::endl;
871 for (
unsigned int ilayer = 0; ilayer <
N_LAYER +
N_DISK; ilayer++) {
872 for (
unsigned int iReg = 0; iReg <
NRegions_[ilayer]; iReg++) {
873 memories <<
"VMStubsME: VMSME_" <<
LayerName(ilayer) <<
"PHI" <<
iTCStr(iReg) <<
"n1 [18]" << std::endl;
876 <<
" output=> MP_" <<
LayerName(ilayer) <<
"PHI" <<
iTCStr(iReg) <<
".vmstubin" << std::endl;
881 for (
unsigned int iSeed = 0; iSeed <
N_SEED_PROMPT; iSeed++) {
886 unsigned int ilayer =
seedLayers(iSeed).second;
890 unsigned int nTCReg =
TC_[iSeed].size() /
NRegions_[l2];
892 for (
unsigned int iReg = 0; iReg <
NRegions_[l2]; iReg++) {
893 unsigned int nmem = 0;
899 for (
unsigned iTC = 0; iTC < nTCReg; iTC++) {
901 memories <<
"VMStubsTE: VMSTE_" <<
LayerName(ilayer) <<
"PHI" <<
iRegStr(iReg, iSeed) <<
"n" << nmem
902 <<
" [18]" << std::endl;
903 os <<
"VMSTE_" <<
LayerName(ilayer) <<
"PHI" <<
iRegStr(iReg, iSeed) <<
"n" << nmem <<
" input=> VMR_"
904 <<
LayerName(ilayer) <<
"PHI" <<
iTCStr(iReg) <<
".vmstubout_seed_" << iSeed <<
" output=> TP_"
911 for (
unsigned int ilayer = 0; ilayer <
N_LAYER +
N_DISK; ilayer++) {
912 for (
unsigned int iVMME = 0; iVMME <
NVMME_[ilayer] *
NRegions_[ilayer]; iVMME++) {
913 unsigned int iReg = iVMME /
NVMME_[ilayer];
914 memories <<
"VMStubsME: VMSME_" <<
LayerName(ilayer) <<
"PHI" <<
iTCStr(iReg) << iVMME + 1 <<
"n1 [18]"
916 os <<
"VMSME_" <<
LayerName(ilayer) <<
"PHI" <<
iTCStr(iReg) << iVMME + 1 <<
"n1"
917 <<
" input=> VMR_" <<
LayerName(ilayer) <<
"PHI" <<
iTCStr(iReg) <<
".vmstuboutMEPHI" <<
iTCStr(iReg)
918 << iVMME + 1 <<
" output=> ME_" <<
LayerName(ilayer) <<
"PHI" <<
iTCStr(iReg) << iVMME + 1 <<
".vmstubin"
924 for (
unsigned int iSeed = 0; iSeed <
N_SEED_PROMPT; iSeed++) {
925 for (
unsigned int innerouterseed = 0; innerouterseed < 2; innerouterseed++) {
930 unsigned int NVMTE1 =
NVMTE_[iSeed].first;
931 unsigned int NVMTE2 =
NVMTE_[iSeed].second;
933 unsigned int ilayer =
seedLayers(iSeed).first;
934 unsigned int NVMTE =
NVMTE_[iSeed].first;
935 if (innerouterseed == 1) {
937 NVMTE =
NVMTE_[iSeed].second;
940 for (
unsigned int iVMTE = 0; iVMTE < NVMTE *
NRegions_[ilayer]; iVMTE++) {
941 unsigned int iReg = iVMTE / NVMTE;
943 unsigned int nmem = 0;
949 for (
unsigned int iTE = 0; iTE <
TE_[iSeed].size(); iTE++) {
950 unsigned int TE1 =
TE_[iSeed][iTE].first;
951 unsigned int TE2 =
TE_[iSeed][iTE].second;
955 if (innerouterseed == 0 && iVMTE == TE1)
957 if (innerouterseed == 1 && iVMTE == TE2)
963 string inorout =
"I";
964 if (innerouterseed == 1)
968 memories <<
"VMStubsTE: VMSTE_" <<
LayerName(ilayer) <<
"PHI" <<
iRegStr(iReg, iSeed) << iVMTE + 1 <<
"n"
969 << nmem <<
" [18]" << std::endl;
970 os <<
"VMSTE_" <<
LayerName(ilayer) <<
"PHI" <<
iRegStr(iReg, iSeed) << iVMTE + 1 <<
"n" << nmem
971 <<
" input=> VMR_" <<
LayerName(ilayer) <<
"PHI" <<
iTCStr(iReg) <<
".vmstuboutTE" << inorout <<
"PHI"
972 <<
iRegStr(iReg, iSeed) << iVMTE + 1 <<
" output=> TE_" <<
LayerName(l1) <<
"PHI"
974 <<
iRegStr(TE2 / NVMTE2, iSeed) << TE2 + 1;
975 if (innerouterseed == 0) {
976 os <<
".innervmstubin" << std::endl;
978 os <<
".outervmstubin" << std::endl;
989 for (
unsigned int iSeed = 0; iSeed <
N_SEED_PROMPT; iSeed++) {
990 for (
unsigned int iTP = 0; iTP <
TC_[iSeed].size(); iTP++) {
991 memories <<
"TrackletParameters: TPAR_" <<
iSeedStr(iSeed) <<
iTCStr(iTP) <<
" [56]" << std::endl;
992 modules <<
"TrackletProcessor: TP_" <<
iSeedStr(iSeed) <<
iTCStr(iTP) << std::endl;
994 <<
".trackpar output=> FT_" <<
iSeedStr(iSeed) <<
".tparin" << std::endl;
998 for (
unsigned int iSeed = 0; iSeed <
N_SEED_PROMPT; iSeed++) {
999 for (
unsigned int iTC = 0; iTC <
TC_[iSeed].size(); iTC++) {
1000 memories <<
"TrackletParameters: TPAR_" <<
iSeedStr(iSeed) <<
iTCStr(iTC) <<
" [56]" << std::endl;
1001 modules <<
"TrackletCalculator: TC_" <<
iSeedStr(iSeed) <<
iTCStr(iTC) << std::endl;
1003 <<
".trackpar output=> FT_" <<
iSeedStr(iSeed) <<
".tparin" << std::endl;
1010 for (
unsigned int iSeed = 0; iSeed <
N_SEED_PROMPT; iSeed++) {
1011 memories <<
"TrackFit: TF_" <<
iSeedStr(iSeed) <<
" [126]" << std::endl;
1012 modules <<
"FitTrack: FT_" <<
iSeedStr(iSeed) << std::endl;
1013 os <<
"TF_" <<
iSeedStr(iSeed) <<
" input=> FT_" <<
iSeedStr(iSeed) <<
".trackout output=> PD.trackin" << std::endl;
1018 modules <<
"PurgeDuplicate: PD" << std::endl;
1020 for (
unsigned int iSeed = 0; iSeed <
N_SEED_PROMPT; iSeed++) {
1021 memories <<
"CleanTrack: CT_" <<
iSeedStr(iSeed) <<
" [126]" << std::endl;
1022 os <<
"CT_" <<
iSeedStr(iSeed) <<
" input=> PD.trackout output=>" << std::endl;
1029 unsigned int layerdisk[52];
1033 dtcname[0] =
"PS10G_1";
1035 phimin[0] = 0.304273;
1036 phimax[0] = 0.742925;
1037 dtcname[1] =
"PS10G_1";
1039 phimin[1] = -0.185672;
1040 phimax[1] = 0.883803;
1041 dtcname[2] =
"PS10G_1";
1043 phimin[2] = -0.132414;
1044 phimax[2] = 0.830545;
1045 dtcname[3] =
"PS10G_1";
1047 phimin[3] = -0.132414;
1048 phimax[3] = 0.830545;
1049 dtcname[4] =
"PS10G_2";
1051 phimin[4] = -0.0133719;
1052 phimax[4] = 0.715599;
1053 dtcname[5] =
"PS10G_2";
1055 phimin[5] = -0.110089;
1056 phimax[5] = 0.808221;
1057 dtcname[6] =
"PS10G_2";
1059 phimin[6] = -0.132414;
1060 phimax[6] = 0.830545;
1061 dtcname[7] =
"PS10G_3";
1063 phimin[7] = -0.11381;
1064 phimax[7] = 0.822812;
1065 dtcname[8] =
"PS10G_3";
1067 phimin[8] = -0.185672;
1068 phimax[8] = 0.883803;
1069 dtcname[9] =
"PS10G_4";
1071 phimin[9] = -0.0823971;
1072 phimax[9] = 0.780529;
1073 dtcname[10] =
"PS10G_4";
1075 phimin[10] = -0.0963091;
1076 phimax[10] = 0.794441;
1077 dtcname[11] =
"PS10G_4";
1079 phimin[11] = -0.0963091;
1080 phimax[11] = 0.794441;
1081 dtcname[12] =
"PS_1";
1083 phimin[12] = 0.0827748;
1084 phimax[12] = 0.615357;
1085 dtcname[13] =
"PS_1";
1087 phimin[13] = -0.0823971;
1088 phimax[13] = 0.780529;
1089 dtcname[14] =
"PS_2";
1091 phimin[14] = -0.0917521;
1092 phimax[14] = 0.614191;
1093 dtcname[15] =
"PS_2";
1095 phimin[15] = -0.0963091;
1096 phimax[15] = 0.794441;
1097 dtcname[16] =
"2S_1";
1099 phimin[16] = -0.0246209;
1100 phimax[16] = 0.763311;
1101 dtcname[17] =
"2S_1";
1103 phimin[17] = 0.261875;
1104 phimax[17] = 0.403311;
1105 dtcname[18] =
"2S_2";
1107 phimin[18] = -0.0542445;
1108 phimax[18] = 0.715509;
1109 dtcname[19] =
"2S_3";
1111 phimin[19] = 0.0410126;
1112 phimax[19] = 0.730605;
1113 dtcname[20] =
"2S_4";
1115 phimin[20] = -0.0428961;
1116 phimax[20] = 0.693862;
1117 dtcname[21] =
"2S_4";
1119 phimin[21] = -0.0676705;
1120 phimax[21] = 0.765802;
1121 dtcname[22] =
"2S_5";
1123 phimin[22] = -0.0648206;
1124 phimax[22] = 0.762952;
1125 dtcname[23] =
"2S_5";
1127 phimin[23] = -0.0676705;
1128 phimax[23] = 0.765802;
1129 dtcname[24] =
"2S_6";
1131 phimin[24] = -0.0648206;
1132 phimax[24] = 0.762952;
1133 dtcname[25] =
"2S_6";
1135 phimin[25] = -0.0676705;
1136 phimax[25] = 0.765802;
1137 dtcname[26] =
"negPS10G_1";
1139 phimin[26] = -0.023281;
1140 phimax[26] = 0.372347;
1141 dtcname[27] =
"negPS10G_1";
1143 phimin[27] = -0.185672;
1144 phimax[27] = 0.883803;
1145 dtcname[28] =
"negPS10G_1";
1147 phimin[28] = -0.132414;
1148 phimax[28] = 0.830545;
1149 dtcname[29] =
"negPS10G_1";
1151 phimin[29] = -0.132414;
1152 phimax[29] = 0.830545;
1153 dtcname[30] =
"negPS10G_2";
1155 phimin[30] = -0.0133719;
1156 phimax[30] = 0.715599;
1157 dtcname[31] =
"negPS10G_2";
1159 phimin[31] = -0.110089;
1160 phimax[31] = 0.808221;
1161 dtcname[32] =
"negPS10G_2";
1163 phimin[32] = -0.132414;
1164 phimax[32] = 0.830545;
1165 dtcname[33] =
"negPS10G_3";
1167 phimin[33] = -0.115834;
1168 phimax[33] = 0.813823;
1169 dtcname[34] =
"negPS10G_3";
1171 phimin[34] = -0.185672;
1172 phimax[34] = 0.883803;
1173 dtcname[35] =
"negPS10G_4";
1175 phimin[35] = -0.0823971;
1176 phimax[35] = 0.780529;
1177 dtcname[36] =
"negPS10G_4";
1179 phimin[36] = -0.0963091;
1180 phimax[36] = 0.794441;
1181 dtcname[37] =
"negPS10G_4";
1183 phimin[37] = -0.0963091;
1184 phimax[37] = 0.794441;
1185 dtcname[38] =
"negPS_1";
1187 phimin[38] = -0.0961318;
1188 phimax[38] = 0.445198;
1189 dtcname[39] =
"negPS_1";
1191 phimin[39] = -0.0823971;
1192 phimax[39] = 0.780529;
1193 dtcname[40] =
"negPS_2";
1195 phimin[40] = -0.0917521;
1196 phimax[40] = 0.614191;
1197 dtcname[41] =
"negPS_2";
1199 phimin[41] = -0.0963091;
1200 phimax[41] = 0.794441;
1201 dtcname[42] =
"neg2S_1";
1203 phimin[42] = -0.0246209;
1204 phimax[42] = 0.763311;
1205 dtcname[43] =
"neg2S_1";
1207 phimin[43] = 0.261875;
1208 phimax[43] = 0.403311;
1209 dtcname[44] =
"neg2S_2";
1211 phimin[44] = -0.0542445;
1212 phimax[44] = 0.715509;
1213 dtcname[45] =
"neg2S_3";
1215 phimin[45] = 0.0410126;
1216 phimax[45] = 0.730605;
1217 dtcname[46] =
"neg2S_4";
1219 phimin[46] = -0.0428961;
1220 phimax[46] = 0.693862;
1221 dtcname[47] =
"neg2S_4";
1223 phimin[47] = -0.06767;
1224 phimax[47] = 0.765802;
1225 dtcname[48] =
"neg2S_5";
1227 phimin[48] = -0.0648201;
1228 phimax[48] = 0.762952;
1229 dtcname[49] =
"neg2S_5";
1231 phimin[49] = -0.06767;
1232 phimax[49] = 0.765802;
1233 dtcname[50] =
"neg2S_6";
1235 phimin[50] = -0.0648201;
1236 phimax[50] = 0.762952;
1237 dtcname[51] =
"neg2S_6";
1239 phimin[51] = -0.06767;
1240 phimax[51] = 0.765802;
1245 for (
unsigned int i = 0;
i < 52;
i++) {
1246 if (olddtc != dtcname[
i]) {
1247 modules <<
"InputRouter: IR_" << dtcname[
i] <<
"_A" << std::endl;
1248 modules <<
"InputRouter: IR_" << dtcname[
i] <<
"_B" << std::endl;
1249 memories <<
"DTCLink: DL_" << dtcname[
i] <<
"_A [36]" << std::endl;
1250 memories <<
"DTCLink: DL_" << dtcname[
i] <<
"_B [36]" << std::endl;
1251 os <<
"DL_" << dtcname[
i] <<
"_A"
1252 <<
" input=> output=> IR_" << dtcname[
i] <<
"_A.stubin" << std::endl;
1253 os <<
"DL_" << dtcname[
i] <<
"_B"
1254 <<
" input=> output=> IR_" << dtcname[
i] <<
"_B.stubin" << std::endl;
1256 olddtc = dtcname[
i];
1259 for (
unsigned int i = 0;
i < 52;
i++) {
1260 double phimintmp = phimin[
i] + dphi;
1261 double phimaxtmp = phimax[
i] + dphi;
1263 for (
unsigned int iReg = 0; iReg <
NRegions_[layerdisk[
i]]; iReg++) {
1268 memories <<
"InputLink: IL_" <<
LayerName(layerdisk[
i]) <<
"PHI" <<
iTCStr(iReg) <<
"_" << dtcname[
i] <<
"_A"
1269 <<
" [36]" << std::endl;
1270 os <<
"IL_" <<
LayerName(layerdisk[i]) <<
"PHI" <<
iTCStr(iReg) <<
"_" << dtcname[
i] <<
"_A"
1271 <<
" input=> IR_" << dtcname[
i] <<
"_A.stubout output=> VMR_" <<
LayerName(layerdisk[i]) <<
"PHI"
1272 <<
iTCStr(iReg) <<
".stubin" << std::endl;
1276 memories <<
"InputLink: IL_" <<
LayerName(layerdisk[
i]) <<
"PHI" <<
iTCStr(iReg) <<
"_" << dtcname[
i] <<
"_B"
1277 <<
" [36]" << std::endl;
1278 os <<
"IL_" <<
LayerName(layerdisk[i]) <<
"PHI" <<
iTCStr(iReg) <<
"_" << dtcname[
i] <<
"_B"
1279 <<
" input=> IR_" << dtcname[
i] <<
"_B.stubout output=> VMR_" <<
LayerName(layerdisk[i]) <<
"PHI"
1280 <<
iTCStr(iReg) <<
".stubin" << std::endl;
double dphisectorHG() const
void writeProjectionMemories(std::ostream &os, std::ostream &memories, std::ostream &modules)
std::vector< std::vector< std::pair< unsigned int, unsigned int > > > projections_[N_LAYER+N_DISK]
std::string SPName(unsigned int l1, unsigned int ireg1, unsigned int ivm1, unsigned int l2, unsigned int ireg2, unsigned int ivm2, unsigned int iseed)
unsigned int projlayers(unsigned int iSeed, unsigned int i) const
std::string iTCStr(unsigned int iTC)
static std::string numStr(unsigned int i)
std::string TParName(unsigned int l1, unsigned int l2, unsigned int l3, unsigned int itc)
constexpr unsigned int N_SEED
std::string TEDName(unsigned int l1, unsigned int ireg1, unsigned int ivm1, unsigned int l2, unsigned int ireg2, unsigned int ivm2, unsigned int iseed)
void writeAll(std::ostream &wires, std::ostream &memories, std::ostream &modules)
Sin< T >::type sin(const T &t)
unsigned int nvmme(unsigned int layerdisk) const
static std::string LayerName(unsigned int ilayer)
void writeASMemories(std::ostream &os, std::ostream &memories, std::ostream &modules)
std::string TEName(unsigned int l1, unsigned int ireg1, unsigned int ivm1, unsigned int l2, unsigned int ireg2, unsigned int ivm2, unsigned int iseed)
unsigned int projdisks(unsigned int iSeed, unsigned int i) const
void writeILMemories(std::ostream &os, std::ostream &memories, std::ostream &modules)
void writeFMMemories(std::ostream &os, std::ostream &memories, std::ostream &modules)
std::vector< std::pair< double, double > > VMStubsME_[N_LAYER+N_DISK]
std::vector< std::pair< unsigned int, unsigned int > > TE_[N_SEED_PROMPT]
std::string TPROJName(unsigned int iSeed, unsigned int iTC, unsigned int ilayer, unsigned int ireg)
std::string STName(unsigned int l1, unsigned int ireg1, unsigned int l2, unsigned int ireg2, unsigned int l3, unsigned int ireg3, unsigned int iseed, unsigned int count)
std::string TCName(unsigned int iSeed, unsigned int iTC)
std::string TREName(unsigned int l1, unsigned int ireg1, unsigned int l2, unsigned int ireg2, unsigned int iseed, unsigned int count)
double rmean(unsigned int iLayer) const
U second(std::pair< T, U > const &p)
double zmean(unsigned int iDisk) const
unsigned int NTC_[N_SEED_PROMPT]
void writeTPARMemories(std::ostream &os, std::ostream &memories, std::ostream &modules)
std::string PRName(unsigned int ilayer, unsigned int ireg)
unsigned int nvmte(unsigned int inner, unsigned int iSeed) const
Cos< T >::type cos(const T &t)
std::vector< std::vector< unsigned int > > TC_[N_SEED_PROMPT]
unsigned int nallstubs(unsigned int layerdisk) const
const Settings & settings_
void writeSPMemories(std::ostream &os, std::ostream &memories, std::ostream &modules)
std::pair< std::vector< std::pair< double, double > >, std::vector< std::pair< double, double > > > VMStubsTE_[N_SEED_PROMPT]
constexpr unsigned int N_SECTOR
unsigned int NVMME_[N_LAYER+N_DISK]
double rinv(double r1, double phi1, double r2, double phi2)
std::pair< double, double > seedRadii(unsigned int iseed)
void writeCMMemories(std::ostream &os, std::ostream &memories, std::ostream &modules)
unsigned int seedlayers(int inner, int seed) const
unsigned int NRegions_[N_LAYER+N_DISK]
bool validTEPair(unsigned int iseed, unsigned int iTE1, unsigned int iTE2)
void writeVMPROJMemories(std::ostream &os, std::ostream &memories, std::ostream &modules)
std::string SPDName(unsigned int l1, unsigned int ireg1, unsigned int ivm1, unsigned int l2, unsigned int ireg2, unsigned int ivm2, unsigned int l3, unsigned int ireg3, unsigned int ivm3, unsigned int iseed)
void writeTFMemories(std::ostream &os, std::ostream &memories, std::ostream &modules)
std::string TCDName(unsigned int l1, unsigned int l2, unsigned int l3, unsigned int itc)
std::string iRegStr(unsigned int iReg, unsigned int iSeed)
std::string FTName(unsigned int l1, unsigned int l2, unsigned int l3)
std::vector< std::pair< double, double > > allStubs_[N_LAYER+N_DISK]
void writeCTMemories(std::ostream &os, std::ostream &memories, std::ostream &modules)
std::pair< unsigned int, unsigned int > seedLayers(unsigned int iSeed)
int matchport_[N_SEED_PROMPT][N_LAYER+N_DISK]
std::string TCNAme(unsigned int iseed, unsigned int iTC)
std::pair< double, double > seedPhiRange(double rproj, unsigned int iSeed, unsigned int iTC)
std::string iSeedStr(unsigned int iSeed)
void writeAPMemories(std::ostream &os, std::ostream &memories, std::ostream &modules)
void writeSPDMemories(std::ostream &os, std::ostream &memories, std::ostream &modules)
void writeVMSMemories(std::ostream &os, std::ostream &memories, std::ostream &modules)
double phi(double r1, double phi1, double r2, double phi2, double r)
constexpr unsigned int N_SEED_PROMPT
std::pair< unsigned int, unsigned int > NVMTE_[N_SEED_PROMPT]
unsigned int NTC(int seed) const