File indexing completed on 2024-11-15 23:40:41
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018 #include "L1Trigger/L1TMuonBarrel/src/L1MuBMTrackAssembler.h"
0019
0020
0021
0022
0023
0024 #include <iostream>
0025 #include <string>
0026
0027
0028
0029
0030
0031 #include "L1Trigger/L1TMuonBarrel/interface/L1MuBMTFConfig.h"
0032 #include "L1Trigger/L1TMuonBarrel/src/L1MuBMSectorProcessor.h"
0033 #include "L1Trigger/L1TMuonBarrel/src/L1MuBMExtrapolationUnit.h"
0034
0035 using namespace std;
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045 L1MuBMTrackAssembler::L1MuBMTrackAssembler(const L1MuBMSectorProcessor& sp) : m_sp(sp) {}
0046
0047
0048
0049
0050
0051 L1MuBMTrackAssembler::~L1MuBMTrackAssembler() {}
0052
0053
0054
0055
0056
0057
0058
0059
0060 void L1MuBMTrackAssembler::run() {
0061
0062
0063 bitset<12> b_adr12_8 = m_sp.EU().getQSTable(EX12, 0);
0064 bitset<12> b_adr12_9 = m_sp.EU().getQSTable(EX12, 1);
0065 bitset<12> b_adr13_8 = m_sp.EU().getQSTable(EX13, 0);
0066 bitset<12> b_adr13_9 = m_sp.EU().getQSTable(EX13, 1);
0067 bitset<12> b_adr14_8 = m_sp.EU().getQSTable(EX14, 0);
0068 bitset<12> b_adr14_9 = m_sp.EU().getQSTable(EX14, 1);
0069 bitset<12> b_adr23_8 = m_sp.EU().getQSTable(EX23, 0);
0070 bitset<12> b_adr23_9 = m_sp.EU().getQSTable(EX23, 1);
0071 bitset<12> b_adr23_0 = m_sp.EU().getQSTable(EX23, 2);
0072 bitset<12> b_adr23_1 = m_sp.EU().getQSTable(EX23, 3);
0073 bitset<12> b_adr24_8 = m_sp.EU().getQSTable(EX24, 0);
0074 bitset<12> b_adr24_9 = m_sp.EU().getQSTable(EX24, 1);
0075 bitset<12> b_adr24_0 = m_sp.EU().getQSTable(EX24, 2);
0076 bitset<12> b_adr24_1 = m_sp.EU().getQSTable(EX24, 3);
0077 bitset<12> b_adr34_8 = m_sp.EU().getQSTable(EX34, 0);
0078 bitset<12> b_adr34_9 = m_sp.EU().getQSTable(EX34, 1);
0079 bitset<12> b_adr34_0 = m_sp.EU().getQSTable(EX34, 2);
0080 bitset<12> b_adr34_1 = m_sp.EU().getQSTable(EX34, 3);
0081
0082
0083
0084 bitset<12> n_1234_888 = (b_adr14_8 & b_adr24_8 & b_adr34_8);
0085 bitset<12> n_1234_889 = (b_adr14_8 & b_adr24_8 & b_adr34_9);
0086 bitset<12> n_1234_880 = (b_adr14_8 & b_adr24_8 & b_adr34_0);
0087 bitset<12> n_1234_881 = (b_adr14_8 & b_adr24_8 & b_adr34_1);
0088 bitset<12> n_1234_898 = (b_adr14_8 & b_adr24_9 & b_adr34_8);
0089 bitset<12> n_1234_899 = (b_adr14_8 & b_adr24_9 & b_adr34_9);
0090 bitset<12> n_1234_890 = (b_adr14_8 & b_adr24_9 & b_adr34_0);
0091 bitset<12> n_1234_891 = (b_adr14_8 & b_adr24_9 & b_adr34_1);
0092 bitset<12> n_1234_800 = (b_adr14_8 & b_adr24_0 & b_adr34_0);
0093 bitset<12> n_1234_801 = (b_adr14_8 & b_adr24_0 & b_adr34_1);
0094 bitset<12> n_1234_810 = (b_adr14_8 & b_adr24_1 & b_adr34_0);
0095 bitset<12> n_1234_811 = (b_adr14_8 & b_adr24_1 & b_adr34_1);
0096
0097 bitset<12> n_1234_988 = (b_adr14_9 & b_adr24_8 & b_adr34_8);
0098 bitset<12> n_1234_989 = (b_adr14_9 & b_adr24_8 & b_adr34_9);
0099 bitset<12> n_1234_980 = (b_adr14_9 & b_adr24_8 & b_adr34_0);
0100 bitset<12> n_1234_981 = (b_adr14_9 & b_adr24_8 & b_adr34_1);
0101 bitset<12> n_1234_998 = (b_adr14_9 & b_adr24_9 & b_adr34_8);
0102 bitset<12> n_1234_999 = (b_adr14_9 & b_adr24_9 & b_adr34_9);
0103 bitset<12> n_1234_990 = (b_adr14_9 & b_adr24_9 & b_adr34_0);
0104 bitset<12> n_1234_991 = (b_adr14_9 & b_adr24_9 & b_adr34_1);
0105 bitset<12> n_1234_900 = (b_adr14_9 & b_adr24_0 & b_adr34_0);
0106 bitset<12> n_1234_901 = (b_adr14_9 & b_adr24_0 & b_adr34_1);
0107 bitset<12> n_1234_910 = (b_adr14_9 & b_adr24_1 & b_adr34_0);
0108 bitset<12> n_1234_911 = (b_adr14_9 & b_adr24_1 & b_adr34_1);
0109
0110 bitset<12> n_123_88 = (b_adr13_8 & b_adr23_8);
0111 bitset<12> n_123_89 = (b_adr13_8 & b_adr23_9);
0112 bitset<12> n_123_80 = (b_adr13_8 & b_adr23_0);
0113 bitset<12> n_123_81 = (b_adr13_8 & b_adr23_1);
0114
0115 bitset<12> n_123_98 = (b_adr13_9 & b_adr23_8);
0116 bitset<12> n_123_99 = (b_adr13_9 & b_adr23_9);
0117 bitset<12> n_123_90 = (b_adr13_9 & b_adr23_0);
0118 bitset<12> n_123_91 = (b_adr13_9 & b_adr23_1);
0119
0120 bitset<12> n_124_88 = (b_adr14_8 & b_adr24_8);
0121 bitset<12> n_124_89 = (b_adr14_8 & b_adr24_9);
0122 bitset<12> n_124_80 = (b_adr14_8 & b_adr24_0);
0123 bitset<12> n_124_81 = (b_adr14_8 & b_adr24_1);
0124
0125 bitset<12> n_124_98 = (b_adr14_9 & b_adr24_8);
0126 bitset<12> n_124_99 = (b_adr14_9 & b_adr24_9);
0127 bitset<12> n_124_90 = (b_adr14_9 & b_adr24_0);
0128 bitset<12> n_124_91 = (b_adr14_9 & b_adr24_1);
0129
0130 bitset<12> n_134_88 = (b_adr14_8 & b_adr34_8);
0131 bitset<12> n_134_89 = (b_adr14_8 & b_adr34_9);
0132 bitset<12> n_134_80 = (b_adr14_8 & b_adr34_0);
0133 bitset<12> n_134_81 = (b_adr14_8 & b_adr34_1);
0134
0135 bitset<12> n_134_98 = (b_adr14_9 & b_adr34_8);
0136 bitset<12> n_134_99 = (b_adr14_9 & b_adr34_9);
0137 bitset<12> n_134_90 = (b_adr14_9 & b_adr34_0);
0138 bitset<12> n_134_91 = (b_adr14_9 & b_adr34_1);
0139
0140 bitset<12> n_234_88 = (b_adr24_8 & b_adr34_8);
0141 bitset<12> n_234_89 = (b_adr24_8 & b_adr34_9);
0142 bitset<12> n_234_80 = (b_adr24_8 & b_adr34_0);
0143 bitset<12> n_234_81 = (b_adr24_8 & b_adr34_1);
0144
0145 bitset<12> n_234_98 = (b_adr24_9 & b_adr34_8);
0146 bitset<12> n_234_99 = (b_adr24_9 & b_adr34_9);
0147 bitset<12> n_234_90 = (b_adr24_9 & b_adr34_0);
0148 bitset<12> n_234_91 = (b_adr24_9 & b_adr34_1);
0149
0150 bitset<12> n_12_8 = b_adr12_8;
0151 bitset<12> n_12_9 = b_adr12_9;
0152
0153 bitset<12> n_13_8 = b_adr13_8;
0154 bitset<12> n_13_9 = b_adr13_9;
0155
0156 bitset<12> n_14_8 = b_adr14_8;
0157 bitset<12> n_14_9 = b_adr14_9;
0158
0159 bitset<12> n_23_8 = b_adr23_8;
0160 bitset<12> n_23_9 = b_adr23_9;
0161
0162 bitset<12> n_24_8 = b_adr24_8;
0163 bitset<12> n_24_9 = b_adr24_9;
0164
0165 bitset<12> n_34_8 = b_adr34_8;
0166 bitset<12> n_34_9 = b_adr34_9;
0167
0168
0169
0170 m_theLastAddress[67] = addressEncoder12(n_1234_888);
0171 m_theLastAddress[66] = addressEncoder12(n_1234_889);
0172 m_theLastAddress[65] = addressEncoder12(n_1234_880);
0173 m_theLastAddress[64] = addressEncoder12(n_1234_881);
0174
0175 m_theLastAddress[63] = addressEncoder12(n_1234_898);
0176 m_theLastAddress[62] = addressEncoder12(n_1234_899);
0177 m_theLastAddress[61] = addressEncoder12(n_1234_890);
0178 m_theLastAddress[60] = addressEncoder12(n_1234_891);
0179
0180 m_theLastAddress[59] = addressEncoder12(n_1234_800);
0181 m_theLastAddress[58] = addressEncoder12(n_1234_801);
0182 m_theLastAddress[57] = addressEncoder12(n_1234_810);
0183 m_theLastAddress[56] = addressEncoder12(n_1234_811);
0184
0185 m_theLastAddress[55] = addressEncoder12(n_1234_988);
0186 m_theLastAddress[54] = addressEncoder12(n_1234_989);
0187 m_theLastAddress[53] = addressEncoder12(n_1234_980);
0188 m_theLastAddress[52] = addressEncoder12(n_1234_981);
0189
0190 m_theLastAddress[51] = addressEncoder12(n_1234_998);
0191 m_theLastAddress[50] = addressEncoder12(n_1234_999);
0192 m_theLastAddress[49] = addressEncoder12(n_1234_990);
0193 m_theLastAddress[48] = addressEncoder12(n_1234_991);
0194
0195 m_theLastAddress[47] = addressEncoder12(n_1234_900);
0196 m_theLastAddress[46] = addressEncoder12(n_1234_901);
0197 m_theLastAddress[45] = addressEncoder12(n_1234_910);
0198 m_theLastAddress[44] = addressEncoder12(n_1234_911);
0199
0200 m_theLastAddress[43] = addressEncoder12(n_123_88);
0201 m_theLastAddress[42] = addressEncoder12(n_123_89);
0202 m_theLastAddress[41] = addressEncoder12(n_123_80);
0203 m_theLastAddress[40] = addressEncoder12(n_123_81);
0204
0205 m_theLastAddress[39] = addressEncoder12(n_123_98);
0206 m_theLastAddress[38] = addressEncoder12(n_123_99);
0207 m_theLastAddress[37] = addressEncoder12(n_123_90);
0208 m_theLastAddress[36] = addressEncoder12(n_123_91);
0209
0210 m_theLastAddress[35] = addressEncoder12(n_124_88);
0211 m_theLastAddress[34] = addressEncoder12(n_124_89);
0212 m_theLastAddress[33] = addressEncoder12(n_124_80);
0213 m_theLastAddress[32] = addressEncoder12(n_124_81);
0214
0215 m_theLastAddress[31] = addressEncoder12(n_124_98);
0216 m_theLastAddress[30] = addressEncoder12(n_124_99);
0217 m_theLastAddress[29] = addressEncoder12(n_124_90);
0218 m_theLastAddress[28] = addressEncoder12(n_124_91);
0219
0220 m_theLastAddress[27] = addressEncoder12(n_134_88);
0221 m_theLastAddress[26] = addressEncoder12(n_134_89);
0222 m_theLastAddress[25] = addressEncoder12(n_134_80);
0223 m_theLastAddress[24] = addressEncoder12(n_134_81);
0224
0225 m_theLastAddress[23] = addressEncoder12(n_134_98);
0226 m_theLastAddress[22] = addressEncoder12(n_134_99);
0227 m_theLastAddress[21] = addressEncoder12(n_134_90);
0228 m_theLastAddress[20] = addressEncoder12(n_134_91);
0229
0230 m_theLastAddress[19] = addressEncoder12(n_234_88);
0231 m_theLastAddress[18] = addressEncoder12(n_234_89);
0232 m_theLastAddress[17] = addressEncoder12(n_234_80);
0233 m_theLastAddress[16] = addressEncoder12(n_234_81);
0234
0235 m_theLastAddress[15] = addressEncoder12(n_234_98);
0236 m_theLastAddress[14] = addressEncoder12(n_234_99);
0237 m_theLastAddress[13] = addressEncoder12(n_234_90);
0238 m_theLastAddress[12] = addressEncoder12(n_234_91);
0239
0240 m_theLastAddress[11] = addressEncoder12(n_12_8);
0241 m_theLastAddress[10] = addressEncoder12(n_12_9);
0242
0243 m_theLastAddress[9] = addressEncoder12(n_13_8);
0244 m_theLastAddress[8] = addressEncoder12(n_13_9);
0245
0246 m_theLastAddress[7] = addressEncoder12(n_14_8);
0247 m_theLastAddress[6] = addressEncoder12(n_14_9);
0248
0249 m_theLastAddress[5] = addressEncoder12(n_23_8);
0250 m_theLastAddress[4] = addressEncoder12(n_23_9);
0251
0252 m_theLastAddress[3] = addressEncoder12(n_24_8);
0253 m_theLastAddress[2] = addressEncoder12(n_24_9);
0254
0255 m_theLastAddress[1] = addressEncoder12(n_34_8);
0256 m_theLastAddress[0] = addressEncoder12(n_34_9);
0257
0258 m_theLastAddressI[11] = addressEncoder12s(n_12_8);
0259 m_theLastAddressI[10] = addressEncoder12s(n_12_9);
0260 m_theLastAddressI[9] = addressEncoder12s(n_13_8);
0261 m_theLastAddressI[8] = addressEncoder12s(n_13_9);
0262 m_theLastAddressI[7] = addressEncoder12s(n_14_8);
0263 m_theLastAddressI[6] = addressEncoder12s(n_14_9);
0264 m_theLastAddressI[5] = addressEncoder12s(n_23_8);
0265 m_theLastAddressI[4] = addressEncoder12s(n_23_9);
0266 m_theLastAddressI[3] = addressEncoder12s(n_24_8);
0267 m_theLastAddressI[2] = addressEncoder12s(n_24_9);
0268 m_theLastAddressI[1] = addressEncoder12s(n_34_8);
0269 m_theLastAddressI[0] = addressEncoder12s(n_34_9);
0270
0271
0272
0273 m_thePriorityTable1[67] = (b_adr12_8[0] && b_adr13_8[0] && b_adr23_8[0] && n_1234_888.any());
0274 m_thePriorityTable1[66] = (b_adr12_8[0] && b_adr13_8[1] && b_adr23_8[1] && n_1234_889.any());
0275 m_thePriorityTable1[65] = (b_adr12_8[0] && b_adr13_8[2] && b_adr23_8[2] && n_1234_880.any());
0276 m_thePriorityTable1[64] = (b_adr12_8[0] && b_adr13_8[3] && b_adr23_8[3] && n_1234_881.any());
0277 m_thePriorityTable1[63] = (b_adr12_8[1] && b_adr13_8[0] && b_adr23_9[0] && n_1234_898.any());
0278 m_thePriorityTable1[62] = (b_adr12_8[1] && b_adr13_8[1] && b_adr23_9[1] && n_1234_899.any());
0279 m_thePriorityTable1[61] = (b_adr12_8[1] && b_adr13_8[2] && b_adr23_9[2] && n_1234_890.any());
0280 m_thePriorityTable1[60] = (b_adr12_8[1] && b_adr13_8[3] && b_adr23_9[3] && n_1234_891.any());
0281 m_thePriorityTable1[59] = (b_adr12_8[2] && b_adr13_8[2] && b_adr23_0[2] && n_1234_800.any());
0282 m_thePriorityTable1[58] = (b_adr12_8[2] && b_adr13_8[3] && b_adr23_0[3] && n_1234_801.any());
0283 m_thePriorityTable1[57] = (b_adr12_8[3] && b_adr13_8[2] && b_adr23_1[2] && n_1234_810.any());
0284 m_thePriorityTable1[56] = (b_adr12_8[3] && b_adr13_8[3] && b_adr23_1[3] && n_1234_811.any());
0285
0286 m_thePriorityTable1[55] = (b_adr12_9[0] && b_adr13_9[0] && b_adr23_8[0] && n_1234_988.any());
0287 m_thePriorityTable1[54] = (b_adr12_9[0] && b_adr13_9[1] && b_adr23_8[1] && n_1234_989.any());
0288 m_thePriorityTable1[53] = (b_adr12_9[0] && b_adr13_9[2] && b_adr23_8[2] && n_1234_980.any());
0289 m_thePriorityTable1[52] = (b_adr12_9[0] && b_adr13_9[3] && b_adr23_8[3] && n_1234_981.any());
0290 m_thePriorityTable1[51] = (b_adr12_9[1] && b_adr13_9[0] && b_adr23_9[0] && n_1234_998.any());
0291 m_thePriorityTable1[50] = (b_adr12_9[1] && b_adr13_9[1] && b_adr23_9[1] && n_1234_999.any());
0292 m_thePriorityTable1[49] = (b_adr12_9[1] && b_adr13_9[2] && b_adr23_9[2] && n_1234_990.any());
0293 m_thePriorityTable1[48] = (b_adr12_9[1] && b_adr13_9[3] && b_adr23_9[3] && n_1234_991.any());
0294 m_thePriorityTable1[47] = (b_adr12_9[2] && b_adr13_9[2] && b_adr23_0[2] && n_1234_900.any());
0295 m_thePriorityTable1[46] = (b_adr12_9[2] && b_adr13_9[3] && b_adr23_0[3] && n_1234_901.any());
0296 m_thePriorityTable1[45] = (b_adr12_9[3] && b_adr13_9[2] && b_adr23_1[2] && n_1234_910.any());
0297 m_thePriorityTable1[44] = (b_adr12_9[3] && b_adr13_9[3] && b_adr23_1[3] && n_1234_911.any());
0298
0299 m_thePriorityTable1[43] = (b_adr12_8[0] && n_123_88.any());
0300 m_thePriorityTable1[42] = (b_adr12_8[1] && n_123_89.any());
0301 m_thePriorityTable1[41] = (b_adr12_8[2] && n_123_80.any());
0302 m_thePriorityTable1[40] = (b_adr12_8[3] && n_123_81.any());
0303
0304 m_thePriorityTable1[39] = (b_adr12_9[0] && n_123_98.any());
0305 m_thePriorityTable1[38] = (b_adr12_9[1] && n_123_99.any());
0306 m_thePriorityTable1[37] = (b_adr12_9[2] && n_123_90.any());
0307 m_thePriorityTable1[36] = (b_adr12_9[3] && n_123_91.any());
0308
0309 m_thePriorityTable1[35] = (b_adr12_8[0] && n_124_88.any());
0310 m_thePriorityTable1[34] = (b_adr12_8[1] && n_124_89.any());
0311 m_thePriorityTable1[33] = (b_adr12_8[2] && n_124_80.any());
0312 m_thePriorityTable1[32] = (b_adr12_8[3] && n_124_81.any());
0313
0314 m_thePriorityTable1[31] = (b_adr12_9[0] && n_124_98.any());
0315 m_thePriorityTable1[30] = (b_adr12_9[1] && n_124_99.any());
0316 m_thePriorityTable1[29] = (b_adr12_9[2] && n_124_90.any());
0317 m_thePriorityTable1[28] = (b_adr12_9[3] && n_124_91.any());
0318
0319 m_thePriorityTable1[27] = (b_adr13_8[0] && n_134_88.any());
0320 m_thePriorityTable1[26] = (b_adr13_8[1] && n_134_89.any());
0321 m_thePriorityTable1[25] = (b_adr13_8[2] && n_134_80.any());
0322 m_thePriorityTable1[24] = (b_adr13_8[3] && n_134_81.any());
0323
0324 m_thePriorityTable1[23] = (b_adr13_9[0] && n_134_98.any());
0325 m_thePriorityTable1[22] = (b_adr13_9[1] && n_134_99.any());
0326 m_thePriorityTable1[21] = (b_adr13_9[2] && n_134_90.any());
0327 m_thePriorityTable1[20] = (b_adr13_9[3] && n_134_91.any());
0328
0329 m_thePriorityTable1[19] = (b_adr23_8[0] && n_234_88.any());
0330 m_thePriorityTable1[18] = (b_adr23_8[1] && n_234_89.any());
0331 m_thePriorityTable1[17] = (b_adr23_8[2] && n_234_80.any());
0332 m_thePriorityTable1[16] = (b_adr23_8[3] && n_234_81.any());
0333
0334 m_thePriorityTable1[15] = (b_adr23_9[0] && n_234_98.any());
0335 m_thePriorityTable1[14] = (b_adr23_9[1] && n_234_99.any());
0336 m_thePriorityTable1[13] = (b_adr23_9[2] && n_234_90.any());
0337 m_thePriorityTable1[12] = (b_adr23_9[3] && n_234_91.any());
0338
0339 m_thePriorityTable1[11] = n_12_8.any();
0340 m_thePriorityTable1[10] = n_12_9.any();
0341
0342 m_thePriorityTable1[9] = n_13_8.any();
0343 m_thePriorityTable1[8] = n_13_9.any();
0344
0345 m_thePriorityTable1[7] = n_14_8.any();
0346 m_thePriorityTable1[6] = n_14_9.any();
0347
0348 m_thePriorityTable1[5] = n_23_8.any();
0349 m_thePriorityTable1[4] = n_23_9.any();
0350
0351 m_thePriorityTable1[3] = n_24_8.any();
0352 m_thePriorityTable1[2] = n_24_9.any();
0353
0354 m_thePriorityTable1[1] = n_34_8.any();
0355 m_thePriorityTable1[0] = n_34_9.any();
0356
0357 if (!m_thePriorityTable1.any())
0358 return;
0359
0360
0361 unsigned int global1 = 0;
0362 unsigned int group1 = 0;
0363 unsigned int p1 = 0;
0364 runEncoderSubUnit1(global1, group1, p1);
0365
0366
0367 runAddressAssignment1(global1, group1);
0368
0369
0370 for (int i = 0; i < 56; i++) {
0371 m_thePriorityTable2[i] = m_thePriorityTable1[i];
0372 }
0373 m_thePriorityTable2 &= getCancelationTable(p1);
0374
0375 if (!m_thePriorityTable2.any())
0376 return;
0377
0378
0379 unsigned int global2 = 0;
0380 unsigned int group2 = 0;
0381 unsigned int p2 = 0;
0382 runEncoderSubUnit2(global2, group2, p2);
0383
0384
0385 runAddressAssignment2(global2, group2);
0386
0387
0388
0389 unsigned int s1_2 = m_theAddresses[1].station(1);
0390 unsigned int s2_2 = m_theAddresses[1].station(2);
0391 unsigned int s3_2 = m_theAddresses[1].station(3);
0392 unsigned int s4_2 = m_theAddresses[1].station(4);
0393
0394 if (s2_2 == m_theAddresses[0].station(2)) {
0395 s2_2 = 15;
0396 m_theBitMaps[1].reset(1);
0397 m_theAddresses[1].setStation(2, 15);
0398 if (m_theTCs[1] == T1234)
0399 m_theTCs[1] = T134;
0400 if (m_theTCs[1] == T123)
0401 m_theTCs[1] = T13;
0402 if (m_theTCs[1] == T124)
0403 m_theTCs[1] = T14;
0404 if (m_theTCs[1] == T234)
0405 m_theTCs[1] = T34;
0406 }
0407 if (s3_2 == m_theAddresses[0].station(3)) {
0408 s3_2 = 15;
0409 m_theBitMaps[1].reset(2);
0410 m_theAddresses[1].setStation(3, 15);
0411 if (m_theTCs[1] == T1234)
0412 m_theTCs[1] = T124;
0413 if (m_theTCs[1] == T123)
0414 m_theTCs[1] = T12;
0415 if (m_theTCs[1] == T134)
0416 m_theTCs[1] = T14;
0417 if (m_theTCs[1] == T234)
0418 m_theTCs[1] = T24;
0419 }
0420 if (s4_2 == m_theAddresses[0].station(4)) {
0421 s4_2 = 15;
0422 m_theBitMaps[1].reset(3);
0423 m_theAddresses[1].setStation(4, 15);
0424 if (m_theTCs[1] == T1234)
0425 m_theTCs[1] = T123;
0426 if (m_theTCs[1] == T124)
0427 m_theTCs[1] = T12;
0428 if (m_theTCs[1] == T134)
0429 m_theTCs[1] = T13;
0430 if (m_theTCs[1] == T234)
0431 m_theTCs[1] = T23;
0432 }
0433
0434 if ((s2_2 == 15 && s3_2 == 15 && s4_2 == 15) || (s1_2 == 15 && s3_2 == 15 && s4_2 == 15) ||
0435 (s1_2 == 15 && s2_2 == 15 && s4_2 == 15) || (s1_2 == 15 && s2_2 == 15 && s3_2 == 15)) {
0436 if (m_sp.config().Debug(5))
0437 cout << "L1MuBMTrackAssembler: second track has been cancelled" << endl;
0438 if (m_sp.config().Debug(5))
0439 print();
0440
0441 m_theTCs[1] = UNDEF;
0442 m_theAddresses[1].reset();
0443 m_theBitMaps[1].reset();
0444 }
0445
0446
0447
0448
0449
0450
0451
0452
0453
0454
0455
0456 }
0457
0458
0459
0460
0461 void L1MuBMTrackAssembler::reset() {
0462 for (int i = 0; i < 68; i++)
0463 m_theLastAddress[i] = 15;
0464 for (int j = 0; j < 12; j++)
0465 m_theLastAddressI[j] = 15;
0466 m_thePriorityTable1.reset();
0467 m_thePriorityTable2.reset();
0468 m_theTCs[0] = UNDEF;
0469 m_theTCs[1] = UNDEF;
0470 m_theBitMaps[0].reset();
0471 m_theBitMaps[1].reset();
0472 m_theAddresses[0].reset();
0473 m_theAddresses[1].reset();
0474 }
0475
0476
0477
0478
0479 void L1MuBMTrackAssembler::print() const {
0480 cout << "Track Assembler : " << endl;
0481 cout << " Priority Table 1 : " << m_thePriorityTable1 << endl;
0482 cout << " Priority Table 2 : "
0483 << " " << m_thePriorityTable2 << endl;
0484
0485
0486 cout << "Track 1: " << m_theTCs[0] << " " << m_theBitMaps[0] << '\t' << m_theAddresses[0] << endl;
0487 cout << "Track 2: " << m_theTCs[1] << " " << m_theBitMaps[1] << '\t' << m_theAddresses[1] << endl;
0488 }
0489
0490
0491
0492
0493 void L1MuBMTrackAssembler::runEncoderSubUnit1(unsigned& global, unsigned& group, unsigned& priority) {
0494
0495
0496 bitset<22> exi;
0497
0498 exi[21] = m_thePriorityTable1[67] || m_thePriorityTable1[66] || m_thePriorityTable1[65] || m_thePriorityTable1[64] ||
0499 m_thePriorityTable1[63] || m_thePriorityTable1[62] || m_thePriorityTable1[61] || m_thePriorityTable1[60] ||
0500 m_thePriorityTable1[59] || m_thePriorityTable1[58] || m_thePriorityTable1[57] || m_thePriorityTable1[56];
0501 exi[20] = m_thePriorityTable1[55] || m_thePriorityTable1[54] || m_thePriorityTable1[53] || m_thePriorityTable1[52] ||
0502 m_thePriorityTable1[51] || m_thePriorityTable1[50] || m_thePriorityTable1[49] || m_thePriorityTable1[48] ||
0503 m_thePriorityTable1[47] || m_thePriorityTable1[46] || m_thePriorityTable1[45] || m_thePriorityTable1[44];
0504 exi[19] = m_thePriorityTable1[43] || m_thePriorityTable1[42] || m_thePriorityTable1[41] || m_thePriorityTable1[40];
0505 exi[18] = m_thePriorityTable1[39] || m_thePriorityTable1[38] || m_thePriorityTable1[37] || m_thePriorityTable1[36];
0506 exi[17] = m_thePriorityTable1[35] || m_thePriorityTable1[34] || m_thePriorityTable1[33] || m_thePriorityTable1[32];
0507 exi[16] = m_thePriorityTable1[31] || m_thePriorityTable1[30] || m_thePriorityTable1[29] || m_thePriorityTable1[28];
0508 exi[15] = m_thePriorityTable1[27] || m_thePriorityTable1[26] || m_thePriorityTable1[25] || m_thePriorityTable1[24];
0509 exi[14] = m_thePriorityTable1[23] || m_thePriorityTable1[22] || m_thePriorityTable1[21] || m_thePriorityTable1[20];
0510 exi[13] = m_thePriorityTable1[19] || m_thePriorityTable1[18] || m_thePriorityTable1[17] || m_thePriorityTable1[16];
0511 exi[12] = m_thePriorityTable1[15] || m_thePriorityTable1[14] || m_thePriorityTable1[13] || m_thePriorityTable1[12];
0512 exi[11] = m_thePriorityTable1[11];
0513 exi[10] = m_thePriorityTable1[10];
0514 exi[9] = m_thePriorityTable1[9];
0515 exi[8] = m_thePriorityTable1[8];
0516 exi[7] = m_thePriorityTable1[7];
0517 exi[6] = m_thePriorityTable1[6];
0518 exi[5] = m_thePriorityTable1[5];
0519 exi[4] = m_thePriorityTable1[4];
0520 exi[3] = m_thePriorityTable1[3];
0521 exi[2] = m_thePriorityTable1[2];
0522 exi[1] = m_thePriorityTable1[1];
0523 exi[0] = m_thePriorityTable1[0];
0524
0525
0526
0527 global = priorityEncoder22(exi);
0528 if (global == 31) {
0529 group = 15;
0530 priority = 0;
0531 return;
0532 }
0533
0534
0535
0536 bitset<12> x;
0537 x = subBitset68(m_thePriorityTable1, 56, 12);
0538 unsigned int prio1234a = priorityEncoder12(x);
0539 x = subBitset68(m_thePriorityTable1, 44, 12);
0540 unsigned int prio1234b = priorityEncoder12(x);
0541
0542 bitset<4> y;
0543 y = subBitset68(m_thePriorityTable1, 40, 4);
0544 unsigned int prio123a = priorityEncoder4(y);
0545 y = subBitset68(m_thePriorityTable1, 36, 4);
0546 unsigned int prio123b = priorityEncoder4(y);
0547 y = subBitset68(m_thePriorityTable1, 32, 4);
0548 unsigned int prio124a = priorityEncoder4(y);
0549 y = subBitset68(m_thePriorityTable1, 28, 4);
0550 unsigned int prio124b = priorityEncoder4(y);
0551 y = subBitset68(m_thePriorityTable1, 24, 4);
0552 unsigned int prio134a = priorityEncoder4(y);
0553 y = subBitset68(m_thePriorityTable1, 20, 4);
0554 unsigned int prio134b = priorityEncoder4(y);
0555 y = subBitset68(m_thePriorityTable1, 16, 4);
0556 unsigned int prio234a = priorityEncoder4(y);
0557 y = subBitset68(m_thePriorityTable1, 12, 4);
0558 unsigned int prio234b = priorityEncoder4(y);
0559
0560 switch (global) {
0561 case 21: {
0562 group = prio1234a;
0563 priority = 56 + group;
0564 break;
0565 }
0566 case 20: {
0567 group = prio1234b;
0568 priority = 44 + group;
0569 break;
0570 }
0571 case 19: {
0572 group = prio123a;
0573 priority = 40 + group;
0574 break;
0575 }
0576 case 18: {
0577 group = prio123b;
0578 priority = 36 + group;
0579 break;
0580 }
0581 case 17: {
0582 group = prio124a;
0583 priority = 32 + group;
0584 break;
0585 }
0586 case 16: {
0587 group = prio124b;
0588 priority = 28 + group;
0589 break;
0590 }
0591 case 15: {
0592 group = prio134a;
0593 priority = 24 + group;
0594 break;
0595 }
0596 case 14: {
0597 group = prio134b;
0598 priority = 20 + group;
0599 break;
0600 }
0601 case 13: {
0602 group = prio234a;
0603 priority = 16 + group;
0604 break;
0605 }
0606 case 12: {
0607 group = prio234b;
0608 priority = 12 + group;
0609 break;
0610 }
0611 default: {
0612 group = 15;
0613 priority = global;
0614 break;
0615 }
0616 }
0617 }
0618
0619
0620
0621
0622 void L1MuBMTrackAssembler::runEncoderSubUnit2(unsigned& global, unsigned& group, unsigned& priority) {
0623
0624
0625 bitset<21> exi;
0626
0627 exi[20] = m_thePriorityTable2[55] || m_thePriorityTable2[54] || m_thePriorityTable2[53] || m_thePriorityTable2[52] ||
0628 m_thePriorityTable2[51] || m_thePriorityTable2[50] || m_thePriorityTable2[49] || m_thePriorityTable2[48] ||
0629 m_thePriorityTable2[47] || m_thePriorityTable2[46] || m_thePriorityTable2[45] || m_thePriorityTable2[44];
0630 exi[19] = m_thePriorityTable2[43] || m_thePriorityTable2[42] || m_thePriorityTable2[41] || m_thePriorityTable2[40];
0631 exi[18] = m_thePriorityTable2[39] || m_thePriorityTable2[38] || m_thePriorityTable2[37] || m_thePriorityTable2[36];
0632 exi[17] = m_thePriorityTable2[35] || m_thePriorityTable2[34] || m_thePriorityTable2[33] || m_thePriorityTable2[32];
0633 exi[16] = m_thePriorityTable2[31] || m_thePriorityTable2[30] || m_thePriorityTable2[29] || m_thePriorityTable2[28];
0634 exi[15] = m_thePriorityTable2[27] || m_thePriorityTable2[26] || m_thePriorityTable2[25] || m_thePriorityTable2[24];
0635 exi[14] = m_thePriorityTable2[23] || m_thePriorityTable2[22] || m_thePriorityTable2[21] || m_thePriorityTable2[20];
0636 exi[13] = m_thePriorityTable2[19] || m_thePriorityTable2[18] || m_thePriorityTable2[17] || m_thePriorityTable2[16];
0637 exi[12] = m_thePriorityTable2[15] || m_thePriorityTable2[14] || m_thePriorityTable2[13] || m_thePriorityTable2[12];
0638 exi[11] = m_thePriorityTable2[11];
0639 exi[10] = m_thePriorityTable2[10];
0640 exi[9] = m_thePriorityTable2[9];
0641 exi[8] = m_thePriorityTable2[8];
0642 exi[7] = m_thePriorityTable2[7];
0643 exi[6] = m_thePriorityTable2[6];
0644 exi[5] = m_thePriorityTable2[5];
0645 exi[4] = m_thePriorityTable2[4];
0646 exi[3] = m_thePriorityTable2[3];
0647 exi[2] = m_thePriorityTable2[2];
0648 exi[1] = m_thePriorityTable2[1];
0649 exi[0] = m_thePriorityTable2[0];
0650
0651
0652
0653 global = priorityEncoder21(exi);
0654 if (global == 31) {
0655 group = 15;
0656 priority = 0;
0657 return;
0658 }
0659
0660
0661
0662 bitset<12> x;
0663 x = subBitset56(m_thePriorityTable2, 44, 12);
0664 unsigned int prio1234b = priorityEncoder12(x);
0665
0666 bitset<4> y;
0667 y = subBitset56(m_thePriorityTable2, 40, 4);
0668 unsigned int prio123a = priorityEncoder4(y);
0669 y = subBitset56(m_thePriorityTable2, 36, 4);
0670 unsigned int prio123b = priorityEncoder4(y);
0671 y = subBitset56(m_thePriorityTable2, 32, 4);
0672 unsigned int prio124a = priorityEncoder4(y);
0673 y = subBitset56(m_thePriorityTable2, 28, 4);
0674 unsigned int prio124b = priorityEncoder4(y);
0675 y = subBitset56(m_thePriorityTable2, 24, 4);
0676 unsigned int prio134a = priorityEncoder4(y);
0677 y = subBitset56(m_thePriorityTable2, 20, 4);
0678 unsigned int prio134b = priorityEncoder4(y);
0679 y = subBitset56(m_thePriorityTable2, 16, 4);
0680 unsigned int prio234a = priorityEncoder4(y);
0681 y = subBitset56(m_thePriorityTable2, 12, 4);
0682 unsigned int prio234b = priorityEncoder4(y);
0683
0684 switch (global) {
0685 case 20: {
0686 group = prio1234b;
0687 priority = 44 + group;
0688 break;
0689 }
0690 case 19: {
0691 group = prio123a;
0692 priority = 40 + group;
0693 break;
0694 }
0695 case 18: {
0696 group = prio123b;
0697 priority = 36 + group;
0698 break;
0699 }
0700 case 17: {
0701 group = prio124a;
0702 priority = 32 + group;
0703 break;
0704 }
0705 case 16: {
0706 group = prio124b;
0707 priority = 28 + group;
0708 break;
0709 }
0710 case 15: {
0711 group = prio134a;
0712 priority = 24 + group;
0713 break;
0714 }
0715 case 14: {
0716 group = prio134b;
0717 priority = 20 + group;
0718 break;
0719 }
0720 case 13: {
0721 group = prio234a;
0722 priority = 16 + group;
0723 break;
0724 }
0725 case 12: {
0726 group = prio234b;
0727 priority = 12 + group;
0728 break;
0729 }
0730 default: {
0731 group = 15;
0732 priority = global;
0733 break;
0734 }
0735 }
0736 }
0737
0738
0739
0740
0741 void L1MuBMTrackAssembler::runAddressAssignment1(int global, int group) {
0742 TrackClass tc(UNDEF);
0743
0744 switch (global) {
0745 case 21: {
0746 tc = T1234;
0747 switch (group) {
0748 case 11:
0749 m_theAddresses[0].setStations(0, 0, 0, m_theLastAddress[67]);
0750 break;
0751 case 10:
0752 m_theAddresses[0].setStations(0, 0, 1, m_theLastAddress[66]);
0753 break;
0754 case 9:
0755 m_theAddresses[0].setStations(0, 0, 2, m_theLastAddress[65]);
0756 break;
0757 case 8:
0758 m_theAddresses[0].setStations(0, 0, 3, m_theLastAddress[64]);
0759 break;
0760 case 7:
0761 m_theAddresses[0].setStations(0, 1, 0, m_theLastAddress[63]);
0762 break;
0763 case 6:
0764 m_theAddresses[0].setStations(0, 1, 1, m_theLastAddress[62]);
0765 break;
0766 case 5:
0767 m_theAddresses[0].setStations(0, 1, 2, m_theLastAddress[61]);
0768 break;
0769 case 4:
0770 m_theAddresses[0].setStations(0, 1, 3, m_theLastAddress[60]);
0771 break;
0772 case 3:
0773 m_theAddresses[0].setStations(0, 2, 2, m_theLastAddress[59]);
0774 break;
0775 case 2:
0776 m_theAddresses[0].setStations(0, 2, 3, m_theLastAddress[58]);
0777 break;
0778 case 1:
0779 m_theAddresses[0].setStations(0, 3, 2, m_theLastAddress[57]);
0780 break;
0781 case 0:
0782 m_theAddresses[0].setStations(0, 3, 3, m_theLastAddress[56]);
0783 break;
0784 }
0785 break;
0786 }
0787 case 20: {
0788 tc = T1234;
0789 switch (group) {
0790 case 11:
0791 m_theAddresses[0].setStations(1, 0, 0, m_theLastAddress[55]);
0792 break;
0793 case 10:
0794 m_theAddresses[0].setStations(1, 0, 1, m_theLastAddress[54]);
0795 break;
0796 case 9:
0797 m_theAddresses[0].setStations(1, 0, 2, m_theLastAddress[53]);
0798 break;
0799 case 8:
0800 m_theAddresses[0].setStations(1, 0, 3, m_theLastAddress[52]);
0801 break;
0802 case 7:
0803 m_theAddresses[0].setStations(1, 1, 0, m_theLastAddress[51]);
0804 break;
0805 case 6:
0806 m_theAddresses[0].setStations(1, 1, 1, m_theLastAddress[50]);
0807 break;
0808 case 5:
0809 m_theAddresses[0].setStations(1, 1, 2, m_theLastAddress[49]);
0810 break;
0811 case 4:
0812 m_theAddresses[0].setStations(1, 1, 3, m_theLastAddress[48]);
0813 break;
0814 case 3:
0815 m_theAddresses[0].setStations(1, 2, 2, m_theLastAddress[47]);
0816 break;
0817 case 2:
0818 m_theAddresses[0].setStations(1, 2, 3, m_theLastAddress[46]);
0819 break;
0820 case 1:
0821 m_theAddresses[0].setStations(1, 3, 2, m_theLastAddress[45]);
0822 break;
0823 case 0:
0824 m_theAddresses[0].setStations(1, 3, 3, m_theLastAddress[44]);
0825 break;
0826 }
0827 break;
0828 }
0829 case 19: {
0830 tc = T123;
0831 switch (group) {
0832 case 3:
0833 m_theAddresses[0].setStations(0, 0, m_theLastAddress[43], 15);
0834 break;
0835 case 2:
0836 m_theAddresses[0].setStations(0, 1, m_theLastAddress[42], 15);
0837 break;
0838 case 1:
0839 m_theAddresses[0].setStations(0, 2, m_theLastAddress[41], 15);
0840 break;
0841 case 0:
0842 m_theAddresses[0].setStations(0, 3, m_theLastAddress[40], 15);
0843 break;
0844 }
0845 break;
0846 }
0847 case 18: {
0848 tc = T123;
0849 switch (group) {
0850 case 3:
0851 m_theAddresses[0].setStations(1, 0, m_theLastAddress[39], 15);
0852 break;
0853 case 2:
0854 m_theAddresses[0].setStations(1, 1, m_theLastAddress[38], 15);
0855 break;
0856 case 1:
0857 m_theAddresses[0].setStations(1, 2, m_theLastAddress[37], 15);
0858 break;
0859 case 0:
0860 m_theAddresses[0].setStations(1, 3, m_theLastAddress[36], 15);
0861 break;
0862 }
0863 break;
0864 }
0865 case 17: {
0866 tc = T124;
0867 switch (group) {
0868 case 3:
0869 m_theAddresses[0].setStations(0, 0, 15, m_theLastAddress[35]);
0870 break;
0871 case 2:
0872 m_theAddresses[0].setStations(0, 1, 15, m_theLastAddress[34]);
0873 break;
0874 case 1:
0875 m_theAddresses[0].setStations(0, 2, 15, m_theLastAddress[33]);
0876 break;
0877 case 0:
0878 m_theAddresses[0].setStations(0, 3, 15, m_theLastAddress[32]);
0879 break;
0880 }
0881 break;
0882 }
0883 case 16: {
0884 tc = T124;
0885 switch (group) {
0886 case 3:
0887 m_theAddresses[0].setStations(1, 0, 15, m_theLastAddress[31]);
0888 break;
0889 case 2:
0890 m_theAddresses[0].setStations(1, 1, 15, m_theLastAddress[30]);
0891 break;
0892 case 1:
0893 m_theAddresses[0].setStations(1, 2, 15, m_theLastAddress[29]);
0894 break;
0895 case 0:
0896 m_theAddresses[0].setStations(1, 3, 15, m_theLastAddress[28]);
0897 break;
0898 }
0899 break;
0900 }
0901 case 15: {
0902 tc = T134;
0903 switch (group) {
0904 case 3:
0905 m_theAddresses[0].setStations(0, 15, 0, m_theLastAddress[27]);
0906 break;
0907 case 2:
0908 m_theAddresses[0].setStations(0, 15, 1, m_theLastAddress[26]);
0909 break;
0910 case 1:
0911 m_theAddresses[0].setStations(0, 15, 2, m_theLastAddress[25]);
0912 break;
0913 case 0:
0914 m_theAddresses[0].setStations(0, 15, 3, m_theLastAddress[24]);
0915 break;
0916 }
0917 break;
0918 }
0919 case 14: {
0920 tc = T134;
0921 switch (group) {
0922 case 3:
0923 m_theAddresses[0].setStations(1, 15, 0, m_theLastAddress[23]);
0924 break;
0925 case 2:
0926 m_theAddresses[0].setStations(1, 15, 1, m_theLastAddress[22]);
0927 break;
0928 case 1:
0929 m_theAddresses[0].setStations(1, 15, 2, m_theLastAddress[21]);
0930 break;
0931 case 0:
0932 m_theAddresses[0].setStations(1, 15, 3, m_theLastAddress[20]);
0933 break;
0934 }
0935 break;
0936 }
0937 case 13: {
0938 tc = T234;
0939 switch (group) {
0940 case 3:
0941 m_theAddresses[0].setStations(15, 0, 0, m_theLastAddress[19]);
0942 break;
0943 case 2:
0944 m_theAddresses[0].setStations(15, 0, 1, m_theLastAddress[18]);
0945 break;
0946 case 1:
0947 m_theAddresses[0].setStations(15, 0, 2, m_theLastAddress[17]);
0948 break;
0949 case 0:
0950 m_theAddresses[0].setStations(15, 0, 3, m_theLastAddress[16]);
0951 break;
0952 }
0953 break;
0954 }
0955 case 12: {
0956 tc = T234;
0957 switch (group) {
0958 case 3:
0959 m_theAddresses[0].setStations(15, 1, 0, m_theLastAddress[15]);
0960 break;
0961 case 2:
0962 m_theAddresses[0].setStations(15, 1, 1, m_theLastAddress[14]);
0963 break;
0964 case 1:
0965 m_theAddresses[0].setStations(15, 1, 2, m_theLastAddress[13]);
0966 break;
0967 case 0:
0968 m_theAddresses[0].setStations(15, 1, 3, m_theLastAddress[12]);
0969 break;
0970 }
0971 break;
0972 }
0973 case 11: {
0974 tc = T12;
0975 m_theAddresses[0].setStations(0, m_theLastAddress[11], 15, 15);
0976 break;
0977 }
0978 case 10: {
0979 tc = T12;
0980 m_theAddresses[0].setStations(1, m_theLastAddress[10], 15, 15);
0981 break;
0982 }
0983 case 9: {
0984 tc = T13;
0985 m_theAddresses[0].setStations(0, 15, m_theLastAddress[9], 15);
0986 break;
0987 }
0988 case 8: {
0989 tc = T13;
0990 m_theAddresses[0].setStations(1, 15, m_theLastAddress[8], 15);
0991 break;
0992 }
0993 case 7: {
0994 tc = T14;
0995 m_theAddresses[0].setStations(0, 15, 15, m_theLastAddress[7]);
0996 break;
0997 }
0998 case 6: {
0999 tc = T14;
1000 m_theAddresses[0].setStations(1, 15, 15, m_theLastAddress[6]);
1001 break;
1002 }
1003 case 5: {
1004 tc = T23;
1005 m_theAddresses[0].setStations(15, 0, m_theLastAddress[5], 15);
1006 break;
1007 }
1008 case 4: {
1009 tc = T23;
1010 m_theAddresses[0].setStations(15, 1, m_theLastAddress[4], 15);
1011 break;
1012 }
1013 case 3: {
1014 tc = T24;
1015 m_theAddresses[0].setStations(15, 0, 15, m_theLastAddress[3]);
1016 break;
1017 }
1018 case 2: {
1019 tc = T24;
1020 m_theAddresses[0].setStations(15, 1, 15, m_theLastAddress[2]);
1021 break;
1022 }
1023 case 1: {
1024 tc = T34;
1025 m_theAddresses[0].setStations(15, 15, 0, m_theLastAddress[1]);
1026 break;
1027 }
1028 case 0: {
1029 tc = T34;
1030 m_theAddresses[0].setStations(15, 15, 1, m_theLastAddress[0]);
1031 break;
1032 }
1033 }
1034
1035
1036 m_theTCs[0] = tc;
1037 m_theBitMaps[0] = tc2bitmap(tc);
1038 }
1039
1040
1041
1042
1043 void L1MuBMTrackAssembler::runAddressAssignment2(int global, int group) {
1044 TrackClass tc(UNDEF);
1045
1046 switch (global) {
1047 case 20: {
1048 tc = T1234;
1049 switch (group) {
1050 case 11:
1051 m_theAddresses[1].setStations(1, 0, 0, m_theLastAddress[55]);
1052 break;
1053 case 10:
1054 m_theAddresses[1].setStations(1, 0, 1, m_theLastAddress[54]);
1055 break;
1056 case 9:
1057 m_theAddresses[1].setStations(1, 0, 2, m_theLastAddress[53]);
1058 break;
1059 case 8:
1060 m_theAddresses[1].setStations(1, 0, 3, m_theLastAddress[52]);
1061 break;
1062 case 7:
1063 m_theAddresses[1].setStations(1, 1, 0, m_theLastAddress[51]);
1064 break;
1065 case 6:
1066 m_theAddresses[1].setStations(1, 1, 1, m_theLastAddress[50]);
1067 break;
1068 case 5:
1069 m_theAddresses[1].setStations(1, 1, 2, m_theLastAddress[49]);
1070 break;
1071 case 4:
1072 m_theAddresses[1].setStations(1, 1, 3, m_theLastAddress[48]);
1073 break;
1074 case 3:
1075 m_theAddresses[1].setStations(1, 2, 2, m_theLastAddress[47]);
1076 break;
1077 case 2:
1078 m_theAddresses[1].setStations(1, 2, 3, m_theLastAddress[46]);
1079 break;
1080 case 1:
1081 m_theAddresses[1].setStations(1, 3, 2, m_theLastAddress[45]);
1082 break;
1083 case 0:
1084 m_theAddresses[1].setStations(1, 3, 3, m_theLastAddress[44]);
1085 break;
1086 }
1087 break;
1088 }
1089 case 19: {
1090 tc = T123;
1091 switch (group) {
1092 case 3:
1093 m_theAddresses[1].setStations(0, 0, m_theLastAddress[43], 15);
1094 break;
1095 case 2:
1096 m_theAddresses[1].setStations(0, 1, m_theLastAddress[42], 15);
1097 break;
1098 case 1:
1099 m_theAddresses[1].setStations(0, 2, m_theLastAddress[41], 15);
1100 break;
1101 case 0:
1102 m_theAddresses[1].setStations(0, 3, m_theLastAddress[40], 15);
1103 break;
1104 }
1105 break;
1106 }
1107 case 18: {
1108 tc = T123;
1109 switch (group) {
1110 case 3:
1111 m_theAddresses[1].setStations(1, 0, m_theLastAddress[39], 15);
1112 break;
1113 case 2:
1114 m_theAddresses[1].setStations(1, 1, m_theLastAddress[38], 15);
1115 break;
1116 case 1:
1117 m_theAddresses[1].setStations(1, 2, m_theLastAddress[37], 15);
1118 break;
1119 case 0:
1120 m_theAddresses[1].setStations(1, 3, m_theLastAddress[36], 15);
1121 break;
1122 }
1123 break;
1124 }
1125 case 17: {
1126 tc = T124;
1127 switch (group) {
1128 case 3:
1129 m_theAddresses[1].setStations(0, 0, 15, m_theLastAddress[35]);
1130 break;
1131 case 2:
1132 m_theAddresses[1].setStations(0, 1, 15, m_theLastAddress[34]);
1133 break;
1134 case 1:
1135 m_theAddresses[1].setStations(0, 2, 15, m_theLastAddress[33]);
1136 break;
1137 case 0:
1138 m_theAddresses[1].setStations(0, 3, 15, m_theLastAddress[32]);
1139 break;
1140 }
1141 break;
1142 }
1143 case 16: {
1144 tc = T124;
1145 switch (group) {
1146 case 3:
1147 m_theAddresses[1].setStations(1, 0, 15, m_theLastAddress[31]);
1148 break;
1149 case 2:
1150 m_theAddresses[1].setStations(1, 1, 15, m_theLastAddress[30]);
1151 break;
1152 case 1:
1153 m_theAddresses[1].setStations(1, 2, 15, m_theLastAddress[29]);
1154 break;
1155 case 0:
1156 m_theAddresses[1].setStations(1, 3, 15, m_theLastAddress[28]);
1157 break;
1158 }
1159 break;
1160 }
1161 case 15: {
1162 tc = T134;
1163 switch (group) {
1164 case 3:
1165 m_theAddresses[1].setStations(0, 15, 0, m_theLastAddress[27]);
1166 break;
1167 case 2:
1168 m_theAddresses[1].setStations(0, 15, 1, m_theLastAddress[26]);
1169 break;
1170 case 1:
1171 m_theAddresses[1].setStations(0, 15, 2, m_theLastAddress[25]);
1172 break;
1173 case 0:
1174 m_theAddresses[1].setStations(0, 15, 3, m_theLastAddress[24]);
1175 break;
1176 }
1177 break;
1178 }
1179 case 14: {
1180 tc = T134;
1181 switch (group) {
1182 case 3:
1183 m_theAddresses[1].setStations(1, 15, 0, m_theLastAddress[23]);
1184 break;
1185 case 2:
1186 m_theAddresses[1].setStations(1, 15, 1, m_theLastAddress[22]);
1187 break;
1188 case 1:
1189 m_theAddresses[1].setStations(1, 15, 2, m_theLastAddress[21]);
1190 break;
1191 case 0:
1192 m_theAddresses[1].setStations(1, 15, 3, m_theLastAddress[20]);
1193 break;
1194 }
1195 break;
1196 }
1197 case 13: {
1198 tc = T234;
1199 switch (group) {
1200 case 3:
1201 m_theAddresses[1].setStations(15, 0, 0, m_theLastAddress[19]);
1202 break;
1203 case 2:
1204 m_theAddresses[1].setStations(15, 0, 1, m_theLastAddress[18]);
1205 break;
1206 case 1:
1207 m_theAddresses[1].setStations(15, 0, 2, m_theLastAddress[17]);
1208 break;
1209 case 0:
1210 m_theAddresses[1].setStations(15, 0, 3, m_theLastAddress[16]);
1211 break;
1212 }
1213 break;
1214 }
1215 case 12: {
1216 tc = T234;
1217 switch (group) {
1218 case 3:
1219 m_theAddresses[1].setStations(15, 1, 0, m_theLastAddress[15]);
1220 break;
1221 case 2:
1222 m_theAddresses[1].setStations(15, 1, 1, m_theLastAddress[14]);
1223 break;
1224 case 1:
1225 m_theAddresses[1].setStations(15, 1, 2, m_theLastAddress[13]);
1226 break;
1227 case 0:
1228 m_theAddresses[1].setStations(15, 1, 3, m_theLastAddress[12]);
1229 break;
1230 }
1231 break;
1232 }
1233 case 11: {
1234 tc = T12;
1235 m_theAddresses[1].setStations(0, m_theLastAddressI[11], 15, 15);
1236 break;
1237 }
1238 case 10: {
1239 tc = T12;
1240 m_theAddresses[1].setStations(1, m_theLastAddressI[10], 15, 15);
1241 break;
1242 }
1243 case 9: {
1244 tc = T13;
1245 m_theAddresses[1].setStations(0, 15, m_theLastAddressI[9], 15);
1246 break;
1247 }
1248 case 8: {
1249 tc = T13;
1250 m_theAddresses[1].setStations(1, 15, m_theLastAddressI[8], 15);
1251 break;
1252 }
1253 case 7: {
1254 tc = T14;
1255 m_theAddresses[1].setStations(0, 15, 15, m_theLastAddressI[7]);
1256 break;
1257 }
1258 case 6: {
1259 tc = T14;
1260 m_theAddresses[1].setStations(1, 15, 15, m_theLastAddressI[6]);
1261 break;
1262 }
1263 case 5: {
1264 tc = T23;
1265 m_theAddresses[1].setStations(15, 0, m_theLastAddressI[5], 15);
1266 break;
1267 }
1268 case 4: {
1269 tc = T23;
1270 m_theAddresses[1].setStations(15, 1, m_theLastAddressI[4], 15);
1271 break;
1272 }
1273 case 3: {
1274 tc = T24;
1275 m_theAddresses[1].setStations(15, 0, 15, m_theLastAddressI[3]);
1276 break;
1277 }
1278 case 2: {
1279 tc = T24;
1280 m_theAddresses[1].setStations(15, 1, 15, m_theLastAddressI[2]);
1281 break;
1282 }
1283 case 1: {
1284 tc = T34;
1285 m_theAddresses[1].setStations(15, 15, 0, m_theLastAddressI[1]);
1286 break;
1287 }
1288 case 0: {
1289 tc = T34;
1290 m_theAddresses[1].setStations(15, 15, 1, m_theLastAddressI[0]);
1291 break;
1292 }
1293 }
1294
1295
1296 m_theTCs[1] = tc;
1297 m_theBitMaps[1] = tc2bitmap(tc);
1298 }
1299
1300
1301
1302
1303 unsigned int L1MuBMTrackAssembler::priorityEncoder12(const bitset<12>& input) {
1304 unsigned int result = 15;
1305
1306 for (int i = 0; i < 12; i++) {
1307 if (input.test(i))
1308 result = i;
1309 }
1310
1311 return result;
1312 }
1313
1314
1315
1316
1317 unsigned int L1MuBMTrackAssembler::priorityEncoder4(const bitset<4>& input) {
1318 unsigned int result = 3;
1319
1320 for (int i = 0; i < 4; i++) {
1321 if (input.test(i))
1322 result = i;
1323 }
1324
1325 return result;
1326 }
1327
1328
1329
1330
1331 unsigned int L1MuBMTrackAssembler::priorityEncoder22(const bitset<22>& input) {
1332 unsigned int result = 31;
1333
1334 for (int i = 0; i < 22; i++) {
1335 if (input.test(i))
1336 result = i;
1337 }
1338
1339 return result;
1340 }
1341
1342
1343
1344
1345 unsigned int L1MuBMTrackAssembler::priorityEncoder21(const bitset<21>& input) {
1346 unsigned int result = 31;
1347
1348 for (int i = 0; i < 21; i++) {
1349 if (input.test(i))
1350 result = i;
1351 }
1352
1353 return result;
1354 }
1355
1356
1357
1358
1359 unsigned int L1MuBMTrackAssembler::addressEncoder12(const bitset<12>& input) {
1360
1361
1362 unsigned int result = 15;
1363
1364 for (int i = 0; i < 12; i++) {
1365 if (input.test(i)) {
1366 result = i;
1367 break;
1368 }
1369 }
1370
1371 return result;
1372 }
1373
1374
1375
1376
1377 unsigned int L1MuBMTrackAssembler::addressEncoder12s(const bitset<12>& input) {
1378
1379
1380 unsigned int result = 15;
1381
1382 for (int i = 0; i < 11; i += 2) {
1383 if (input.test(i) || input.test(i + 1)) {
1384 if (input.test(i))
1385 result = i;
1386 if (input.test(i + 1))
1387 result = i + 1;
1388 break;
1389 }
1390 }
1391
1392 return result;
1393 }
1394
1395
1396
1397
1398 unsigned long L1MuBMTrackAssembler::subBitset68(const bitset<68>& input, int pos, int length) {
1399 bitset<68> s(input);
1400
1401 for (int i = pos + length; i < 68; i++)
1402 s.reset(i);
1403
1404 s >>= pos;
1405
1406 return s.to_ulong();
1407 }
1408
1409
1410
1411
1412 unsigned long L1MuBMTrackAssembler::subBitset56(const bitset<56>& input, int pos, int length) {
1413 bitset<56> s(input);
1414
1415 for (int i = pos + length; i < 56; i++)
1416 s.reset(i);
1417
1418 s >>= pos;
1419
1420 return s.to_ulong();
1421 }
1422
1423
1424
1425
1426 bitset<56> L1MuBMTrackAssembler::getCancelationTable(unsigned int p) {
1427
1428
1429
1430
1431 switch (p) {
1432 case 67: {
1433 bitset<56> b(string("00000111111100000111000001110000011100000111010101010101"));
1434 return b;
1435 break;
1436 }
1437 case 66: {
1438 bitset<56> b(string("00001011111100000111000001110000101100001011010101010110"));
1439 return b;
1440 break;
1441 }
1442 case 65: {
1443 bitset<56> b(string("00001101010100000111000001110000110100001101010101010111"));
1444 return b;
1445 break;
1446 }
1447 case 64: {
1448 bitset<56> b(string("00001110101000000111000001110000111000001110010101010111"));
1449 return b;
1450 break;
1451 }
1452 case 63: {
1453 bitset<56> b(string("01110000111100001011000010110000011101110000010101101001"));
1454 return b;
1455 break;
1456 }
1457 case 62: {
1458 bitset<56> b(string("10110000111100001011000010110000101110110000010101101010"));
1459 return b;
1460 break;
1461 }
1462 case 61: {
1463 bitset<56> b(string("11010000111100001011000010110000110111010000010101101011"));
1464 return b;
1465 break;
1466 }
1467 case 60: {
1468 bitset<56> b(string("11100000111100001011000010110000111011100000010101101011"));
1469 return b;
1470 break;
1471 }
1472 case 59: {
1473 bitset<56> b(string("11011101000100001101000011010000110111011101010101111111"));
1474 return b;
1475 break;
1476 }
1477 case 58: {
1478 bitset<56> b(string("11101110001000001101000011010000111011101110010101111111"));
1479 return b;
1480 break;
1481 }
1482 case 57: {
1483 bitset<56> b(string("11011101010000001110000011100000110111011101010101111111"));
1484 return b;
1485 break;
1486 }
1487 case 56: {
1488 bitset<56> b(string("11101110100000001110000011100000111011101110010101111111"));
1489 return b;
1490 break;
1491 }
1492
1493 case 55: {
1494 bitset<56> b(string("00000000000001110000011100000111000000000111101010010101"));
1495 return b;
1496 break;
1497 }
1498 case 54: {
1499 bitset<56> b(string("00000000000001110000011100001011000000001011101010010110"));
1500 return b;
1501 break;
1502 }
1503 case 53: {
1504 bitset<56> b(string("00000000000001110000011100001101000000001101101010010111"));
1505 return b;
1506 break;
1507 }
1508 case 52: {
1509 bitset<56> b(string("00000000000001110000011100001110000000001110101010010111"));
1510 return b;
1511 break;
1512 }
1513 case 51: {
1514 bitset<56> b(string("00000000000010110000101100000111000001110000101010101001"));
1515 return b;
1516 break;
1517 }
1518 case 50: {
1519 bitset<56> b(string("00000000000010110000101100001011000010110000101010101010"));
1520 return b;
1521 break;
1522 }
1523 case 49: {
1524 bitset<56> b(string("00000000000010110000101100001101000011010000101010101011"));
1525 return b;
1526 break;
1527 }
1528 case 48: {
1529 bitset<56> b(string("00000000000010110000101100001110000011100000101010101011"));
1530 return b;
1531 break;
1532 }
1533 case 47: {
1534 bitset<56> b(string("00000000000011010000110100001101000011011101101010111111"));
1535 return b;
1536 break;
1537 }
1538 case 46: {
1539 bitset<56> b(string("00000000000011010000110100001110000011101110101010111111"));
1540 return b;
1541 break;
1542 }
1543 case 45: {
1544 bitset<56> b(string("00000000000011100000111000001101000011011101101010111111"));
1545 return b;
1546 break;
1547 }
1548 case 44: {
1549 bitset<56> b(string("00000000000011100000111000001110000011101110101010111111"));
1550 return b;
1551 break;
1552 }
1553
1554 case 43: {
1555 bitset<56> b(string("00000000000000000111000001110000111100001111010101010111"));
1556 return b;
1557 break;
1558 }
1559 case 42: {
1560 bitset<56> b(string("00000000000000001011000010110000111111110000010101101011"));
1561 return b;
1562 break;
1563 }
1564 case 41: {
1565 bitset<56> b(string("00000000000000001101000011010000111111111111010101111111"));
1566 return b;
1567 break;
1568 }
1569 case 40: {
1570 bitset<56> b(string("00000000000000001110000011100000111111111111010101111111"));
1571 return b;
1572 break;
1573 }
1574
1575 case 39: {
1576 bitset<56> b(string("00000000000000000000011100001111000000001111101010010111"));
1577 return b;
1578 break;
1579 }
1580 case 38: {
1581 bitset<56> b(string("00000000000000000000101100001111000011110000101010101011"));
1582 return b;
1583 break;
1584 }
1585 case 37: {
1586 bitset<56> b(string("00000000000000000000110100001111000011111111101010111111"));
1587 return b;
1588 break;
1589 }
1590 case 36: {
1591 bitset<56> b(string("00000000000000000000111000001111000011111111101010111111"));
1592 return b;
1593 break;
1594 }
1595
1596 case 35: {
1597 bitset<56> b(string("00000000000000000000000001110000111100001111010101010111"));
1598 return b;
1599 break;
1600 }
1601 case 34: {
1602 bitset<56> b(string("00000000000000000000000010110000111111110000010101101011"));
1603 return b;
1604 break;
1605 }
1606 case 33: {
1607 bitset<56> b(string("00000000000000000000000011010000111111111111010101111111"));
1608 return b;
1609 break;
1610 }
1611 case 32: {
1612 bitset<56> b(string("00000000000000000000000011100000111111111111010101111111"));
1613 return b;
1614 break;
1615 }
1616
1617 case 31: {
1618 bitset<56> b(string("00000000000000000000011100001111000000001111101010010111"));
1619 return b;
1620 break;
1621 }
1622 case 30: {
1623 bitset<56> b(string("00000000000000000000101100001111000011110000101010101011"));
1624 return b;
1625 break;
1626 }
1627 case 29: {
1628 bitset<56> b(string("00000000000000000000110100001111000011111111101010111111"));
1629 return b;
1630 break;
1631 }
1632 case 28: {
1633 bitset<56> b(string("00000000000000000000111000001111000011111111101010111111"));
1634 return b;
1635 break;
1636 }
1637
1638 case 27: {
1639 bitset<56> b(string("00000000000000000000000000000000011101110111010101111101"));
1640 return b;
1641 break;
1642 }
1643 case 26: {
1644 bitset<56> b(string("00000000000000000000000000000000101110111011010101111110"));
1645 return b;
1646 break;
1647 }
1648 case 25: {
1649 bitset<56> b(string("00000000000000000000000000000000110111011101010101111111"));
1650 return b;
1651 break;
1652 }
1653 case 24: {
1654 bitset<56> b(string("00000000000000000000000000000000111011101110010101111111"));
1655 return b;
1656 break;
1657 }
1658
1659 case 23: {
1660 bitset<56> b(string("00000000000000000000000000000000000001110111101010111101"));
1661 return b;
1662 break;
1663 }
1664 case 22: {
1665 bitset<56> b(string("00000000000000000000000000000000000010111011101010111110"));
1666 return b;
1667 break;
1668 }
1669 case 21: {
1670 bitset<56> b(string("00000000000000000000000000000000000011011101101010111111"));
1671 return b;
1672 break;
1673 }
1674 case 20: {
1675 bitset<56> b(string("00000000000000000000000000000000000011101110101010111111"));
1676 return b;
1677 break;
1678 }
1679
1680 case 19: {
1681 bitset<56> b(string("00000000000000000000000000000000000000000111111111010101"));
1682 return b;
1683 break;
1684 }
1685 case 18: {
1686 bitset<56> b(string("00000000000000000000000000000000000000001011111111010110"));
1687 return b;
1688 break;
1689 }
1690 case 17: {
1691 bitset<56> b(string("00000000000000000000000000000000000000001101111111010111"));
1692 return b;
1693 break;
1694 }
1695 case 16: {
1696 bitset<56> b(string("00000000000000000000000000000000000000001110111111010111"));
1697 return b;
1698 break;
1699 }
1700
1701 case 15: {
1702 bitset<56> b(string("00000000000000000000000000000000000000000000111111101001"));
1703 return b;
1704 break;
1705 }
1706 case 14: {
1707 bitset<56> b(string("00000000000000000000000000000000000000000000111111101010"));
1708 return b;
1709 break;
1710 }
1711 case 13: {
1712 bitset<56> b(string("00000000000000000000000000000000000000000000111111101011"));
1713 return b;
1714 break;
1715 }
1716 case 12: {
1717 bitset<56> b(string("00000000000000000000000000000000000000000000111111101011"));
1718 return b;
1719 break;
1720 }
1721
1722 case 11: {
1723 bitset<56> b(string("00000000000000000000000000000000000000000000010101111111"));
1724 return b;
1725 break;
1726 }
1727 case 10: {
1728 bitset<56> b(string("00000000000000000000000000000000000000000000001010111111"));
1729 return b;
1730 break;
1731 }
1732
1733 case 9: {
1734 bitset<56> b(string("00000000000000000000000000000000000000000000000101111111"));
1735 return b;
1736 break;
1737 }
1738 case 8: {
1739 bitset<56> b(string("00000000000000000000000000000000000000000000000010111111"));
1740 return b;
1741 break;
1742 }
1743
1744 case 7: {
1745 bitset<56> b(string("00000000000000000000000000000000000000000000000001111111"));
1746 return b;
1747 break;
1748 }
1749 case 6: {
1750 bitset<56> b(string("00000000000000000000000000000000000000000000000000111111"));
1751 return b;
1752 break;
1753 }
1754
1755 case 5: {
1756 bitset<56> b(string("00000000000000000000000000000000000000000000000000010111"));
1757 return b;
1758 break;
1759 }
1760 case 4: {
1761 bitset<56> b(string("00000000000000000000000000000000000000000000000000001011"));
1762 return b;
1763 break;
1764 }
1765
1766 case 3: {
1767 bitset<56> b(string("00000000000000000000000000000000000000000000000000000111"));
1768 return b;
1769 break;
1770 }
1771 case 2: {
1772 bitset<56> b(string("00000000000000000000000000000000000000000000000000000011"));
1773 return b;
1774 break;
1775 }
1776
1777 case 1: {
1778 bitset<56> b(string("00000000000000000000000000000000000000000000000000000001"));
1779 return b;
1780 break;
1781 }
1782 case 0: {
1783 bitset<56> b(string("00000000000000000000000000000000000000000000000000000000"));
1784 return b;
1785 break;
1786 }
1787 default: {
1788 bitset<56> b;
1789 return b;
1790 break;
1791 }
1792 }
1793 }