CMS 3D CMS Logo

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