test
CMS 3D CMS Logo

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