7 : verbose_(settings.getParameter<
bool>(
"verbose")),
9 initK_(settings.getParameter<
std::
vector<double> >(
"initialK")),
10 initK2_(settings.getParameter<
std::
vector<double> >(
"initialK2")),
11 eLoss_(settings.getParameter<
std::
vector<double> >(
"eLoss")),
12 aPhi_(settings.getParameter<
std::
vector<double> >(
"aPhi")),
13 aPhiB_(settings.getParameter<
std::
vector<double> >(
"aPhiB")),
14 aPhiBNLO_(settings.getParameter<
std::
vector<double> >(
"aPhiBNLO")),
15 bPhi_(settings.getParameter<
std::
vector<double> >(
"bPhi")),
16 bPhiB_(settings.getParameter<
std::
vector<double> >(
"bPhiB")),
17 phiAt2_(settings.getParameter<double>(
"phiAt2")),
19 chiSquare_(settings.getParameter<
std::
vector<double> >(
"chiSquare")),
20 chiSquareCutPattern_(settings.getParameter<
std::
vector<
int> >(
"chiSquareCutPattern")),
21 chiSquareCutCurv_(settings.getParameter<
std::
vector<
int> >(
"chiSquareCutCurvMax")),
22 chiSquareCut_(settings.getParameter<
std::
vector<
int> >(
"chiSquareCut")),
23 trackComp_(settings.getParameter<
std::
vector<double> >(
"trackComp")),
24 trackCompErr1_(settings.getParameter<
std::
vector<double> >(
"trackCompErr1")),
25 trackCompErr2_(settings.getParameter<
std::
vector<double> >(
"trackCompErr2")),
26 trackCompPattern_(settings.getParameter<
std::
vector<
int> >(
"trackCompCutPattern")),
27 trackCompCutCurv_(settings.getParameter<
std::
vector<
int> >(
"trackCompCutCurvMax")),
28 trackCompCut_(settings.getParameter<
std::
vector<
int> >(
"trackCompCut")),
29 chiSquareCutTight_(settings.getParameter<
std::
vector<
int> >(
"chiSquareCutTight")),
30 combos4_(settings.getParameter<
std::
vector<
int> >(
"combos4")),
31 combos3_(settings.getParameter<
std::
vector<
int> >(
"combos3")),
32 combos2_(settings.getParameter<
std::
vector<
int> >(
"combos2")),
33 combos1_(settings.getParameter<
std::
vector<
int> >(
"combos1")),
35 useOfflineAlgo_(settings.getParameter<
bool>(
"useOfflineAlgo")),
36 mScatteringPhi_(settings.getParameter<
std::
vector<double> >(
"mScatteringPhi")),
37 mScatteringPhiB_(settings.getParameter<
std::
vector<double> >(
"mScatteringPhiB")),
38 pointResolutionPhi_(settings.getParameter<double>(
"pointResolutionPhi")),
39 pointResolutionPhiB_(settings.getParameter<double>(
"pointResolutionPhiB")),
40 pointResolutionPhiBH_(settings.getParameter<
std::
vector<double> >(
"pointResolutionPhiBH")),
41 pointResolutionPhiBL_(settings.getParameter<
std::
vector<double> >(
"pointResolutionPhiBL")),
42 pointResolutionVertex_(settings.getParameter<double>(
"pointResolutionVertex"))
50 return std::make_pair(
true,
i);
52 return std::make_pair(
false, 0);
61 if (
track.curvatureAtVertex() == 0) {
64 }
else if (
track.curvatureAtVertex() > 0) {
95 int phi2 =
track.phiAtMuon() >> 2;
99 int processor =
track.sector();
113 muon.setHwPtUnconstrained(
pt2);
120 word1 = word1 |
HF << 22;
123 uint32_t word2 =
sign;
124 word2 = word2 | signValid << 1;
125 word2 = word2 |
dxy << 2;
126 word2 = word2 | trackAddr << 4;
128 word2 = word2 |
pt2 << 23;
129 muon.setDataword(word2, word1);
135 std::unique_ptr<l1t::RegionalMuonCandBxCollection>&
out) {
173 std::map<uint, uint> diffInfo;
174 for (
uint i = 0;
i < 12; ++
i) {
178 std::map<uint, uint> stubInfo;
180 int sector =
seed->scNum();
181 int previousSector = sector - 1;
182 int nextSector = sector + 1;
205 for (
const auto& stub : stubs) {
208 if (stub->stNum() !=
step)
214 if (stub->scNum() == previousSector) {
215 if (stub->whNum() ==
wheel) {
223 }
else if (stub->whNum() == innerWheel) {
232 }
else if (stub->scNum() == sector) {
233 if (stub->whNum() ==
wheel) {
241 }
else if (stub->whNum() == innerWheel) {
250 }
else if (stub->scNum() == nextSector) {
251 if (stub->whNum() ==
wheel) {
259 }
else if (stub->whNum() == innerWheel) {
262 stubInfo[10] =
N - 1;
265 stubInfo[11] =
N - 1;
286 if (diffInfo[s4] != 60000)
287 return std::make_pair(
true, stubInfo[s4]);
289 return std::make_pair(
false, 0);
294 return 8 * stub->phiB();
298 if (stub->scNum() == sector) {
300 }
else if ((stub->scNum() == sector - 1) || (stub->scNum() == 11 && sector == 0)) {
301 return stub->phi() - 2144;
302 }
else if ((stub->scNum() == sector + 1) || (stub->scNum() == 0 && sector == 11)) {
303 return stub->phi() + 2144;
309 unsigned int mask = 0;
310 for (
const auto& stub :
track.stubs()) {
311 mask = mask + round(
pow(2, stub->stNum() - 1));
317 return bit1 * 1 + bit2 * 2 + bit3 * 4 + bit4 * 8;
323 int K =
track.curvature();
325 int phiB =
track.bendingAngle();
346 int addr = KBound / 2;
348 addr = (-KBound) / 2;
352 printf(
"propagate to vertex K=%d deltaK=%d addr=%d\n", K, deltaK,
addr);
361 ap_fixed<BITSCURV, BITSCURV> phi11 = ap_fixed<BITSPARAM + 1, 2>(
aPhi_[
step - 1]) * ap_fixed<BITSCURV, BITSCURV>(K);
362 ap_fixed<BITSPHIB, BITSPHIB> phi12 =
363 ap_fixed<BITSPARAM + 1, 2>(-
bPhi_[
step - 1]) * ap_fixed<BITSPHIB, BITSPHIB>(phiB);
366 printf(
"phi prop = %d * %f = %d, %d * %f = %d\n",
368 ap_fixed<BITSPARAM + 1, 2>(
aPhi_[
step - 1]).to_float(),
371 ap_fixed<BITSPARAM + 1, 2>(-
bPhi_[
step - 1]).to_float(),
374 int phiNew = ap_fixed<BITSPHI, BITSPHI>(
phi + phi11 + phi12);
377 ap_fixed<BITSCURV, BITSCURV> phiB11 = ap_fixed<BITSPARAM, 1>(
aPhiB_[
step - 1]) * ap_fixed<BITSCURV, BITSCURV>(K);
378 ap_fixed<BITSPHIB + 1, BITSPHIB + 1> phiB12 =
379 ap_ufixed<BITSPARAM + 1, 1>(
bPhiB_[
step - 1]) * ap_fixed<BITSPHIB, BITSPHIB>(phiB);
380 int phiBNew = ap_fixed<13, 13>(phiB11 + phiB12);
382 printf(
"phiB prop = %d * %f = %d, %d * %f = %d\n",
384 ap_fixed<BITSPARAM + 1, 2>(
aPhiB_[
step - 1]).to_float(),
387 ap_ufixed<BITSPARAM + 1, 1>(
bPhiB_[
step - 1]).to_float(),
393 int addr = KBound / 2;
396 ap_fixed<12, 12> DXY;
401 phiBNew = ap_fixed<BITSPHIB, BITSPHIB>(DXY - ap_fixed<BITSPHIB, BITSPHIB>(phiB));
403 printf(
"Vertex phiB prop = %d - %d = %d\n", DXY.to_int(), ap_fixed<BITSPHIB, BITSPHIB>(phiB).to_int(), phiBNew);
427 ROOT::Math::SMatrix<double, 3>
P(
a, 9);
429 const std::vector<double>& covLine =
track.covariance();
431 cov = ROOT::Math::Similarity(
P, cov);
437 std::vector<double>
b(6);
450 printf(
"Covariance term for phiB = %f\n", cov(2, 2));
451 printf(
"Multiple scattering term for phiB = %f\n", MS(2, 2));
454 track.setCovariance(cov);
455 track.setCoordinates(
step - 1, KNew, phiNew, phiBNew);
461 if (mask == 3 || mask == 5 || mask == 9 || mask == 6 || mask == 10 || mask == 12)
471 int trackK =
track.curvature();
473 int trackPhiB =
track.bendingAngle();
480 residual[1] = phiB - trackPhiB;
494 if (stub->quality() < 4)
499 const std::vector<double>& covLine =
track.covariance();
508 track.step(), fabs(trackK),
Gain(0, 0),
Gain(0, 1),
Gain(1, 0),
Gain(1, 1),
Gain(2, 0),
Gain(2, 1));
510 int KNew = (trackK +
int(
Gain(0, 0) * residual(0) +
Gain(0, 1) * residual(1)));
511 if (fabs(KNew) > 8192)
515 int phiBNew =
wrapAround(trackPhiB +
int(
Gain(2, 0) * residual(0) +
Gain(2, 1) * residual(1)), 4096);
517 track.setResidual(stub->stNum() - 1, fabs(
phi - phiNew) + fabs(phiB - phiBNew) / 8);
520 printf(
"residual %d - %d = %d %d - %d = %d\n",
phi,
trackPhi,
int(residual[0]), phiB, trackPhiB,
int(residual[1]));
521 printf(
"Gains offline: %f %f %f %f\n",
Gain(0, 0),
Gain(0, 1),
Gain(2, 0),
Gain(2, 1));
522 printf(
" K = %d + %f * %f + %f * %f\n", trackK,
Gain(0, 0), residual(0),
Gain(0, 1), residual(1));
523 printf(
" phiB = %d + %f * %f + %f * %f\n", trackPhiB,
Gain(2, 0), residual(0),
Gain(2, 1), residual(1));
526 track.setCoordinates(
track.step(), KNew, phiNew, phiBNew);
530 c(0, 0) = covNew(0, 0);
531 c(0, 1) = covNew(0, 1);
532 c(0, 2) = covNew(0, 2);
533 c(1, 0) = covNew(1, 0);
534 c(1, 1) = covNew(1, 1);
535 c(1, 2) = covNew(1, 2);
536 c(2, 0) = covNew(2, 0);
537 c(2, 1) = covNew(2, 1);
538 c(2, 2) = covNew(2, 2);
540 printf(
"Post Fit Covariance Matrix %f %f %f\n", cov(0, 0), cov(1, 1), cov(2, 2));
551 int trackK =
track.curvature();
553 int trackPhiB =
track.bendingAngle();
560 printf(
"residuals %d - %d = %d\n",
phi,
trackPhi,
int(residual));
567 const std::vector<double>& covLine =
track.covariance();
576 track.setKalmanGain(
track.step(), fabs(trackK),
Gain(0, 0), 0.0,
Gain(1, 0), 0.0,
Gain(2, 0), 0.0);
578 printf(
"Gains: %f %f\n",
Gain(0, 0),
Gain(2, 0));
582 int phiBNew =
wrapAround(trackPhiB +
int(
Gain(2, 0) * residual), 4096);
583 track.setCoordinates(
track.step(), KNew, phiNew, phiBNew);
588 printf(
"phiUpdate: %d %d\n",
int(
Gain(0, 0) * residual),
int(
Gain(2, 0) * residual));
591 c(0, 0) = covNew(0, 0);
592 c(0, 1) = covNew(0, 1);
593 c(0, 2) = covNew(0, 2);
594 c(1, 0) = covNew(1, 0);
595 c(1, 1) = covNew(1, 1);
596 c(1, 2) = covNew(1, 2);
597 c(2, 0) = covNew(2, 0);
598 c(2, 1) = covNew(2, 1);
599 c(2, 2) = covNew(2, 2);
611 int trackK =
track.curvature();
613 int trackPhiB =
track.bendingAngle();
619 ap_fixed<BITSPHI + 1, BITSPHI + 1> residualPhi =
phi -
trackPhi;
620 ap_fixed<BITSPHIB + 1, BITSPHIB + 1> residualPhiB = phiB - trackPhiB;
623 printf(
"residual %d - %d = %d %d - %d = %d\n",
626 residualPhi.to_int(),
629 residualPhiB.to_int());
631 uint absK = fabs(trackK);
635 std::vector<float> GAIN;
637 if (!(mask == 3 || mask == 5 || mask == 9 || mask == 6 || mask == 10 || mask == 12)) {
646 printf(
"Gains (fp): %f %f %f %f\n", GAIN[0], GAIN[1], GAIN[2], GAIN[3]);
647 if (!(mask == 3 || mask == 5 || mask == 9 || mask == 6 || mask == 10 || mask == 12))
648 printf(
"Addr=%d gain0=%f gain4=-%f\n",
650 ap_ufixed<GAIN_0, GAIN_0INT>(GAIN[0]).to_float(),
651 ap_ufixed<GAIN_4, GAIN_4INT>(GAIN[2]).to_float());
653 printf(
"Addr=%d %f -%f %f %f\n",
655 ap_fixed<GAIN2_0, GAIN2_0INT>(GAIN[0]).to_float(),
656 ap_ufixed<GAIN2_1, GAIN2_1INT>(GAIN[1]).to_float(),
657 ap_ufixed<GAIN2_4, GAIN2_4INT>(GAIN[2]).to_float(),
658 ap_ufixed<GAIN2_5, GAIN2_5INT>(GAIN[3]).to_float());
661 track.setKalmanGain(
track.step(), fabs(trackK), GAIN[0], GAIN[1], 1, 0, GAIN[2], GAIN[3]);
664 if (!(mask == 3 || mask == 5 || mask == 9 || mask == 6 || mask == 10 || mask == 12)) {
665 KNew = ap_fixed<BITSPHI + 9, BITSPHI + 9>(ap_fixed<BITSCURV, BITSCURV>(trackK) +
666 ap_ufixed<GAIN_0, GAIN_0INT>(GAIN[0]) * residualPhi);
668 ap_fixed<BITSPHI + 7, BITSPHI + 7> k11 = ap_fixed<GAIN2_0, GAIN2_0INT>(GAIN[0]) * residualPhi;
669 ap_fixed<BITSPHIB + 4, BITSPHIB + 4> k12 = ap_ufixed<GAIN2_1, GAIN2_1INT>(GAIN[1]) * residualPhiB;
670 KNew = ap_fixed<BITSPHI + 9, BITSPHI + 9>(ap_fixed<BITSCURV, BITSCURV>(trackK) + k11 - k12);
672 if (fabs(KNew) >= 8191)
678 ap_fixed<BITSPHI + 5, BITSPHI + 5> pbdouble_0 = ap_ufixed<GAIN2_4, GAIN2_4INT>(GAIN[2]) * residualPhi;
679 ap_fixed<BITSPHIB + 24, BITSPHIB + 4> pb_1 = ap_ufixed<GAIN2_5, GAIN2_5INT>(GAIN[3]) * residualPhiB;
680 ap_fixed<BITSPHI + 9, BITSPHI + 5> pb_0 = ap_ufixed<GAIN_4, GAIN_4INT>(GAIN[2]) * residualPhi;
683 printf(
"phiupdate %f %f %f\n", pb_0.to_float(), pb_1.to_float(), pbdouble_0.to_float());
687 if (!(mask == 3 || mask == 5 || mask == 9 || mask == 6 || mask == 10 || mask == 12)) {
688 phiBNew = ap_fixed<BITSPHI + 8, BITSPHI + 8>(ap_fixed<BITSPHIB, BITSPHIB>(trackPhiB) -
689 ap_ufixed<GAIN_4, GAIN_4INT>(GAIN[2]) * residualPhi);
691 if (fabs(phiBNew) >= 4095)
694 phiBNew = ap_fixed<BITSPHI + 7, BITSPHI + 7>(ap_fixed<BITSPHIB, BITSPHIB>(trackPhiB) + pb_1 - pbdouble_0);
695 if (fabs(phiBNew) >= 4095)
698 track.setCoordinates(
track.step(), KNew, phiNew, phiBNew);
714 double residual = -
track.dxy();
720 const std::vector<double>& covLine =
track.covariance();
729 printf(
"sigma3=%f sigma6=%f\n", cov(0, 3), cov(3, 3));
730 printf(
" K = %d + %f * %f\n",
track.curvature(),
Gain(0, 0), residual);
737 printf(
"Post fit impact parameter=%d\n", dxyNew);
738 track.setCoordinatesAtVertex(KNew, phiNew, -residual);
741 c(0, 0) = covNew(0, 0);
742 c(0, 1) = covNew(0, 1);
743 c(0, 2) = covNew(0, 2);
744 c(1, 0) = covNew(1, 0);
745 c(1, 1) = covNew(1, 1);
746 c(1, 2) = covNew(1, 2);
747 c(2, 0) = covNew(2, 0);
748 c(2, 1) = covNew(2, 1);
749 c(2, 2) = covNew(2, 2);
755 double residual = -
track.dxy();
761 track.setKalmanGain(
track.step(), fabs(
track.curvature()), GAIN.first, GAIN.second, -1);
763 ap_fixed<BITSCURV, BITSCURV> k_0 =
764 -(ap_ufixed<GAIN_V0, GAIN_V0INT>(fabs(GAIN.first))) * ap_fixed<BITSPHIB, BITSPHIB>(residual);
765 int KNew = ap_fixed<BITSCURV, BITSCURV>(k_0 + ap_fixed<BITSCURV, BITSCURV>(
track.curvature()));
768 printf(
"VERTEX GAIN(%d)= -%f * %d = %d\n",
770 ap_ufixed<GAIN_V0, GAIN_V0INT>(fabs(GAIN.first)).to_float(),
771 ap_fixed<BITSPHIB, BITSPHIB>(residual).to_int(),
775 int p_0 =
fp_product(GAIN.second,
int(residual), 7);
777 track.setCoordinatesAtVertex(KNew, phiNew, -residual);
783 if (
track.hasFineEta())
784 etaINT =
track.fineEta();
786 etaINT =
track.coarseEta();
789 double lsbEta = 0.010875;
793 if (
track.curvatureAtVertex() < 0)
795 double pt = double(
ptLUT(
track.curvatureAtVertex())) / 2.0;
799 double eta = etaINT * lsbEta;
803 K =
track.curvatureAtMuon();
808 K = 46 * K / fabs(K);
809 double pt = 1.0 / (
lsb * fabs(K));
819 std::vector<int> combinatorics;
821 switch (
seed->stNum()) {
838 printf(
"Something really bad happend\n");
842 seedQual =
seed->quality();
843 for (
const auto& mask : combinatorics) {
850 charge = phiB / fabs(phiB);
853 if (
track.step() == 4 && (fabs(
seed->phiB()) > 15))
854 address =
charge * 15 * 8;
856 if (
track.step() == 3 && (fabs(
seed->phiB()) > 30))
857 address =
charge * 30 * 8;
858 if (
track.step() == 2 && (fabs(
seed->phiB()) > 127))
859 address =
charge * 127 * 8;
867 if (
seed->quality() < 4) {
875 float DK = 512 * 512.;
876 covariance(0, 0) = DK;
877 covariance(0, 1) = 0;
878 covariance(0, 2) = 0;
879 covariance(1, 0) = 0;
881 covariance(1, 2) = 0;
882 covariance(2, 0) = 0;
883 covariance(2, 1) = 0;
884 if (!(mask == 3 || mask == 5 || mask == 9 || mask == 6 || mask == 10 || mask == 12))
887 if (
seed->quality() < 4)
892 track.setCovariance(covariance);
896 printf(
"New Kalman fit staring at step=%d, phi=%d,phiB=%d with curvature=%d\n",
898 track.positionAngle(),
899 track.bendingAngle(),
902 for (
unsigned int i = 0;
i < 4; ++
i)
905 printf(
"------------------------------------------------------\n");
906 printf(
"------------------------------------------------------\n");
907 printf(
"------------------------------------------------------\n");
909 for (
const auto& stub : stubs)
910 printf(
"station=%d phi=%d phiB=%d qual=%d tag=%d sector=%d wheel=%d fineEta= %d %d\n",
920 printf(
"------------------------------------------------------\n");
921 printf(
"------------------------------------------------------\n");
924 int phiAtStation2 = 0;
926 while (
track.step() > 0) {
928 if (
track.step() == 1) {
940 printf(
"Unconstrained PT in Muon System: pt=%f\n",
track.ptUnconstrained());
945 printf(
"propagated Coordinates step:%d,phi=%d,phiB=%d,K=%d\n",
947 track.positionAngle(),
948 track.bendingAngle(),
951 if (
track.step() > 0)
953 std::pair<bool, uint> bestStub =
match(
seed, stubs,
track.step());
954 if ((!bestStub.first) || (!
update(
track, stubs[bestStub.second], mask, seedQual)))
957 printf(
"updated Coordinates step:%d,phi=%d,phiB=%d,K=%d\n",
959 track.positionAngle(),
960 track.bendingAngle(),
965 if (
track.step() == 0) {
968 printf(
" Coordinates before vertex constraint step:%d,phi=%d,dxy=%d,K=%d\n",
972 track.curvatureAtVertex());
974 printf(
"Chi Square = %d\n",
track.approxChi2());
979 printf(
" Coordinates after vertex constraint step:%d,phi=%d,dxy=%d,K=%d maximum local chi2=%d\n",
983 track.curvatureAtVertex(),
985 printf(
"------------------------------------------------------\n");
986 printf(
"------------------------------------------------------\n");
990 track.setCoordinatesAtMuon(
track.curvatureAtMuon(), phiAtStation2,
track.phiBAtMuon());
993 printf(
"Floating point coordinates at vertex: pt=%f, eta=%f phi=%f\n",
track.pt(),
track.eta(),
track.phi());
994 pretracks.push_back(
track);
1002 if (!cleaned.empty()) {
1003 return std::make_pair(
true, cleaned[0]);
1005 return std::make_pair(
false, nullTrack);
1011 int K =
track.curvatureAtMuon();
1019 for (
const auto& stub :
track.stubs()) {
1022 int diff1 =
wrapAround(stubCoords - coords, 1024);
1026 printf(
"Chi Square stub for track with pattern=%d coords=%d -> AK=%d stubCoords=%d diff=%d delta=%d\n",
1045 track.setApproxChi2(chi);
1055 int K =
track.curvatureAtVertex() >> 4;
1057 if (
track.stubs().size() != 2) {
1058 track.setTrackCompatibility(0);
1063 if (
track.stubs()[0]->quality() >
track.stubs()[1]->quality())
1068 printf(
"stubsel %d phi=%d phiB=%d\n", stubSel, stub->phi(), stub->phiB());
1077 ap_fixed<12, 12>
diff = ap_int<10>(stub->phiB()) -
1078 ap_ufixed<5, 1>(
trackComp_[stub->stNum() - 1]) * ap_fixed<BITSCURV - 4, BITSCURV - 4>(K);
1079 ap_ufixed<11, 11>
delta;
1092 printf(
"delta = %d = abs(%d - %f*%d\n",
delta.to_int(), stub->phiB(),
trackComp_[stub->stNum() - 1], K);
1093 printf(
"err = %d = %f + %f*%d\n",
1116 return 160 + (
track.stubs().size()) * 20 - chi;
1120 if (
value > maximum - 1)
1122 if (
value < -maximum)
1134 }
else if (sector == 1) {
1153 }
else if (sector == 1) {
1170 std::map<int, int>
out;
1173 if (
track.wheel() == -2)
1175 else if (
track.wheel() == -1)
1177 else if (
track.wheel() == 0)
1179 else if (
track.wheel() == 1)
1181 else if (
track.wheel() == 2)
1195 for (
const auto& stub :
track.stubs()) {
1196 bool ownwheel = stub->whNum() ==
track.wheel();
1198 if ((stub->scNum() ==
track.sector() + 1) || (stub->scNum() == 0 &&
track.sector() == 11))
1200 if ((stub->scNum() ==
track.sector() - 1) || (stub->scNum() == 11 &&
track.sector() == 0))
1202 int addr =
encode(ownwheel, sector, stub->tag());
1204 if (stub->stNum() == 4) {
1211 if (stub->stNum() == 3) {
1214 if (stub->stNum() == 2) {
1217 if (stub->stNum() == 1) {
1240 return (
long((
a * (1 << bits)) *
b)) >> bits;
1244 int charge = (K >= 0) ? +1 : -1;
1256 FK = .8569 * FK / (1.0 + 0.1144 * FK);
1258 FK = FK -
charge * 1.23e-03;
1278 std::map<uint, int> infoRank;
1279 std::map<uint, L1MuKBMTrack> infoTrack;
1280 for (
uint i = 3;
i <= 15; ++
i) {
1281 if (
i == 4 ||
i == 8)
1294 int sel6 = infoRank[10] >= infoRank[12] ? 10 : 12;
1295 int sel5 = infoRank[14] >= infoRank[9] ? 14 : 9;
1296 int sel4 = infoRank[11] >= infoRank[13] ? 11 : 13;
1297 int sel3 = infoRank[sel6] >= infoRank[sel5] ? sel6 : sel5;
1298 int sel2 = infoRank[sel4] >= infoRank[sel3] ? sel4 : sel3;
1299 selected = infoRank[15] >= infoRank[sel2] ? 15 : sel2;
1303 int sel2 = infoRank[5] >= infoRank[6] ? 5 : 6;
1304 selected = infoRank[7] >= infoRank[sel2] ? 7 : sel2;
1309 auto search = infoTrack.find(selected);
1310 if (
search != infoTrack.end())
1317 if (stub->qeta1() != 0 && stub->qeta2() != 0) {
1320 if (stub->qeta1() == 0) {
1324 return (stub->qeta1());
1336 for (
unsigned int i = 0;
i <
track.stubs().size(); ++
i) {
1337 if (fabs(
track.stubs()[
i]->whNum()) != awheel)
1338 mask = mask | (1 <<
i);
1340 mask = (awheel << nstubs) | mask;
1345 for (
const auto& stub :
track.stubs()) {
1351 sums +=
rank * stub->eta1();
1355 if (sumweights == 1)
1357 else if (sumweights == 2)
1359 else if (sumweights == 3)
1361 else if (sumweights == 4)
1363 else if (sumweights == 5)
1365 else if (sumweights == 6)
1385 for (
const auto& stub :
track.stubs())
1386 if (stub->stNum() == 2)
1389 ap_fixed<BITSPHI, BITSPHI>
phi =
track.phiAtMuon();
1390 ap_fixed<BITSPHIB, BITSPHIB> phiB =
track.phiBAtMuon();
1392 int phiNew = ap_fixed<BITSPHI + 1, BITSPHI + 1, AP_TRN_ZERO, AP_SAT>(
phi +
phiAt2 * phiB);
1395 printf(
"Phi at second station=%d\n", phiNew);