CMS 3D CMS Logo

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