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