CMS 3D CMS Logo

SourceCardRouting.h
Go to the documentation of this file.
1 /*
2  SourceCardRouting library
3  Andrew Rose 2007
4 */
5 
6 #ifndef SOURCECARDROUTING_H
7 #define SOURCECARDROUTING_H
8 
9 // The string and stream definitions
10 #include <iostream>
11 #include <string>
12 
14 public:
17 
20  struct EmuToSfpData {
21  // Input data.
22  unsigned short eIsoRank[4];
23  unsigned short eIsoCardId[4];
24  unsigned short eIsoRegionId[4];
25  unsigned short eNonIsoRank[4];
26  unsigned short eNonIsoCardId[4];
27  unsigned short eNonIsoRegionId[4];
28  unsigned short mipBits[7][2];
29  unsigned short qBits[7][2];
30  // Output data.
31  unsigned short sfp[2][4]; // [ cycle ] [ output number ]
32  };
33 
34  // SFP arrays are SFP[cycle<2][sfp number<4]
35  // electron arrays are eIsoRank[candidate number<4]
36  // muon arrays are MIPbits[rec card number<7][region<2]
37  void EMUtoSFP(unsigned short (&eIsoRank)[4],
38  unsigned short (&eIsoCardId)[4],
39  unsigned short (&eIsoRegionId)[4],
40  unsigned short (&eNonIsoRank)[4],
41  unsigned short (&eNonIsoCardId)[4],
42  unsigned short (&eNonIsoRegionId)[4],
43  unsigned short (&MIPbits)[7][2],
44  unsigned short (&Qbits)[7][2],
45  unsigned short (&SFP)[2][4]) const;
46 
47  // SFP arrays are SFP[cycle<2][sfp number<4]
48  // electron arrays are eIsoRank[candidate number<4]
49  // muon arrays are MIPbits[rec card number<7][region<2]
50  void SFPtoEMU(unsigned short (&eIsoRank)[4],
51  unsigned short (&eIsoCardId)[4],
52  unsigned short (&eIsoRegionId)[4],
53  unsigned short (&eNonIsoRank)[4],
54  unsigned short (&eNonIsoCardId)[4],
55  unsigned short (&eNonIsoRegionId)[4],
56  unsigned short (&MIPbits)[7][2],
57  unsigned short (&Qbits)[7][2],
58  unsigned short (&SFP)[2][4]) const;
59 
60  /***********************************************************************************************************************/
61  // RC arrays are RC[receiver card number<7][region<2]
62  // HF arrays are HF[eta<4][HF region<2]
63  // SFP arrays are SFP[cycle<2][sfp number<4]
64  void RC56HFtoSFP(unsigned short (&RC)[7][2],
65  unsigned short (&RCof)[7][2],
66  unsigned short (&RCtau)[7][2],
67  unsigned short (&HF)[4][2],
68  unsigned short (&HFQ)[4][2],
69  unsigned short (&SFP)[2][4]) const;
70 
71  // RC arrays are RC[receiver card number<7][region<2]
72  // HF arrays are HF[eta<4][HF region<2]
73  // SFP arrays are SFP[cycle<2][sfp number<4]
74  void SFPtoRC56HF(unsigned short (&RC)[7][2],
75  unsigned short (&RCof)[7][2],
76  unsigned short (&RCtau)[7][2],
77  unsigned short (&HF)[4][2],
78  unsigned short (&HFQ)[4][2],
79  unsigned short (&SFP)[2][4]) const;
80 
81  // RC arrays are RC[receiver card number<7][region<2]
82  // SFP arrays are SFP[cycle<2][sfp number<4]
83  void RC012toSFP(unsigned short (&RC)[7][2],
84  unsigned short (&RCof)[7][2],
85  unsigned short (&RCtau)[7][2],
86  unsigned short (&SFP)[2][4]) const;
87 
88  // RC arrays are RC[receiver card number<7][region<2]
89  // SFP arrays are SFP[cycle<2][sfp number<4]
90  void SFPtoRC012(unsigned short (&RC)[7][2],
91  unsigned short (&RCof)[7][2],
92  unsigned short (&RCtau)[7][2],
93  unsigned short (&SFP)[2][4]) const;
94 
95  // RC arrays are RC[receiver card number<7][region<2]
96  // SFP arrays are SFP[cycle<2][sfp number<4]
97  void RC234toSFP(unsigned short (&RC)[7][2],
98  unsigned short (&RCof)[7][2],
99  unsigned short (&RCtau)[7][2],
100  unsigned short (&sisterRC)[7][2],
101  unsigned short (&sisterRCof)[7][2],
102  unsigned short (&sisterRCtau)[7][2],
103  unsigned short (&SFP)[2][4]) const;
104 
105  // RC arrays are RC[receiver card number<7][region<2]
106  // SFP arrays are SFP[cycle<2][sfp number<4]
107  void SFPtoRC234(unsigned short (&RC)[7][2],
108  unsigned short (&RCof)[7][2],
109  unsigned short (&RCtau)[7][2],
110  unsigned short (&sisterRC)[7][2],
111  unsigned short (&sisterRCof)[7][2],
112  unsigned short (&sisterRCtau)[7][2],
113  unsigned short (&SFP)[2][4]) const;
114 
115  /***********************************************************************************************************************/
116 
117  // VHDCI arrays are VHDCI[VHDCI<2][cycle<2]
118  // SFP arrays are SFP[cycle<2][sfp number<4]
119 
120  void SFPtoVHDCI(int RoutingMode, unsigned short (&SFP)[2][4], unsigned long (&VHDCI)[2][2]) const;
121 
122  // VHDCI arrays are VHDCI[VHDCI<2][cycle<2]
123  // SFP arrays are SFP[cycle<2][sfp number<4]
124  void VHDCItoSFP(int RoutingMode, unsigned short (&SFP)[2][4], unsigned long (&VHDCI)[2][2]) const;
125 
126  /***********************************************************************************************************************/
127 
128  // VHDCI arrays are VHDCI[VHDCI<2][cycle<2]
129  // electron arrays are eIsoRank[candidate number<4]
130  // muon arrays are MIPbits[rec card number<7][region<2]
131 
132  void EMUtoVHDCI(unsigned short (&eIsoRank)[4],
133  unsigned short (&eIsoCardId)[4],
134  unsigned short (&eIsoRegionId)[4],
135  unsigned short (&eNonIsoRank)[4],
136  unsigned short (&eNonIsoCardId)[4],
137  unsigned short (&eNonIsoRegionId)[4],
138  unsigned short (&MIPbits)[7][2],
139  unsigned short (&Qbits)[7][2],
140  unsigned long (&VHDCI)[2][2]) const;
141 
142  // VHDCI arrays are VHDCI[VHDCI<2][cycle<2]
143  // electron arrays are eIsoRank[candidate number<4]
144  // muon arrays are MIPbits[rec card number<7][region<2]
145  void VHDCItoEMU(unsigned short (&eIsoRank)[4],
146  unsigned short (&eIsoCardId)[4],
147  unsigned short (&eIsoRegionId)[4],
148  unsigned short (&eNonIsoRank)[4],
149  unsigned short (&eNonIsoCardId)[4],
150  unsigned short (&eNonIsoRegionId)[4],
151  unsigned short (&MIPbits)[7][2],
152  unsigned short (&Qbits)[7][2],
153  unsigned long (&VHDCI)[2][2]) const;
154 
155  /***********************************************************************************************************************/
156 
157  // RC arrays are RC[receiver card number<7][region<2]
158  // HF arrays are HF[eta<4][HF region<2]
159  // VHDCI arrays are VHDCI[VHDCI<2][cycle<2]
160  void RC56HFtoVHDCI(unsigned short (&RC)[7][2],
161  unsigned short (&RCof)[7][2],
162  unsigned short (&RCtau)[7][2],
163  unsigned short (&HF)[4][2],
164  unsigned short (&HFQ)[4][2],
165  unsigned long (&VHDCI)[2][2]) const;
166 
167  // RC arrays are RC[receiver card number<7][region<2]
168  // HF arrays are HF[eta<4][HF region<2]
169  // VHDCI arrays are VHDCI[VHDCI<2][cycle<2]
170  void VHDCItoRC56HF(unsigned short (&RC)[7][2],
171  unsigned short (&RCof)[7][2],
172  unsigned short (&RCtau)[7][2],
173  unsigned short (&HF)[4][2],
174  unsigned short (&HFQ)[4][2],
175  unsigned long (&VHDCI)[2][2]) const;
176 
177  // RC arrays are RC[receiver card number<7][region<2]
178  // VHDCI arrays are VHDCI[VHDCI<2][cycle<2]
179  void RC012toVHDCI(unsigned short (&RC)[7][2],
180  unsigned short (&RCof)[7][2],
181  unsigned short (&RCtau)[7][2],
182  unsigned long (&VHDCI)[2][2]) const;
183 
184  // RC arrays are RC[receiver card number<7][region<2]
185  // VHDCI arrays are VHDCI[VHDCI<2][cycle<2]
186  void VHDCItoRC012(unsigned short (&RC)[7][2],
187  unsigned short (&RCof)[7][2],
188  unsigned short (&RCtau)[7][2],
189  unsigned long (&VHDCI)[2][2]) const;
190 
191  // RC arrays are RC[receiver card number<7][region<2]
192  // VHDCI arrays are VHDCI[VHDCI<2][cycle<2]
193  void RC234toVHDCI(unsigned short (&RC)[7][2],
194  unsigned short (&RCof)[7][2],
195  unsigned short (&RCtau)[7][2],
196  unsigned short (&sisterRC)[7][2],
197  unsigned short (&sisterRCof)[7][2],
198  unsigned short (&sisterRCtau)[7][2],
199  unsigned long (&VHDCI)[2][2]) const;
200 
201  // RC arrays are RC[receiver card number<7][region<2]
202  // VHDCI arrays are VHDCI[VHDCI<2][cycle<2]
203  void VHDCItoRC234(unsigned short (&RC)[7][2],
204  unsigned short (&RCof)[7][2],
205  unsigned short (&RCtau)[7][2],
206  unsigned short (&sisterRC)[7][2],
207  unsigned short (&sisterRCof)[7][2],
208  unsigned short (&sisterRCtau)[7][2],
209  unsigned long (&VHDCI)[2][2]) const;
210 
211  /***********************************************************************************************************************/
212 
213  // electron arrays are eIsoRank[candidate number<4]
214  // muon arrays are MIPbits[rec card number<7][region<2]
215 
216  void EMUtoSTRING(unsigned short &logicalCardID,
217  unsigned short &eventNumber,
218  unsigned short (&eIsoRank)[4],
219  unsigned short (&eIsoCardId)[4],
220  unsigned short (&eIsoRegionId)[4],
221  unsigned short (&eNonIsoRank)[4],
222  unsigned short (&eNonIsoCardId)[4],
223  unsigned short (&eNonIsoRegionId)[4],
224  unsigned short (&MIPbits)[7][2],
225  unsigned short (&Qbits)[7][2],
226  std::string &dataString) const;
227 
228  // RC arrays are RC[receiver card number<7][region<2]
229  // HF arrays are HF[eta<4][HF region<2]
230  void RC56HFtoSTRING(unsigned short &logicalCardID,
231  unsigned short &eventNumber,
232  unsigned short (&RC)[7][2],
233  unsigned short (&RCof)[7][2],
234  unsigned short (&RCtau)[7][2],
235  unsigned short (&HF)[4][2],
236  unsigned short (&HFQ)[4][2],
237  std::string &dataString) const;
238 
239  // RC arrays are RC[receiver card number<7][region<2]
240  void RC012toSTRING(unsigned short &logicalCardID,
241  unsigned short &eventNumber,
242  unsigned short (&RC)[7][2],
243  unsigned short (&RCof)[7][2],
244  unsigned short (&RCtau)[7][2],
245  std::string &dataString) const;
246 
247  // RC arrays are RC[receiver card number<7][region<2]
248  void RC234toSTRING(unsigned short &logicalCardID,
249  unsigned short &eventNumber,
250  unsigned short (&RC)[7][2],
251  unsigned short (&RCof)[7][2],
252  unsigned short (&RCtau)[7][2],
253  unsigned short (&sisterRC)[7][2],
254  unsigned short (&sisterRCof)[7][2],
255  unsigned short (&sisterRCtau)[7][2],
256  std::string &dataString) const;
257 
258  /***********************************************************************************************************************/
259 
260  // SFP arrays are SFP[cycle<2][sfp number<4]
261  void SFPtoSTRING(unsigned short &logicalCardID,
262  unsigned short &eventNumber,
263  int RoutingMode,
264  unsigned short (&SFP)[2][4],
265  std::string &dataString) const;
266 
267  /***********************************************************************************************************************/
268 
269  // VHDCI arrays are VHDCI[VHDCI<2][cycle<2]
270  void STRINGtoVHDCI(unsigned short &logicalCardID,
271  unsigned short &eventNumber,
272  std::string &dataString,
273  unsigned long (&VHDCI)[2][2]) const;
274 
275  // VHDCI arrays are VHDCI[VHDCI<2][cycle<2]
276  void VHDCItoSTRING(unsigned short &logicalCardID,
277  unsigned short &eventNumber,
278  std::string &dataString,
279  unsigned long (&VHDCI)[2][2]) const;
280 
281  /***********************************************************************************************************************/
282 
283  void LogicalCardIDtoRoutingMode(unsigned short &logicalCardID, int &RoutingMode, int &RCTCrateNumber) const;
284 
285  void RoutingModetoLogicalCardID(unsigned short &logicalCardID, int &RoutingMode, int &RCTCrateNumber) const;
286 
287 }; // class SourceCardRouting
288 
289 #endif //~SOURCECARDMANAGER_H
290 
292 // These were going to be implimented but made things a lot more complicated
293 // than necessary
294 /*
295 //RC arrays are RC[receiver card number<7][region<2]
296 //HF arrays are HF[eta<4][HF region<2]
297 //SFP arrays are SFP[cycle<2][sfp number<4]
298  void RCtoSFP( int &RoutingMode,
299  unsigned short (&RC)[7][2],
300  unsigned short (&RCof)[7][2],
301  unsigned short (&RCtau)[7][2],
302  unsigned short (&sisterRC)[7][2],
303  unsigned short (&sisterRCof)[7][2],
304  unsigned short (&sisterRCtau)[7][2],
305  unsigned short (&HF)[4][2],
306  unsigned short (&HFQ)[4][2],
307  unsigned short (&SFP)[2][4] );
308 
309 
310 //RC arrays are RC[receiver card number<7][region<2]
311 //HF arrays are HF[eta<4][HF region<2]
312 //SFP arrays are SFP[cycle<2][sfp number<4]
313  void SFPtoRC( int &RoutingMode,
314  unsigned short (&RC)[7][2],
315  unsigned short (&RCof)[7][2],
316  unsigned short (&RCtau)[7][2],
317  unsigned short (&sisterRC)[7][2],
318  unsigned short (&sisterRCof)[7][2],
319  unsigned short (&sisterRCtau)[7][2],
320  unsigned short (&HF)[4][2],
321  unsigned short (&HFQ)[4][2],
322  unsigned short (&SFP)[2][4] );*/
323 
324 /*
325 //RC arrays are RC[receiver card number<7][region<2]
326 //VHDCI arrays are VHDCI[VHDCI<2][cycle<2]
327  void RCtoSTRING( unsigned short &logicalCardID,
328  unsigned short &eventNumber,
329  unsigned short (&RC)[7][2],
330  unsigned short (&RCof)[7][2],
331  unsigned short (&RCtau)[7][2],
332  unsigned short (&sisterRC)[7][2],
333  unsigned short (&sisterRCof)[7][2],
334  unsigned short (&sisterRCtau)[7][2],
335  unsigned short (&HF)[4][2],
336  unsigned short (&HFQ)[4][2],
337  std::string &dataString );
338 */
339 
340 /*
341 //RC arrays are RC[receiver card number<7][region<2]
342 //VHDCI arrays are VHDCI[VHDCI<2][cycle<2]
343  void RCtoVHDCI( int &RoutingMode,
344  unsigned short (&RC)[7][2],
345  unsigned short (&RCof)[7][2],
346  unsigned short (&RCtau)[7][2],
347  unsigned short (&sisterRC)[7][2],
348  unsigned short (&sisterRCof)[7][2],
349  unsigned short (&sisterRCtau)[7][2],
350  unsigned short (&HF)[4][2],
351  unsigned short (&HFQ)[4][2],
352  unsigned long (&VHDCI)[2][2] );
353 
354 //RC arrays are RC[receiver card number<7][region<2]
355 //VHDCI arrays are VHDCI[VHDCI<2][cycle<2]
356  void VHDCItoRC( int &RoutingMode,
357  unsigned short (&RC)[7][2],
358  unsigned short (&RCof)[7][2],
359  unsigned short (&RCtau)[7][2],
360  unsigned short (&sisterRC)[7][2],
361  unsigned short (&sisterRCof)[7][2],
362  unsigned short (&sisterRCtau)[7][2],
363  unsigned short (&HF)[4][2],
364  unsigned short (&HFQ)[4][2],
365  unsigned long (&VHDCI)[2][2] );
366 */
void SFPtoRC012(unsigned short(&RC)[7][2], unsigned short(&RCof)[7][2], unsigned short(&RCtau)[7][2], unsigned short(&SFP)[2][4]) const
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 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 LogicalCardIDtoRoutingMode(unsigned short &logicalCardID, int &RoutingMode, int &RCTCrateNumber) 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 RC012toSFP(unsigned short(&RC)[7][2], unsigned short(&RCof)[7][2], unsigned short(&RCtau)[7][2], unsigned short(&SFP)[2][4]) const
void SFPtoSTRING(unsigned short &logicalCardID, unsigned short &eventNumber, int RoutingMode, unsigned short(&SFP)[2][4], std::string &dataString) 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
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 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
void VHDCItoSTRING(unsigned short &logicalCardID, unsigned short &eventNumber, std::string &dataString, unsigned long(&VHDCI)[2][2]) const
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
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 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 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 VHDCItoRC012(unsigned short(&RC)[7][2], unsigned short(&RCof)[7][2], unsigned short(&RCtau)[7][2], unsigned long(&VHDCI)[2][2]) const
void VHDCItoSFP(int RoutingMode, unsigned short(&SFP)[2][4], unsigned long(&VHDCI)[2][2]) const
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 STRINGtoVHDCI(unsigned short &logicalCardID, unsigned short &eventNumber, std::string &dataString, unsigned long(&VHDCI)[2][2]) 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 SFPtoVHDCI(int RoutingMode, unsigned short(&SFP)[2][4], unsigned long(&VHDCI)[2][2]) 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 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 RC012toVHDCI(unsigned short(&RC)[7][2], unsigned short(&RCof)[7][2], unsigned short(&RCtau)[7][2], unsigned long(&VHDCI)[2][2]) const
void RoutingModetoLogicalCardID(unsigned short &logicalCardID, int &RoutingMode, int &RCTCrateNumber) 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 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