CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
GctFormatTranslateV38.cc
Go to the documentation of this file.
2 
3 // C++ headers
4 #include <iostream>
5 #include <cassert>
6 #include <algorithm>
7 #include <cmath>
8 
9 // Framework headers
11 
12 // Namespace resolution
13 using std::cout;
14 using std::endl;
15 using std::make_pair;
16 using std::pair;
17 
18 // INITIALISE STATIC VARIABLES
19 /*** Setup BlockID to BlockLength Map ***/
21  // Miscellaneous Blocks
22  {0x000, 0}, // NULL
23  // ConcJet FPGA
24  {0x580, 12}, // ConcJet: Input TrigPathA (Jet Cands)
25  {0x581, 2}, // ConcJet: Input TrigPathB (HF Rings)
26  {0x582, 4}, // ConcJet: Input TrigPathC (MissHt)
27  {0x583, 8}, // ConcJet: Jet Cands and Counts Output to GT
28  {0x587, 4}, // ConcJet: BX & Orbit Info
29  // ConcElec FPGA
30  {0x680, 16}, // ConcElec: Input TrigPathA (EM Cands)
31  {0x681, 6}, // ConcElec: Input TrigPathB (Et Sums)
32  {0x682, 2}, // ConcElec: Input TrigPathC (Ht Sums)
33  {0x683, 6}, // ConcElec: EM Cands and Energy Sums Output to GT
34  {0x686, 2}, // ConcElec: Test (GT Serdes Loopback)
35  {0x687, 4}, // ConcElec: BX & Orbit Info
36  // Electron Leaf FPGAs
37  {0x800, 20}, // Leaf0ElecPosEtaU1: Sort Input
38  {0x803, 4}, // Leaf0ElecPosEtaU1: Sort Output
39  {0x804, 15}, // Leaf0ElecPosEtaU1: Raw Input
40  {0x880, 16}, // Leaf0ElecPosEtaU2: Sort Input
41  {0x883, 4}, // Leaf0ElecPosEtaU2: Sort Output
42  {0x884, 12}, // Leaf0ElecPosEtaU2: Raw Input
43  {0xc00, 20}, // Leaf0ElecNegEtaU1: Sort Input
44  {0xc03, 4}, // Leaf0ElecNegEtaU1: Sort Output
45  {0xc04, 15}, // Leaf0ElecNegEtaU1: Raw Input
46  {0xc80, 16}, // Leaf0ElecNegEtaU2: Sort Input
47  {0xc83, 4}, // Leaf0ElecNegEtaU2: Sort Output
48  {0xc84, 12}, // Leaf0ElecNegEtaU2: Raw Input
49  // Wheel Pos-eta Jet FPGA
50  {0x300, 27}, // WheelPosEtaJet: Input TrigPathA (Jet Sort)
51  {0x301, 3}, // WheelPosEtaJet: Input TrigPathB (MissHt)
52  {0x303, 6}, // WheelPosEtaJet: Output TrigPathA (Jet Sort)
53  {0x305, 2}, // WheelPosEtaJet: Output TrigPathB (MissHt)
54  {0x306,
55  32}, // WheelPosEtaJet: Test (deprecated) (Doesn't exist in V27.1 format, but does in V24 & V25, so keep for CRUZET2 data compatibility reasons)
56  {0x307,
57  4}, // WheelPosEtaJet: Info (deprecated) (Doesn't exist in V27.1 format, but does in V24 & V25, so keep for CRUZET2 data compatibility reasons)
58  // Wheel Pos-eta Energy FPGA
59  {0x380, 21}, // WheelPosEtaEnergy: Input TrigPathA (Et)
60  {0x381, 6}, // WheelPosEtaEnergy: Input TrigPathB (Ht)
61  {0x383, 7}, // WheelPosEtaEnergy: Output TrigPathA (Et)
62  {0x385, 2}, // WheelPosEtaEnergy: Output TrigPathB (Ht)
63  {0x386, 32}, // WheelPosEtaEnergy: Test
64  {0x387,
65  6}, // WheelPosEtaEnergy: BX & Orbit Info (Potential data incompatibility between V24/V25 where block length=4, and V27.1 where block length=6)
66  // Wheel Neg-eta Jet FPGA
67  {0x700, 27}, // WheelNegEtaJet: Input TrigPathA (Jet Sort)
68  {0x701, 3}, // WheelNegEtaJet: Input TrigPathB (MissHt)
69  {0x703, 6}, // WheelNegEtaJet: Output TrigPathA (Jet Sort)
70  {0x705, 2}, // WheelNegEtaJet: Output TrigPathB (MissHt)
71  {0x706,
72  32}, // WheelNegEtaJet: Test (deprecated) (Doesn't exist in V27.1 format, but does in V24 & V25, so keep for CRUZET2 data compatibility reasons)
73  {0x707,
74  4}, // WheelNegEtaJet: Info (deprecated) (Doesn't exist in V27.1 format, but does in V24 & V25, so keep for CRUZET2 data compatibility reasons)
75  // Wheel Neg-eta Energy FPGA
76  {0x780, 21}, // WheelNegEtaEnergy: Input TrigPathA (Et)
77  {0x781, 6}, // WheelNegEtaEnergy: Input TrigPathB (Ht)
78  {0x783, 7}, // WheelNegEtaEnergy: Output TrigPathA (Et)
79  {0x785, 2}, // WheelNegEtaEnergy: Output TrigPathB (Ht)
80  {0x786, 32}, // WheelNegEtaEnergy: Test
81  {0x787,
82  6}, // WheelNegEtaEnergy: BX & Orbit Info (Potential data incompatibility between V24/V25 where block length=4, and V27.1 where block length=6)
83  // Jet Leaf FPGAs - Positive Eta
84  {0x900, 13}, // Leaf1JetPosEtaU1: JF2 Input
85  {0x901, 3}, // Leaf1JetPosEtaU1: JF2 Shared Received
86  {0x902, 3}, // Leaf1JetPosEtaU1: JF2 Shared Sent
87  {0x903, 10}, // Leaf1JetPosEtaU1: JF2 Output
88  {0x904, 8}, // Leaf1JetPosEtaU1: JF2 Raw Input
89  {0x908, 13}, // Leaf1JetPosEtaU1: JF3 Input
90  {0x909, 3}, // Leaf1JetPosEtaU1: JF3 Shared Received
91  {0x90a, 3}, // Leaf1JetPosEtaU1: JF3 Shared Sent
92  {0x90b, 10}, // Leaf1JetPosEtaU1: JF3 Output
93  {0x90c, 8}, // Leaf1JetPosEtaU1: JF3 Raw Input
94  {0x980, 6}, // Leaf1JetPosEtaU2: Eta0 Input
95  {0x984, 6}, // Leaf1JetPosEtaU2: Eta0 Raw Input
96  {0x988, 13}, // Leaf1JetPosEtaU2: JF1 Input
97  {0x989, 3}, // Leaf1JetPosEtaU2: JF1 Shared Received
98  {0x98a, 3}, // Leaf1JetPosEtaU2: JF1 Shared Sent
99  {0x98b, 10}, // Leaf1JetPosEtaU2: JF1 Output
100  {0x98c, 8}, // Leaf1JetPosEtaU2: JF1 Raw Input
101  {0xa00, 13}, // Leaf2JetPosEtaU1: JF2 Input
102  {0xa01, 3}, // Leaf2JetPosEtaU1: JF2 Shared Received
103  {0xa02, 3}, // Leaf2JetPosEtaU1: JF2 Shared Sent
104  {0xa03, 10}, // Leaf2JetPosEtaU1: JF2 Output
105  {0xa04, 8}, // Leaf2JetPosEtaU1: JF2 Raw Input
106  {0xa08, 13}, // Leaf2JetPosEtaU1: JF3 Input
107  {0xa09, 3}, // Leaf2JetPosEtaU1: JF3 Shared Received
108  {0xa0a, 3}, // Leaf2JetPosEtaU1: JF3 Shared Sent
109  {0xa0b, 10}, // Leaf2JetPosEtaU1: JF3 Output
110  {0xa0c, 8}, // Leaf2JetPosEtaU1: JF3 Raw Input
111  {0xa80, 6}, // Leaf2JetPosEtaU2: Eta0 Input
112  {0xa84, 6}, // Leaf2JetPosEtaU2: Eta0 Raw Input
113  {0xa88, 13}, // Leaf2JetPosEtaU2: JF1 Input
114  {0xa89, 3}, // Leaf2JetPosEtaU2: JF1 Shared Received
115  {0xa8a, 3}, // Leaf2JetPosEtaU2: JF1 Shared Sent
116  {0xa8b, 10}, // Leaf2JetPosEtaU2: JF1 Output
117  {0xa8c, 8}, // Leaf2JetPosEtaU2: JF1 Raw Input
118  {0xb00, 13}, // Leaf3JetPosEtaU1: JF2 Input
119  {0xb01, 3}, // Leaf3JetPosEtaU1: JF2 Shared Received
120  {0xb02, 3}, // Leaf3JetPosEtaU1: JF2 Shared Sent
121  {0xb03, 10}, // Leaf3JetPosEtaU1: JF2 Output
122  {0xb04, 8}, // Leaf3JetPosEtaU1: JF2 Raw Input
123  {0xb08, 13}, // Leaf3JetPosEtaU1: JF3 Input
124  {0xb09, 3}, // Leaf3JetPosEtaU1: JF3 Shared Received
125  {0xb0a, 3}, // Leaf3JetPosEtaU1: JF3 Shared Sent
126  {0xb0b, 10}, // Leaf3JetPosEtaU1: JF3 Output
127  {0xb0c, 8}, // Leaf3JetPosEtaU1: JF3 Raw Input
128  {0xb80, 6}, // Leaf3JetPosEtaU2: Eta0 Input
129  {0xb84, 6}, // Leaf3JetPosEtaU2: Eta0 Raw Input
130  {0xb88, 13}, // Leaf3JetPosEtaU2: JF1 Input
131  {0xb89, 3}, // Leaf3JetPosEtaU2: JF1 Shared Received
132  {0xb8a, 3}, // Leaf3JetPosEtaU2: JF1 Shared Sent
133  {0xb8b, 10}, // Leaf3JetPosEtaU2: JF1 Output
134  {0xb8c, 8}, // Leaf3JetPosEtaU2: JF1 Raw Input
135  // Jet Leaf FPGAs - Negative Eta
136  {0xd00, 13}, // Leaf1JetNegEtaU1: JF2 Input
137  {0xd01, 3}, // Leaf1JetNegEtaU1: JF2 Shared Received
138  {0xd02, 3}, // Leaf1JetNegEtaU1: JF2 Shared Sent
139  {0xd03, 10}, // Leaf1JetNegEtaU1: JF2 Output
140  {0xd04, 8}, // Leaf1JetNegEtaU1: JF2 Raw Input
141  {0xd08, 13}, // Leaf1JetNegEtaU1: JF3 Input
142  {0xd09, 3}, // Leaf1JetNegEtaU1: JF3 Shared Received
143  {0xd0a, 3}, // Leaf1JetNegEtaU1: JF3 Shared Sent
144  {0xd0b, 10}, // Leaf1JetNegEtaU1: JF3 Output
145  {0xd0c, 8}, // Leaf1JetNegEtaU1: JF3 Raw Input
146  {0xd80, 6}, // Leaf1JetNegEtaU2: Eta0 Input
147  {0xd84, 6}, // Leaf1JetNegEtaU2: Eta0 Raw Input
148  {0xd88, 13}, // Leaf1JetNegEtaU2: JF1 Input
149  {0xd89, 3}, // Leaf1JetNegEtaU2: JF1 Shared Received
150  {0xd8a, 3}, // Leaf1JetNegEtaU2: JF1 Shared Sent
151  {0xd8b, 10}, // Leaf1JetNegEtaU2: JF1 Output
152  {0xd8c, 8}, // Leaf1JetNegEtaU2: JF1 Raw Input
153  {0xe00, 13}, // Leaf2JetNegEtaU1: JF2 Input
154  {0xe01, 3}, // Leaf2JetNegEtaU1: JF2 Shared Received
155  {0xe02, 3}, // Leaf2JetNegEtaU1: JF2 Shared Sent
156  {0xe03, 10}, // Leaf2JetNegEtaU1: JF2 Output
157  {0xe04, 8}, // Leaf2JetNegEtaU1: JF2 Raw Input
158  {0xe08, 13}, // Leaf2JetNegEtaU1: JF3 Input
159  {0xe09, 3}, // Leaf2JetNegEtaU1: JF3 Shared Received
160  {0xe0a, 3}, // Leaf2JetNegEtaU1: JF3 Shared Sent
161  {0xe0b, 10}, // Leaf2JetNegEtaU1: JF3 Output
162  {0xe0c, 8}, // Leaf2JetNegEtaU1: JF3 Raw Input
163  {0xe80, 6}, // Leaf2JetNegEtaU2: Eta0 Input
164  {0xe84, 6}, // Leaf2JetNegEtaU2: Eta0 Raw Input
165  {0xe88, 13}, // Leaf2JetNegEtaU2: JF1 Input
166  {0xe89, 3}, // Leaf2JetNegEtaU2: JF1 Shared Received
167  {0xe8a, 3}, // Leaf2JetNegEtaU2: JF1 Shared Sent
168  {0xe8b, 10}, // Leaf2JetNegEtaU2: JF1 Output
169  {0xe8c, 8}, // Leaf2JetNegEtaU2: JF1 Raw Input
170  {0xf00, 13}, // Leaf3JetNegEtaU1: JF2 Input
171  {0xf01, 3}, // Leaf3JetNegEtaU1: JF2 Shared Received
172  {0xf02, 3}, // Leaf3JetNegEtaU1: JF2 Shared Sent
173  {0xf03, 10}, // Leaf3JetNegEtaU1: JF2 Output
174  {0xf04, 8}, // Leaf3JetNegEtaU1: JF2 Raw Input
175  {0xf08, 13}, // Leaf3JetNegEtaU1: JF3 Input
176  {0xf09, 3}, // Leaf3JetNegEtaU1: JF3 Shared Received
177  {0xf0a, 3}, // Leaf3JetNegEtaU1: JF3 Shared Sent
178  {0xf0b, 10}, // Leaf3JetNegEtaU1: JF3 Output
179  {0xf0c, 8}, // Leaf3JetNegEtaU1: JF3 Raw Input
180  {0xf80, 6}, // Leaf3JetNegEtaU2: Eta0 Input
181  {0xf84, 6}, // Leaf3JetNegEtaU2: Eta0 Raw Input
182  {0xf88, 13}, // Leaf3JetNegEtaU2: JF1 Input
183  {0xf89, 3}, // Leaf3JetNegEtaU2: JF1 Shared Received
184  {0xf8a, 3}, // Leaf3JetNegEtaU2: JF1 Shared Sent
185  {0xf8b, 10}, // Leaf3JetNegEtaU2: JF1 Output
186  {0xf8c, 8} // Leaf3JetNegEtaU2: JF1 Raw Input
187 };
188 
189 /*** Setup BlockID to BlockName Map ***/
191  // Miscellaneous Blocks
192  {0x000, "NULL"},
193  // ConcJet FPGA
194  {0x580, "ConcJet: Input TrigPathA (Jet Cands)"},
195  {0x581, "ConcJet: Input TrigPathB (HF Rings)"},
196  {0x582, "ConcJet: Input TrigPathC (MissHt)"},
197  {0x583, "ConcJet: Jet Cands and Counts Output to GT"},
198  {0x587, "ConcJet: BX & Orbit Info"},
199  // ConcElec FPGA
200  {0x680, "ConcElec: Input TrigPathA (EM Cands)"},
201  {0x681, "ConcElec: Input TrigPathB (Et Sums)"},
202  {0x682, "ConcElec: Input TrigPathC (Ht Sums)"},
203  {0x683, "ConcElec: EM Cands and Energy Sums Output to GT"},
204  {0x686, "ConcElec: Test (GT Serdes Loopback)"},
205  {0x687, "ConcElec: BX & Orbit Info"},
206  // Electron Leaf FPGAs
207  {0x800, "Leaf0ElecPosEtaU1: Sort Input"},
208  {0x803, "Leaf0ElecPosEtaU1: Sort Output"},
209  {0x804, "Leaf0ElecPosEtaU1: Raw Input"},
210  {0x880, "Leaf0ElecPosEtaU2: Sort Input"},
211  {0x883, "Leaf0ElecPosEtaU2: Sort Output"},
212  {0x884, "Leaf0ElecPosEtaU2: Raw Input"},
213  {0xc00, "Leaf0ElecNegEtaU1: Sort Input"},
214  {0xc03, "Leaf0ElecNegEtaU1: Sort Output"},
215  {0xc04, "Leaf0ElecNegEtaU1: Raw Input"},
216  {0xc80, "Leaf0ElecNegEtaU2: Sort Input"},
217  {0xc83, "Leaf0ElecNegEtaU2: Sort Output"},
218  {0xc84, "Leaf0ElecNegEtaU2: Raw Input"},
219  // Wheel Pos-eta Jet FPGA
220  {0x300, "WheelPosEtaJet: Input TrigPathA (Jet Sort)"},
221  {0x301, "WheelPosEtaJet: Input TrigPathB (MissHt)"},
222  {0x303, "WheelPosEtaJet: Output TrigPathA (Jet Sort)"},
223  {0x305, "WheelPosEtaJet: Output TrigPathB (MissHt)"},
224  {0x306,
225  "WheelPosEtaJet: Test (deprecated)"}, // (Doesn't exist in V27.1 format, but does in V24 & V25, so keep for CRUZET2 data compatibility reasons)
226  {0x307,
227  "WheelPosEtaJet: Info (deprecated)"}, // (Doesn't exist in V27.1 format, but does in V24 & V25, so keep for CRUZET2 data compatibility reasons)
228  // Wheel Pos-eta Energy FPGA
229  {0x380, "WheelPosEtaEnergy: Input TrigPathA (Et)"},
230  {0x381, "WheelPosEtaEnergy: Input TrigPathB (Ht)"},
231  {0x383, "WheelPosEtaEnergy: Output TrigPathA (Et)"},
232  {0x385, "WheelPosEtaEnergy: Output TrigPathB (Ht)"},
233  {0x386, "WheelPosEtaEnergy: Test"},
234  {0x387, "WheelPosEtaEnergy: BX & Orbit Info"},
235  // Wheel Neg-eta Jet FPGA
236  {0x700, "WheelNegEtaJet: Input TrigPathA (Jet Sort)"},
237  {0x701, "WheelNegEtaJet: Input TrigPathB (MissHt)"},
238  {0x703, "WheelNegEtaJet: Output TrigPathA (Jet Sort)"},
239  {0x705, "WheelNegEtaJet: Output TrigPathB (MissHt)"},
240  {0x706,
241  "WheelNegEtaJet: Test (deprecated)"}, // (Doesn't exist in V27.1 format, but does in V24 & V25, so keep for CRUZET2 data compatibility reasons)
242  {0x707,
243  "WheelNegEtaJet: Info (deprecated)"}, // (Doesn't exist in V27.1 format, but does in V24 & V25, so keep for CRUZET2 data compatibility reasons)
244  // Wheel Neg-eta Energy FPGA
245  {0x780, "WheelNegEtaEnergy: Input TrigPathA (Et)"},
246  {0x781, "WheelNegEtaEnergy: Input TrigPathB (Ht)"},
247  {0x783, "WheelNegEtaEnergy: Output TrigPathA (Et)"},
248  {0x785, "WheelNegEtaEnergy: Output TrigPathB (Ht)"},
249  {0x786, "WheelNegEtaEnergy: Test"},
250  {0x787, "WheelNegEtaEnergy: BX & Orbit Info"},
251  // Jet Leaf FPGAs - Positive Eta
252  {0x900, "Leaf1JetPosEtaU1: JF2 Input"},
253  {0x901, "Leaf1JetPosEtaU1: JF2 Shared Received"},
254  {0x902, "Leaf1JetPosEtaU1: JF2 Shared Sent"},
255  {0x903, "Leaf1JetPosEtaU1: JF2 Output"},
256  {0x904, "Leaf1JetPosEtaU1: JF2 Raw Input"},
257  {0x908, "Leaf1JetPosEtaU1: JF3 Input"},
258  {0x909, "Leaf1JetPosEtaU1: JF3 Shared Received"},
259  {0x90a, "Leaf1JetPosEtaU1: JF3 Shared Sent"},
260  {0x90b, "Leaf1JetPosEtaU1: JF3 Output"},
261  {0x90c, "Leaf1JetPosEtaU1: JF3 Raw Input"},
262  {0x980, "Leaf1JetPosEtaU2: Eta0 Input"}, // Next Leaf Start
263  {0x984, "Leaf1JetPosEtaU2: Eta0 Raw Input"},
264  {0x988, "Leaf1JetPosEtaU2: JF1 Input"},
265  {0x989, "Leaf1JetPosEtaU2: JF1 Shared Received"},
266  {0x98a, "Leaf1JetPosEtaU2: JF1 Shared Sent"},
267  {0x98b, "Leaf1JetPosEtaU2: JF1 Output"},
268  {0x98c, "Leaf1JetPosEtaU2: JF1 Raw Input"},
269  {0xa00, "Leaf2JetPosEtaU1: JF2 Input"}, // Next Leaf Start
270  {0xa01, "Leaf2JetPosEtaU1: JF2 Shared Received"},
271  {0xa02, "Leaf2JetPosEtaU1: JF2 Shared Sent"},
272  {0xa03, "Leaf2JetPosEtaU1: JF2 Output"},
273  {0xa04, "Leaf2JetPosEtaU1: JF2 Raw Input"},
274  {0xa08, "Leaf2JetPosEtaU1: JF3 Input"},
275  {0xa09, "Leaf2JetPosEtaU1: JF3 Shared Received"},
276  {0xa0a, "Leaf2JetPosEtaU1: JF3 Shared Sent"},
277  {0xa0b, "Leaf2JetPosEtaU1: JF3 Output"},
278  {0xa0c, "Leaf2JetPosEtaU1: JF3 Raw Input"},
279  {0xa80, "Leaf2JetPosEtaU2: Eta0 Input"}, // Next Leaf Start
280  {0xa84, "Leaf2JetPosEtaU2: Eta0 Raw Input"},
281  {0xa88, "Leaf2JetPosEtaU2: JF1 Input"},
282  {0xa89, "Leaf2JetPosEtaU2: JF1 Shared Received"},
283  {0xa8a, "Leaf2JetPosEtaU2: JF1 Shared Sent"},
284  {0xa8b, "Leaf2JetPosEtaU2: JF1 Output"},
285  {0xa8c, "Leaf2JetPosEtaU2: JF1 Raw Input"},
286  {0xb00, "Leaf3JetPosEtaU1: JF2 Input"}, // Next Leaf Start
287  {0xb01, "Leaf3JetPosEtaU1: JF2 Shared Received"},
288  {0xb02, "Leaf3JetPosEtaU1: JF2 Shared Sent"},
289  {0xb03, "Leaf3JetPosEtaU1: JF2 Output"},
290  {0xb04, "Leaf3JetPosEtaU1: JF2 Raw Input"},
291  {0xb08, "Leaf3JetPosEtaU1: JF3 Input"},
292  {0xb09, "Leaf3JetPosEtaU1: JF3 Shared Received"},
293  {0xb0a, "Leaf3JetPosEtaU1: JF3 Shared Sent"},
294  {0xb0b, "Leaf3JetPosEtaU1: JF3 Output"},
295  {0xb0c, "Leaf3JetPosEtaU1: JF3 Raw Input"},
296  {0xb80, "Leaf3JetPosEtaU2: Eta0 Input"}, // Next Leaf Start
297  {0xb84, "Leaf3JetPosEtaU2: Eta0 Raw Input"},
298  {0xb88, "Leaf3JetPosEtaU2: JF1 Input"},
299  {0xb89, "Leaf3JetPosEtaU2: JF1 Shared Received"},
300  {0xb8a, "Leaf3JetPosEtaU2: JF1 Shared Sent"},
301  {0xb8b, "Leaf3JetPosEtaU2: JF1 Output"},
302  {0xb8c, "Leaf3JetPosEtaU2: JF1 Raw Input"},
303  // Jet Leaf FPGAs - Negative Eta
304  {0xd00, "Leaf1JetNegEtaU1: JF2 Input"}, // START OF NEG ETA JET LEAVES
305  {0xd01, "Leaf1JetNegEtaU1: JF2 Shared Received"},
306  {0xd02, "Leaf1JetNegEtaU1: JF2 Shared Sent"},
307  {0xd03, "Leaf1JetNegEtaU1: JF2 Output"},
308  {0xd04, "Leaf1JetNegEtaU1: JF2 Raw Input"},
309  {0xd08, "Leaf1JetNegEtaU1: JF3 Input"},
310  {0xd09, "Leaf1JetNegEtaU1: JF3 Shared Received"},
311  {0xd0a, "Leaf1JetNegEtaU1: JF3 Shared Sent"},
312  {0xd0b, "Leaf1JetNegEtaU1: JF3 Output"},
313  {0xd0c, "Leaf1JetNegEtaU1: JF3 Raw Input"},
314  {0xd80, "Leaf1JetNegEtaU2: Eta0 Input"}, // Next Leaf Start
315  {0xd84, "Leaf1JetNegEtaU2: Eta0 Raw Input"},
316  {0xd88, "Leaf1JetNegEtaU2: JF1 Input"},
317  {0xd89, "Leaf1JetNegEtaU2: JF1 Shared Received"},
318  {0xd8a, "Leaf1JetNegEtaU2: JF1 Shared Sent"},
319  {0xd8b, "Leaf1JetNegEtaU2: JF1 Output"},
320  {0xd8c, "Leaf1JetNegEtaU2: JF1 Raw Input"},
321  {0xe00, "Leaf2JetNegEtaU1: JF2 Input"}, // Next Leaf Start
322  {0xe01, "Leaf2JetNegEtaU1: JF2 Shared Received"},
323  {0xe02, "Leaf2JetNegEtaU1: JF2 Shared Sent"},
324  {0xe03, "Leaf2JetNegEtaU1: JF2 Output"},
325  {0xe04, "Leaf2JetNegEtaU1: JF2 Raw Input"},
326  {0xe08, "Leaf2JetNegEtaU1: JF3 Input"},
327  {0xe09, "Leaf2JetNegEtaU1: JF3 Shared Received"},
328  {0xe0a, "Leaf2JetNegEtaU1: JF3 Shared Sent"},
329  {0xe0b, "Leaf2JetNegEtaU1: JF3 Output"},
330  {0xe0c, "Leaf2JetNegEtaU1: JF3 Raw Input"},
331  {0xe80, "Leaf2JetNegEtaU2: Eta0 Input"}, // Next Leaf Start
332  {0xe84, "Leaf2JetNegEtaU2: Eta0 Raw Input"},
333  {0xe88, "Leaf2JetNegEtaU2: JF1 Input"},
334  {0xe89, "Leaf2JetNegEtaU2: JF1 Shared Received"},
335  {0xe8a, "Leaf2JetNegEtaU2: JF1 Shared Sent"},
336  {0xe8b, "Leaf2JetNegEtaU2: JF1 Output"},
337  {0xe8c, "Leaf2JetNegEtaU2: JF1 Raw Input"},
338  {0xf00, "Leaf3JetNegEtaU1: JF2 Input"}, // Next Leaf Start
339  {0xf01, "Leaf3JetNegEtaU1: JF2 Shared Received"},
340  {0xf02, "Leaf3JetNegEtaU1: JF2 Shared Sent"},
341  {0xf03, "Leaf3JetNegEtaU1: JF2 Output"},
342  {0xf04, "Leaf3JetNegEtaU1: JF2 Raw Input"},
343  {0xf08, "Leaf3JetNegEtaU1: JF3 Input"},
344  {0xf09, "Leaf3JetNegEtaU1: JF3 Shared Received"},
345  {0xf0a, "Leaf3JetNegEtaU1: JF3 Shared Sent"},
346  {0xf0b, "Leaf3JetNegEtaU1: JF3 Output"},
347  {0xf0c, "Leaf3JetNegEtaU1: JF3 Raw Input"},
348  {0xf80, "Leaf3JetNegEtaU2: Eta0 Input"}, // Next Leaf Start
349  {0xf84, "Leaf3JetNegEtaU2: Eta0 Raw Input"},
350  {0xf88, "Leaf3JetNegEtaU2: JF1 Input"},
351  {0xf89, "Leaf3JetNegEtaU2: JF1 Shared Received"},
352  {0xf8a, "Leaf3JetNegEtaU2: JF1 Shared Sent"},
353  {0xf8b, "Leaf3JetNegEtaU2: JF1 Output"},
354  {0xf8c, "Leaf3JetNegEtaU2: JF1 Raw Input"}};
355 
356 /*** Setup BlockID to Unpack-Function Map ***/
358  // Miscellaneous Blocks
359  {0x000, &GctFormatTranslateV38::blockDoNothing}, // NULL
360  // ConcJet FPGA
361  {0x580, &GctFormatTranslateV38::blockToGctTrigObjects}, // ConcJet: Input TrigPathA (Jet Cands)
362  {0x581, &GctFormatTranslateV38::blockToGctInternRingSums}, // ConcJet: Input TrigPathB (HF Rings)
363  {0x582, &GctFormatTranslateV38::blockToGctInternHtMissPostWheel}, // ConcJet: Input TrigPathC (MissHt)
364  {0x583, &GctFormatTranslateV38::blockToGctJetCandsAndCounts}, // ConcJet: Jet Cands and Counts Output to GT
365  {0x587, &GctFormatTranslateV38::blockDoNothing}, // ConcJet: BX & Orbit Info
366  // ConcElec FPGA
367  {0x680, &GctFormatTranslateV38::blockToGctInternEmCand}, // ConcElec: Input TrigPathA (EM Cands)
368  {0x681, &GctFormatTranslateV38::blockToGctInternEtSums}, // ConcElec: Input TrigPathB (Et Sums)
369  {0x682, &GctFormatTranslateV38::blockToGctInternEtSums}, // ConcElec: Input TrigPathC (Ht Sums)
370  {0x683, &GctFormatTranslateV38::blockToGctEmCandsAndEnergySums}, // ConcElec: EM Cands and Energy Sums Output to GT
371  {0x686, &GctFormatTranslateV38::blockDoNothing}, // ConcElec: Test (GT Serdes Loopback)
372  {0x687, &GctFormatTranslateV38::blockDoNothing}, // ConcElec: BX & Orbit Info
373  // Electron Leaf FPGAs
374  {0x800, &GctFormatTranslateV38::blockToGctInternEmCand}, // Leaf0ElecPosEtaU1: Sort Input
375  {0x803, &GctFormatTranslateV38::blockToGctInternEmCand}, // Leaf0ElecPosEtaU1: Sort Output
376  {0x804, &GctFormatTranslateV38::blockToFibresAndToRctEmCand}, // Leaf0ElecPosEtaU1: Raw Input
377  {0x880, &GctFormatTranslateV38::blockToGctInternEmCand}, // Leaf0ElecPosEtaU2: Sort Input
378  {0x883, &GctFormatTranslateV38::blockToGctInternEmCand}, // Leaf0ElecPosEtaU2: Sort Output
379  {0x884, &GctFormatTranslateV38::blockToFibresAndToRctEmCand}, // Leaf0ElecPosEtaU2: Raw Input
380  {0xc00, &GctFormatTranslateV38::blockToGctInternEmCand}, // Leaf0ElecNegEtaU1: Sort Input
381  {0xc03, &GctFormatTranslateV38::blockToGctInternEmCand}, // Leaf0ElecNegEtaU1: Sort Output
382  {0xc04, &GctFormatTranslateV38::blockToFibresAndToRctEmCand}, // Leaf0ElecNegEtaU1: Raw Input
383  {0xc80, &GctFormatTranslateV38::blockToGctInternEmCand}, // Leaf0ElecNegEtaU2: Sort Input
384  {0xc83, &GctFormatTranslateV38::blockToGctInternEmCand}, // Leaf0ElecNegEtaU2: Sort Output
385  {0xc84, &GctFormatTranslateV38::blockToFibresAndToRctEmCand}, // Leaf0ElecNegEtaU2: Raw Input
386  // Wheel Pos-eta Jet FPGA
387  {0x300, &GctFormatTranslateV38::blockToGctJetClusterMinimal}, // WheelPosEtaJet: Input TrigPathA (Jet Sort)
388  {0x301, &GctFormatTranslateV38::blockToGctInternHtMissPreWheel}, // WheelPosEtaJet: Input TrigPathB (MissHt)
389  {0x303, &GctFormatTranslateV38::blockToGctTrigObjects}, // WheelPosEtaJet: Output TrigPathA (Jet Sort)
390  {0x305, &GctFormatTranslateV38::blockToGctInternHtMissPostWheel}, // WheelPosEtaJet: Output TrigPathB (MissHt)
391  {0x306,
393  blockDoNothing}, // WheelPosEtaJet: Test (deprecated) (Doesn't exist in V27.1 format, but does in V24 & V25, so keep for CRUZET2 data compatibility reasons)
394  {0x307,
396  blockDoNothing}, // WheelPosEtaJet: Info (deprecated) (Doesn't exist in V27.1 format, but does in V24 & V25, so keep for CRUZET2 data compatibility reasons)
397  // Wheel Pos-eta Energy FPGA
398  {0x380,
399  &GctFormatTranslateV38::blockToGctWheelInputInternEtAndRingSums}, // WheelPosEtaEnergy: Input TrigPathA (Et)
400  {0x381, &GctFormatTranslateV38::blockToGctInternEtSums}, // WheelPosEtaEnergy: Input TrigPathB (Ht)
401  {0x383,
402  &GctFormatTranslateV38::blockToGctWheelOutputInternEtAndRingSums}, // WheelPosEtaEnergy: Output TrigPathA (Et)
403  {0x385, &GctFormatTranslateV38::blockToGctInternEtSums}, // WheelPosEtaEnergy: Output TrigPathB (Ht)
404  {0x386, &GctFormatTranslateV38::blockDoNothing}, // WheelPosEtaEnergy: Test
405  {0x387,
407  blockDoNothing}, // WheelPosEtaEnergy: BX & Orbit Info (Potential data incompatibility between V24/V25 where block length=4, and V27.1 where block length=6)
408  // Wheel Neg-eta Jet FPGA
409  {0x700, &GctFormatTranslateV38::blockToGctJetClusterMinimal}, // WheelNegEtaJet: Input TrigPathA (Jet Sort)
410  {0x701, &GctFormatTranslateV38::blockToGctInternHtMissPreWheel}, // WheelNegEtaJet: Input TrigPathB (MissHt)
411  {0x703, &GctFormatTranslateV38::blockToGctTrigObjects}, // WheelNegEtaJet: Output TrigPathA (Jet Sort)
412  {0x705, &GctFormatTranslateV38::blockToGctInternHtMissPostWheel}, // WheelNegEtaJet: Output TrigPathB (MissHt)
413  {0x706,
415  blockDoNothing}, // WheelNegEtaJet: Test (deprecated) (Doesn't exist in V27.1 format, but does in V24 & V25, so keep for CRUZET2 data compatibility reasons)
416  {0x707,
418  blockDoNothing}, // WheelNegEtaJet: Info (deprecated) (Doesn't exist in V27.1 format, but does in V24 & V25, so keep for CRUZET2 data compatibility reasons)
419  // Wheel Neg-eta Energy FPGA
420  {0x780,
421  &GctFormatTranslateV38::blockToGctWheelInputInternEtAndRingSums}, // WheelNegEtaEnergy: Input TrigPathA (Et)
422  {0x781, &GctFormatTranslateV38::blockToGctInternEtSums}, // WheelNegEtaEnergy: Input TrigPathB (Ht)
423  {0x783,
424  &GctFormatTranslateV38::blockToGctWheelOutputInternEtAndRingSums}, // WheelNegEtaEnergy: Output TrigPathA (Et)
425  {0x785, &GctFormatTranslateV38::blockToGctInternEtSums}, // WheelNegEtaEnergy: Output TrigPathB (Ht)
426  {0x786, &GctFormatTranslateV38::blockDoNothing}, // WheelNegEtaEnergy: Test
427  {0x787,
429  blockDoNothing}, // WheelNegEtaEnergy: BX & Orbit Info (Potential data incompatibility between V24/V25 where block length=4, and V27.1 where block length=6)
430  // Jet Leaf FPGAs - Positive Eta
431  {0x900, &GctFormatTranslateV38::blockToRctCaloRegions}, // Leaf1JetPosEtaU1: JF2 Input
432  {0x901, &GctFormatTranslateV38::blockToGctJetPreCluster}, // Leaf1JetPosEtaU1: JF2 Shared Received
433  {0x902, &GctFormatTranslateV38::blockToGctJetPreCluster}, // Leaf1JetPosEtaU1: JF2 Shared Sent
434  {0x903, &GctFormatTranslateV38::blockToGctInternEtSumsAndJetCluster}, // Leaf1JetPosEtaU1: JF2 Output
435  {0x904, &GctFormatTranslateV38::blockToFibres}, // Leaf1JetPosEtaU1: JF2 Raw Input
436  {0x908, &GctFormatTranslateV38::blockToRctCaloRegions}, // Leaf1JetPosEtaU1: JF3 Input
437  {0x909, &GctFormatTranslateV38::blockToGctJetPreCluster}, // Leaf1JetPosEtaU1: JF3 Shared Received
438  {0x90a, &GctFormatTranslateV38::blockToGctJetPreCluster}, // Leaf1JetPosEtaU1: JF3 Shared Sent
439  {0x90b, &GctFormatTranslateV38::blockToGctInternEtSumsAndJetCluster}, // Leaf1JetPosEtaU1: JF3 Output
440  {0x90c, &GctFormatTranslateV38::blockToFibres}, // Leaf1JetPosEtaU1: JF3 Raw Input
441  {0x980, &GctFormatTranslateV38::blockDoNothing}, // Leaf1JetPosEtaU2: Eta0 Input
442  {0x984, &GctFormatTranslateV38::blockToFibres}, // Leaf1JetPosEtaU2: Eta0 Raw Input
443  {0x988, &GctFormatTranslateV38::blockToRctCaloRegions}, // Leaf1JetPosEtaU2: JF1 Input
444  {0x989, &GctFormatTranslateV38::blockToGctJetPreCluster}, // Leaf1JetPosEtaU2: JF1 Shared Received
445  {0x98a, &GctFormatTranslateV38::blockToGctJetPreCluster}, // Leaf1JetPosEtaU2: JF1 Shared Sent
446  {0x98b, &GctFormatTranslateV38::blockToGctInternEtSumsAndJetCluster}, // Leaf1JetPosEtaU2: JF1 Output
447  {0x98c, &GctFormatTranslateV38::blockToFibres}, // Leaf1JetPosEtaU2: JF1 Raw Input
448  {0xa00, &GctFormatTranslateV38::blockToRctCaloRegions}, // Leaf2JetPosEtaU1: JF2 Input
449  {0xa01, &GctFormatTranslateV38::blockToGctJetPreCluster}, // Leaf2JetPosEtaU1: JF2 Shared Received
450  {0xa02, &GctFormatTranslateV38::blockToGctJetPreCluster}, // Leaf2JetPosEtaU1: JF2 Shared Sent
451  {0xa03, &GctFormatTranslateV38::blockToGctInternEtSumsAndJetCluster}, // Leaf2JetPosEtaU1: JF2 Output
452  {0xa04, &GctFormatTranslateV38::blockToFibres}, // Leaf2JetPosEtaU1: JF2 Raw Input
453  {0xa08, &GctFormatTranslateV38::blockToRctCaloRegions}, // Leaf2JetPosEtaU1: JF3 Input
454  {0xa09, &GctFormatTranslateV38::blockToGctJetPreCluster}, // Leaf2JetPosEtaU1: JF3 Shared Received
455  {0xa0a, &GctFormatTranslateV38::blockToGctJetPreCluster}, // Leaf2JetPosEtaU1: JF3 Shared Sent
456  {0xa0b, &GctFormatTranslateV38::blockToGctInternEtSumsAndJetCluster}, // Leaf2JetPosEtaU1: JF3 Output
457  {0xa0c, &GctFormatTranslateV38::blockToFibres}, // Leaf2JetPosEtaU1: JF3 Raw Input
458  {0xa80, &GctFormatTranslateV38::blockDoNothing}, // Leaf2JetPosEtaU2: Eta0 Input
459  {0xa84, &GctFormatTranslateV38::blockToFibres}, // Leaf2JetPosEtaU2: Eta0 Raw Input
460  {0xa88, &GctFormatTranslateV38::blockToRctCaloRegions}, // Leaf2JetPosEtaU2: JF1 Input
461  {0xa89, &GctFormatTranslateV38::blockToGctJetPreCluster}, // Leaf2JetPosEtaU2: JF1 Shared Received
462  {0xa8a, &GctFormatTranslateV38::blockToGctJetPreCluster}, // Leaf2JetPosEtaU2: JF1 Shared Sent
463  {0xa8b, &GctFormatTranslateV38::blockToGctInternEtSumsAndJetCluster}, // Leaf2JetPosEtaU2: JF1 Output
464  {0xa8c, &GctFormatTranslateV38::blockToFibres}, // Leaf2JetPosEtaU2: JF1 Raw Input
465  {0xb00, &GctFormatTranslateV38::blockToRctCaloRegions}, // Leaf3JetPosEtaU1: JF2 Input
466  {0xb01, &GctFormatTranslateV38::blockToGctJetPreCluster}, // Leaf3JetPosEtaU1: JF2 Shared Received
467  {0xb02, &GctFormatTranslateV38::blockToGctJetPreCluster}, // Leaf3JetPosEtaU1: JF2 Shared Sent
468  {0xb03, &GctFormatTranslateV38::blockToGctInternEtSumsAndJetCluster}, // Leaf3JetPosEtaU1: JF2 Output
469  {0xb04, &GctFormatTranslateV38::blockToFibres}, // Leaf3JetPosEtaU1: JF2 Raw Input
470  {0xb08, &GctFormatTranslateV38::blockToRctCaloRegions}, // Leaf3JetPosEtaU1: JF3 Input
471  {0xb09, &GctFormatTranslateV38::blockToGctJetPreCluster}, // Leaf3JetPosEtaU1: JF3 Shared Received
472  {0xb0a, &GctFormatTranslateV38::blockToGctJetPreCluster}, // Leaf3JetPosEtaU1: JF3 Shared Sent
473  {0xb0b, &GctFormatTranslateV38::blockToGctInternEtSumsAndJetCluster}, // Leaf3JetPosEtaU1: JF3 Output
474  {0xb0c, &GctFormatTranslateV38::blockToFibres}, // Leaf3JetPosEtaU1: JF3 Raw Input
475  {0xb80, &GctFormatTranslateV38::blockDoNothing}, // Leaf3JetPosEtaU2: Eta0 Input
476  {0xb84, &GctFormatTranslateV38::blockToFibres}, // Leaf3JetPosEtaU2: Eta0 Raw Input
477  {0xb88, &GctFormatTranslateV38::blockToRctCaloRegions}, // Leaf3JetPosEtaU2: JF1 Input
478  {0xb89, &GctFormatTranslateV38::blockToGctJetPreCluster}, // Leaf3JetPosEtaU2: JF1 Shared Received
479  {0xb8a, &GctFormatTranslateV38::blockToGctJetPreCluster}, // Leaf3JetPosEtaU2: JF1 Shared Sent
480  {0xb8b, &GctFormatTranslateV38::blockToGctInternEtSumsAndJetCluster}, // Leaf3JetPosEtaU2: JF1 Output
481  {0xb8c, &GctFormatTranslateV38::blockToFibres}, // Leaf3JetPosEtaU2: JF1 Raw Input
482  // Jet Leaf FPGAs - Negative Eta
483  {0xd00, &GctFormatTranslateV38::blockToRctCaloRegions}, // Leaf1JetNegEtaU1: JF2 Input
484  {0xd01, &GctFormatTranslateV38::blockToGctJetPreCluster}, // Leaf1JetNegEtaU1: JF2 Shared Received
485  {0xd02, &GctFormatTranslateV38::blockToGctJetPreCluster}, // Leaf1JetNegEtaU1: JF2 Shared Sent
486  {0xd03, &GctFormatTranslateV38::blockToGctInternEtSumsAndJetCluster}, // Leaf1JetNegEtaU1: JF2 Output
487  {0xd04, &GctFormatTranslateV38::blockToFibres}, // Leaf1JetNegEtaU1: JF2 Raw Input
488  {0xd08, &GctFormatTranslateV38::blockToRctCaloRegions}, // Leaf1JetNegEtaU1: JF3 Input
489  {0xd09, &GctFormatTranslateV38::blockToGctJetPreCluster}, // Leaf1JetNegEtaU1: JF3 Shared Received
490  {0xd0a, &GctFormatTranslateV38::blockToGctJetPreCluster}, // Leaf1JetNegEtaU1: JF3 Shared Sent
491  {0xd0b, &GctFormatTranslateV38::blockToGctInternEtSumsAndJetCluster}, // Leaf1JetNegEtaU1: JF3 Output
492  {0xd0c, &GctFormatTranslateV38::blockToFibres}, // Leaf1JetNegEtaU1: JF3 Raw Input
493  {0xd80, &GctFormatTranslateV38::blockDoNothing}, // Leaf1JetNegEtaU2: Eta0 Input
494  {0xd84, &GctFormatTranslateV38::blockToFibres}, // Leaf1JetNegEtaU2: Eta0 Raw Input
495  {0xd88, &GctFormatTranslateV38::blockToRctCaloRegions}, // Leaf1JetNegEtaU2: JF1 Input
496  {0xd89, &GctFormatTranslateV38::blockToGctJetPreCluster}, // Leaf1JetNegEtaU2: JF1 Shared Received
497  {0xd8a, &GctFormatTranslateV38::blockToGctJetPreCluster}, // Leaf1JetNegEtaU2: JF1 Shared Sent
498  {0xd8b, &GctFormatTranslateV38::blockToGctInternEtSumsAndJetCluster}, // Leaf1JetNegEtaU2: JF1 Output
499  {0xd8c, &GctFormatTranslateV38::blockToFibres}, // Leaf1JetNegEtaU2: JF1 Raw Input
500  {0xe00, &GctFormatTranslateV38::blockToRctCaloRegions}, // Leaf2JetNegEtaU1: JF2 Input
501  {0xe01, &GctFormatTranslateV38::blockToGctJetPreCluster}, // Leaf2JetNegEtaU1: JF2 Shared Received
502  {0xe02, &GctFormatTranslateV38::blockToGctJetPreCluster}, // Leaf2JetNegEtaU1: JF2 Shared Sent
503  {0xe03, &GctFormatTranslateV38::blockToGctInternEtSumsAndJetCluster}, // Leaf2JetNegEtaU1: JF2 Output
504  {0xe04, &GctFormatTranslateV38::blockToFibres}, // Leaf2JetNegEtaU1: JF2 Raw Input
505  {0xe08, &GctFormatTranslateV38::blockToRctCaloRegions}, // Leaf2JetNegEtaU1: JF3 Input
506  {0xe09, &GctFormatTranslateV38::blockToGctJetPreCluster}, // Leaf2JetNegEtaU1: JF3 Shared Received
507  {0xe0a, &GctFormatTranslateV38::blockToGctJetPreCluster}, // Leaf2JetNegEtaU1: JF3 Shared Sent
508  {0xe0b, &GctFormatTranslateV38::blockToGctInternEtSumsAndJetCluster}, // Leaf2JetNegEtaU1: JF3 Output
509  {0xe0c, &GctFormatTranslateV38::blockToFibres}, // Leaf2JetNegEtaU1: JF3 Raw Input
510  {0xe80, &GctFormatTranslateV38::blockDoNothing}, // Leaf2JetNegEtaU2: Eta0 Input
511  {0xe84, &GctFormatTranslateV38::blockToFibres}, // Leaf2JetNegEtaU2: Eta0 Raw Input
512  {0xe88, &GctFormatTranslateV38::blockToRctCaloRegions}, // Leaf2JetNegEtaU2: JF1 Input
513  {0xe89, &GctFormatTranslateV38::blockToGctJetPreCluster}, // Leaf2JetNegEtaU2: JF1 Shared Received
514  {0xe8a, &GctFormatTranslateV38::blockToGctJetPreCluster}, // Leaf2JetNegEtaU2: JF1 Shared Sent
515  {0xe8b, &GctFormatTranslateV38::blockToGctInternEtSumsAndJetCluster}, // Leaf2JetNegEtaU2: JF1 Output
516  {0xe8c, &GctFormatTranslateV38::blockToFibres}, // Leaf2JetNegEtaU2: JF1 Raw Input
517  {0xf00, &GctFormatTranslateV38::blockToRctCaloRegions}, // Leaf3JetNegEtaU1: JF2 Input
518  {0xf01, &GctFormatTranslateV38::blockToGctJetPreCluster}, // Leaf3JetNegEtaU1: JF2 Shared Received
519  {0xf02, &GctFormatTranslateV38::blockToGctJetPreCluster}, // Leaf3JetNegEtaU1: JF2 Shared Sent
520  {0xf03, &GctFormatTranslateV38::blockToGctInternEtSumsAndJetCluster}, // Leaf3JetNegEtaU1: JF2 Output
521  {0xf04, &GctFormatTranslateV38::blockToFibres}, // Leaf3JetNegEtaU1: JF2 Raw Input
522  {0xf08, &GctFormatTranslateV38::blockToRctCaloRegions}, // Leaf3JetNegEtaU1: JF3 Input
523  {0xf09, &GctFormatTranslateV38::blockToGctJetPreCluster}, // Leaf3JetNegEtaU1: JF3 Shared Received
524  {0xf0a, &GctFormatTranslateV38::blockToGctJetPreCluster}, // Leaf3JetNegEtaU1: JF3 Shared Sent
525  {0xf0b, &GctFormatTranslateV38::blockToGctInternEtSumsAndJetCluster}, // Leaf3JetNegEtaU1: JF3 Output
526  {0xf0c, &GctFormatTranslateV38::blockToFibres}, // Leaf3JetNegEtaU1: JF3 Raw Input
527  {0xf80, &GctFormatTranslateV38::blockDoNothing}, // Leaf3JetNegEtaU2: Eta0 Input
528  {0xf84, &GctFormatTranslateV38::blockToFibres}, // Leaf3JetNegEtaU2: Eta0 Raw Input
529  {0xf88, &GctFormatTranslateV38::blockToRctCaloRegions}, // Leaf3JetNegEtaU2: JF1 Input
530  {0xf89, &GctFormatTranslateV38::blockToGctJetPreCluster}, // Leaf3JetNegEtaU2: JF1 Shared Received
531  {0xf8a, &GctFormatTranslateV38::blockToGctJetPreCluster}, // Leaf3JetNegEtaU2: JF1 Shared Sent
532  {0xf8b, &GctFormatTranslateV38::blockToGctInternEtSumsAndJetCluster}, // Leaf3JetNegEtaU2: JF1 Output
533  {0xf8c, &GctFormatTranslateV38::blockToFibres}, // Leaf3JetNegEtaU2: JF1 Raw Input
534 };
535 
536 /*** Setup RCT Em Crate Map ***/
538  {0x804, 13}, {0x884, 9}, {0xc04, 4}, {0xc84, 0}};
539 
540 /*** Setup RCT jet crate map. ***/
542  {0x900, 9}, // PosEta Leaf 1 JF2
543  {0x908, 10}, // PosEta Leaf 1 JF3
544  {0x988, 17}, // PosEta Leaf 1 JF1
545  {0xa00, 12}, // PosEta Leaf 2 JF2
546  {0xa08, 13}, // PosEta Leaf 2 JF3
547  {0xa88, 11}, // PosEta Leaf 2 JF1
548  {0xb00, 15}, // PosEta Leaf 3 JF2
549  {0xb08, 16}, // PosEta Leaf 3 JF3
550  {0xb88, 14}, // PosEta Leaf 3 JF1
551  {0xd00, 0}, // NegEta Leaf 1 JF2
552  {0xd08, 1}, // NegEta Leaf 1 JF3
553  {0xd88, 8}, // NegEta Leaf 1 JF1
554  {0xe00, 3}, // NegEta Leaf 2 JF2
555  {0xe08, 4}, // NegEta Leaf 2 JF3
556  {0xe88, 2}, // NegEta Leaf 2 JF1
557  {0xf00, 6}, // NegEta Leaf 3 JF2
558  {0xf08, 7}, // NegEta Leaf 3 JF3
559  {0xf88, 5} // NegEta Leaf 3 JF1
560 };
561 
562 /*** Setup Block ID map for pipeline payload positions of isolated Internal EM Cands. ***/
564  {0x680, IsoBoundaryPair(8, 15)},
565  {0x800, IsoBoundaryPair(0, 9)},
566  {0x803, IsoBoundaryPair(0, 1)},
567  {0x880, IsoBoundaryPair(0, 7)},
568  {0x883, IsoBoundaryPair(0, 1)},
569  {0xc00, IsoBoundaryPair(0, 9)},
570  {0xc03, IsoBoundaryPair(0, 1)},
571  {0xc80, IsoBoundaryPair(0, 7)},
572  {0xc83, IsoBoundaryPair(0, 1)}};
573 
574 // PUBLIC METHODS
575 
577  bool unpackSharedRegions,
580  : GctFormatTranslateBase(hltMode, unpackSharedRegions),
581  m_numberOfGctSamplesToUnpack(numberOfGctSamplesToUnpack),
582  m_numberOfRctSamplesToUnpack(numberOfRctSamplesToUnpack) {}
583 
585 
587  // Turn the four 8-bit header words into the full 32-bit header.
588  uint32_t hdr = data[0] + (data[1] << 8) + (data[2] << 16) + (data[3] << 24);
589 
590  // Bit mapping of V35 header:
591  // --------------------------
592  // 11:0 => block_id Unique pipeline identifier.
593  // - 3:0 =>> pipe_id There can be up to 16 different pipelines per FPGA.
594  // - 6:4 =>> reserved Do not use yet. Set to zero.
595  // - 11:7 =>> fpga geograpical add The VME geographical address of the FPGA.
596  // 15:12 => event_id Determined locally. Not reset by Resync.
597  // 19:16 => number_of_time_samples If time samples 15 or more then value = 15.
598  // 31:20 => event_bcid The bunch crossing the data was recorded.
599 
600  unsigned blockId = hdr & 0xfff;
601  unsigned blockLength = 0; // Set to zero until we know it's a valid block
602  unsigned nSamples = (hdr >> 16) & 0xf;
603  unsigned bxId = (hdr >> 20) & 0xfff;
604  unsigned eventId = (hdr >> 12) & 0xf;
605  bool valid = (blockLengthMap().find(blockId) != blockLengthMap().end());
606 
607  if (valid) {
608  blockLength = blockLengthMap().find(blockId)->second;
609  }
610 
611  return GctBlockHeader(blockId, blockLength, nSamples, bxId, eventId, valid);
612 }
613 
614 // conversion
615 bool GctFormatTranslateV38::convertBlock(const unsigned char* data, const GctBlockHeader& hdr) {
616  // if the block has no time samples, don't bother with it.
617  if (hdr.nSamples() < 1) {
618  return true;
619  }
620 
621  if (!checkBlock(hdr)) {
622  return false;
623  } // Check the block to see if it's possible to unpack.
624 
625  // The header validity check above will protect against
626  // the map::find() method returning the end of the map,
627  // assuming the block header definitions are up-to-date.
628  (this->*m_blockUnpackFn.find(hdr.blockId())->second)(data,
629  hdr); // Calls the correct unpack function, based on block ID.
630 
631  return true;
632 }
633 
634 // PROTECTED METHODS
635 
636 uint32_t GctFormatTranslateV38::generateRawHeader(const uint32_t blockId,
637  const uint32_t nSamples,
638  const uint32_t bxId,
639  const uint32_t eventId) const {
640  // Bit mapping of V35 header:
641  // --------------------------
642  // 11:0 => block_id Unique pipeline identifier.
643  // - 3:0 =>> pipe_id There can be up to 16 different pipelines per FPGA.
644  // - 6:4 =>> reserved Do not use yet. Set to zero.
645  // - 11:7 =>> fpga geograpical add The VME geographical address of the FPGA.
646  // 15:12 => event_id Determined locally. Not reset by Resync.
647  // 19:16 => number_of_time_samples If time samples 15 or more then value = 15.
648  // 31:20 => event_bxId The bunch crossing the data was recorded.
649 
650  return ((bxId & 0xfff) << 20) | ((nSamples & 0xf) << 16) | ((eventId & 0xf) << 12) | (blockId & 0xfff);
651 }
652 
653 // PRIVATE METHODS
654 
655 // Throughout the code, bx refers to the hardware definition of time-samples
656 // ie. if 5 time samples are unpacked, they are bx=0, 1, 2, 3, 4 in order
657 // what is written to digi would be -2, -1, 0, +1, +2
658 
659 // Output EM Candidates unpacking
661  const unsigned int id = hdr.blockId();
662  const unsigned int nSamples = hdr.nSamples();
663 
664  // Re-interpret pointer. p16 will be pointing at the 16 bit word that
665  // contains the rank0 non-isolated electron of the zeroth time-sample.
666  const uint16_t* p16 = reinterpret_cast<const uint16_t*>(d);
667 
668  // UNPACK EM CANDS
669 
670  const unsigned int emCandCategoryOffset =
671  nSamples * 4; // Offset to jump from the non-iso electrons to the isolated ones.
672  const unsigned int timeSampleOffset = nSamples * 2; // Offset to jump to next candidate pair in the same time-sample.
673 
674  unsigned int samplesToUnpack =
675  std::min(nSamples, m_numberOfGctSamplesToUnpack); // Unpack as many as asked for if they are in the raw data
676  unsigned int centralSample =
677  (unsigned)std::ceil((double)nSamples / 2.) - 1; // think this works when nSamples is even, need to check!!!
678  unsigned int firstSample = centralSample - (unsigned)std::ceil((double)samplesToUnpack / 2.) + 1;
679  unsigned int lastSample = centralSample + (unsigned)(samplesToUnpack / 2);
680 
681  LogDebug("GCT") << "Unpacking output EM. Central sample=" << centralSample << " first=" << firstSample
682  << " last=" << lastSample;
683 
684  for (unsigned int iso = 0; iso < 2; ++iso) // loop over non-iso/iso candidate pairs
685  {
686  bool isoFlag = (iso == 1);
687 
688  // Get the correct collection to put them in.
690  if (isoFlag) {
691  em = colls()->gctIsoEm();
692  } else {
693  em = colls()->gctNonIsoEm();
694  }
695 
696  for (unsigned int bx = firstSample; bx <= lastSample; ++bx) // loop over samples to be unpacked
697  {
698  // cand0Offset will give the offset on p16 to get the rank 0 candidate
699  // of the correct category and timesample.
700  const unsigned int cand0Offset = iso * emCandCategoryOffset + bx * 2;
701 
702  em->push_back(L1GctEmCand(p16[cand0Offset], isoFlag, id, 0, (int)bx - (int)centralSample)); // rank0 electron
703  em->push_back(L1GctEmCand(
704  p16[cand0Offset + timeSampleOffset], isoFlag, id, 1, (int)bx - (int)centralSample)); // rank1 electron
705  em->push_back(L1GctEmCand(p16[cand0Offset + 1], isoFlag, id, 2, (int)bx - (int)centralSample)); // rank2 electron
706  em->push_back(L1GctEmCand(
707  p16[cand0Offset + timeSampleOffset + 1], isoFlag, id, 3, (int)bx - (int)centralSample)); // rank3 electron
708 
709  LogDebug("GCT") << "Unpacked a bunch of EG. iso=" << iso << " bx=" << bx << std::endl;
710  }
711  }
712 
713  p16 += emCandCategoryOffset * 2; // Move the pointer over the data we've already unpacked.
714 
715  // UNPACK ENERGY SUMS
716 
717  for (unsigned int bx = firstSample; bx <= lastSample; ++bx) // loop over all time samples
718  {
719  const unsigned int offset = bx * 2;
720  colls()->gctEtTot()->push_back(L1GctEtTotal(p16[offset], (int)bx - (int)centralSample)); // Et total
721  colls()->gctEtHad()->push_back(L1GctEtHad(p16[offset + 1], (int)bx - (int)centralSample)); // Et hadronic
722  }
723 
724  p16 += nSamples * 2;
725 
726  // 32-bit pointer for getting Missing Et.
727  const uint32_t* p32 = reinterpret_cast<const uint32_t*>(p16);
728 
729  for (unsigned int bx = firstSample; bx <= lastSample; ++bx) {
730  colls()->gctEtMiss()->push_back(L1GctEtMiss(p32[bx], (int)bx - (int)centralSample)); // Et Miss
731  LogDebug("GCT") << "Unpacked energy sums bx=" << bx << std::endl;
732  }
733 }
734 
736  const unsigned int id = hdr.blockId(); // Capture block ID.
737  const unsigned int nSamples = hdr.nSamples(); // Number of time-samples.
738 
739  // Re-interpret block payload pointer to 16 bits so it sees one candidate at a time.
740  // p16 points to the start of the block payload, at the rank0 tau jet candidate.
741  const uint16_t* p16 = reinterpret_cast<const uint16_t*>(d);
742 
743  // UNPACK JET CANDS
744 
745  const unsigned int jetCandCategoryOffset = nSamples * 4; // Offset to jump from one jet category to the next.
746  const unsigned int timeSampleOffset = nSamples * 2; // Offset to jump to next candidate pair in the same time-sample.
747 
748  unsigned int samplesToUnpack =
749  std::min(nSamples, m_numberOfGctSamplesToUnpack); // Unpack as many as asked for if they are in the raw data
750  unsigned int centralSample =
751  (unsigned)std::ceil((double)nSamples / 2.) - 1; // think this works when nSamples is even, need to check!!!
752  unsigned int firstSample = centralSample - (unsigned)std::ceil((double)samplesToUnpack / 2.) + 1;
753  unsigned int lastSample = centralSample + (unsigned)(samplesToUnpack / 2);
754 
755  LogDebug("GCT") << "Unpacking output Jets. Samples to unpack=" << samplesToUnpack << " central=" << centralSample
756  << " first=" << firstSample << " last=" << lastSample;
757 
758  // Loop over the different catagories of jets
759  for (unsigned int iCat = 0; iCat < NUM_JET_CATEGORIES; ++iCat) {
760  L1GctJetCandCollection* const jets = gctJets(iCat);
761  assert(jets->empty()); // The supplied vector should be empty.
762 
763  bool tauflag = (iCat == TAU_JETS);
764  bool forwardFlag = (iCat == FORWARD_JETS);
765 
766  // Loop over the different timesamples (bunch crossings).
767  for (unsigned int bx = firstSample; bx <= lastSample; ++bx) {
768  // cand0Offset will give the offset on p16 to get the rank 0 Jet Cand of the correct category and timesample.
769  const unsigned int cand0Offset = iCat * jetCandCategoryOffset + bx * 2;
770 
771  // Rank 0 Jet.
772  jets->push_back(L1GctJetCand(p16[cand0Offset], tauflag, forwardFlag, id, 0, (int)bx - (int)centralSample));
773  // Rank 1 Jet.
774  jets->push_back(
775  L1GctJetCand(p16[cand0Offset + timeSampleOffset], tauflag, forwardFlag, id, 1, (int)bx - (int)centralSample));
776  // Rank 2 Jet.
777  jets->push_back(L1GctJetCand(p16[cand0Offset + 1], tauflag, forwardFlag, id, 2, (int)bx - (int)centralSample));
778  // Rank 3 Jet.
779  jets->push_back(L1GctJetCand(
780  p16[cand0Offset + timeSampleOffset + 1], tauflag, forwardFlag, id, 3, (int)bx - (int)centralSample));
781  }
782  }
783 
784  p16 += NUM_JET_CATEGORIES * jetCandCategoryOffset; // Move the pointer over the data we've already unpacked.
785 
786  // NOW UNPACK: HFBitCounts, HFRingEtSums and Missing Ht
787 
788  // Re-interpret block payload pointer to 32 bits so it sees six jet counts at a time.
789  const uint32_t* p32 = reinterpret_cast<const uint32_t*>(p16);
790 
791  for (unsigned int bx = firstSample; bx <= lastSample; ++bx) // loop over all time samples
792  {
793  // Channel 0 carries both HF counts and sums
794  colls()->gctHfBitCounts()->push_back(
795  L1GctHFBitCounts::fromConcHFBitCounts(id, 6, (int)bx - (int)centralSample, p32[bx]));
796  colls()->gctHfRingEtSums()->push_back(
797  L1GctHFRingEtSums::fromConcRingSums(id, 6, (int)bx - (int)centralSample, p32[bx]));
798 
799  // Channel 1 carries Missing HT.
800  colls()->gctHtMiss()->push_back(L1GctHtMiss(p32[bx + nSamples], (int)bx - (int)centralSample));
801  }
802 }
803 
804 // Internal EM Candidates unpacking
805 void GctFormatTranslateV38::blockToGctInternEmCand(const unsigned char* d, const GctBlockHeader& hdr) {
806  // Don't want to do this in HLT optimisation mode!
807  if (hltMode()) {
808  LogDebug("GCT") << "HLT mode - skipping unpack of internal EM Cands";
809  return;
810  }
811 
812  unsigned int id = hdr.blockId();
813  unsigned int nSamples = hdr.nSamples();
814  unsigned int numCandPairs = hdr.blockLength();
815 
816  // Debug assertion to prevent problems if definitions not up to date.
817  auto found = internEmIsoBounds().find(id);
819 
820  unsigned int lowerIsoPairBound = found->second.first;
821  unsigned int upperIsoPairBound = found->second.second;
822 
823  // Re-interpret pointer to 16 bits so it sees one candidate at a time.
824  const uint16_t* p = reinterpret_cast<const uint16_t*>(d);
825 
826  // Loop over timesamples (i.e. bunch crossings)
827  for (unsigned int bx = 0; bx < nSamples; ++bx) {
828  // Loop over candidate pairs (i.e. each iteration unpacks a pair of candidates)
829  for (unsigned int candPair = 0; candPair < numCandPairs; ++candPair) {
830  // Is the candidate electron pair an isolated pair or not?
831  bool iso = ((candPair >= lowerIsoPairBound) && (candPair <= upperIsoPairBound));
832 
833  // Loop over the two electron candidates in each pair
834  for (unsigned int i = 0; i < 2; ++i) {
835  unsigned offset = 2 * (bx + candPair * nSamples) + i;
836  uint16_t candRaw = p[offset];
837  colls()->gctInternEm()->push_back(L1GctInternEmCand(candRaw, iso, id, candPair * 2 + i, bx));
838  }
839  }
840  }
841 }
842 
843 // Input EM Candidates unpacking
844 // this is the last time I deal the RCT bit assignment travesty!!!
845 void GctFormatTranslateV38::blockToRctEmCand(const unsigned char* d, const GctBlockHeader& hdr) {
846  // Don't want to do this in HLT optimisation mode!
847  if (hltMode()) {
848  LogDebug("GCT") << "HLT mode - skipping unpack of RCT EM Cands";
849  return;
850  }
851 
852  unsigned int id = hdr.blockId();
853  unsigned int nSamples = hdr.nSamples();
854  unsigned int length = hdr.blockLength();
855 
856  // re-interpret pointer
857  const uint16_t* p = reinterpret_cast<const uint16_t*>(d);
858 
859  // arrays of source card data
860  uint16_t sfp[2][4]; // [ cycle ] [ SFP ]
861  uint16_t eIsoRank[4];
862  uint16_t eIsoCard[4];
863  uint16_t eIsoRgn[4];
864  uint16_t eNonIsoRank[4];
865  uint16_t eNonIsoCard[4];
866  uint16_t eNonIsoRgn[4];
867  uint16_t MIPbits[7][2];
868  uint16_t QBits[7][2];
869 
870  unsigned int bx = 0;
871 
872  auto found = rctEmCrateMap().find(id);
873  assert(found != rctEmCrateMap().end());
874  // loop over crates
875  for (unsigned int crate = found->second; crate < found->second + length / 3; ++crate) {
876  // read SC SFP words
877  for (unsigned short iSfp = 0; iSfp < 4; ++iSfp) {
878  for (unsigned short cyc = 0; cyc < 2; ++cyc) {
879  if (iSfp == 0) {
880  sfp[cyc][iSfp] = 0;
881  } // muon bits
882  else { // EM candidate
883  sfp[cyc][iSfp] = *p;
884  ++p;
885  }
886  }
887  p = p + 2 * (nSamples - 1);
888  }
889 
890  // fill SC arrays
891  srcCardRouting().SFPtoEMU(eIsoRank, eIsoCard, eIsoRgn, eNonIsoRank, eNonIsoCard, eNonIsoRgn, MIPbits, QBits, sfp);
892 
893  // create EM cands
894  for (unsigned short int i = 0; i < 4; ++i) {
895  colls()->rctEm()->push_back(L1CaloEmCand(eIsoRank[i], eIsoRgn[i], eIsoCard[i], crate, true, i, bx));
896  }
897  for (unsigned short int i = 0; i < 4; ++i) {
898  colls()->rctEm()->push_back(L1CaloEmCand(eNonIsoRank[i], eNonIsoRgn[i], eNonIsoCard[i], crate, false, i, bx));
899  }
900  }
901 }
902 
903 // Input RCT region unpacking
904 void GctFormatTranslateV38::blockToRctCaloRegions(const unsigned char* d, const GctBlockHeader& hdr) {
905  // Don't want to do this in HLT optimisation mode!
906  if (hltMode()) {
907  LogDebug("GCT") << "HLT mode - skipping unpack of RCT Regions";
908  return;
909  }
910 
911  unsigned int id = hdr.blockId();
912  unsigned int nSamples = hdr.nSamples();
913  unsigned int length = hdr.blockLength();
914 
915  // Debug assertion to prevent problems if definitions not up to date.
916  auto found = rctJetCrateMap().find(id);
917  assert(found != rctJetCrateMap().end());
918 
919  // get crate (need this to get ieta and iphi)
920  unsigned int crate = found->second;
921 
922  // re-interpret pointer
923  const uint16_t* p = reinterpret_cast<const uint16_t*>(d);
924 
925  // eta and phi
926  unsigned int ieta;
927  unsigned int iphi;
928 
929  for (unsigned int i = 0; i < length; ++i) {
930  for (uint16_t bx = 0; bx < nSamples; ++bx) {
931  // First figure out eta and phi
932  if (crate < 9) { // negative eta
933  ieta = 12 - i;
934  iphi = 2 * ((11 - crate) % 9);
935  } else { // positive eta
936  ieta = 9 + i;
937  iphi = 2 * ((20 - crate) % 9);
938  }
939 
940  // Skip the first four regions (i.e. where i<2) which are duplicates (shared data).
941  if (i > 1) {
942  // First region is phi=0
943  colls()->rctCalo()->push_back(L1CaloRegion::makeRegionFromUnpacker(*p, ieta, iphi, id, i, bx));
944  ++p;
945  // Second region is phi=1
946  if (iphi > 0) {
947  iphi -= 1;
948  } else {
949  iphi = 17;
950  }
951  colls()->rctCalo()->push_back(L1CaloRegion::makeRegionFromUnpacker(*p, ieta, iphi, id, i, bx));
952  ++p;
953  }
954  // Unpack the shared data if asked for debugging
955  else if (unpackSharedRegions()) {
956  // First region is phi=0
957  colls()->rctCalo()->push_back(L1CaloRegion::makeRegionFromUnpacker(*p, ieta, iphi, id, i, bx));
958  ++p;
959  // Second region is phi=1
960  if (iphi > 0) {
961  iphi -= 1;
962  } else {
963  iphi = 17;
964  }
965  colls()->rctCalo()->push_back(L1CaloRegion::makeRegionFromUnpacker(*p, ieta, iphi, id, i, bx));
966  ++p;
967 
968  } else { // Skip the shared data
969  ++p;
970  ++p;
971  }
972  }
973  }
974 }
975 
976 // Fibre unpacking
977 void GctFormatTranslateV38::blockToFibres(const unsigned char* d, const GctBlockHeader& hdr) {
978  // Don't want to do this in HLT optimisation mode!
979  if (hltMode()) {
980  LogDebug("GCT") << "HLT mode - skipping unpack of GCT Fibres";
981  return;
982  }
983 
984  unsigned int id = hdr.blockId();
985  unsigned int nSamples = hdr.nSamples();
986  unsigned int length = hdr.blockLength();
987 
988  // re-interpret pointer
989  const uint32_t* p = reinterpret_cast<const uint32_t*>(d);
990 
991  for (unsigned int i = 0; i < length; ++i) {
992  for (unsigned int bx = 0; bx < nSamples; ++bx) {
993  colls()->gctFibres()->push_back(L1GctFibreWord(*p, id, i, bx));
994  ++p;
995  }
996  }
997 }
998 
1000  this->blockToRctEmCand(d, hdr);
1001  this->blockToFibres(d, hdr);
1002 }
1003 
1004 void GctFormatTranslateV38::blockToGctInternEtSums(const unsigned char* d, const GctBlockHeader& hdr) {
1005  // Don't want to do this in HLT optimisation mode!
1006 
1007  if (hltMode()) {
1008  LogDebug("GCT") << "HLT mode - skipping unpack of internal Et Sums";
1009  return;
1010  }
1011 
1012  unsigned int id = hdr.blockId();
1013  unsigned int nSamples = hdr.nSamples();
1014  unsigned int length = hdr.blockLength();
1015 
1016  // Re-interpret pointer to 32 bits
1017  const uint32_t* p = reinterpret_cast<const uint32_t*>(d);
1018 
1019  for (unsigned int i = 0; i < length; ++i) {
1020  // Loop over timesamples (i.e. bunch crossings)
1021  for (unsigned int bx = 0; bx < nSamples; ++bx) {
1022  colls()->gctInternEtSums()->push_back(L1GctInternEtSum::fromTotalEtOrHt(id, i, bx, *p));
1023  ++p;
1024  }
1025  }
1026 }
1027 
1029  // Don't want to do this in HLT optimisation mode!
1030  if (hltMode()) {
1031  LogDebug("GCT") << "HLT mode - skipping unpack of internal Jet Cands";
1032  return;
1033  }
1034 
1035  unsigned int id = hdr.blockId();
1036  unsigned int nSamples = hdr.nSamples();
1037  unsigned int length = hdr.blockLength();
1038 
1039  // Re-interpret pointer to 32 bits
1040  const uint32_t* p = reinterpret_cast<const uint32_t*>(d);
1041 
1042  for (unsigned int i = 0; i < length; ++i) {
1043  // Loop over timesamples (i.e. bunch crossings)
1044  for (unsigned int bx = 0; bx < nSamples; ++bx) {
1045  if (i < 2)
1046  colls()->gctInternEtSums()->push_back(L1GctInternEtSum::fromJetMissEt(id, i, bx, *p));
1047  if (i == 3) {
1048  colls()->gctInternEtSums()->push_back(L1GctInternEtSum::fromJetTotEt(id, i, bx, *p));
1049  colls()->gctInternEtSums()->push_back(L1GctInternEtSum::fromJetTotHt(id, i, bx, *p));
1050  }
1051  if (i > 4)
1052  colls()->gctInternJets()->push_back(L1GctInternJetData::fromJetCluster(L1CaloRegionDetId(0, 0), id, i, bx, *p));
1053  ++p;
1054  }
1055  }
1056 }
1057 
1058 void GctFormatTranslateV38::blockToGctTrigObjects(const unsigned char* d, const GctBlockHeader& hdr) {
1059  // Don't want to do this in HLT optimisation mode!
1060  if (hltMode()) {
1061  LogDebug("GCT") << "HLT mode - skipping unpack of internal Jet Cands";
1062  return;
1063  }
1064 
1065  unsigned int id = hdr.blockId();
1066  unsigned int nSamples = hdr.nSamples();
1067  unsigned int length = hdr.blockLength();
1068 
1069  // Re-interpret pointer to 16 bits so it sees one candidate at a time.
1070  const uint16_t* p = reinterpret_cast<const uint16_t*>(d);
1071 
1072  for (unsigned int i = 0; i < length; ++i) {
1073  // Loop over timesamples (i.e. bunch crossings)
1074  for (unsigned int bx = 0; bx < nSamples; ++bx) {
1075  colls()->gctInternJets()->push_back(
1077  ++p;
1078  colls()->gctInternJets()->push_back(
1080  ++p;
1081  }
1082  }
1083 }
1084 
1086  // Don't want to do this in HLT optimisation mode!
1087  if (hltMode()) {
1088  LogDebug("GCT") << "HLT mode - skipping unpack of internal Jet Cands";
1089  return;
1090  }
1091 
1092  unsigned int id = hdr.blockId();
1093  unsigned int nSamples = hdr.nSamples();
1094  unsigned int length = hdr.blockLength();
1095 
1096  // Re-interpret pointer to 16 bits so it sees one candidate at a time.
1097  const uint16_t* p = reinterpret_cast<const uint16_t*>(d);
1098 
1099  for (unsigned int i = 0; i < length; ++i) {
1100  // Loop over timesamples (i.e. bunch crossings)
1101  for (unsigned int bx = 0; bx < nSamples; ++bx) {
1102  colls()->gctInternJets()->push_back(
1104  ++p;
1105  colls()->gctInternJets()->push_back(
1107  ++p;
1108  }
1109  }
1110 }
1111 
1112 void GctFormatTranslateV38::blockToGctJetPreCluster(const unsigned char* d, const GctBlockHeader& hdr) {
1113  // Don't want to do this in HLT optimisation mode!
1114  if (hltMode()) {
1115  LogDebug("GCT") << "HLT mode - skipping unpack of internal Jet Cands";
1116  return;
1117  }
1118 
1119  unsigned int id = hdr.blockId();
1120  unsigned int nSamples = hdr.nSamples();
1121  unsigned int length = hdr.blockLength();
1122 
1123  // Re-interpret pointer to 16 bits so it sees one candidate at a time.
1124  const uint16_t* p = reinterpret_cast<const uint16_t*>(d);
1125 
1126  for (unsigned int i = 0; i < length; ++i) {
1127  // Loop over timesamples (i.e. bunch crossings)
1128  for (unsigned int bx = 0; bx < nSamples; ++bx) {
1129  colls()->gctInternJets()->push_back(
1131  ++p;
1132  colls()->gctInternJets()->push_back(
1134  ++p;
1135  }
1136  }
1137 }
1138 
1139 void GctFormatTranslateV38::blockToGctInternRingSums(const unsigned char* d, const GctBlockHeader& hdr) {
1140  // Don't want to do this in HLT optimisation mode!
1141  if (hltMode()) {
1142  LogDebug("GCT") << "HLT mode - skipping unpack of internal HF ring data";
1143  return;
1144  }
1145 
1146  unsigned int id = hdr.blockId();
1147  unsigned int nSamples = hdr.nSamples();
1148  unsigned int length = hdr.blockLength();
1149 
1150  // Re-interpret pointer to 32 bits
1151  const uint32_t* p = reinterpret_cast<const uint32_t*>(d);
1152 
1153  for (unsigned int i = 0; i < length / 2; ++i) {
1154  // Loop over timesamples (i.e. bunch crossings)
1155  for (unsigned int bx = 0; bx < nSamples; ++bx) {
1156  colls()->gctInternHFData()->push_back(L1GctInternHFData::fromConcRingSums(id, i, bx, *p));
1157  ++p;
1158  }
1159  for (unsigned int bx = 0; bx < nSamples; ++bx) {
1160  colls()->gctInternHFData()->push_back(L1GctInternHFData::fromConcBitCounts(id, i, bx, *p));
1161  ++p;
1162  }
1163  }
1164 }
1165 
1167  // Don't want to do this in HLT optimisation mode!
1168  if (hltMode()) {
1169  LogDebug("GCT") << "HLT mode - skipping unpack of wheel input internal Et sums and HF ring data";
1170  return;
1171  }
1172 
1173  unsigned int id = hdr.blockId();
1174  unsigned int nSamples = hdr.nSamples();
1175  unsigned int length = hdr.blockLength();
1176 
1177  // Re-interpret pointer to 32 bits
1178  const uint32_t* p = reinterpret_cast<const uint32_t*>(d);
1179 
1180  for (unsigned int i = 0; i < length; ++i) {
1181  // Loop over timesamples (i.e. bunch crossings)
1182  for (unsigned int bx = 0; bx < nSamples; ++bx) {
1183  if (i < 3) {
1184  colls()->gctInternEtSums()->push_back(L1GctInternEtSum::fromTotalEtOrHt(id, i, bx, *p));
1185  } else if (i > 2 && i < 9) {
1186  colls()->gctInternEtSums()->push_back(L1GctInternEtSum::fromMissEtxOrEty(id, i, bx, *p));
1187  } else if (i > 8 && i < 15) {
1188  colls()->gctInternHFData()->push_back(L1GctInternHFData::fromWheelRingSums(id, i, bx, *p));
1189  } else if (i > 14) {
1190  colls()->gctInternHFData()->push_back(L1GctInternHFData::fromWheelBitCounts(id, i, bx, *p));
1191  }
1192  ++p;
1193  }
1194  }
1195 }
1196 
1198  const GctBlockHeader& hdr) {
1199  // Don't want to do this in HLT optimisation mode!
1200  if (hltMode()) {
1201  LogDebug("GCT") << "HLT mode - skipping unpack of wheel output internal Et sums and HF ring data";
1202  return;
1203  }
1204 
1205  unsigned int id = hdr.blockId();
1206  unsigned int nSamples = hdr.nSamples();
1207  unsigned int length = hdr.blockLength();
1208 
1209  // Re-interpret pointer to 32 bits
1210  const uint32_t* p = reinterpret_cast<const uint32_t*>(d);
1211 
1212  for (unsigned int i = 0; i < length; ++i) {
1213  // Loop over timesamples (i.e. bunch crossings)
1214  for (unsigned int bx = 0; bx < nSamples; ++bx) {
1215  if (i < 1) {
1216  colls()->gctInternEtSums()->push_back(L1GctInternEtSum::fromTotalEtOrHt(id, i, bx, *p));
1217  } else if (i > 0 && i < 3) {
1218  colls()->gctInternEtSums()->push_back(L1GctInternEtSum::fromMissEtxOrEty(id, i, bx, *p));
1219  } else if (i > 2 && i < 5) {
1220  colls()->gctInternHFData()->push_back(L1GctInternHFData::fromWheelRingSums(id, i, bx, *p));
1221  } else if (i > 4) {
1222  colls()->gctInternHFData()->push_back(L1GctInternHFData::fromWheelBitCounts(id, i, bx, *p));
1223  }
1224  ++p;
1225  }
1226  }
1227 }
1228 
1230  // Don't want to do this in HLT optimisation mode!
1231  if (hltMode()) {
1232  LogDebug("GCT") << "HLT mode - skipping unpack of pre-wheel internal Missing Ht data";
1233  return;
1234  }
1235 
1236  unsigned int id = hdr.blockId();
1237  unsigned int nSamples = hdr.nSamples();
1238  unsigned int length = hdr.blockLength();
1239 
1240  // Re-interpret pointer to 32 bits
1241  const uint32_t* p = reinterpret_cast<const uint32_t*>(d);
1242 
1243  for (unsigned int iLength = 0; iLength < length; ++iLength) {
1244  // Loop over timesamples (i.e. bunch crossings)
1245  for (unsigned int bx = 0; bx < nSamples; ++bx) {
1246  colls()->gctInternHtMiss()->push_back(L1GctInternHtMiss::unpackerMissHtxHty(id, iLength, bx, *p));
1247  ++p;
1248  }
1249  }
1250 }
1251 
1253  // Don't want to do this in HLT optimisation mode!
1254  if (hltMode()) {
1255  LogDebug("GCT") << "HLT mode - skipping unpack of post-wheel internal Missing Ht data";
1256  return;
1257  }
1258 
1259  unsigned int id = hdr.blockId();
1260  unsigned int nSamples = hdr.nSamples();
1261  unsigned int length = hdr.blockLength();
1262 
1263  // Re-interpret pointer to 32 bits
1264  const uint32_t* p = reinterpret_cast<const uint32_t*>(d);
1265 
1266  for (unsigned int iLength = 0; iLength < length; ++iLength) {
1267  // Loop over timesamples (i.e. bunch crossings)
1268  for (unsigned int bx = 0; bx < nSamples; ++bx) {
1269  if (iLength % 2) {
1270  colls()->gctInternHtMiss()->push_back(L1GctInternHtMiss::unpackerMissHty(id, iLength, bx, *p));
1271  } // Hty on odd numbers
1272  else {
1273  colls()->gctInternHtMiss()->push_back(L1GctInternHtMiss::unpackerMissHtx(id, iLength, bx, *p));
1274  } // Htx on even numbers
1275  ++p;
1276  }
1277  }
1278 }
1279 
1280 // LocalWords: rctJetCrate
static L1GctInternEtSum fromMissEtxOrEty(uint16_t capBlock, uint16_t capIndex, int16_t bx, uint32_t data)
L1GctHFBitCountsCollection *const gctHfBitCounts() const
GCT output: Hadronic-Forward bit-counts collection.
constexpr int32_t ceil(float num)
static L1GctInternJetData fromJetPreCluster(L1CaloRegionDetId rgn, uint16_t capBlock, uint16_t capIndex, int16_t bx, uint32_t data)
construct from &quot;jet_precluster&quot;
L1GctEmCandCollection *const gctNonIsoEm() const
GCT output: Non-isolated EM candidate collection.
Global Calorimeter Trigger SC -&gt; CC fibre data word.
static const BlockNameMap m_blockName
Map to hold a description for each block number.
void blockToGctInternEmCand(const unsigned char *d, const GctBlockHeader &hdr)
unpack GCT internal EM Candidates
bool checkBlock(const GctBlockHeader &hdr) const
Performs checks on the block header to see if the block is possible to unpack or not.
L1CaloEmCollection *const rctEm() const
Input electrons from the RCT to the GCT.
tuple numberOfGctSamplesToUnpack
Definition: HLT_Fake_cff.py:51
L1GctHtMissCollection *const gctHtMiss() const
GCT output: Missing Ht collection.
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
Level-1 Trigger jet candidate.
Definition: L1GctJetCand.h:17
Abstract interface for RawToDigi/DigiToRaw conversions of GCT data.
Level-1 Region Calorimeter Trigger EM candidate.
Definition: L1CaloEmCand.h:17
void blockToGctWheelInputInternEtAndRingSums(const unsigned char *d, const GctBlockHeader &hdr)
unpack GCT internal input to wheel
Persistable copy of missing Et measured at Level-1.
Definition: L1GctEtMiss.h:17
const SourceCardRouting & srcCardRouting() const
Protected interface to the unpackSharedRegions commissioning option.
GctBlockHeader generateBlockHeader(const unsigned char *data) const override
Generate a block header from four 8-bit values.
static L1GctInternJetData fromJetClusterMinimal(L1CaloRegionDetId rgn, uint16_t capBlock, uint16_t capIndex, int16_t bx, uint32_t data)
construct from &quot;jet_cluster_minimal&quot;
GctFormatTranslateV38(bool hltMode=false, bool unpackSharedRegions=false, unsigned numberOfGctSamplesToUnpack=1, unsigned numberOfRctSamplesToUnpack=1)
Constructor.
assert(be >=bs)
static L1GctInternHFData fromConcBitCounts(const uint16_t capBlock, const uint16_t capIndex, const int16_t bx, const uint32_t data)
Level-1 Trigger EM candidate at output of GCT.
Definition: L1GctEmCand.h:21
void blockToGctInternRingSums(const unsigned char *d, const GctBlockHeader &hdr)
unpack GCT internal HF ring sums
static L1GctInternEtSum fromTotalEtOrHt(uint16_t capBlock, uint16_t capIndex, int16_t bx, uint32_t data)
L1GctInternHFDataCollection *const gctInternHFData() const
Internal Hadronic-Forward bit-counts/ring-sums data collection.
~GctFormatTranslateV38() override
Destructor.
static const BlockIdToUnpackFnMap m_blockUnpackFn
Block ID to unpack function map.
U second(std::pair< T, U > const &p)
std::vector< L1GctJetCand > L1GctJetCandCollection
const BlkToRctCrateMap & rctEmCrateMap() const final
get static the block ID to RCT crate map for electrons.
tuple d
Definition: ztail.py:151
static const BlkToRctCrateMap m_rctJetCrate
Map to relate capture block ID to the RCT crate the data originated from (for jets).
void blockToGctInternEtSums(const unsigned char *d, const GctBlockHeader &hdr)
unpack GCT internal Et sums
const unsigned m_numberOfGctSamplesToUnpack
Number of BXs of GCT data to unpack (assuming they are in the raw data)
void blockToGctJetPreCluster(const unsigned char *d, const GctBlockHeader &hdr)
unpack GCT internal shared jet finder info
static L1GctInternHtMiss unpackerMissHtxHty(const uint16_t capBlock, const uint16_t capIndex, const int16_t bx, const uint32_t data)
Named ctor for making missing Ht x &amp; y components object from unpacker raw data (wheel input)...
void blockToGctInternEtSumsAndJetCluster(const unsigned char *d, const GctBlockHeader &hdr)
unpack GCT internal output of leaf jet finder
L1GctInternEtSumCollection *const gctInternEtSums() const
Internal Et Sum collection.
L1GctEtTotalCollection *const gctEtTot() const
GCT output: Total Et collection.
GctUnpackCollections *const colls() const
Protected access to the GCT Unpack Collections.
static L1GctInternHtMiss unpackerMissHty(const uint16_t capBlock, const uint16_t capIndex, const int16_t bx, const uint32_t data)
Named ctor for making missing Ht y-component object from unpacker raw data.
static L1GctInternHFData fromConcRingSums(const uint16_t capBlock, const uint16_t capIndex, const int16_t bx, const uint32_t data)
L1GctInternHtMissCollection *const gctInternHtMiss() const
Internal missing Ht collection.
Persistable copy of total Et measured at Level-1.
Definition: L1GctEtTotal.h:17
Simple class for holding the basic attributes of an 32-bit block header.
vector< PseudoJet > jets
std::map< unsigned int, PtrToUnpackFn > BlockIdToUnpackFnMap
Typedef for a block ID to unpack function map.
L1GctEtMissCollection *const gctEtMiss() const
GCT output: Missing Et collection.
static L1GctInternEtSum fromJetMissEt(uint16_t capBlock, uint16_t capIndex, int16_t bx, uint32_t data)
void blockToGctWheelOutputInternEtAndRingSums(const unsigned char *d, const GctBlockHeader &hdr)
unpack GCT internal output of wheel
T min(T a, T b)
Definition: MathUtil.h:58
std::map< unsigned int, unsigned int > BlockLengthMap
Block ID to Block Length map.
void blockDoNothing(const unsigned char *d, const GctBlockHeader &hdr)
The null unpack function - obviously common to all formats.
bool hltMode() const
Protected interface to get HLT optimisation mode flag.
constexpr size_t nSamples
static L1GctInternHFData fromWheelRingSums(const uint16_t capBlock, const uint16_t capIndex, const int16_t bx, const uint32_t data)
tuple unpackSharedRegions
Definition: HLT_Fake_cff.py:50
Persistable copy of total Ht measured at Level-1.
Definition: L1GctEtHad.h:17
void blockToFibres(const unsigned char *d, const GctBlockHeader &hdr)
unpack Fibres
const BlkToRctCrateMap & rctJetCrateMap() const final
get the static block ID to RCT crate map for jets
static const BlockLengthMap m_blockLength
Map to translate block number to fundamental size of a block (i.e. for 1 time-sample).
uint32_t blockLength() const
Get the fundamental block length (for 1 time sample)
static L1GctHFRingEtSums fromConcRingSums(const uint16_t capBlock, const uint16_t capIndex, const int16_t bx, const uint32_t data)
tuple numberOfRctSamplesToUnpack
Definition: HLT_Fake_cff.py:52
void blockToRctCaloRegions(const unsigned char *d, const GctBlockHeader &hdr)
Unpack RCT Calo Regions.
L1GctJetCandCollection *const gctJets(const unsigned cat) const
Get a specific jet candandiate collection using the JetCandCategory enumeration.
void blockToFibresAndToRctEmCand(const unsigned char *d, const GctBlockHeader &hdr)
unpack Fibres and RCT EM Candidates
const BlockIdToEmCandIsoBoundMap & internEmIsoBounds() const final
get the static intern EM cand isolated boundary map.
void blockToGctInternHtMissPreWheel(const unsigned char *d, const GctBlockHeader &hdr)
unpack GCT internal Missing Ht data that is being input to the wheels.
static L1GctInternJetData fromJetCluster(L1CaloRegionDetId rgn, uint16_t capBlock, uint16_t capIndex, int16_t bx, uint32_t data)
construct from &quot;jet_cluster&quot;
L1GctHFRingEtSumsCollection *const gctHfRingEtSums() const
GCT output: Hadronic-Forward ring-sums collection.
Persistable copy of missing Et measured at Level-1.
Definition: L1GctHtMiss.h:16
const BlockLengthMap & blockLengthMap() const final
get the static block ID to block-length map.
static L1GctInternJetData fromGctTrigObject(L1CaloRegionDetId rgn, uint16_t capBlock, uint16_t capIndex, int16_t bx, uint32_t data)
construct from &quot;gct_trig_object&quot;
static const BlockIdToEmCandIsoBoundMap m_internEmIsoBounds
void blockToGctTrigObjects(const unsigned char *d, const GctBlockHeader &hdr)
unpack GCT internal wheel and conc jets
L1GctFibreCollection *const gctFibres() const
Raw fibre input to the GCT.
L1GctEmCandCollection *const gctIsoEm() const
GCT output: Isolated EM candidate collection.
void blockToGctJetClusterMinimal(const unsigned char *d, const GctBlockHeader &hdr)
unpack GCT internal input to wheel jet sort
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
L1GctInternJetDataCollection *const gctInternJets() const
Internal Jet candidate collection.
void blockToRctEmCand(const unsigned char *d, const GctBlockHeader &hdr)
unpack RCT EM Candidates
static L1GctInternHtMiss unpackerMissHtx(const uint16_t capBlock, const uint16_t capIndex, const int16_t bx, const uint32_t data)
Named ctor for making missing Ht x-component object from unpacker raw data.
string end
Definition: dataset.py:937
static const BlkToRctCrateMap m_rctEmCrate
Map to relate capture block ID to the RCT crate the data originated from (for electrons).
L1GctEtHadCollection *const gctEtHad() const
GCT output: Hadronic transverse-energy (Ht) collection.
bool convertBlock(const unsigned char *d, const GctBlockHeader &hdr) override
Get digis from the block - will return true if it succeeds, false otherwise.
uint32_t generateRawHeader(const uint32_t blockId, const uint32_t nSamples, const uint32_t bxId, const uint32_t eventId) const override
Returns a raw 32-bit header word generated from the blockId, number of time samples, bunch-crossing and event IDs.
static L1GctHFBitCounts fromConcHFBitCounts(const uint16_t capBlock, const uint16_t capIndex, const int16_t bx, const uint32_t data)
static L1GctInternHFData fromWheelBitCounts(const uint16_t capBlock, const uint16_t capIndex, const int16_t bx, const uint32_t data)
tuple cout
Definition: gather_cfg.py:144
void blockToGctJetCandsAndCounts(const unsigned char *d, const GctBlockHeader &hdr)
Unpack GCT Jet Candidates and jet counts.
std::map< unsigned int, IsoBoundaryPair > BlockIdToEmCandIsoBoundMap
A typdef for mapping Block IDs to IsoBoundaryPairs.
uint32_t blockId() const
Get the block ID.
std::map< unsigned int, unsigned int > BlkToRctCrateMap
Typedef for mapping block ID to RCT crate.
std::map< unsigned int, std::string > BlockNameMap
Block ID to Block Description map.
L1GctInternEmCandCollection *const gctInternEm() const
Internal EM candidate collection.
uint32_t nSamples() const
Get the number of time samples.
static L1CaloRegion makeRegionFromUnpacker(const uint16_t data, const unsigned ieta, const unsigned iphi, const uint16_t block, const uint16_t index, const int16_t bx)
constructor from raw data and GCT indices for unpacking
Definition: L1CaloRegion.cc:78
static L1GctInternEtSum fromJetTotEt(uint16_t capBlock, uint16_t capIndex, int16_t bx, uint32_t data)
void blockToGctEmCandsAndEnergySums(const unsigned char *d, const GctBlockHeader &hdr)
unpack GCT EM Candidates and energy sums.
L1CaloRegionCollection *const rctCalo() const
Input calo regions from the RCT to the GCT.
void blockToGctInternHtMissPostWheel(const unsigned char *d, const GctBlockHeader &hdr)
unpack GCT internal Missing Ht data that is either wheel output or concJet input (i.e. after wheel processing).
std::vector< L1GctEmCand > L1GctEmCandCollection
#define LogDebug(id)
static L1GctInternEtSum fromJetTotHt(uint16_t capBlock, uint16_t capIndex, int16_t bx, uint32_t data)