CMS 3D CMS Logo

L1MuBMTrackAssembler.cc
Go to the documentation of this file.
1 //-------------------------------------------------
2 //
3 // Class: L1MuBMTrackAssembler
4 //
5 // Description: Track Assembler
6 //
7 //
8 //
9 // Author :
10 // N. Neumeister CERN EP
11 //
12 //--------------------------------------------------
13 
14 //-----------------------
15 // This Class's Header --
16 //-----------------------
17 
19 
20 //---------------
21 // C++ Headers --
22 //---------------
23 
24 #include <iostream>
25 #include <string>
26 
27 //-------------------------------
28 // Collaborating Class Headers --
29 //-------------------------------
30 
34 
35 using namespace std;
36 
37 // --------------------------------
38 // class L1MuBMTrackAssembler
39 //---------------------------------
40 
41 //----------------
42 // Constructors --
43 //----------------
44 
46 
47 //--------------
48 // Destructor --
49 //--------------
50 
52 
53 //--------------
54 // Operations --
55 //--------------
56 
57 //
58 // run Track Assembler
59 //
61  // get the 18 bitmap tables from the Quality Sorter Unit
62 
63  bitset<12> b_adr12_8 = m_sp.EU()->getQSTable(EX12, 0);
64  bitset<12> b_adr12_9 = m_sp.EU()->getQSTable(EX12, 1);
65  bitset<12> b_adr13_8 = m_sp.EU()->getQSTable(EX13, 0);
66  bitset<12> b_adr13_9 = m_sp.EU()->getQSTable(EX13, 1);
67  bitset<12> b_adr14_8 = m_sp.EU()->getQSTable(EX14, 0);
68  bitset<12> b_adr14_9 = m_sp.EU()->getQSTable(EX14, 1);
69  bitset<12> b_adr23_8 = m_sp.EU()->getQSTable(EX23, 0);
70  bitset<12> b_adr23_9 = m_sp.EU()->getQSTable(EX23, 1);
71  bitset<12> b_adr23_0 = m_sp.EU()->getQSTable(EX23, 2);
72  bitset<12> b_adr23_1 = m_sp.EU()->getQSTable(EX23, 3);
73  bitset<12> b_adr24_8 = m_sp.EU()->getQSTable(EX24, 0);
74  bitset<12> b_adr24_9 = m_sp.EU()->getQSTable(EX24, 1);
75  bitset<12> b_adr24_0 = m_sp.EU()->getQSTable(EX24, 2);
76  bitset<12> b_adr24_1 = m_sp.EU()->getQSTable(EX24, 3);
77  bitset<12> b_adr34_8 = m_sp.EU()->getQSTable(EX34, 0);
78  bitset<12> b_adr34_9 = m_sp.EU()->getQSTable(EX34, 1);
79  bitset<12> b_adr34_0 = m_sp.EU()->getQSTable(EX34, 2);
80  bitset<12> b_adr34_1 = m_sp.EU()->getQSTable(EX34, 3);
81 
82  // Last segment node building
83 
84  bitset<12> n_1234_888 = (b_adr14_8 & b_adr24_8 & b_adr34_8);
85  bitset<12> n_1234_889 = (b_adr14_8 & b_adr24_8 & b_adr34_9);
86  bitset<12> n_1234_880 = (b_adr14_8 & b_adr24_8 & b_adr34_0);
87  bitset<12> n_1234_881 = (b_adr14_8 & b_adr24_8 & b_adr34_1);
88  bitset<12> n_1234_898 = (b_adr14_8 & b_adr24_9 & b_adr34_8);
89  bitset<12> n_1234_899 = (b_adr14_8 & b_adr24_9 & b_adr34_9);
90  bitset<12> n_1234_890 = (b_adr14_8 & b_adr24_9 & b_adr34_0);
91  bitset<12> n_1234_891 = (b_adr14_8 & b_adr24_9 & b_adr34_1);
92  bitset<12> n_1234_800 = (b_adr14_8 & b_adr24_0 & b_adr34_0);
93  bitset<12> n_1234_801 = (b_adr14_8 & b_adr24_0 & b_adr34_1);
94  bitset<12> n_1234_810 = (b_adr14_8 & b_adr24_1 & b_adr34_0);
95  bitset<12> n_1234_811 = (b_adr14_8 & b_adr24_1 & b_adr34_1);
96 
97  bitset<12> n_1234_988 = (b_adr14_9 & b_adr24_8 & b_adr34_8);
98  bitset<12> n_1234_989 = (b_adr14_9 & b_adr24_8 & b_adr34_9);
99  bitset<12> n_1234_980 = (b_adr14_9 & b_adr24_8 & b_adr34_0);
100  bitset<12> n_1234_981 = (b_adr14_9 & b_adr24_8 & b_adr34_1);
101  bitset<12> n_1234_998 = (b_adr14_9 & b_adr24_9 & b_adr34_8);
102  bitset<12> n_1234_999 = (b_adr14_9 & b_adr24_9 & b_adr34_9);
103  bitset<12> n_1234_990 = (b_adr14_9 & b_adr24_9 & b_adr34_0);
104  bitset<12> n_1234_991 = (b_adr14_9 & b_adr24_9 & b_adr34_1);
105  bitset<12> n_1234_900 = (b_adr14_9 & b_adr24_0 & b_adr34_0);
106  bitset<12> n_1234_901 = (b_adr14_9 & b_adr24_0 & b_adr34_1);
107  bitset<12> n_1234_910 = (b_adr14_9 & b_adr24_1 & b_adr34_0);
108  bitset<12> n_1234_911 = (b_adr14_9 & b_adr24_1 & b_adr34_1);
109 
110  bitset<12> n_123_88 = (b_adr13_8 & b_adr23_8);
111  bitset<12> n_123_89 = (b_adr13_8 & b_adr23_9);
112  bitset<12> n_123_80 = (b_adr13_8 & b_adr23_0);
113  bitset<12> n_123_81 = (b_adr13_8 & b_adr23_1);
114 
115  bitset<12> n_123_98 = (b_adr13_9 & b_adr23_8);
116  bitset<12> n_123_99 = (b_adr13_9 & b_adr23_9);
117  bitset<12> n_123_90 = (b_adr13_9 & b_adr23_0);
118  bitset<12> n_123_91 = (b_adr13_9 & b_adr23_1);
119 
120  bitset<12> n_124_88 = (b_adr14_8 & b_adr24_8);
121  bitset<12> n_124_89 = (b_adr14_8 & b_adr24_9);
122  bitset<12> n_124_80 = (b_adr14_8 & b_adr24_0);
123  bitset<12> n_124_81 = (b_adr14_8 & b_adr24_1);
124 
125  bitset<12> n_124_98 = (b_adr14_9 & b_adr24_8);
126  bitset<12> n_124_99 = (b_adr14_9 & b_adr24_9);
127  bitset<12> n_124_90 = (b_adr14_9 & b_adr24_0);
128  bitset<12> n_124_91 = (b_adr14_9 & b_adr24_1);
129 
130  bitset<12> n_134_88 = (b_adr14_8 & b_adr34_8);
131  bitset<12> n_134_89 = (b_adr14_8 & b_adr34_9);
132  bitset<12> n_134_80 = (b_adr14_8 & b_adr34_0);
133  bitset<12> n_134_81 = (b_adr14_8 & b_adr34_1);
134 
135  bitset<12> n_134_98 = (b_adr14_9 & b_adr34_8);
136  bitset<12> n_134_99 = (b_adr14_9 & b_adr34_9);
137  bitset<12> n_134_90 = (b_adr14_9 & b_adr34_0);
138  bitset<12> n_134_91 = (b_adr14_9 & b_adr34_1);
139 
140  bitset<12> n_234_88 = (b_adr24_8 & b_adr34_8);
141  bitset<12> n_234_89 = (b_adr24_8 & b_adr34_9);
142  bitset<12> n_234_80 = (b_adr24_8 & b_adr34_0);
143  bitset<12> n_234_81 = (b_adr24_8 & b_adr34_1);
144 
145  bitset<12> n_234_98 = (b_adr24_9 & b_adr34_8);
146  bitset<12> n_234_99 = (b_adr24_9 & b_adr34_9);
147  bitset<12> n_234_90 = (b_adr24_9 & b_adr34_0);
148  bitset<12> n_234_91 = (b_adr24_9 & b_adr34_1);
149 
150  bitset<12> n_12_8 = b_adr12_8;
151  bitset<12> n_12_9 = b_adr12_9;
152 
153  bitset<12> n_13_8 = b_adr13_8;
154  bitset<12> n_13_9 = b_adr13_9;
155 
156  bitset<12> n_14_8 = b_adr14_8;
157  bitset<12> n_14_9 = b_adr14_9;
158 
159  bitset<12> n_23_8 = b_adr23_8;
160  bitset<12> n_23_9 = b_adr23_9;
161 
162  bitset<12> n_24_8 = b_adr24_8;
163  bitset<12> n_24_9 = b_adr24_9;
164 
165  bitset<12> n_34_8 = b_adr34_8;
166  bitset<12> n_34_9 = b_adr34_9;
167 
168  // Last address encoders
169 
170  m_theLastAddress[67] = addressEncoder12(n_1234_888);
171  m_theLastAddress[66] = addressEncoder12(n_1234_889);
172  m_theLastAddress[65] = addressEncoder12(n_1234_880);
173  m_theLastAddress[64] = addressEncoder12(n_1234_881);
174 
175  m_theLastAddress[63] = addressEncoder12(n_1234_898);
176  m_theLastAddress[62] = addressEncoder12(n_1234_899);
177  m_theLastAddress[61] = addressEncoder12(n_1234_890);
178  m_theLastAddress[60] = addressEncoder12(n_1234_891);
179 
180  m_theLastAddress[59] = addressEncoder12(n_1234_800);
181  m_theLastAddress[58] = addressEncoder12(n_1234_801);
182  m_theLastAddress[57] = addressEncoder12(n_1234_810);
183  m_theLastAddress[56] = addressEncoder12(n_1234_811);
184 
185  m_theLastAddress[55] = addressEncoder12(n_1234_988);
186  m_theLastAddress[54] = addressEncoder12(n_1234_989);
187  m_theLastAddress[53] = addressEncoder12(n_1234_980);
188  m_theLastAddress[52] = addressEncoder12(n_1234_981);
189 
190  m_theLastAddress[51] = addressEncoder12(n_1234_998);
191  m_theLastAddress[50] = addressEncoder12(n_1234_999);
192  m_theLastAddress[49] = addressEncoder12(n_1234_990);
193  m_theLastAddress[48] = addressEncoder12(n_1234_991);
194 
195  m_theLastAddress[47] = addressEncoder12(n_1234_900);
196  m_theLastAddress[46] = addressEncoder12(n_1234_901);
197  m_theLastAddress[45] = addressEncoder12(n_1234_910);
198  m_theLastAddress[44] = addressEncoder12(n_1234_911);
199 
200  m_theLastAddress[43] = addressEncoder12(n_123_88);
201  m_theLastAddress[42] = addressEncoder12(n_123_89);
202  m_theLastAddress[41] = addressEncoder12(n_123_80);
203  m_theLastAddress[40] = addressEncoder12(n_123_81);
204 
205  m_theLastAddress[39] = addressEncoder12(n_123_98);
206  m_theLastAddress[38] = addressEncoder12(n_123_99);
207  m_theLastAddress[37] = addressEncoder12(n_123_90);
208  m_theLastAddress[36] = addressEncoder12(n_123_91);
209 
210  m_theLastAddress[35] = addressEncoder12(n_124_88);
211  m_theLastAddress[34] = addressEncoder12(n_124_89);
212  m_theLastAddress[33] = addressEncoder12(n_124_80);
213  m_theLastAddress[32] = addressEncoder12(n_124_81);
214 
215  m_theLastAddress[31] = addressEncoder12(n_124_98);
216  m_theLastAddress[30] = addressEncoder12(n_124_99);
217  m_theLastAddress[29] = addressEncoder12(n_124_90);
218  m_theLastAddress[28] = addressEncoder12(n_124_91);
219 
220  m_theLastAddress[27] = addressEncoder12(n_134_88);
221  m_theLastAddress[26] = addressEncoder12(n_134_89);
222  m_theLastAddress[25] = addressEncoder12(n_134_80);
223  m_theLastAddress[24] = addressEncoder12(n_134_81);
224 
225  m_theLastAddress[23] = addressEncoder12(n_134_98);
226  m_theLastAddress[22] = addressEncoder12(n_134_99);
227  m_theLastAddress[21] = addressEncoder12(n_134_90);
228  m_theLastAddress[20] = addressEncoder12(n_134_91);
229 
230  m_theLastAddress[19] = addressEncoder12(n_234_88);
231  m_theLastAddress[18] = addressEncoder12(n_234_89);
232  m_theLastAddress[17] = addressEncoder12(n_234_80);
233  m_theLastAddress[16] = addressEncoder12(n_234_81);
234 
235  m_theLastAddress[15] = addressEncoder12(n_234_98);
236  m_theLastAddress[14] = addressEncoder12(n_234_99);
237  m_theLastAddress[13] = addressEncoder12(n_234_90);
238  m_theLastAddress[12] = addressEncoder12(n_234_91);
239 
240  m_theLastAddress[11] = addressEncoder12(n_12_8);
241  m_theLastAddress[10] = addressEncoder12(n_12_9);
242 
243  m_theLastAddress[9] = addressEncoder12(n_13_8);
244  m_theLastAddress[8] = addressEncoder12(n_13_9);
245 
246  m_theLastAddress[7] = addressEncoder12(n_14_8);
247  m_theLastAddress[6] = addressEncoder12(n_14_9);
248 
249  m_theLastAddress[5] = addressEncoder12(n_23_8);
250  m_theLastAddress[4] = addressEncoder12(n_23_9);
251 
252  m_theLastAddress[3] = addressEncoder12(n_24_8);
253  m_theLastAddress[2] = addressEncoder12(n_24_9);
254 
255  m_theLastAddress[1] = addressEncoder12(n_34_8);
256  m_theLastAddress[0] = addressEncoder12(n_34_9);
257 
258  m_theLastAddressI[11] = addressEncoder12s(n_12_8);
259  m_theLastAddressI[10] = addressEncoder12s(n_12_9);
270 
271  // Main equations (68)
272 
273  m_thePriorityTable1[67] = (b_adr12_8[0] & b_adr13_8[0] & b_adr23_8[0] & n_1234_888.any());
274  m_thePriorityTable1[66] = (b_adr12_8[0] & b_adr13_8[1] & b_adr23_8[1] & n_1234_889.any());
275  m_thePriorityTable1[65] = (b_adr12_8[0] & b_adr13_8[2] & b_adr23_8[2] & n_1234_880.any());
276  m_thePriorityTable1[64] = (b_adr12_8[0] & b_adr13_8[3] & b_adr23_8[3] & n_1234_881.any());
277  m_thePriorityTable1[63] = (b_adr12_8[1] & b_adr13_8[0] & b_adr23_9[0] & n_1234_898.any());
278  m_thePriorityTable1[62] = (b_adr12_8[1] & b_adr13_8[1] & b_adr23_9[1] & n_1234_899.any());
279  m_thePriorityTable1[61] = (b_adr12_8[1] & b_adr13_8[2] & b_adr23_9[2] & n_1234_890.any());
280  m_thePriorityTable1[60] = (b_adr12_8[1] & b_adr13_8[3] & b_adr23_9[3] & n_1234_891.any());
281  m_thePriorityTable1[59] = (b_adr12_8[2] & b_adr13_8[2] & b_adr23_0[2] & n_1234_800.any());
282  m_thePriorityTable1[58] = (b_adr12_8[2] & b_adr13_8[3] & b_adr23_0[3] & n_1234_801.any());
283  m_thePriorityTable1[57] = (b_adr12_8[3] & b_adr13_8[2] & b_adr23_1[2] & n_1234_810.any());
284  m_thePriorityTable1[56] = (b_adr12_8[3] & b_adr13_8[3] & b_adr23_1[3] & n_1234_811.any());
285 
286  m_thePriorityTable1[55] = (b_adr12_9[0] & b_adr13_9[0] & b_adr23_8[0] & n_1234_988.any());
287  m_thePriorityTable1[54] = (b_adr12_9[0] & b_adr13_9[1] & b_adr23_8[1] & n_1234_989.any());
288  m_thePriorityTable1[53] = (b_adr12_9[0] & b_adr13_9[2] & b_adr23_8[2] & n_1234_980.any());
289  m_thePriorityTable1[52] = (b_adr12_9[0] & b_adr13_9[3] & b_adr23_8[3] & n_1234_981.any());
290  m_thePriorityTable1[51] = (b_adr12_9[1] & b_adr13_9[0] & b_adr23_9[0] & n_1234_998.any());
291  m_thePriorityTable1[50] = (b_adr12_9[1] & b_adr13_9[1] & b_adr23_9[1] & n_1234_999.any());
292  m_thePriorityTable1[49] = (b_adr12_9[1] & b_adr13_9[2] & b_adr23_9[2] & n_1234_990.any());
293  m_thePriorityTable1[48] = (b_adr12_9[1] & b_adr13_9[3] & b_adr23_9[3] & n_1234_991.any());
294  m_thePriorityTable1[47] = (b_adr12_9[2] & b_adr13_9[2] & b_adr23_0[2] & n_1234_900.any());
295  m_thePriorityTable1[46] = (b_adr12_9[2] & b_adr13_9[3] & b_adr23_0[3] & n_1234_901.any());
296  m_thePriorityTable1[45] = (b_adr12_9[3] & b_adr13_9[2] & b_adr23_1[2] & n_1234_910.any());
297  m_thePriorityTable1[44] = (b_adr12_9[3] & b_adr13_9[3] & b_adr23_1[3] & n_1234_911.any());
298 
299  m_thePriorityTable1[43] = (b_adr12_8[0] & n_123_88.any());
300  m_thePriorityTable1[42] = (b_adr12_8[1] & n_123_89.any());
301  m_thePriorityTable1[41] = (b_adr12_8[2] & n_123_80.any());
302  m_thePriorityTable1[40] = (b_adr12_8[3] & n_123_81.any());
303 
304  m_thePriorityTable1[39] = (b_adr12_9[0] & n_123_98.any());
305  m_thePriorityTable1[38] = (b_adr12_9[1] & n_123_99.any());
306  m_thePriorityTable1[37] = (b_adr12_9[2] & n_123_90.any());
307  m_thePriorityTable1[36] = (b_adr12_9[3] & n_123_91.any());
308 
309  m_thePriorityTable1[35] = (b_adr12_8[0] & n_124_88.any());
310  m_thePriorityTable1[34] = (b_adr12_8[1] & n_124_89.any());
311  m_thePriorityTable1[33] = (b_adr12_8[2] & n_124_80.any());
312  m_thePriorityTable1[32] = (b_adr12_8[3] & n_124_81.any());
313 
314  m_thePriorityTable1[31] = (b_adr12_9[0] & n_124_98.any());
315  m_thePriorityTable1[30] = (b_adr12_9[1] & n_124_99.any());
316  m_thePriorityTable1[29] = (b_adr12_9[2] & n_124_90.any());
317  m_thePriorityTable1[28] = (b_adr12_9[3] & n_124_91.any());
318 
319  m_thePriorityTable1[27] = (b_adr13_8[0] & n_134_88.any());
320  m_thePriorityTable1[26] = (b_adr13_8[1] & n_134_89.any());
321  m_thePriorityTable1[25] = (b_adr13_8[2] & n_134_80.any());
322  m_thePriorityTable1[24] = (b_adr13_8[3] & n_134_81.any());
323 
324  m_thePriorityTable1[23] = (b_adr13_9[0] & n_134_98.any());
325  m_thePriorityTable1[22] = (b_adr13_9[1] & n_134_99.any());
326  m_thePriorityTable1[21] = (b_adr13_9[2] & n_134_90.any());
327  m_thePriorityTable1[20] = (b_adr13_9[3] & n_134_91.any());
328 
329  m_thePriorityTable1[19] = (b_adr23_8[0] & n_234_88.any());
330  m_thePriorityTable1[18] = (b_adr23_8[1] & n_234_89.any());
331  m_thePriorityTable1[17] = (b_adr23_8[2] & n_234_80.any());
332  m_thePriorityTable1[16] = (b_adr23_8[3] & n_234_81.any());
333 
334  m_thePriorityTable1[15] = (b_adr23_9[0] & n_234_98.any());
335  m_thePriorityTable1[14] = (b_adr23_9[1] & n_234_99.any());
336  m_thePriorityTable1[13] = (b_adr23_9[2] & n_234_90.any());
337  m_thePriorityTable1[12] = (b_adr23_9[3] & n_234_91.any());
338 
339  m_thePriorityTable1[11] = n_12_8.any();
340  m_thePriorityTable1[10] = n_12_9.any();
341 
342  m_thePriorityTable1[9] = n_13_8.any();
343  m_thePriorityTable1[8] = n_13_9.any();
344 
345  m_thePriorityTable1[7] = n_14_8.any();
346  m_thePriorityTable1[6] = n_14_9.any();
347 
348  m_thePriorityTable1[5] = n_23_8.any();
349  m_thePriorityTable1[4] = n_23_9.any();
350 
351  m_thePriorityTable1[3] = n_24_8.any();
352  m_thePriorityTable1[2] = n_24_9.any();
353 
354  m_thePriorityTable1[1] = n_34_8.any();
355  m_thePriorityTable1[0] = n_34_9.any();
356 
357  if (!m_thePriorityTable1.any())
358  return;
359 
360  // first Priority Encoder Sub-Unit
361  unsigned int global1 = 0;
362  unsigned int group1 = 0;
363  unsigned int p1 = 0;
364  runEncoderSubUnit1(global1, group1, p1);
365 
366  // Address Assignment for the highest priority track
367  runAddressAssignment1(global1, group1);
368 
369  // Cancellation and second Track Finder Unit
370  for (int i = 0; i < 56; i++) {
372  }
374 
375  if (!m_thePriorityTable2.any())
376  return;
377 
378  // second Priority Encoder Sub-Unit
379  unsigned int global2 = 0;
380  unsigned int group2 = 0;
381  unsigned int p2 = 0;
382  runEncoderSubUnit2(global2, group2, p2);
383 
384  // Address Assignment for the second priority track
385  runAddressAssignment2(global2, group2);
386 
387  // Fake Pair Cancellation Unit
388 
389  unsigned int s1_2 = m_theAddresses[1].station(1);
390  unsigned int s2_2 = m_theAddresses[1].station(2);
391  unsigned int s3_2 = m_theAddresses[1].station(3);
392  unsigned int s4_2 = m_theAddresses[1].station(4);
393 
394  if (s2_2 == m_theAddresses[0].station(2)) {
395  s2_2 = 15;
396  m_theBitMaps[1].reset(1);
397  m_theAddresses[1].setStation(2, 15);
398  if (m_theTCs[1] == T1234)
399  m_theTCs[1] = T134;
400  if (m_theTCs[1] == T123)
401  m_theTCs[1] = T13;
402  if (m_theTCs[1] == T124)
403  m_theTCs[1] = T14;
404  if (m_theTCs[1] == T234)
405  m_theTCs[1] = T34;
406  }
407  if (s3_2 == m_theAddresses[0].station(3)) {
408  s3_2 = 15;
409  m_theBitMaps[1].reset(2);
410  m_theAddresses[1].setStation(3, 15);
411  if (m_theTCs[1] == T1234)
412  m_theTCs[1] = T124;
413  if (m_theTCs[1] == T123)
414  m_theTCs[1] = T12;
415  if (m_theTCs[1] == T134)
416  m_theTCs[1] = T14;
417  if (m_theTCs[1] == T234)
418  m_theTCs[1] = T24;
419  }
420  if (s4_2 == m_theAddresses[0].station(4)) {
421  s4_2 = 15;
422  m_theBitMaps[1].reset(3);
423  m_theAddresses[1].setStation(4, 15);
424  if (m_theTCs[1] == T1234)
425  m_theTCs[1] = T123;
426  if (m_theTCs[1] == T124)
427  m_theTCs[1] = T12;
428  if (m_theTCs[1] == T134)
429  m_theTCs[1] = T13;
430  if (m_theTCs[1] == T234)
431  m_theTCs[1] = T23;
432  }
433 
434  if ((s2_2 == 15 && s3_2 == 15 && s4_2 == 15) || (s1_2 == 15 && s3_2 == 15 && s4_2 == 15) ||
435  (s1_2 == 15 && s2_2 == 15 && s4_2 == 15) || (s1_2 == 15 && s2_2 == 15 && s3_2 == 15)) {
436  if (L1MuBMTFConfig::Debug(5))
437  cout << "L1MuBMTrackAssembler: second track has been cancelled" << endl;
438  if (L1MuBMTFConfig::Debug(5))
439  print();
440 
441  m_theTCs[1] = UNDEF;
442  m_theAddresses[1].reset();
443  m_theBitMaps[1].reset();
444  }
445 
446  /*
447  if ( m_theBitMaps[1].to_ulong() != tc2bitmap(m_theTCs[1]) ) {
448  if ( L1MuBMTFConfig::Debug(5) ) cout << "L1MuBMTrackAssembler: second track has been cancelled" << endl;
449  if ( L1MuBMTFConfig::Debug(5) ) print();
450 
451  m_theTCs[1] = UNDEF;
452  m_theAddresses[1].reset();
453  m_theBitMaps[1].reset();
454  }
455 */
456 }
457 
458 //
459 // reset Track Assembler
460 //
462  for (int i = 0; i < 68; i++)
463  m_theLastAddress[i] = 15;
464  for (int j = 0; j < 12; j++)
465  m_theLastAddressI[j] = 15;
466  m_thePriorityTable1.reset();
467  m_thePriorityTable2.reset();
468  m_theTCs[0] = UNDEF;
469  m_theTCs[1] = UNDEF;
470  m_theBitMaps[0].reset();
471  m_theBitMaps[1].reset();
472  m_theAddresses[0].reset();
473  m_theAddresses[1].reset();
474 }
475 
476 //
477 // print result of Track Assembler
478 //
480  cout << "Track Assembler : " << endl;
481  cout << " Priority Table 1 : " << m_thePriorityTable1 << endl;
482  cout << " Priority Table 2 : "
483  << " " << m_thePriorityTable2 << endl;
484 
485  // print result
486  cout << "Track 1: " << m_theTCs[0] << " " << m_theBitMaps[0] << '\t' << m_theAddresses[0] << endl;
487  cout << "Track 2: " << m_theTCs[1] << " " << m_theBitMaps[1] << '\t' << m_theAddresses[1] << endl;
488 }
489 
490 //
491 // run the first Priority Encoder Sub-Unit
492 //
493 void L1MuBMTrackAssembler::runEncoderSubUnit1(unsigned& global, unsigned& group, unsigned& priority) {
494  // Global Grouping
495 
496  bitset<22> exi;
497 
512  exi[11] = m_thePriorityTable1[11];
513  exi[10] = m_thePriorityTable1[10];
514  exi[9] = m_thePriorityTable1[9];
515  exi[8] = m_thePriorityTable1[8];
516  exi[7] = m_thePriorityTable1[7];
517  exi[6] = m_thePriorityTable1[6];
518  exi[5] = m_thePriorityTable1[5];
519  exi[4] = m_thePriorityTable1[4];
520  exi[3] = m_thePriorityTable1[3];
521  exi[2] = m_thePriorityTable1[2];
522  exi[1] = m_thePriorityTable1[1];
523  exi[0] = m_thePriorityTable1[0];
524 
525  // Global Priority Encoder
526 
527  global = priorityEncoder22(exi);
528  if (global == 31) {
529  group = 15;
530  priority = 0;
531  return;
532  }
533 
534  // Group priority encoders
535 
536  bitset<12> x;
537  x = subBitset68(m_thePriorityTable1, 56, 12);
538  unsigned int prio1234a = priorityEncoder12(x);
539  x = subBitset68(m_thePriorityTable1, 44, 12);
540  unsigned int prio1234b = priorityEncoder12(x);
541 
542  bitset<4> y;
544  unsigned int prio123a = priorityEncoder4(y);
546  unsigned int prio123b = priorityEncoder4(y);
548  unsigned int prio124a = priorityEncoder4(y);
550  unsigned int prio124b = priorityEncoder4(y);
552  unsigned int prio134a = priorityEncoder4(y);
554  unsigned int prio134b = priorityEncoder4(y);
556  unsigned int prio234a = priorityEncoder4(y);
558  unsigned int prio234b = priorityEncoder4(y);
559 
560  switch (global) {
561  case 21: {
562  group = prio1234a;
563  priority = 56 + group;
564  break;
565  }
566  case 20: {
567  group = prio1234b;
568  priority = 44 + group;
569  break;
570  }
571  case 19: {
572  group = prio123a;
573  priority = 40 + group;
574  break;
575  }
576  case 18: {
577  group = prio123b;
578  priority = 36 + group;
579  break;
580  }
581  case 17: {
582  group = prio124a;
583  priority = 32 + group;
584  break;
585  }
586  case 16: {
587  group = prio124b;
588  priority = 28 + group;
589  break;
590  }
591  case 15: {
592  group = prio134a;
593  priority = 24 + group;
594  break;
595  }
596  case 14: {
597  group = prio134b;
598  priority = 20 + group;
599  break;
600  }
601  case 13: {
602  group = prio234a;
603  priority = 16 + group;
604  break;
605  }
606  case 12: {
607  group = prio234b;
608  priority = 12 + group;
609  break;
610  }
611  default: {
612  group = 15;
613  priority = global;
614  break;
615  }
616  }
617 }
618 
619 //
620 // run the second Priority Encoder Sub-Unit
621 //
622 void L1MuBMTrackAssembler::runEncoderSubUnit2(unsigned& global, unsigned& group, unsigned& priority) {
623  // Global Grouping
624 
625  bitset<21> exi;
626 
638  exi[11] = m_thePriorityTable2[11];
639  exi[10] = m_thePriorityTable2[10];
640  exi[9] = m_thePriorityTable2[9];
641  exi[8] = m_thePriorityTable2[8];
642  exi[7] = m_thePriorityTable2[7];
643  exi[6] = m_thePriorityTable2[6];
644  exi[5] = m_thePriorityTable2[5];
645  exi[4] = m_thePriorityTable2[4];
646  exi[3] = m_thePriorityTable2[3];
647  exi[2] = m_thePriorityTable2[2];
648  exi[1] = m_thePriorityTable2[1];
649  exi[0] = m_thePriorityTable2[0];
650 
651  // Global Priority Encoder
652 
653  global = priorityEncoder21(exi);
654  if (global == 31) {
655  group = 15;
656  priority = 0;
657  return;
658  }
659 
660  // Group priority encoders
661 
662  bitset<12> x;
663  x = subBitset56(m_thePriorityTable2, 44, 12);
664  unsigned int prio1234b = priorityEncoder12(x);
665 
666  bitset<4> y;
668  unsigned int prio123a = priorityEncoder4(y);
670  unsigned int prio123b = priorityEncoder4(y);
672  unsigned int prio124a = priorityEncoder4(y);
674  unsigned int prio124b = priorityEncoder4(y);
676  unsigned int prio134a = priorityEncoder4(y);
678  unsigned int prio134b = priorityEncoder4(y);
680  unsigned int prio234a = priorityEncoder4(y);
682  unsigned int prio234b = priorityEncoder4(y);
683 
684  switch (global) {
685  case 20: {
686  group = prio1234b;
687  priority = 44 + group;
688  break;
689  }
690  case 19: {
691  group = prio123a;
692  priority = 40 + group;
693  break;
694  }
695  case 18: {
696  group = prio123b;
697  priority = 36 + group;
698  break;
699  }
700  case 17: {
701  group = prio124a;
702  priority = 32 + group;
703  break;
704  }
705  case 16: {
706  group = prio124b;
707  priority = 28 + group;
708  break;
709  }
710  case 15: {
711  group = prio134a;
712  priority = 24 + group;
713  break;
714  }
715  case 14: {
716  group = prio134b;
717  priority = 20 + group;
718  break;
719  }
720  case 13: {
721  group = prio234a;
722  priority = 16 + group;
723  break;
724  }
725  case 12: {
726  group = prio234b;
727  priority = 12 + group;
728  break;
729  }
730  default: {
731  group = 15;
732  priority = global;
733  break;
734  }
735  }
736 }
737 
738 //
739 // run the first Address Assignment Sub-Unit
740 //
742  TrackClass tc(UNDEF);
743 
744  switch (global) {
745  case 21: {
746  tc = T1234;
747  switch (group) {
748  case 11:
750  break;
751  case 10:
753  break;
754  case 9:
756  break;
757  case 8:
759  break;
760  case 7:
762  break;
763  case 6:
765  break;
766  case 5:
768  break;
769  case 4:
771  break;
772  case 3:
774  break;
775  case 2:
777  break;
778  case 1:
780  break;
781  case 0:
783  break;
784  }
785  break;
786  }
787  case 20: {
788  tc = T1234;
789  switch (group) {
790  case 11:
792  break;
793  case 10:
795  break;
796  case 9:
798  break;
799  case 8:
801  break;
802  case 7:
804  break;
805  case 6:
807  break;
808  case 5:
810  break;
811  case 4:
813  break;
814  case 3:
816  break;
817  case 2:
819  break;
820  case 1:
822  break;
823  case 0:
825  break;
826  }
827  break;
828  }
829  case 19: {
830  tc = T123;
831  switch (group) {
832  case 3:
833  m_theAddresses[0].setStations(0, 0, m_theLastAddress[43], 15);
834  break;
835  case 2:
836  m_theAddresses[0].setStations(0, 1, m_theLastAddress[42], 15);
837  break;
838  case 1:
839  m_theAddresses[0].setStations(0, 2, m_theLastAddress[41], 15);
840  break;
841  case 0:
842  m_theAddresses[0].setStations(0, 3, m_theLastAddress[40], 15);
843  break;
844  }
845  break;
846  }
847  case 18: {
848  tc = T123;
849  switch (group) {
850  case 3:
851  m_theAddresses[0].setStations(1, 0, m_theLastAddress[39], 15);
852  break;
853  case 2:
854  m_theAddresses[0].setStations(1, 1, m_theLastAddress[38], 15);
855  break;
856  case 1:
857  m_theAddresses[0].setStations(1, 2, m_theLastAddress[37], 15);
858  break;
859  case 0:
860  m_theAddresses[0].setStations(1, 3, m_theLastAddress[36], 15);
861  break;
862  }
863  break;
864  }
865  case 17: {
866  tc = T124;
867  switch (group) {
868  case 3:
869  m_theAddresses[0].setStations(0, 0, 15, m_theLastAddress[35]);
870  break;
871  case 2:
872  m_theAddresses[0].setStations(0, 1, 15, m_theLastAddress[34]);
873  break;
874  case 1:
875  m_theAddresses[0].setStations(0, 2, 15, m_theLastAddress[33]);
876  break;
877  case 0:
878  m_theAddresses[0].setStations(0, 3, 15, m_theLastAddress[32]);
879  break;
880  }
881  break;
882  }
883  case 16: {
884  tc = T124;
885  switch (group) {
886  case 3:
887  m_theAddresses[0].setStations(1, 0, 15, m_theLastAddress[31]);
888  break;
889  case 2:
890  m_theAddresses[0].setStations(1, 1, 15, m_theLastAddress[30]);
891  break;
892  case 1:
893  m_theAddresses[0].setStations(1, 2, 15, m_theLastAddress[29]);
894  break;
895  case 0:
896  m_theAddresses[0].setStations(1, 3, 15, m_theLastAddress[28]);
897  break;
898  }
899  break;
900  }
901  case 15: {
902  tc = T134;
903  switch (group) {
904  case 3:
905  m_theAddresses[0].setStations(0, 15, 0, m_theLastAddress[27]);
906  break;
907  case 2:
908  m_theAddresses[0].setStations(0, 15, 1, m_theLastAddress[26]);
909  break;
910  case 1:
911  m_theAddresses[0].setStations(0, 15, 2, m_theLastAddress[25]);
912  break;
913  case 0:
914  m_theAddresses[0].setStations(0, 15, 3, m_theLastAddress[24]);
915  break;
916  }
917  break;
918  }
919  case 14: {
920  tc = T134;
921  switch (group) {
922  case 3:
923  m_theAddresses[0].setStations(1, 15, 0, m_theLastAddress[23]);
924  break;
925  case 2:
926  m_theAddresses[0].setStations(1, 15, 1, m_theLastAddress[22]);
927  break;
928  case 1:
929  m_theAddresses[0].setStations(1, 15, 2, m_theLastAddress[21]);
930  break;
931  case 0:
932  m_theAddresses[0].setStations(1, 15, 3, m_theLastAddress[20]);
933  break;
934  }
935  break;
936  }
937  case 13: {
938  tc = T234;
939  switch (group) {
940  case 3:
941  m_theAddresses[0].setStations(15, 0, 0, m_theLastAddress[19]);
942  break;
943  case 2:
944  m_theAddresses[0].setStations(15, 0, 1, m_theLastAddress[18]);
945  break;
946  case 1:
947  m_theAddresses[0].setStations(15, 0, 2, m_theLastAddress[17]);
948  break;
949  case 0:
950  m_theAddresses[0].setStations(15, 0, 3, m_theLastAddress[16]);
951  break;
952  }
953  break;
954  }
955  case 12: {
956  tc = T234;
957  switch (group) {
958  case 3:
959  m_theAddresses[0].setStations(15, 1, 0, m_theLastAddress[15]);
960  break;
961  case 2:
962  m_theAddresses[0].setStations(15, 1, 1, m_theLastAddress[14]);
963  break;
964  case 1:
965  m_theAddresses[0].setStations(15, 1, 2, m_theLastAddress[13]);
966  break;
967  case 0:
968  m_theAddresses[0].setStations(15, 1, 3, m_theLastAddress[12]);
969  break;
970  }
971  break;
972  }
973  case 11: {
974  tc = T12;
975  m_theAddresses[0].setStations(0, m_theLastAddress[11], 15, 15);
976  break;
977  }
978  case 10: {
979  tc = T12;
980  m_theAddresses[0].setStations(1, m_theLastAddress[10], 15, 15);
981  break;
982  }
983  case 9: {
984  tc = T13;
985  m_theAddresses[0].setStations(0, 15, m_theLastAddress[9], 15);
986  break;
987  }
988  case 8: {
989  tc = T13;
990  m_theAddresses[0].setStations(1, 15, m_theLastAddress[8], 15);
991  break;
992  }
993  case 7: {
994  tc = T14;
995  m_theAddresses[0].setStations(0, 15, 15, m_theLastAddress[7]);
996  break;
997  }
998  case 6: {
999  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  // set Track Class and covert to bitmap
1036  m_theTCs[0] = tc;
1037  m_theBitMaps[0] = tc2bitmap(tc);
1038 }
1039 
1040 //
1041 // run the second Address Assignment Sub-Unit
1042 //
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  // set Track Class and covert to bitmap
1296  m_theTCs[1] = tc;
1297  m_theBitMaps[1] = tc2bitmap(tc);
1298 }
1299 
1300 //
1301 // 12 bit priority encoder
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 // 4 bit priority encoder
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 // 22 bit priority encoder
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 // 21 bit priority encoder
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 // 12 bit address encoder
1358 //
1359 unsigned int L1MuBMTrackAssembler::addressEncoder12(const bitset<12>& input) {
1360  // inverse order priority encoder
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 // special 12 bit address encoder
1376 //
1377 unsigned int L1MuBMTrackAssembler::addressEncoder12s(const bitset<12>& input) {
1378  // inverse order priority encoder which prefers second addresses
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 // get sub-bitmap of a 68-bit word
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 // get sub-bitmap of a 56-bit word
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 // Cancel Out Table
1425 //
1427  // Cancellation Table
1428  // Each 0 in this Table means a sub-track of the
1429  // previous found Track
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 }
L1MuBMExtrapolationUnit.h
DDAxes::y
mps_fire.i
i
Definition: mps_fire.py:355
input
static const std::string input
Definition: EdmProvDump.cc:48
EX13
Definition: L1MuDTExtParam.h:22
L1MuBMTrackAssembler::priorityEncoder22
static unsigned int priorityEncoder22(const std::bitset< 22 > &input)
22 bit priority encoder
Definition: L1MuBMTrackAssembler.cc:1331
L1MuBMTrackAssembler::runEncoderSubUnit1
void runEncoderSubUnit1(unsigned &global, unsigned &group, unsigned &priority)
run the first Priority Encoder Sub-Unit
Definition: L1MuBMTrackAssembler.cc:493
L1MuBMTrackAssembler::subBitset68
static unsigned long subBitset68(const std::bitset< 68 > &input, int pos, int length)
get sub-bitmap of a 68-bit word
Definition: L1MuBMTrackAssembler.cc:1398
T14
Definition: L1MuBMTrackAssParam.h:21
L1MuBMTrackAssembler::priorityEncoder12
static unsigned int priorityEncoder12(const std::bitset< 12 > &input)
12 bit priority encoder
Definition: L1MuBMTrackAssembler.cc:1303
relativeConstraints.station
station
Definition: relativeConstraints.py:67
L1MuBMAddressArray::setStations
void setStations(int adr1, int adr2, int adr3, int adr4)
set addresses of all four stations
Definition: L1MuBMAddressArray.cc:118
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
tc2bitmap
const unsigned int tc2bitmap(const TrackClass tc)
Definition: L1MuBMTrackAssParam.cc:52
gather_cfg.cout
cout
Definition: gather_cfg.py:144
pos
Definition: PixelAliasList.h:18
T123
Definition: L1MuBMTrackAssParam.h:21
L1MuBMAddressArray::station
unsigned short station(int stat) const
get address of a given station [1-4]
Definition: L1MuBMAddressArray.h:80
T12
Definition: L1MuBMTrackAssParam.h:21
T134
Definition: L1MuBMTrackAssParam.h:21
DDAxes::x
L1MuBMSectorProcessor
Definition: L1MuBMSectorProcessor.h:54
L1MuBMTrackAssembler::runAddressAssignment2
void runAddressAssignment2(int global, int group)
run the second Address Assignment Sub-Unit
Definition: L1MuBMTrackAssembler.cc:1043
L1MuBMAddressArray::reset
void reset()
reset address array
Definition: L1MuBMAddressArray.cc:100
EX34
Definition: L1MuDTExtParam.h:22
L1MuBMTrackAssembler::~L1MuBMTrackAssembler
~L1MuBMTrackAssembler() override
destructor
Definition: L1MuBMTrackAssembler.cc:51
L1MuBMTrackAssembler::m_theBitMaps
std::bitset< 4 > m_theBitMaps[2]
Definition: L1MuBMTrackAssembler.h:130
L1MuBMTrackAssembler::runAddressAssignment1
void runAddressAssignment1(int global, int group)
run the first Address Assignment Sub-Unit
Definition: L1MuBMTrackAssembler.cc:741
L1MuBMTrackAssembler::run
void run() override
run Track Assembler
Definition: L1MuBMTrackAssembler.cc:60
alignCSCRings.s
s
Definition: alignCSCRings.py:92
T234
Definition: L1MuBMTrackAssParam.h:21
L1MuBMTrackAssembler::m_thePriorityTable1
std::bitset< 68 > m_thePriorityTable1
Definition: L1MuBMTrackAssembler.h:124
p2
double p2[4]
Definition: TauolaWrapper.h:90
L1MuBMTrackAssembler::m_thePriorityTable2
std::bitset< 56 > m_thePriorityTable2
Definition: L1MuBMTrackAssembler.h:125
L1MuBMExtrapolationUnit::getQSTable
const std::bitset< 12 > & getQSTable(Extrapolation ext, unsigned int startAdr) const
get Quality Sorter table for a given SEU
Definition: L1MuBMExtrapolationUnit.cc:226
L1MuBMTFConfig::Debug
static bool Debug()
Definition: L1MuBMTFConfig.h:54
b
double b
Definition: hdecay.h:118
T13
Definition: L1MuBMTrackAssParam.h:21
T34
Definition: L1MuBMTrackAssParam.h:21
EX23
Definition: L1MuDTExtParam.h:22
TrackClass
TrackClass
Definition: L1MuBMTrackAssParam.h:21
L1MuBMTrackAssembler::priorityEncoder21
static unsigned int priorityEncoder21(const std::bitset< 21 > &input)
21 bit priority encoder
Definition: L1MuBMTrackAssembler.cc:1345
L1MuBMTrackAssembler::m_theAddresses
L1MuBMAddressArray m_theAddresses[2]
Definition: L1MuBMTrackAssembler.h:131
EX12
Definition: L1MuDTExtParam.h:22
L1MuBMTrackAssembler::priorityEncoder4
static unsigned int priorityEncoder4(const std::bitset< 4 > &input)
4 bit priority encoder
Definition: L1MuBMTrackAssembler.cc:1317
L1MuBMTrackAssembler::m_theLastAddressI
unsigned int m_theLastAddressI[12]
Definition: L1MuBMTrackAssembler.h:127
L1MuBMTFConfig.h
T124
Definition: L1MuBMTrackAssParam.h:21
L1MuBMTrackAssembler::getCancelationTable
static std::bitset< 56 > getCancelationTable(unsigned int)
cancel Out Table
Definition: L1MuBMTrackAssembler.cc:1426
EX24
Definition: L1MuDTExtParam.h:22
L1MuBMAddressArray::setStation
void setStation(int stat, int adr)
set address of a given station [1-4]
Definition: L1MuBMAddressArray.cc:109
L1MuBMTrackAssembler::L1MuBMTrackAssembler
L1MuBMTrackAssembler(const L1MuBMSectorProcessor &)
constructor
Definition: L1MuBMTrackAssembler.cc:45
L1MuBMTrackAssembler::runEncoderSubUnit2
void runEncoderSubUnit2(unsigned &global, unsigned &group, unsigned &priority)
run the second Priority Encoder Sub-Unit
Definition: L1MuBMTrackAssembler.cc:622
T1234
Definition: L1MuBMTrackAssParam.h:21
p1
double p1[4]
Definition: TauolaWrapper.h:89
L1MuBMTrackAssembler::print
void print() const
print result of Track Assembler
Definition: L1MuBMTrackAssembler.cc:479
L1MuBMTrackAssembler::m_theTCs
TrackClass m_theTCs[2]
Definition: L1MuBMTrackAssembler.h:129
std
Definition: JetResolutionObject.h:76
L1MuBMTrackAssembler::addressEncoder12
static unsigned int addressEncoder12(const std::bitset< 12 > &input)
12 bit address encoder
Definition: L1MuBMTrackAssembler.cc:1359
T24
Definition: L1MuBMTrackAssParam.h:21
L1MuBMTrackAssembler.h
L1MuBMSectorProcessor::EU
const L1MuBMExtrapolationUnit * EU() const
return pointer to Extrapolation Unit
Definition: L1MuBMSectorProcessor.h:91
T23
Definition: L1MuBMTrackAssParam.h:21
UNDEF
Definition: L1MuBMTrackAssParam.h:21
mps_fire.result
result
Definition: mps_fire.py:303
EX14
Definition: L1MuDTExtParam.h:22
L1MuBMTrackAssembler::addressEncoder12s
static unsigned int addressEncoder12s(const std::bitset< 12 > &input)
special 12 bit address encoder
Definition: L1MuBMTrackAssembler.cc:1377
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
L1MuBMTrackAssembler::subBitset56
static unsigned long subBitset56(const std::bitset< 56 > &input, int pos, int length)
get sub-bitmap of a 56-bit word
Definition: L1MuBMTrackAssembler.cc:1412
L1MuBMTrackAssembler::m_sp
const L1MuBMSectorProcessor & m_sp
Definition: L1MuBMTrackAssembler.h:122
L1MuBMSectorProcessor.h
L1MuBMTrackAssembler::m_theLastAddress
unsigned int m_theLastAddress[68]
Definition: L1MuBMTrackAssembler.h:126
watchdog.group
group
Definition: watchdog.py:82
L1MuBMTrackAssembler::reset
void reset() override
reset Track Assembler
Definition: L1MuBMTrackAssembler.cc:461