CMS 3D CMS Logo

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