CMS 3D CMS Logo

SourceCardRouting.cc
Go to the documentation of this file.
1 /*
2  SourceCardRouting library
3  Andrew Rose 2007
4 */
5 
6 // Prototype class definition
7 #include "SourceCardRouting.h" //hh"
8 
9 // File streams
10 #include <iomanip>
11 #include <iostream>
12 #include <sstream>
13 using namespace std;
14 
18  // std::cout<<"Constructor"<<std::endl;
19 }
20 
22  // std::cout<<"Destructor"<<std::endl;
23 }
26 // SFP arrays are SFP[cycle<2][sfp number<4]
27 // electron arrays are eIsoRank[candidate number<4]
28 // muon arrays are MIPbits[rec card number<7][region<2]
29 
30 void SourceCardRouting::EMUtoSFP(unsigned short (&eIsoRank)[4],
31  unsigned short (&eIsoCardId)[4],
32  unsigned short (&eIsoRegionId)[4],
33  unsigned short (&eNonIsoRank)[4],
34  unsigned short (&eNonIsoCardId)[4],
35  unsigned short (&eNonIsoRegionId)[4],
36  unsigned short (&MIPbits)[7][2],
37  unsigned short (&Qbits)[7][2],
38  unsigned short (&SFP)[2][4]) const {
39  SFP[0][0] = 0;
40  SFP[1][0] = 0x8000;
41 
42  for (int i = 0; i < 7; i++) {
43  for (int j = 0; j < 2; j++) {
44  SFP[0][0] = SFP[0][0] | ((MIPbits[i][j] & 0x01) << ((2 * i) + j));
45  SFP[1][0] = SFP[1][0] | ((Qbits[i][j] & 0x01) << ((2 * i) + j));
46  }
47  }
48 
49  SFP[0][1] = (eIsoRank[0] & 0x3f) | ((eIsoRegionId[0] & 0x01) << 6) | ((eIsoCardId[0] & 0x07) << 7) |
50  ((eIsoRank[1] & 0x7) << 10);
51  SFP[1][1] = 0x8000 | (eIsoRank[2] & 0x3f) | ((eIsoRegionId[2] & 0x01) << 6) | ((eIsoCardId[2] & 0x07) << 7) |
52  ((eIsoRank[3] & 0x7) << 10);
53  SFP[0][2] = (eNonIsoRank[0] & 0x3f) | ((eNonIsoRegionId[0] & 0x01) << 6) | ((eNonIsoCardId[0] & 0x07) << 7) |
54  ((eIsoRank[1] & 0x38) << 7) | ((eIsoRegionId[1] & 0x01) << 13);
55  SFP[1][2] = 0x8000 | (eNonIsoRank[2] & 0x3f) | ((eNonIsoRegionId[2] & 0x01) << 6) | ((eNonIsoCardId[2] & 0x07) << 7) |
56  ((eIsoRank[3] & 0x38) << 7) | ((eIsoRegionId[3] & 0x01) << 13);
57  SFP[0][3] = (eNonIsoRank[1] & 0x3f) | ((eNonIsoRegionId[1] & 0x01) << 6) | ((eNonIsoCardId[1] & 0x07) << 7) |
58  ((eIsoCardId[1] & 0x07) << 10);
59  SFP[1][3] = 0x8000 | (eNonIsoRank[3] & 0x3f) | ((eNonIsoRegionId[3] & 0x01) << 6) | ((eNonIsoCardId[3] & 0x07) << 7) |
60  ((eIsoCardId[3] & 0x07) << 10);
61 }
62 
64 // SFP arrays are SFP[cycle<2][sfp number<4]
65 // electron arrays are eIsoRank[candidate number<4]
66 // muon arrays are MIPbits[rec card number<7][region<2]
67 
68 void SourceCardRouting::SFPtoEMU(unsigned short (&eIsoRank)[4],
69  unsigned short (&eIsoCardId)[4],
70  unsigned short (&eIsoRegionId)[4],
71  unsigned short (&eNonIsoRank)[4],
72  unsigned short (&eNonIsoCardId)[4],
73  unsigned short (&eNonIsoRegionId)[4],
74  unsigned short (&MIPbits)[7][2],
75  unsigned short (&Qbits)[7][2],
76  unsigned short (&SFP)[2][4]) const {
77  for (int i = 0; i < 7; i++) {
78  for (int j = 0; j < 2; j++) {
79  MIPbits[i][j] = (SFP[0][0] >> ((2 * i) + j)) & 0x1;
80  Qbits[i][j] = (SFP[1][0] >> ((2 * i) + j)) & 0x1;
81  }
82  }
83 
84  eIsoRank[0] = SFP[0][1] & 0x3f;
85  eIsoRank[1] = ((SFP[0][1] >> 10) & 0x7) | ((SFP[0][2] >> 7) & 0x38);
86  eIsoRank[2] = SFP[1][1] & 0x3f;
87  eIsoRank[3] = ((SFP[1][1] >> 10) & 0x7) | ((SFP[1][2] >> 7) & 0x38);
88 
89  eNonIsoRank[0] = SFP[0][2] & 0x3f;
90  eNonIsoRank[1] = SFP[0][3] & 0x3f;
91  eNonIsoRank[2] = SFP[1][2] & 0x3f;
92  eNonIsoRank[3] = SFP[1][3] & 0x3f;
93 
94  eIsoRegionId[0] = (SFP[0][1] >> 6) & 0x1;
95  eIsoRegionId[1] = (SFP[0][2] >> 13) & 0x1;
96  eIsoRegionId[2] = (SFP[1][1] >> 6) & 0x1;
97  eIsoRegionId[3] = (SFP[1][2] >> 13) & 0x1;
98 
99  eNonIsoRegionId[0] = (SFP[0][2] >> 6) & 0x1;
100  eNonIsoRegionId[1] = (SFP[0][3] >> 6) & 0x1;
101  eNonIsoRegionId[2] = (SFP[1][2] >> 6) & 0x1;
102  eNonIsoRegionId[3] = (SFP[1][3] >> 6) & 0x1;
103 
104  eIsoCardId[0] = (SFP[0][1] >> 7) & 0x7;
105  eIsoCardId[1] = (SFP[0][3] >> 10) & 0x7;
106  eIsoCardId[2] = (SFP[1][1] >> 7) & 0x7;
107  eIsoCardId[3] = (SFP[1][3] >> 10) & 0x7;
108 
109  eNonIsoCardId[0] = (SFP[0][2] >> 7) & 0x7;
110  eNonIsoCardId[1] = (SFP[0][3] >> 7) & 0x7;
111  eNonIsoCardId[2] = (SFP[1][2] >> 7) & 0x7;
112  eNonIsoCardId[3] = (SFP[1][3] >> 7) & 0x7;
113 }
114 
116 // RC arrays are RC[receiver card number<7][region<2]
117 // HF arrays are HF[eta<4][HF region<2]
118 // SFP arrays are SFP[cycle<2][sfp number<4]
119 
120 void SourceCardRouting::RC56HFtoSFP(unsigned short (&RC)[7][2],
121  unsigned short (&RCof)[7][2],
122  unsigned short (&RCtau)[7][2],
123  unsigned short (&HF)[4][2],
124  unsigned short (&HFQ)[4][2],
125  unsigned short (&SFP)[2][4]) const {
126  SFP[0][0] = (RC[5][0] & 0x3ff) | ((RCof[5][0] & 0x1) << 10) | ((RCtau[5][0] & 0x1) << 11) |
127  ((HFQ[0][0] & 0x1) << 12) | ((HFQ[1][0] & 0x01) << 13) | ((HF[0][0] & 0x01) << 14);
128  SFP[1][0] = 0x8000 | (RC[5][1] & 0x3ff) | ((RCof[5][1] & 0x1) << 10) | ((RCtau[5][1] & 0x1) << 11) |
129  ((HFQ[2][0] & 0x1) << 12) | ((HFQ[3][0] & 0x01) << 13) | ((HF[2][0] & 0x01) << 14);
130  SFP[0][1] = (RC[6][0] & 0x3ff) | ((RCof[6][0] & 0x1) << 10) | ((RCtau[6][0] & 0x1) << 11) |
131  ((HFQ[0][1] & 0x1) << 12) | ((HFQ[1][1] & 0x01) << 13) | ((HF[0][1] & 0x01) << 14);
132  SFP[1][1] = 0x8000 | (RC[6][1] & 0x3ff) | ((RCof[6][1] & 0x1) << 10) | ((RCtau[6][1] & 0x1) << 11) |
133  ((HFQ[2][1] & 0x1) << 12) | ((HFQ[3][1] & 0x01) << 13) | ((HF[2][1] & 0x01) << 14);
134  SFP[0][2] = ((HF[0][0] >> 1) & 0x7f) | ((HF[1][0] & 0xff) << 7);
135  SFP[1][2] = 0x8000 | ((HF[2][0] >> 1) & 0x7f) | ((HF[3][0] & 0xff) << 7);
136  SFP[0][3] = ((HF[0][1] >> 1) & 0x7f) | ((HF[1][1] & 0xff) << 7);
137  SFP[1][3] = 0x8000 | ((HF[2][1] >> 1) & 0x7f) | ((HF[3][1] & 0xff) << 7);
138 }
139 
141 // RC arrays are RC[receiver card number<7][region<2]
142 // HF arrays are HF[eta<4][HF region<2]
143 // SFP arrays are SFP[cycle<2][sfp number<4]
144 
145 void SourceCardRouting::SFPtoRC56HF(unsigned short (&RC)[7][2],
146  unsigned short (&RCof)[7][2],
147  unsigned short (&RCtau)[7][2],
148  unsigned short (&HF)[4][2],
149  unsigned short (&HFQ)[4][2],
150  unsigned short (&SFP)[2][4]) const {
151  RC[5][0] = SFP[0][0] & 0x3ff;
152  RC[5][1] = SFP[1][0] & 0x3ff;
153  RC[6][0] = SFP[0][1] & 0x3ff;
154  RC[6][1] = SFP[1][1] & 0x3ff;
155 
156  RCof[5][0] = (SFP[0][0] >> 10) & 0x1;
157  RCof[5][1] = (SFP[1][0] >> 10) & 0x1;
158  RCof[6][0] = (SFP[0][1] >> 10) & 0x1;
159  RCof[6][1] = (SFP[1][1] >> 10) & 0x1;
160 
161  RCtau[5][0] = (SFP[0][0] >> 11) & 0x1;
162  RCtau[5][1] = (SFP[1][0] >> 11) & 0x1;
163  RCtau[6][0] = (SFP[0][1] >> 11) & 0x1;
164  RCtau[6][1] = (SFP[1][1] >> 11) & 0x1;
165 
166  HFQ[0][0] = (SFP[0][0] >> 12) & 0x1;
167  HFQ[1][0] = (SFP[0][0] >> 13) & 0x1;
168  HFQ[2][0] = (SFP[1][0] >> 12) & 0x1;
169  HFQ[3][0] = (SFP[1][0] >> 13) & 0x1;
170 
171  HFQ[0][1] = (SFP[0][1] >> 12) & 0x1;
172  HFQ[1][1] = (SFP[0][1] >> 13) & 0x1;
173  HFQ[2][1] = (SFP[1][1] >> 12) & 0x1;
174  HFQ[3][1] = (SFP[1][1] >> 13) & 0x1;
175 
176  HF[0][0] = ((SFP[0][2] & 0x7f) << 1) | ((SFP[0][0] >> 14) & 0x01);
177  HF[1][0] = (SFP[0][2] >> 7) & 0xff;
178  HF[2][0] = ((SFP[1][2] & 0x7f) << 1) | ((SFP[1][0] >> 14) & 0x01);
179  HF[3][0] = (SFP[1][2] >> 7) & 0xff;
180 
181  HF[0][1] = ((SFP[0][3] & 0x7f) << 1) | ((SFP[0][1] >> 14) & 0x01);
182  HF[1][1] = (SFP[0][3] >> 7) & 0xff;
183  HF[2][1] = ((SFP[1][3] & 0x7f) << 1) | ((SFP[1][1] >> 14) & 0x01);
184  HF[3][1] = (SFP[1][3] >> 7) & 0xff;
185 }
186 
188 // RC arrays are RC[receiver card number<7][region<2]
189 // SFP arrays are SFP[cycle<2][sfp number<4]
190 
191 void SourceCardRouting::RC012toSFP(unsigned short (&RC)[7][2],
192  unsigned short (&RCof)[7][2],
193  unsigned short (&RCtau)[7][2],
194  unsigned short (&SFP)[2][4]) const {
195  SFP[0][0] = (RC[0][0] & 0x3ff) | ((RCof[0][0] & 0x1) << 10) | ((RCtau[0][0] & 0x1) << 11) | ((RC[2][0] & 0x7) << 12);
196  SFP[1][0] =
197  0x8000 | (RC[0][1] & 0x3ff) | ((RCof[0][1] & 0x1) << 10) | ((RCtau[0][1] & 0x1) << 11) | ((RC[2][1] & 0x7) << 12);
198 
199  SFP[0][1] = (RC[1][0] & 0x3ff) | ((RCof[1][0] & 0x1) << 10) | ((RCtau[1][0] & 0x1) << 11) | ((RC[2][0] & 0x38) << 9);
200  SFP[1][1] =
201  0x8000 | (RC[1][1] & 0x3ff) | ((RCof[1][1] & 0x1) << 10) | ((RCtau[1][1] & 0x1) << 11) | ((RC[2][1] & 0x38) << 9);
202 
203  SFP[0][2] = (RC[0][0] & 0x3ff) | ((RCof[0][0] & 0x1) << 10) | ((RCtau[0][0] & 0x1) << 11);
204  SFP[1][2] = 0x8000 | (RC[0][1] & 0x3ff) | ((RCof[0][1] & 0x1) << 10) | ((RCtau[0][1] & 0x1) << 11);
205 
206  SFP[0][3] = (RC[1][0] & 0x3ff) | ((RCof[1][0] & 0x1) << 10) | ((RCtau[1][0] & 0x1) << 11);
207  SFP[1][3] = 0x8000 | (RC[1][1] & 0x3ff) | ((RCof[1][1] & 0x1) << 10) | ((RCtau[1][1] & 0x1) << 11);
208 }
209 
211 // RC arrays are RC[receiver card number<7][region<2]
212 // SFP arrays are SFP[cycle<2][sfp number<4]
213 
214 void SourceCardRouting::SFPtoRC012(unsigned short (&RC)[7][2],
215  unsigned short (&RCof)[7][2],
216  unsigned short (&RCtau)[7][2],
217  unsigned short (&SFP)[2][4]) const {
218  RC[0][0] = SFP[0][0] & 0x3ff;
219  RC[0][1] = SFP[1][0] & 0x3ff;
220  RC[1][0] = SFP[0][1] & 0x3ff;
221  RC[1][1] = SFP[1][1] & 0x3ff;
222  RC[2][0] = (RC[2][0] & 0x3c0) | ((SFP[0][0] & 0x7000) >> 12) | ((SFP[0][1] & 0x7000) >> 9);
223  RC[2][1] = (RC[2][1] & 0x3c0) | ((SFP[1][0] & 0x7000) >> 12) | ((SFP[1][1] & 0x7000) >> 9);
224 
225  RCof[0][0] = (SFP[0][0] >> 10) & 0x1;
226  RCof[0][1] = (SFP[1][0] >> 10) & 0x1;
227  RCof[1][0] = (SFP[0][1] >> 10) & 0x1;
228  RCof[1][1] = (SFP[1][1] >> 10) & 0x1;
229 
230  RCtau[0][0] = (SFP[0][0] >> 11) & 0x1;
231  RCtau[0][1] = (SFP[1][0] >> 11) & 0x1;
232  RCtau[1][0] = (SFP[0][1] >> 11) & 0x1;
233  RCtau[1][1] = (SFP[1][1] >> 11) & 0x1;
234 }
235 
237 // RC arrays are RC[receiver card number<7][region<2]
238 // SFP arrays are SFP[cycle<2][sfp number<4]
239 
240 void SourceCardRouting::RC234toSFP(unsigned short (&RC)[7][2],
241  unsigned short (&RCof)[7][2],
242  unsigned short (&RCtau)[7][2],
243  unsigned short (&sisterRC)[7][2],
244  unsigned short (&sisterRCof)[7][2],
245  unsigned short (&sisterRCtau)[7][2],
246  unsigned short (&SFP)[2][4]) const {
247  SFP[0][0] = (RC[3][0] & 0x3ff) | ((RCof[3][0] & 0x1) << 10) | ((RCtau[3][0] & 0x1) << 11) | ((RC[2][0] & 0x1c0) << 6);
248  SFP[1][0] = 0x8000 | (RC[3][1] & 0x3ff) | ((RCof[3][1] & 0x1) << 10) | ((RCtau[3][1] & 0x1) << 11) |
249  ((RC[2][1] & 0x1c0) << 6);
250 
251  SFP[0][1] = (RC[4][0] & 0x3ff) | ((RCof[4][0] & 0x1) << 10) | ((RCtau[4][0] & 0x1) << 11) |
252  ((RC[2][0] & 0x200) << 3) | ((RCof[2][0] & 0x1) << 13) | ((RCtau[2][0] & 0x1) << 14);
253  SFP[1][1] = 0x8000 | (RC[4][1] & 0x3ff) | ((RCof[4][1] & 0x1) << 10) | ((RCtau[4][1] & 0x1) << 11) |
254  ((RC[2][1] & 0x200) << 3) | ((RCof[2][1] & 0x1) << 13) | ((RCtau[2][1] & 0x1) << 14);
255 
256  SFP[0][2] = (sisterRC[3][0] & 0x3ff) | ((sisterRCof[3][0] & 0x1) << 10) | ((sisterRCtau[3][0] & 0x1) << 11) |
257  ((sisterRC[2][0] & 0x1c0) << 6);
258  SFP[1][2] = 0x8000 | (sisterRC[3][1] & 0x3ff) | ((sisterRCof[3][1] & 0x1) << 10) | ((sisterRCtau[3][1] & 0x1) << 11) |
259  ((sisterRC[2][1] & 0x1c0) << 6);
260 
261  SFP[0][3] = (sisterRC[4][0] & 0x3ff) | ((sisterRCof[4][0] & 0x1) << 10) | ((sisterRCtau[4][0] & 0x1) << 11) |
262  ((sisterRC[2][0] & 0x200) << 3) | ((sisterRCof[2][0] & 0x1) << 13) | ((sisterRCtau[2][0] & 0x1) << 14);
263  SFP[1][3] = 0x8000 | (sisterRC[4][1] & 0x3ff) | ((sisterRCof[4][1] & 0x1) << 10) | ((sisterRCtau[4][1] & 0x1) << 11) |
264  ((sisterRC[2][1] & 0x200) << 3) | ((sisterRCof[2][1] & 0x1) << 13) | ((sisterRCtau[2][1] & 0x1) << 14);
265 }
266 
268 // RC arrays are RC[receiver card number<7][region<2]
269 // SFP arrays are SFP[cycle<2][sfp number<4]
270 
271 void SourceCardRouting::SFPtoRC234(unsigned short (&RC)[7][2],
272  unsigned short (&RCof)[7][2],
273  unsigned short (&RCtau)[7][2],
274  unsigned short (&sisterRC)[7][2],
275  unsigned short (&sisterRCof)[7][2],
276  unsigned short (&sisterRCtau)[7][2],
277  unsigned short (&SFP)[2][4]) const {
278  RC[2][0] = (RC[2][0] & 0x3f) | ((SFP[0][0] & 0x7000) >> 6) | ((SFP[0][1] & 0x1000) >> 3);
279  RC[3][0] = SFP[0][0] & 0x3ff;
280  RC[4][0] = SFP[0][1] & 0x3ff;
281  RC[2][1] = (RC[2][1] & 0x3f) | ((SFP[1][0] & 0x7000) >> 6) | ((SFP[1][1] & 0x1000) >> 3);
282  RC[3][1] = SFP[1][0] & 0x3ff;
283  RC[4][1] = SFP[1][1] & 0x3ff;
284 
285  RCof[2][0] = (SFP[0][1] >> 13) & 0x1;
286  RCof[3][0] = (SFP[0][0] >> 10) & 0x1;
287  RCof[4][0] = (SFP[0][1] >> 10) & 0x1;
288  RCof[2][1] = (SFP[1][1] >> 13) & 0x1;
289  RCof[3][1] = (SFP[1][0] >> 10) & 0x1;
290  RCof[4][1] = (SFP[1][1] >> 10) & 0x1;
291 
292  RCtau[2][0] = (SFP[0][1] >> 14) & 0x1;
293  RCtau[3][0] = (SFP[0][0] >> 11) & 0x1;
294  RCtau[4][0] = (SFP[0][1] >> 11) & 0x1;
295  RCtau[2][1] = (SFP[1][1] >> 14) & 0x1;
296  RCtau[3][1] = (SFP[1][0] >> 11) & 0x1;
297  RCtau[4][1] = (SFP[1][1] >> 11) & 0x1;
298 
299  sisterRC[2][0] = (sisterRC[2][0] & ~0x3C0) | ((SFP[0][2] & 0x7000) >> 6) | ((SFP[0][3] & 0x1000) >> 3);
300  sisterRC[3][0] = SFP[0][2] & 0x3ff;
301  sisterRC[4][0] = SFP[0][3] & 0x3ff;
302  sisterRC[2][1] = (sisterRC[2][1] & ~0x3C0) | ((SFP[1][2] & 0x7000) >> 6) | ((SFP[1][3] & 0x1000) >> 3);
303  sisterRC[3][1] = SFP[1][2] & 0x3ff;
304  sisterRC[4][1] = SFP[1][3] & 0x3ff;
305 
306  sisterRCof[2][0] = (SFP[0][3] >> 13) & 0x1;
307  sisterRCof[3][0] = (SFP[0][2] >> 10) & 0x1;
308  sisterRCof[4][0] = (SFP[0][3] >> 10) & 0x1;
309  sisterRCof[2][1] = (SFP[1][3] >> 13) & 0x1;
310  sisterRCof[3][1] = (SFP[1][2] >> 10) & 0x1;
311  sisterRCof[4][1] = (SFP[1][3] >> 10) & 0x1;
312 
313  sisterRCtau[2][0] = (SFP[0][3] >> 14) & 0x1;
314  sisterRCtau[3][0] = (SFP[0][2] >> 11) & 0x1;
315  sisterRCtau[4][0] = (SFP[0][3] >> 11) & 0x1;
316  sisterRCtau[2][1] = (SFP[1][3] >> 14) & 0x1;
317  sisterRCtau[3][1] = (SFP[1][2] >> 11) & 0x1;
318  sisterRCtau[4][1] = (SFP[1][3] >> 11) & 0x1;
319 }
320 
323 // VHDCI arrays are VHDCI[VHDCI<2][cycle<2]
324 // SFP arrays are SFP[cycle<2][sfp number<4]
325 
326 void SourceCardRouting::SFPtoVHDCI(int RoutingMode, unsigned short (&SFP)[2][4], unsigned long (&VHDCI)[2][2]) const {
327  unsigned short sfp_reverse[2][4] = {{0}};
328 
329  for (int i = 0; i < 2; i++) {
330  for (int j = 0; j < 4; j++) {
331  for (int k = 0; k < 16; k++) {
332  sfp_reverse[i][j] = sfp_reverse[i][j] | (((SFP[i][j] >> k) & 0x01) << (15 - k));
333  }
334  // std::cout <<hex<< SFP[i][j]<<'\t'<<sfp_reverse[i][j]<<std::endl;
335  }
336  }
337 
338  switch (RoutingMode) {
339  case 0:
340  VHDCI[0][0] = (SFP[0][1] & 0x3ff) | ((SFP[0][1] & 0x1c00) << 1) | ((SFP[0][2] & 0x3c00) << 4) |
341  ((SFP[0][3] & 0x1c00) << 8) | ((SFP[0][0] & 0xff) << 22);
342  VHDCI[0][1] = (SFP[1][1] & 0x3ff) | ((SFP[1][1] & 0x1c00) << 1) | ((SFP[1][2] & 0x3c00) << 4) |
343  ((SFP[1][3] & 0x1c00) << 8) | ((SFP[1][0] & 0xff) << 22);
344  VHDCI[1][0] = (SFP[0][2] & 0x3ff) | ((SFP[0][3] & 0x3ff) << 11) | ((SFP[0][0] & 0x3f00) << 14);
345  VHDCI[1][1] = (SFP[1][2] & 0x3ff) | ((SFP[1][3] & 0x3ff) << 11) | ((SFP[1][0] & 0x3f00) << 14);
346  break;
347  case 1:
348  VHDCI[0][0] = (SFP[0][0] & 0xfff) | ((SFP[0][1] & 0x7) << 12) | ((SFP[0][2] & 0x80) << 10) |
349  ((SFP[0][0] & 0x4000) << 4) | ((sfp_reverse[0][1] & 0xc) << 17) |
350  ((sfp_reverse[0][0] & 0xc) << 19) | ((sfp_reverse[0][1] & 0x1ff0) << 19);
351  VHDCI[0][1] = (SFP[1][0] & 0xfff) | ((SFP[1][1] & 0x7) << 12) | ((SFP[1][2] & 0x80) << 10) |
352  ((SFP[1][0] & 0x4000) << 4) | ((sfp_reverse[1][1] & 0xc) << 17) |
353  ((sfp_reverse[1][0] & 0xc) << 19) | ((sfp_reverse[1][1] & 0x1ff0) << 19);
354 
355  VHDCI[1][0] = (SFP[0][1] & 0x4000) | ((SFP[0][3] & 0x80) << 24);
356  VHDCI[1][1] = (SFP[1][1] & 0x4000) | ((SFP[1][3] & 0x80) << 24);
357 
358  for (int i = 0; i < 7; i++) {
359  VHDCI[1][0] = VHDCI[1][0] | (((SFP[0][2] >> i) & 0x1) << (2 * i)) |
360  (((SFP[0][2] >> (i + 8)) & 0x1) << ((2 * i) + 1)) |
361  (((sfp_reverse[0][3] >> (i + 1)) & 0x1) << ((2 * i) + 17)) |
362  (((sfp_reverse[0][3] >> (i + 9)) & 0x1) << ((2 * i) + 18));
363  VHDCI[1][1] = VHDCI[1][1] | (((SFP[1][2] >> i) & 0x1) << (2 * i)) |
364  (((SFP[1][2] >> (i + 8)) & 0x1) << ((2 * i) + 1)) |
365  (((sfp_reverse[1][3] >> (i + 1)) & 0x1) << ((2 * i) + 17)) |
366  (((sfp_reverse[1][3] >> (i + 9)) & 0x1) << ((2 * i) + 18));
367  }
368  break;
369  case 2:
370  VHDCI[0][0] = (SFP[0][0] & 0xfff) | ((SFP[0][1] & 0x7) << 12) | ((sfp_reverse[0][1] & 0xe) << 16) |
371  ((sfp_reverse[0][0] & 0xe) << 19) | ((sfp_reverse[0][1] & 0x1ff0) << 19);
372  VHDCI[0][1] = (SFP[1][0] & 0xfff) | ((SFP[1][1] & 0x7) << 12) | ((sfp_reverse[1][1] & 0xe) << 16) |
373  ((sfp_reverse[1][0] & 0xe) << 19) | ((sfp_reverse[1][1] & 0x1ff0) << 19);
374  VHDCI[1][0] = 0;
375  VHDCI[1][1] = 0;
376  break;
377  case 3:
378  VHDCI[0][0] = ((SFP[0][0] >> 12) & 0x7) | ((SFP[0][1] >> 9) & 0x38) | ((SFP[0][0] & 0x1ff) << 6) |
379  ((sfp_reverse[0][1] & 0xfff0) << 13) | ((sfp_reverse[0][0] & 0x70) << 25);
380  VHDCI[0][1] = ((SFP[1][0] >> 12) & 0x7) | ((SFP[1][1] >> 9) & 0x38) | ((SFP[1][0] & 0x1ff) << 6) |
381  ((sfp_reverse[1][1] & 0xfff0) << 13) | ((sfp_reverse[1][0] & 0x70) << 25);
382 
383  VHDCI[1][0] = ((SFP[0][2] >> 12) & 0x7) | ((SFP[0][3] >> 9) & 0x38) | ((SFP[0][2] & 0x1ff) << 6) |
384  ((sfp_reverse[0][3] & 0xfff0) << 13) | ((sfp_reverse[0][2] & 0x70) << 25);
385  VHDCI[1][1] = ((SFP[1][2] >> 12) & 0x7) | ((SFP[1][3] >> 9) & 0x38) | ((SFP[1][2] & 0x1ff) << 6) |
386  ((sfp_reverse[1][3] & 0xfff0) << 13) | ((sfp_reverse[1][2] & 0x70) << 25);
387  break;
388  default:
389  VHDCI[0][0] = 0;
390  VHDCI[0][1] = 0;
391  VHDCI[1][0] = 0;
392  VHDCI[1][1] = 0;
393  }
394 }
395 
397 // VHDCI arrays are VHDCI[VHDCI<2][cycle<2]
398 // SFP arrays are SFP[cycle<2][sfp number<4]
399 void SourceCardRouting::VHDCItoSFP(int RoutingMode, unsigned short (&SFP)[2][4], unsigned long (&VHDCI)[2][2]) const {
400  unsigned short VHDCI_reverse[2][4] = {{0}};
401 
402  for (int i = 0; i < 2; i++) {
403  for (int j = 0; j < 2; j++) {
404  for (int k = 0; k < 32; k++) {
405  VHDCI_reverse[i][j] = VHDCI_reverse[i][j] | (((VHDCI[i][j] >> k) & 0x01) << (31 - k));
406  }
407  }
408  }
409 
410  switch (RoutingMode) {
411  case 0:
412  SFP[0][0] = ((VHDCI[0][0] >> 22) & 0xff) | ((VHDCI[1][0] >> 14) & 0x3f00);
413  SFP[1][0] = 0x8000 | ((VHDCI[0][1] >> 22) & 0xff) | ((VHDCI[1][1] >> 14) & 0x3f00);
414  SFP[0][1] = (VHDCI[0][0] & 0x3ff) | ((VHDCI[0][0] >> 1) & 0x1c00);
415  SFP[1][1] = 0x8000 | (VHDCI[0][1] & 0x3ff) | ((VHDCI[0][1] >> 1) & 0x1c00);
416  SFP[0][2] = (VHDCI[1][0] & 0x3ff) | ((VHDCI[0][0] >> 4) & 0x3c00);
417  SFP[1][2] = 0x8000 | (VHDCI[1][1] & 0x3ff) | ((VHDCI[0][1] >> 4) & 0x3c00);
418  SFP[0][3] = ((VHDCI[1][0] >> 11) & 0x3ff) | ((VHDCI[0][0] >> 8) & 0x1c00);
419  SFP[1][3] = 0x8000 | ((VHDCI[1][1] >> 11) & 0x3ff) | ((VHDCI[0][1] >> 8) & 0x1c00);
420  break;
421  case 1:
422  SFP[0][0] = (VHDCI[0][0] & 0xfff) | ((VHDCI_reverse[0][0] & 0x600) << 3) | ((VHDCI_reverse[0][0] & 0x2000) << 1);
423  SFP[1][0] =
424  0x8000 | (VHDCI[0][1] & 0xfff) | ((VHDCI_reverse[0][1] & 0x600) << 3) | ((VHDCI_reverse[0][1] & 0x2000) << 1);
425  SFP[0][1] = ((VHDCI[0][0] & 0x7000) >> 12) | ((VHDCI_reverse[0][0] & 0x1ff) << 3) |
426  ((VHDCI_reverse[0][0] & 0x1800) << 1) | (VHDCI[1][0] & 0x4000);
427  SFP[1][1] = 0x8000 | ((VHDCI[0][1] & 0x7000) >> 12) | ((VHDCI_reverse[0][1] & 0x1ff) << 3) |
428  ((VHDCI_reverse[0][1] & 0x1800) << 1) | (VHDCI[1][1] & 0x4000);
429 
430  SFP[0][2] = ((VHDCI[0][0] & 0x20000) >> 10);
431  SFP[1][2] = 0x8000 | ((VHDCI[0][1] & 0x20000) >> 10);
432  SFP[0][3] = ((VHDCI[1][0] & 0x20000) >> 3);
433  SFP[1][3] = 0x8000 | ((VHDCI[1][1] & 0x20000) >> 3);
434  for (int i = 0; i < 7; i++) {
435  SFP[0][2] =
436  SFP[0][2] | (((VHDCI[1][0] >> (2 * i)) & 0x1) << i) | (((VHDCI[1][0] >> ((2 * i) + 1)) & 0x1) << (i + 8));
437  SFP[1][2] =
438  SFP[1][2] | (((VHDCI[1][1] >> (2 * i)) & 0x1) << i) | (((VHDCI[1][1] >> ((2 * i) + 1)) & 0x1) << (i + 8));
439  SFP[0][3] = SFP[0][3] | (((VHDCI_reverse[1][0] >> ((2 * i) + 1)) & 0x1) << i) |
440  (((VHDCI_reverse[1][0] >> (2 * i)) & 0x1) << (i + 7));
441  SFP[1][3] = SFP[1][3] | (((VHDCI_reverse[1][1] >> ((2 * i) + 1)) & 0x1) << i) |
442  (((VHDCI_reverse[1][1] >> (2 * i)) & 0x1) << (i + 7));
443  }
444  break;
445  case 2:
446  SFP[0][0] = (VHDCI[0][0] & 0xfff) | ((VHDCI_reverse[0][0] & 0xe00) << 3);
447  SFP[1][0] = 0x8000 | (VHDCI[0][1] & 0xfff) | ((VHDCI_reverse[0][1] & 0xe00) << 3);
448  SFP[0][1] =
449  ((VHDCI[0][0] & 0x7000) >> 12) | ((VHDCI_reverse[0][0] & 0x1ff) << 3) | (VHDCI_reverse[0][0] & 0x7000);
450  SFP[1][1] = 0x8000 | ((VHDCI[0][1] & 0x7000) >> 12) | ((VHDCI_reverse[0][1] & 0x1ff) << 3) |
451  (VHDCI_reverse[0][1] & 0x7000);
452  SFP[0][2] = (VHDCI[0][0] & 0xfff);
453  SFP[1][2] = 0x8000 | (VHDCI[0][1] & 0xfff);
454  SFP[0][3] = ((VHDCI[0][0] & 0x7000) >> 12) | ((VHDCI_reverse[0][0] & 0x1ff) << 3);
455  SFP[1][3] = 0x8000 | ((VHDCI[0][1] & 0x7000) >> 12) | ((VHDCI_reverse[0][1] & 0x1ff) << 3);
456  break;
457  case 3:
458  SFP[0][0] = ((VHDCI[0][0] & 0x7fc0) >> 6) | ((VHDCI_reverse[0][0] & 0x7) << 9) | ((VHDCI[0][0] & 0x7) << 12);
459  SFP[1][0] =
460  0x8000 | ((VHDCI[0][1] & 0x7fc0) >> 6) | ((VHDCI_reverse[0][1] & 0x7) << 9) | ((VHDCI[0][1] & 0x7) << 12);
461  SFP[0][1] = ((VHDCI_reverse[0][0] & 0x7ff8) >> 3) | ((VHDCI[0][0] & 0x38) << 9);
462  SFP[1][1] = 0x8000 | ((VHDCI_reverse[0][1] & 0x7ff8) >> 3) | ((VHDCI[0][1] & 0x38) << 9);
463  SFP[0][2] = ((VHDCI[1][0] & 0x7fc0) >> 6) | ((VHDCI_reverse[1][0] & 0x7) << 9) | ((VHDCI[1][0] & 0x7) << 12);
464  SFP[1][2] =
465  0x8000 | ((VHDCI[1][1] & 0x7fc0) >> 6) | ((VHDCI_reverse[1][1] & 0x7) << 9) | ((VHDCI[1][1] & 0x7) << 12);
466  SFP[0][3] = ((VHDCI_reverse[1][0] & 0x7ff8) >> 3) | ((VHDCI[1][0] & 0x38) << 9);
467  SFP[1][3] = 0x8000 | ((VHDCI_reverse[1][1] & 0x7ff8) >> 3) | ((VHDCI[1][1] & 0x38) << 9);
468  break;
469  default:
470  SFP[0][0] = 0;
471  SFP[1][0] = 0x8000;
472  SFP[0][1] = 0;
473  SFP[1][1] = 0x8000;
474  SFP[0][2] = 0;
475  SFP[1][2] = 0x8000;
476  SFP[0][3] = 0;
477  SFP[1][3] = 0x8000;
478  }
479 }
480 
483 // VHDCI arrays are VHDCI[VHDCI<2][cycle<2]
484 // electron arrays are eIsoRank[candidate number<4]
485 // muon arrays are MIPbits[rec card number<7][region<2]
486 
487 void SourceCardRouting::EMUtoVHDCI(unsigned short (&eIsoRank)[4],
488  unsigned short (&eIsoCardId)[4],
489  unsigned short (&eIsoRegionId)[4],
490  unsigned short (&eNonIsoRank)[4],
491  unsigned short (&eNonIsoCardId)[4],
492  unsigned short (&eNonIsoRegionId)[4],
493  unsigned short (&MIPbits)[7][2],
494  unsigned short (&Qbits)[7][2],
495  unsigned long (&VHDCI)[2][2]) const {
496  unsigned short SFP[2][4] = {{0}};
497  EMUtoSFP(eIsoRank, eIsoCardId, eIsoRegionId, eNonIsoRank, eNonIsoCardId, eNonIsoRegionId, MIPbits, Qbits, SFP);
498  SFPtoVHDCI(0, SFP, VHDCI);
499 }
500 
502 // VHDCI arrays are VHDCI[VHDCI<2][cycle<2]
503 // electron arrays are eIsoRank[candidate number<4]
504 // muon arrays are MIPbits[rec card number<7][region<2]
505 
506 void SourceCardRouting::VHDCItoEMU(unsigned short (&eIsoRank)[4],
507  unsigned short (&eIsoCardId)[4],
508  unsigned short (&eIsoRegionId)[4],
509  unsigned short (&eNonIsoRank)[4],
510  unsigned short (&eNonIsoCardId)[4],
511  unsigned short (&eNonIsoRegionId)[4],
512  unsigned short (&MIPbits)[7][2],
513  unsigned short (&Qbits)[7][2],
514  unsigned long (&VHDCI)[2][2]) const {
515  unsigned short SFP[2][4] = {{0}};
516  VHDCItoSFP(0, SFP, VHDCI);
517  SFPtoEMU(eIsoRank, eIsoCardId, eIsoRegionId, eNonIsoRank, eNonIsoCardId, eNonIsoRegionId, MIPbits, Qbits, SFP);
518 }
519 
521 // RC arrays are RC[receiver card number<7][region<2]
522 // HF arrays are HF[eta<4][HF region<2]
523 // VHDCI arrays are VHDCI[VHDCI<2][cycle<2]
524 
525 void SourceCardRouting::RC56HFtoVHDCI(unsigned short (&RC)[7][2],
526  unsigned short (&RCof)[7][2],
527  unsigned short (&RCtau)[7][2],
528  unsigned short (&HF)[4][2],
529  unsigned short (&HFQ)[4][2],
530  unsigned long (&VHDCI)[2][2]) const {
531  unsigned short SFP[2][4] = {{0}};
532  RC56HFtoSFP(RC, RCof, RCtau, HF, HFQ, SFP);
533  SFPtoVHDCI(1, SFP, VHDCI);
534 }
535 
537 // RC arrays are RC[receiver card number<7][region<2]
538 // HF arrays are HF[eta<4][HF region<2]
539 // VHDCI arrays are VHDCI[VHDCI<2][cycle<2]
540 
541 void SourceCardRouting::VHDCItoRC56HF(unsigned short (&RC)[7][2],
542  unsigned short (&RCof)[7][2],
543  unsigned short (&RCtau)[7][2],
544  unsigned short (&HF)[4][2],
545  unsigned short (&HFQ)[4][2],
546  unsigned long (&VHDCI)[2][2]) const {
547  unsigned short SFP[2][4] = {{0}};
548  VHDCItoSFP(1, SFP, VHDCI);
549  SFPtoRC56HF(RC, RCof, RCtau, HF, HFQ, SFP);
550 }
551 
553 // RC arrays are RC[receiver card number<7][region<2]
554 // VHDCI arrays are VHDCI[VHDCI<2][cycle<2]
555 
556 void SourceCardRouting::RC012toVHDCI(unsigned short (&RC)[7][2],
557  unsigned short (&RCof)[7][2],
558  unsigned short (&RCtau)[7][2],
559  unsigned long (&VHDCI)[2][2]) const {
560  unsigned short SFP[2][4] = {{0}};
561  RC012toSFP(RC, RCof, RCtau, SFP);
562  SFPtoVHDCI(2, SFP, VHDCI);
563 }
564 
566 // RC arrays are RC[receiver card number<7][region<2]
567 // VHDCI arrays are VHDCI[VHDCI<2][cycle<2]
568 
569 void SourceCardRouting::VHDCItoRC012(unsigned short (&RC)[7][2],
570  unsigned short (&RCof)[7][2],
571  unsigned short (&RCtau)[7][2],
572  unsigned long (&VHDCI)[2][2]) const {
573  unsigned short SFP[2][4] = {{0}};
574  VHDCItoSFP(2, SFP, VHDCI);
575  SFPtoRC012(RC, RCof, RCtau, SFP);
576 }
577 
579 // RC arrays are RC[receiver card number<7][region<2]
580 // VHDCI arrays are VHDCI[VHDCI<2][cycle<2]
581 
582 void SourceCardRouting::RC234toVHDCI(unsigned short (&RC)[7][2],
583  unsigned short (&RCof)[7][2],
584  unsigned short (&RCtau)[7][2],
585  unsigned short (&sisterRC)[7][2],
586  unsigned short (&sisterRCof)[7][2],
587  unsigned short (&sisterRCtau)[7][2],
588  unsigned long (&VHDCI)[2][2]) const {
589  unsigned short SFP[2][4] = {{0}};
590  RC234toSFP(RC, RCof, RCtau, sisterRC, sisterRCof, sisterRCtau, SFP);
591  SFPtoVHDCI(3, SFP, VHDCI);
592 }
593 
595 // RC arrays are RC[receiver card number<7][region<2]
596 // VHDCI arrays are VHDCI[VHDCI<2][cycle<2]
597 
598 void SourceCardRouting::VHDCItoRC234(unsigned short (&RC)[7][2],
599  unsigned short (&RCof)[7][2],
600  unsigned short (&RCtau)[7][2],
601  unsigned short (&sisterRC)[7][2],
602  unsigned short (&sisterRCof)[7][2],
603  unsigned short (&sisterRCtau)[7][2],
604  unsigned long (&VHDCI)[2][2]) const {
605  unsigned short SFP[2][4] = {{0}};
606  VHDCItoSFP(3, SFP, VHDCI);
607  SFPtoRC234(RC, RCof, RCtau, sisterRC, sisterRCof, sisterRCtau, SFP);
608 }
609 
612 // electron arrays are eIsoRank[candidate number<4]
613 // muon arrays are MIPbits[rec card number<7][region<2]
614 
615 void SourceCardRouting::EMUtoSTRING(unsigned short &logicalCardID,
616  unsigned short &eventNumber,
617  unsigned short (&eIsoRank)[4],
618  unsigned short (&eIsoCardId)[4],
619  unsigned short (&eIsoRegionId)[4],
620  unsigned short (&eNonIsoRank)[4],
621  unsigned short (&eNonIsoCardId)[4],
622  unsigned short (&eNonIsoRegionId)[4],
623  unsigned short (&MIPbits)[7][2],
624  unsigned short (&Qbits)[7][2],
625  std::string &dataString) const {
626  unsigned long VHDCI[2][2] = {{0}};
627  EMUtoVHDCI(eIsoRank, eIsoCardId, eIsoRegionId, eNonIsoRank, eNonIsoCardId, eNonIsoRegionId, MIPbits, Qbits, VHDCI);
628  VHDCItoSTRING(logicalCardID, eventNumber, dataString, VHDCI);
629 }
630 
632 // RC arrays are RC[receiver card number<7][region<2]
633 // HF arrays are HF[eta<4][HF region<2]
634 
635 void SourceCardRouting::RC56HFtoSTRING(unsigned short &logicalCardID,
636  unsigned short &eventNumber,
637  unsigned short (&RC)[7][2],
638  unsigned short (&RCof)[7][2],
639  unsigned short (&RCtau)[7][2],
640  unsigned short (&HF)[4][2],
641  unsigned short (&HFQ)[4][2],
642  std::string &dataString) const {
643  unsigned long VHDCI[2][2] = {{0}};
644  RC56HFtoVHDCI(RC, RCof, RCtau, HF, HFQ, VHDCI);
645  VHDCItoSTRING(logicalCardID, eventNumber, dataString, VHDCI);
646 }
647 
649 // RC arrays are RC[receiver card number<7][region<2]
650 
651 void SourceCardRouting::RC012toSTRING(unsigned short &logicalCardID,
652  unsigned short &eventNumber,
653  unsigned short (&RC)[7][2],
654  unsigned short (&RCof)[7][2],
655  unsigned short (&RCtau)[7][2],
656  std::string &dataString) const {
657  unsigned long VHDCI[2][2] = {{0}};
658  RC012toVHDCI(RC, RCof, RCtau, VHDCI);
659  VHDCItoSTRING(logicalCardID, eventNumber, dataString, VHDCI);
660 }
661 
663 // RC arrays are RC[receiver card number<7][region<2]
664 
665 void SourceCardRouting::RC234toSTRING(unsigned short &logicalCardID,
666  unsigned short &eventNumber,
667  unsigned short (&RC)[7][2],
668  unsigned short (&RCof)[7][2],
669  unsigned short (&RCtau)[7][2],
670  unsigned short (&sisterRC)[7][2],
671  unsigned short (&sisterRCof)[7][2],
672  unsigned short (&sisterRCtau)[7][2],
673  std::string &dataString) const {
674  unsigned long VHDCI[2][2] = {{0}};
675  RC234toVHDCI(RC, RCof, RCtau, sisterRC, sisterRCof, sisterRCtau, VHDCI);
676  VHDCItoSTRING(logicalCardID, eventNumber, dataString, VHDCI);
677 }
678 
681 // SFP arrays are SFP[cycle<2][sfp number<4]
682 void SourceCardRouting::SFPtoSTRING(unsigned short &logicalCardID,
683  unsigned short &eventNumber,
684  int RoutingMode,
685  unsigned short (&SFP)[2][4],
686  std::string &dataString) const {
687  unsigned long VHDCI[2][2] = {{0}};
688  SFPtoVHDCI(RoutingMode, SFP, VHDCI);
689  VHDCItoSTRING(logicalCardID, eventNumber, dataString, VHDCI);
690 }
691 
694 // VHDCI arrays are VHDCI[VHDCI<2][cycle<2]
695 void SourceCardRouting::STRINGtoVHDCI(unsigned short &logicalCardID,
696  unsigned short &eventNumber,
697  std::string &dataString,
698  unsigned long (&VHDCI)[2][2]) const {
699  stringstream temp;
700 
701  if (!dataString.empty()) {
702  temp << dataString << std::endl;
703  temp >> dec >> eventNumber;
704  temp >> dec >> logicalCardID;
705  temp >> hex >> VHDCI[0][0];
706  temp >> hex >> VHDCI[0][1];
707  temp >> hex >> VHDCI[1][0];
708  temp >> hex >> VHDCI[1][1];
709  } else {
710  eventNumber = 65535;
711  logicalCardID = 65535;
712  VHDCI[0][0] = 0;
713  VHDCI[0][1] = 0;
714  VHDCI[1][0] = 0;
715  VHDCI[1][1] = 0;
716  }
717 }
718 
720 // VHDCI arrays are VHDCI[VHDCI<2][cycle<2]
721 void SourceCardRouting::VHDCItoSTRING(unsigned short &logicalCardID,
722  unsigned short &eventNumber,
723  std::string &dataString,
724  unsigned long (&VHDCI)[2][2]) const {
725  stringstream temp;
726 
727  temp << dec << eventNumber << '\t';
728  temp << dec << logicalCardID << '\t';
729  temp << hex << setw(8) << setfill('0') << VHDCI[0][0] << '\t';
730  temp << hex << setw(8) << setfill('0') << VHDCI[0][1] << '\t';
731  temp << hex << setw(8) << setfill('0') << VHDCI[1][0] << '\t';
732  temp << hex << setw(8) << setfill('0') << VHDCI[1][1] << std::endl;
733  dataString = temp.str();
734 }
735 
738 
739 void SourceCardRouting::LogicalCardIDtoRoutingMode(unsigned short &logicalCardID,
740  int &RoutingMode,
741  int &RCTCrateNumber) const {
742  RCTCrateNumber = (logicalCardID >> 3);
743  if ((logicalCardID & 0x4) != 0)
744  RCTCrateNumber += 9;
745  RoutingMode = (logicalCardID & 0x3);
746 }
747 
749 
750 void SourceCardRouting::RoutingModetoLogicalCardID(unsigned short &logicalCardID,
751  int &RoutingMode,
752  int &RCTCrateNumber) const {
753  logicalCardID = ((RCTCrateNumber % 9) << 3) | (RCTCrateNumber > 8 ? 0x4 : 0x0) | (RoutingMode & 0x3);
754 }
755 
757 // These were going to be implimented but made things a lot more complicated
758 // than necessary
759 
760 /*
762 //RC arrays are RC[receiver card number<7][region<2]
763 //HF arrays are HF[eta<4][HF region<2]
764 //SFP arrays are SFP[cycle<2][sfp number<4]
765  void SourceCardRouting::RCtoSFP( int &RoutingMode,
766  unsigned short (&RC)[7][2],
767  unsigned short (&RCof)[7][2],
768  unsigned short (&RCtau)[7][2],
769  unsigned short (&sisterRC)[7][2],
770  unsigned short (&sisterRCof)[7][2],
771  unsigned short (&sisterRCtau)[7][2],
772  unsigned short (&HF)[4][2],
773  unsigned short (&HFQ)[4][2],
774  unsigned short (&SFP)[2][4] ){
775 
776  switch(RoutingMode){
777  case 1:
778  RC56HFtoSFP(RC,RCof,RCtau,HF,HFQ,SFP);
779  break;
780  case 2:
781  RC012toSFP(RC,RCof,RCtau,SFP);
782  break;
783  case 3:
784  RC234toSFP(RC,RCof,RCtau,sisterRC,sisterRCof,sisterRCtau,SFP);
785  break;
786  default:
787  break;
788  }
789 }
790 
791 
793 //RC arrays are RC[receiver card number<7][region<2]
794 //HF arrays are HF[eta<4][HF region<2]
795 //SFP arrays are SFP[cycle<2][sfp number<4]
796  void SourceCardRouting::SFPtoRC( int &RoutingMode,
797  unsigned short (&RC)[7][2],
798  unsigned short (&RCof)[7][2],
799  unsigned short (&RCtau)[7][2],
800  unsigned short (&sisterRC)[7][2],
801  unsigned short (&sisterRCof)[7][2],
802  unsigned short (&sisterRCtau)[7][2],
803  unsigned short (&HF)[4][2],
804  unsigned short (&HFQ)[4][2],
805  unsigned short (&SFP)[2][4] ){
806 
807  switch(RoutingMode){
808  case 1:
809  SFPtoRC56HF(RC,RCof,RCtau,HF,HFQ,SFP);
810  break;
811  case 2:
812  SFPtoRC012(RC,RCof,RCtau,SFP);
813  break;
814  case 3:
815  SFPtoRC234(RC,RCof,RCtau,sisterRC,sisterRCof,sisterRCtau,SFP);
816  break;
817  default:
818  break;
819  }
820 }
821 */
822 
823 /*
825 //RC arrays are RC[receiver card number<7][region<2]
826 //HF arrays are HF[eta<4][HF region<2]
827 //VHDCI arrays are VHDCI[VHDCI<2][cycle<2]
828  void SourceCardRouting::RCtoVHDCI( int &RoutingMode,
829  unsigned short (&RC)[7][2],
830  unsigned short (&RCof)[7][2],
831  unsigned short (&RCtau)[7][2],
832  unsigned short (&sisterRC)[7][2],
833  unsigned short (&sisterRCof)[7][2],
834  unsigned short (&sisterRCtau)[7][2],
835  unsigned short (&HF)[4][2],
836  unsigned short (&HFQ)[4][2],
837  unsigned long (&VHDCI)[2][2] ){
838 
839  switch(RoutingMode){
840  case 1:
841  RC56HFtoVHDCI(RC,RCof,RCtau,HF,HFQ,VHDCI);
842  break;
843  case 2:
844  RC012toVHDCI(RC,RCof,RCtau,VHDCI);
845  break;
846  case 3:
847  RC234toVHDCI(RC,RCof,RCtau,sisterRC,sisterRCof,sisterRCtau,VHDCI);
848  break;
849  default:
850  break;
851  }
852 }
853 
855 //RC arrays are RC[receiver card number<7][region<2]
856 //HF arrays are HF[eta<4][HF region<2]
857 //VHDCI arrays are VHDCI[VHDCI<2][cycle<2]
858  void SourceCardRouting::VHDCItoRC( int &RoutingMode,
859  unsigned short (&RC)[7][2],
860  unsigned short (&RCof)[7][2],
861  unsigned short (&RCtau)[7][2],
862  unsigned short (&sisterRC)[7][2],
863  unsigned short (&sisterRCof)[7][2],
864  unsigned short (&sisterRCtau)[7][2],
865  unsigned short (&HF)[4][2],
866  unsigned short (&HFQ)[4][2],
867  unsigned long (&VHDCI)[2][2] ){
868 
869  switch(RoutingMode){
870  case 1:
871  VHDCItoRC56HF(RC,RCof,RCtau,HF,HFQ,VHDCI);
872  break;
873  case 2:
874  VHDCItoRC012(RC,RCof,RCtau,VHDCI);
875  break;
876  case 3:
877  VHDCItoRC234(RC,RCof,RCtau,sisterRC,sisterRCof,sisterRCtau,VHDCI);
878  break;
879  default:
880  break;
881  }
882 }
883 */
mps_fire.i
i
Definition: mps_fire.py:355
SourceCardRouting::LogicalCardIDtoRoutingMode
void LogicalCardIDtoRoutingMode(unsigned short &logicalCardID, int &RoutingMode, int &RCTCrateNumber) const
Definition: SourceCardRouting.cc:739
SourceCardRouting::VHDCItoRC56HF
void VHDCItoRC56HF(unsigned short(&RC)[7][2], unsigned short(&RCof)[7][2], unsigned short(&RCtau)[7][2], unsigned short(&HF)[4][2], unsigned short(&HFQ)[4][2], unsigned long(&VHDCI)[2][2]) const
Definition: SourceCardRouting.cc:541
SourceCardRouting::EMUtoVHDCI
void EMUtoVHDCI(unsigned short(&eIsoRank)[4], unsigned short(&eIsoCardId)[4], unsigned short(&eIsoRegionId)[4], unsigned short(&eNonIsoRank)[4], unsigned short(&eNonIsoCardId)[4], unsigned short(&eNonIsoRegionId)[4], unsigned short(&MIPbits)[7][2], unsigned short(&Qbits)[7][2], unsigned long(&VHDCI)[2][2]) const
Definition: SourceCardRouting.cc:487
SourceCardRouting::RC56HFtoSFP
void RC56HFtoSFP(unsigned short(&RC)[7][2], unsigned short(&RCof)[7][2], unsigned short(&RCtau)[7][2], unsigned short(&HF)[4][2], unsigned short(&HFQ)[4][2], unsigned short(&SFP)[2][4]) const
Definition: SourceCardRouting.cc:120
SourceCardRouting::RC012toSTRING
void RC012toSTRING(unsigned short &logicalCardID, unsigned short &eventNumber, unsigned short(&RC)[7][2], unsigned short(&RCof)[7][2], unsigned short(&RCtau)[7][2], std::string &dataString) const
Definition: SourceCardRouting.cc:651
groupFilesInBlocks.temp
list temp
Definition: groupFilesInBlocks.py:142
SourceCardRouting::VHDCItoSTRING
void VHDCItoSTRING(unsigned short &logicalCardID, unsigned short &eventNumber, std::string &dataString, unsigned long(&VHDCI)[2][2]) const
Definition: SourceCardRouting.cc:721
SourceCardRouting::SFPtoRC234
void SFPtoRC234(unsigned short(&RC)[7][2], unsigned short(&RCof)[7][2], unsigned short(&RCtau)[7][2], unsigned short(&sisterRC)[7][2], unsigned short(&sisterRCof)[7][2], unsigned short(&sisterRCtau)[7][2], unsigned short(&SFP)[2][4]) const
Definition: SourceCardRouting.cc:271
SourceCardRouting::SFPtoRC56HF
void SFPtoRC56HF(unsigned short(&RC)[7][2], unsigned short(&RCof)[7][2], unsigned short(&RCtau)[7][2], unsigned short(&HF)[4][2], unsigned short(&HFQ)[4][2], unsigned short(&SFP)[2][4]) const
Definition: SourceCardRouting.cc:145
SourceCardRouting::RC012toSFP
void RC012toSFP(unsigned short(&RC)[7][2], unsigned short(&RCof)[7][2], unsigned short(&RCtau)[7][2], unsigned short(&SFP)[2][4]) const
Definition: SourceCardRouting.cc:191
SourceCardRouting::SFPtoSTRING
void SFPtoSTRING(unsigned short &logicalCardID, unsigned short &eventNumber, int RoutingMode, unsigned short(&SFP)[2][4], std::string &dataString) const
Definition: SourceCardRouting.cc:682
testProducerWithPsetDescEmpty_cfi.x1
x1
Definition: testProducerWithPsetDescEmpty_cfi.py:33
SourceCardRouting::RC56HFtoSTRING
void RC56HFtoSTRING(unsigned short &logicalCardID, unsigned short &eventNumber, unsigned short(&RC)[7][2], unsigned short(&RCof)[7][2], unsigned short(&RCtau)[7][2], unsigned short(&HF)[4][2], unsigned short(&HFQ)[4][2], std::string &dataString) const
Definition: SourceCardRouting.cc:635
SourceCardRouting::EMUtoSTRING
void EMUtoSTRING(unsigned short &logicalCardID, unsigned short &eventNumber, unsigned short(&eIsoRank)[4], unsigned short(&eIsoCardId)[4], unsigned short(&eIsoRegionId)[4], unsigned short(&eNonIsoRank)[4], unsigned short(&eNonIsoCardId)[4], unsigned short(&eNonIsoRegionId)[4], unsigned short(&MIPbits)[7][2], unsigned short(&Qbits)[7][2], std::string &dataString) const
Definition: SourceCardRouting.cc:615
SourceCardRouting::VHDCItoRC012
void VHDCItoRC012(unsigned short(&RC)[7][2], unsigned short(&RCof)[7][2], unsigned short(&RCtau)[7][2], unsigned long(&VHDCI)[2][2]) const
Definition: SourceCardRouting.cc:569
dqmdumpme.k
k
Definition: dqmdumpme.py:60
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
SourceCardRouting::STRINGtoVHDCI
void STRINGtoVHDCI(unsigned short &logicalCardID, unsigned short &eventNumber, std::string &dataString, unsigned long(&VHDCI)[2][2]) const
Definition: SourceCardRouting.cc:695
SourceCardRouting::RC234toSTRING
void RC234toSTRING(unsigned short &logicalCardID, unsigned short &eventNumber, unsigned short(&RC)[7][2], unsigned short(&RCof)[7][2], unsigned short(&RCtau)[7][2], unsigned short(&sisterRC)[7][2], unsigned short(&sisterRCof)[7][2], unsigned short(&sisterRCtau)[7][2], std::string &dataString) const
Definition: SourceCardRouting.cc:665
SourceCardRouting::SFPtoEMU
void SFPtoEMU(unsigned short(&eIsoRank)[4], unsigned short(&eIsoCardId)[4], unsigned short(&eIsoRegionId)[4], unsigned short(&eNonIsoRank)[4], unsigned short(&eNonIsoCardId)[4], unsigned short(&eNonIsoRegionId)[4], unsigned short(&MIPbits)[7][2], unsigned short(&Qbits)[7][2], unsigned short(&SFP)[2][4]) const
Definition: SourceCardRouting.cc:68
SourceCardRouting::RC012toVHDCI
void RC012toVHDCI(unsigned short(&RC)[7][2], unsigned short(&RCof)[7][2], unsigned short(&RCtau)[7][2], unsigned long(&VHDCI)[2][2]) const
Definition: SourceCardRouting.cc:556
SourceCardRouting::EMUtoSFP
void EMUtoSFP(unsigned short(&eIsoRank)[4], unsigned short(&eIsoCardId)[4], unsigned short(&eIsoRegionId)[4], unsigned short(&eNonIsoRank)[4], unsigned short(&eNonIsoCardId)[4], unsigned short(&eNonIsoRegionId)[4], unsigned short(&MIPbits)[7][2], unsigned short(&Qbits)[7][2], unsigned short(&SFP)[2][4]) const
Definition: SourceCardRouting.cc:30
SourceCardRouting::VHDCItoEMU
void VHDCItoEMU(unsigned short(&eIsoRank)[4], unsigned short(&eIsoCardId)[4], unsigned short(&eIsoRegionId)[4], unsigned short(&eNonIsoRank)[4], unsigned short(&eNonIsoCardId)[4], unsigned short(&eNonIsoRegionId)[4], unsigned short(&MIPbits)[7][2], unsigned short(&Qbits)[7][2], unsigned long(&VHDCI)[2][2]) const
Definition: SourceCardRouting.cc:506
SourceCardRouting::RC56HFtoVHDCI
void RC56HFtoVHDCI(unsigned short(&RC)[7][2], unsigned short(&RCof)[7][2], unsigned short(&RCtau)[7][2], unsigned short(&HF)[4][2], unsigned short(&HFQ)[4][2], unsigned long(&VHDCI)[2][2]) const
Definition: SourceCardRouting.cc:525
SourceCardRouting::VHDCItoSFP
void VHDCItoSFP(int RoutingMode, unsigned short(&SFP)[2][4], unsigned long(&VHDCI)[2][2]) const
Definition: SourceCardRouting.cc:399
std
Definition: JetResolutionObject.h:76
CaloTPGTranscoder_cfi.HF
HF
Definition: CaloTPGTranscoder_cfi.py:4
SourceCardRouting::RC234toSFP
void RC234toSFP(unsigned short(&RC)[7][2], unsigned short(&RCof)[7][2], unsigned short(&RCtau)[7][2], unsigned short(&sisterRC)[7][2], unsigned short(&sisterRCof)[7][2], unsigned short(&sisterRCtau)[7][2], unsigned short(&SFP)[2][4]) const
Definition: SourceCardRouting.cc:240
SourceCardRouting.h
SourceCardRouting::SFPtoVHDCI
void SFPtoVHDCI(int RoutingMode, unsigned short(&SFP)[2][4], unsigned long(&VHDCI)[2][2]) const
Definition: SourceCardRouting.cc:326
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
SourceCardRouting::RoutingModetoLogicalCardID
void RoutingModetoLogicalCardID(unsigned short &logicalCardID, int &RoutingMode, int &RCTCrateNumber) const
Definition: SourceCardRouting.cc:750
SourceCardRouting::~SourceCardRouting
~SourceCardRouting()
Definition: SourceCardRouting.cc:21
SourceCardRouting::RC234toVHDCI
void RC234toVHDCI(unsigned short(&RC)[7][2], unsigned short(&RCof)[7][2], unsigned short(&RCtau)[7][2], unsigned short(&sisterRC)[7][2], unsigned short(&sisterRCof)[7][2], unsigned short(&sisterRCtau)[7][2], unsigned long(&VHDCI)[2][2]) const
Definition: SourceCardRouting.cc:582
TauDecayModes.dec
dec
Definition: TauDecayModes.py:143
SourceCardRouting::VHDCItoRC234
void VHDCItoRC234(unsigned short(&RC)[7][2], unsigned short(&RCof)[7][2], unsigned short(&RCtau)[7][2], unsigned short(&sisterRC)[7][2], unsigned short(&sisterRCof)[7][2], unsigned short(&sisterRCtau)[7][2], unsigned long(&VHDCI)[2][2]) const
Definition: SourceCardRouting.cc:598
SourceCardRouting::SourceCardRouting
SourceCardRouting()
Definition: SourceCardRouting.cc:17
SourceCardRouting::SFPtoRC012
void SFPtoRC012(unsigned short(&RC)[7][2], unsigned short(&RCof)[7][2], unsigned short(&RCtau)[7][2], unsigned short(&SFP)[2][4]) const
Definition: SourceCardRouting.cc:214