File indexing completed on 2024-09-07 04:36:11
0001 #include "EventFilter/GctRawToDigi/src/GctFormatTranslateV35.h"
0002
0003
0004 #include <iostream>
0005 #include <cassert>
0006
0007
0008 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0009
0010
0011 using std::cout;
0012 using std::endl;
0013 using std::make_pair;
0014 using std::pair;
0015
0016
0017
0018 const GctFormatTranslateV35::BlockLengthMap GctFormatTranslateV35::m_blockLength = {
0019
0020 {0x000, 0},
0021
0022 {0x580, 12},
0023 {0x581, 2},
0024 {0x583, 8},
0025 {0x587, 4},
0026
0027 {0x680, 16},
0028 {0x681, 6},
0029 {0x682, 2},
0030 {0x683, 6},
0031 {0x686, 2},
0032 {0x687, 4},
0033
0034 {0x800, 20},
0035 {0x803, 4},
0036 {0x804, 15},
0037 {0x880, 16},
0038 {0x883, 4},
0039 {0x884, 12},
0040 {0xc00, 20},
0041 {0xc03, 4},
0042 {0xc04, 15},
0043 {0xc80, 16},
0044 {0xc83, 4},
0045 {0xc84, 12},
0046
0047 {0x300, 27},
0048 {0x303, 6},
0049 {0x306,
0050 32},
0051 {0x307,
0052 4},
0053
0054 {0x380, 21},
0055 {0x381, 3},
0056 {0x383, 7},
0057 {0x385, 2},
0058 {0x386, 32},
0059 {0x387,
0060 6},
0061
0062 {0x700, 27},
0063 {0x703, 6},
0064 {0x706,
0065 32},
0066 {0x707,
0067 4},
0068
0069 {0x780, 21},
0070 {0x781, 3},
0071 {0x783, 7},
0072 {0x785, 2},
0073 {0x786, 32},
0074 {0x787,
0075 6},
0076
0077 {0x900, 12},
0078 {0x901, 3},
0079 {0x902, 3},
0080 {0x903, 10},
0081 {0x904, 8},
0082 {0x908, 12},
0083 {0x909, 3},
0084 {0x90a, 3},
0085 {0x90b, 10},
0086 {0x90c, 8},
0087 {0x980, 3},
0088 {0x984, 6},
0089 {0x988, 12},
0090 {0x989, 3},
0091 {0x98a, 3},
0092 {0x98b, 10},
0093 {0x98c, 8},
0094 {0xa00, 12},
0095 {0xa01, 3},
0096 {0xa02, 3},
0097 {0xa03, 10},
0098 {0xa04, 8},
0099 {0xa08, 12},
0100 {0xa09, 3},
0101 {0xa0a, 3},
0102 {0xa0b, 10},
0103 {0xa0c, 8},
0104 {0xa80, 3},
0105 {0xa84, 6},
0106 {0xa88, 12},
0107 {0xa89, 3},
0108 {0xa8a, 3},
0109 {0xa8b, 10},
0110 {0xa8c, 8},
0111 {0xb00, 12},
0112 {0xb01, 3},
0113 {0xb02, 3},
0114 {0xb03, 10},
0115 {0xb04, 8},
0116 {0xb08, 12},
0117 {0xb09, 3},
0118 {0xb0a, 3},
0119 {0xb0b, 10},
0120 {0xb0c, 8},
0121 {0xb80, 3},
0122 {0xb84, 6},
0123 {0xb88, 12},
0124 {0xb89, 3},
0125 {0xb8a, 3},
0126 {0xb8b, 10},
0127 {0xb8c, 8},
0128
0129 {0xd00, 12},
0130 {0xd01, 3},
0131 {0xd02, 3},
0132 {0xd03, 10},
0133 {0xd04, 8},
0134 {0xd08, 12},
0135 {0xd09, 3},
0136 {0xd0a, 3},
0137 {0xd0b, 10},
0138 {0xd0c, 8},
0139 {0xd80, 3},
0140 {0xd84, 6},
0141 {0xd88, 12},
0142 {0xd89, 3},
0143 {0xd8a, 3},
0144 {0xd8b, 10},
0145 {0xd8c, 8},
0146 {0xe00, 12},
0147 {0xe01, 3},
0148 {0xe02, 3},
0149 {0xe03, 10},
0150 {0xe04, 8},
0151 {0xe08, 12},
0152 {0xe09, 3},
0153 {0xe0a, 3},
0154 {0xe0b, 10},
0155 {0xe0c, 8},
0156 {0xe80, 3},
0157 {0xe84, 6},
0158 {0xe88, 12},
0159 {0xe89, 3},
0160 {0xe8a, 3},
0161 {0xe8b, 10},
0162 {0xe8c, 8},
0163 {0xf00, 12},
0164 {0xf01, 3},
0165 {0xf02, 3},
0166 {0xf03, 10},
0167 {0xf04, 8},
0168 {0xf08, 12},
0169 {0xf09, 3},
0170 {0xf0a, 3},
0171 {0xf0b, 10},
0172 {0xf0c, 8},
0173 {0xf80, 3},
0174 {0xf84, 6},
0175 {0xf88, 12},
0176 {0xf89, 3},
0177 {0xf8a, 3},
0178 {0xf8b, 10},
0179 {0xf8c, 8}
0180 };
0181
0182
0183 const GctFormatTranslateV35::BlockNameMap GctFormatTranslateV35::m_blockName = {
0184
0185 {0x000, "NULL"},
0186
0187 {0x580, "ConcJet: Input TrigPathA (Jet Cands)"},
0188 {0x581, "ConcJet: Input TrigPathB (HF Rings)"},
0189 {0x583, "ConcJet: Jet Cands and Counts Output to GT"},
0190 {0x587, "ConcJet: BX & Orbit Info"},
0191
0192 {0x680, "ConcElec: Input TrigPathA (EM Cands)"},
0193 {0x681, "ConcElec: Input TrigPathB (Et Sums)"},
0194 {0x682, "ConcElec: Input TrigPathC (Ht Sums)"},
0195 {0x683, "ConcElec: EM Cands and Energy Sums Output to GT"},
0196 {0x686, "ConcElec: Test (GT Serdes Loopback)"},
0197 {0x687, "ConcElec: BX & Orbit Info"},
0198
0199 {0x800, "Leaf0ElecPosEtaU1: Sort Input"},
0200 {0x803, "Leaf0ElecPosEtaU1: Sort Output"},
0201 {0x804, "Leaf0ElecPosEtaU1: Raw Input"},
0202 {0x880, "Leaf0ElecPosEtaU2: Sort Input"},
0203 {0x883, "Leaf0ElecPosEtaU2: Sort Output"},
0204 {0x884, "Leaf0ElecPosEtaU2: Raw Input"},
0205 {0xc00, "Leaf0ElecNegEtaU1: Sort Input"},
0206 {0xc03, "Leaf0ElecNegEtaU1: Sort Output"},
0207 {0xc04, "Leaf0ElecNegEtaU1: Raw Input"},
0208 {0xc80, "Leaf0ElecNegEtaU2: Sort Input"},
0209 {0xc83, "Leaf0ElecNegEtaU2: Sort Output"},
0210 {0xc84, "Leaf0ElecNegEtaU2: Raw Input"},
0211
0212 {0x300, "WheelPosEtaJet: Input TrigPathA (Jet Sort)"},
0213 {0x303, "WheelPosEtaJet: Output TrigPathA (Jet Sort)"},
0214 {0x306,
0215 "WheelPosEtaJet: Test (deprecated)"},
0216 {0x307,
0217 "WheelPosEtaJet: Info (deprecated)"},
0218
0219 {0x380, "WheelPosEtaEnergy: Input TrigPathA (Et)"},
0220 {0x381, "WheelPosEtaEnergy: Input TrigPathB (Ht)"},
0221 {0x383, "WheelPosEtaEnergy: Output TrigPathA (Et)"},
0222 {0x385, "WheelPosEtaEnergy: Output TrigPathB (Ht)"},
0223 {0x386, "WheelPosEtaEnergy: Test"},
0224 {0x387, "WheelPosEtaEnergy: BX & Orbit Info"},
0225
0226 {0x700, "WheelNegEtaJet: Input TrigPathA (Jet Sort)"},
0227 {0x703, "WheelNegEtaJet: Output TrigPathA (Jet Sort)"},
0228 {0x706,
0229 "WheelNegEtaJet: Test (deprecated)"},
0230 {0x707,
0231 "WheelNegEtaJet: Info (deprecated)"},
0232
0233 {0x780, "WheelNegEtaEnergy: Input TrigPathA (Et)"},
0234 {0x781, "WheelNegEtaEnergy: Input TrigPathB (Ht)"},
0235 {0x783, "WheelNegEtaEnergy: Output TrigPathA (Et)"},
0236 {0x785, "WheelNegEtaEnergy: Output TrigPathB (Ht)"},
0237 {0x786, "WheelNegEtaEnergy: Test"},
0238 {0x787, "WheelNegEtaEnergy: BX & Orbit Info"},
0239
0240 {0x900, "Leaf1JetPosEtaU1: JF2 Input"},
0241 {0x901, "Leaf1JetPosEtaU1: JF2 Shared Received"},
0242 {0x902, "Leaf1JetPosEtaU1: JF2 Shared Sent"},
0243 {0x903, "Leaf1JetPosEtaU1: JF2 Output"},
0244 {0x904, "Leaf1JetPosEtaU1: JF2 Raw Input"},
0245 {0x908, "Leaf1JetPosEtaU1: JF3 Input"},
0246 {0x909, "Leaf1JetPosEtaU1: JF3 Shared Received"},
0247 {0x90a, "Leaf1JetPosEtaU1: JF3 Shared Sent"},
0248 {0x90b, "Leaf1JetPosEtaU1: JF3 Output"},
0249 {0x90c, "Leaf1JetPosEtaU1: JF3 Raw Input"},
0250 {0x980, "Leaf1JetPosEtaU2: Eta0 Input"},
0251 {0x984, "Leaf1JetPosEtaU2: Eta0 Raw Input"},
0252 {0x988, "Leaf1JetPosEtaU2: JF1 Input"},
0253 {0x989, "Leaf1JetPosEtaU2: JF1 Shared Received"},
0254 {0x98a, "Leaf1JetPosEtaU2: JF1 Shared Sent"},
0255 {0x98b, "Leaf1JetPosEtaU2: JF1 Output"},
0256 {0x98c, "Leaf1JetPosEtaU2: JF1 Raw Input"},
0257 {0xa00, "Leaf2JetPosEtaU1: JF2 Input"},
0258 {0xa01, "Leaf2JetPosEtaU1: JF2 Shared Received"},
0259 {0xa02, "Leaf2JetPosEtaU1: JF2 Shared Sent"},
0260 {0xa03, "Leaf2JetPosEtaU1: JF2 Output"},
0261 {0xa04, "Leaf2JetPosEtaU1: JF2 Raw Input"},
0262 {0xa08, "Leaf2JetPosEtaU1: JF3 Input"},
0263 {0xa09, "Leaf2JetPosEtaU1: JF3 Shared Received"},
0264 {0xa0a, "Leaf2JetPosEtaU1: JF3 Shared Sent"},
0265 {0xa0b, "Leaf2JetPosEtaU1: JF3 Output"},
0266 {0xa0c, "Leaf2JetPosEtaU1: JF3 Raw Input"},
0267 {0xa80, "Leaf2JetPosEtaU2: Eta0 Input"},
0268 {0xa84, "Leaf2JetPosEtaU2: Eta0 Raw Input"},
0269 {0xa88, "Leaf2JetPosEtaU2: JF1 Input"},
0270 {0xa89, "Leaf2JetPosEtaU2: JF1 Shared Received"},
0271 {0xa8a, "Leaf2JetPosEtaU2: JF1 Shared Sent"},
0272 {0xa8b, "Leaf2JetPosEtaU2: JF1 Output"},
0273 {0xa8c, "Leaf2JetPosEtaU2: JF1 Raw Input"},
0274 {0xb00, "Leaf3JetPosEtaU1: JF2 Input"},
0275 {0xb01, "Leaf3JetPosEtaU1: JF2 Shared Received"},
0276 {0xb02, "Leaf3JetPosEtaU1: JF2 Shared Sent"},
0277 {0xb03, "Leaf3JetPosEtaU1: JF2 Output"},
0278 {0xb04, "Leaf3JetPosEtaU1: JF2 Raw Input"},
0279 {0xb08, "Leaf3JetPosEtaU1: JF3 Input"},
0280 {0xb09, "Leaf3JetPosEtaU1: JF3 Shared Received"},
0281 {0xb0a, "Leaf3JetPosEtaU1: JF3 Shared Sent"},
0282 {0xb0b, "Leaf3JetPosEtaU1: JF3 Output"},
0283 {0xb0c, "Leaf3JetPosEtaU1: JF3 Raw Input"},
0284 {0xb80, "Leaf3JetPosEtaU2: Eta0 Input"},
0285 {0xb84, "Leaf3JetPosEtaU2: Eta0 Raw Input"},
0286 {0xb88, "Leaf3JetPosEtaU2: JF1 Input"},
0287 {0xb89, "Leaf3JetPosEtaU2: JF1 Shared Received"},
0288 {0xb8a, "Leaf3JetPosEtaU2: JF1 Shared Sent"},
0289 {0xb8b, "Leaf3JetPosEtaU2: JF1 Output"},
0290 {0xb8c, "Leaf3JetPosEtaU2: JF1 Raw Input"},
0291
0292 {0xd00, "Leaf1JetNegEtaU1: JF2 Input"},
0293 {0xd01, "Leaf1JetNegEtaU1: JF2 Shared Received"},
0294 {0xd02, "Leaf1JetNegEtaU1: JF2 Shared Sent"},
0295 {0xd03, "Leaf1JetNegEtaU1: JF2 Output"},
0296 {0xd04, "Leaf1JetNegEtaU1: JF2 Raw Input"},
0297 {0xd08, "Leaf1JetNegEtaU1: JF3 Input"},
0298 {0xd09, "Leaf1JetNegEtaU1: JF3 Shared Received"},
0299 {0xd0a, "Leaf1JetNegEtaU1: JF3 Shared Sent"},
0300 {0xd0b, "Leaf1JetNegEtaU1: JF3 Output"},
0301 {0xd0c, "Leaf1JetNegEtaU1: JF3 Raw Input"},
0302 {0xd80, "Leaf1JetNegEtaU2: Eta0 Input"},
0303 {0xd84, "Leaf1JetNegEtaU2: Eta0 Raw Input"},
0304 {0xd88, "Leaf1JetNegEtaU2: JF1 Input"},
0305 {0xd89, "Leaf1JetNegEtaU2: JF1 Shared Received"},
0306 {0xd8a, "Leaf1JetNegEtaU2: JF1 Shared Sent"},
0307 {0xd8b, "Leaf1JetNegEtaU2: JF1 Output"},
0308 {0xd8c, "Leaf1JetNegEtaU2: JF1 Raw Input"},
0309 {0xe00, "Leaf2JetNegEtaU1: JF2 Input"},
0310 {0xe01, "Leaf2JetNegEtaU1: JF2 Shared Received"},
0311 {0xe02, "Leaf2JetNegEtaU1: JF2 Shared Sent"},
0312 {0xe03, "Leaf2JetNegEtaU1: JF2 Output"},
0313 {0xe04, "Leaf2JetNegEtaU1: JF2 Raw Input"},
0314 {0xe08, "Leaf2JetNegEtaU1: JF3 Input"},
0315 {0xe09, "Leaf2JetNegEtaU1: JF3 Shared Received"},
0316 {0xe0a, "Leaf2JetNegEtaU1: JF3 Shared Sent"},
0317 {0xe0b, "Leaf2JetNegEtaU1: JF3 Output"},
0318 {0xe0c, "Leaf2JetNegEtaU1: JF3 Raw Input"},
0319 {0xe80, "Leaf2JetNegEtaU2: Eta0 Input"},
0320 {0xe84, "Leaf2JetNegEtaU2: Eta0 Raw Input"},
0321 {0xe88, "Leaf2JetNegEtaU2: JF1 Input"},
0322 {0xe89, "Leaf2JetNegEtaU2: JF1 Shared Received"},
0323 {0xe8a, "Leaf2JetNegEtaU2: JF1 Shared Sent"},
0324 {0xe8b, "Leaf2JetNegEtaU2: JF1 Output"},
0325 {0xe8c, "Leaf2JetNegEtaU2: JF1 Raw Input"},
0326 {0xf00, "Leaf3JetNegEtaU1: JF2 Input"},
0327 {0xf01, "Leaf3JetNegEtaU1: JF2 Shared Received"},
0328 {0xf02, "Leaf3JetNegEtaU1: JF2 Shared Sent"},
0329 {0xf03, "Leaf3JetNegEtaU1: JF2 Output"},
0330 {0xf04, "Leaf3JetNegEtaU1: JF2 Raw Input"},
0331 {0xf08, "Leaf3JetNegEtaU1: JF3 Input"},
0332 {0xf09, "Leaf3JetNegEtaU1: JF3 Shared Received"},
0333 {0xf0a, "Leaf3JetNegEtaU1: JF3 Shared Sent"},
0334 {0xf0b, "Leaf3JetNegEtaU1: JF3 Output"},
0335 {0xf0c, "Leaf3JetNegEtaU1: JF3 Raw Input"},
0336 {0xf80, "Leaf3JetNegEtaU2: Eta0 Input"},
0337 {0xf84, "Leaf3JetNegEtaU2: Eta0 Raw Input"},
0338 {0xf88, "Leaf3JetNegEtaU2: JF1 Input"},
0339 {0xf89, "Leaf3JetNegEtaU2: JF1 Shared Received"},
0340 {0xf8a, "Leaf3JetNegEtaU2: JF1 Shared Sent"},
0341 {0xf8b, "Leaf3JetNegEtaU2: JF1 Output"},
0342 {0xf8c, "Leaf3JetNegEtaU2: JF1 Raw Input"}};
0343
0344
0345 const GctFormatTranslateV35::BlockIdToUnpackFnMap GctFormatTranslateV35::m_blockUnpackFn = {
0346
0347 {0x000, &GctFormatTranslateV35::blockDoNothing},
0348
0349 {0x580, &GctFormatTranslateV35::blockToGctTrigObjects},
0350 {0x581, &GctFormatTranslateV35::blockToGctInternRingSums},
0351 {0x583, &GctFormatTranslateV35::blockToGctJetCandsAndCounts},
0352 {0x587, &GctFormatTranslateV35::blockDoNothing},
0353
0354 {0x680, &GctFormatTranslateV35::blockToGctInternEmCand},
0355 {0x681, &GctFormatTranslateV35::blockToGctInternEtSums},
0356 {0x682, &GctFormatTranslateV35::blockToGctInternEtSums},
0357 {0x683, &GctFormatTranslateV35::blockToGctEmCandsAndEnergySums},
0358 {0x686, &GctFormatTranslateV35::blockDoNothing},
0359 {0x687, &GctFormatTranslateV35::blockDoNothing},
0360
0361 {0x800, &GctFormatTranslateV35::blockToGctInternEmCand},
0362 {0x803, &GctFormatTranslateV35::blockToGctInternEmCand},
0363 {0x804, &GctFormatTranslateV35::blockToFibresAndToRctEmCand},
0364 {0x880, &GctFormatTranslateV35::blockToGctInternEmCand},
0365 {0x883, &GctFormatTranslateV35::blockToGctInternEmCand},
0366 {0x884, &GctFormatTranslateV35::blockToFibresAndToRctEmCand},
0367 {0xc00, &GctFormatTranslateV35::blockToGctInternEmCand},
0368 {0xc03, &GctFormatTranslateV35::blockToGctInternEmCand},
0369 {0xc04, &GctFormatTranslateV35::blockToFibresAndToRctEmCand},
0370 {0xc80, &GctFormatTranslateV35::blockToGctInternEmCand},
0371 {0xc83, &GctFormatTranslateV35::blockToGctInternEmCand},
0372 {0xc84, &GctFormatTranslateV35::blockToFibresAndToRctEmCand},
0373
0374 {0x300, &GctFormatTranslateV35::blockToGctJetClusterMinimal},
0375 {0x303, &GctFormatTranslateV35::blockToGctTrigObjects},
0376 {0x306,
0377 &GctFormatTranslateV35::
0378 blockDoNothing},
0379 {0x307,
0380 &GctFormatTranslateV35::
0381 blockDoNothing},
0382
0383 {0x380,
0384 &GctFormatTranslateV35::blockToGctWheelInputInternEtAndRingSums},
0385 {0x381, &GctFormatTranslateV35::blockToGctInternEtSums},
0386 {0x383,
0387 &GctFormatTranslateV35::blockToGctWheelOutputInternEtAndRingSums},
0388 {0x385, &GctFormatTranslateV35::blockToGctInternEtSums},
0389 {0x386, &GctFormatTranslateV35::blockDoNothing},
0390 {0x387,
0391 &GctFormatTranslateV35::
0392 blockDoNothing},
0393
0394 {0x700, &GctFormatTranslateV35::blockToGctJetClusterMinimal},
0395 {0x703, &GctFormatTranslateV35::blockToGctTrigObjects},
0396 {0x706,
0397 &GctFormatTranslateV35::
0398 blockDoNothing},
0399 {0x707,
0400 &GctFormatTranslateV35::
0401 blockDoNothing},
0402
0403 {0x780,
0404 &GctFormatTranslateV35::blockToGctWheelInputInternEtAndRingSums},
0405 {0x781, &GctFormatTranslateV35::blockToGctInternEtSums},
0406 {0x783,
0407 &GctFormatTranslateV35::blockToGctWheelOutputInternEtAndRingSums},
0408 {0x785, &GctFormatTranslateV35::blockToGctInternEtSums},
0409 {0x786, &GctFormatTranslateV35::blockDoNothing},
0410 {0x787,
0411 &GctFormatTranslateV35::
0412 blockDoNothing},
0413
0414 {0x900, &GctFormatTranslateV35::blockToRctCaloRegions},
0415 {0x901, &GctFormatTranslateV35::blockToGctJetPreCluster},
0416 {0x902, &GctFormatTranslateV35::blockToGctJetPreCluster},
0417 {0x903, &GctFormatTranslateV35::blockToGctInternEtSumsAndJetCluster},
0418 {0x904, &GctFormatTranslateV35::blockToFibres},
0419 {0x908, &GctFormatTranslateV35::blockToRctCaloRegions},
0420 {0x909, &GctFormatTranslateV35::blockToGctJetPreCluster},
0421 {0x90a, &GctFormatTranslateV35::blockToGctJetPreCluster},
0422 {0x90b, &GctFormatTranslateV35::blockToGctInternEtSumsAndJetCluster},
0423 {0x90c, &GctFormatTranslateV35::blockToFibres},
0424 {0x980, &GctFormatTranslateV35::blockDoNothing},
0425 {0x984, &GctFormatTranslateV35::blockToFibres},
0426 {0x988, &GctFormatTranslateV35::blockToRctCaloRegions},
0427 {0x989, &GctFormatTranslateV35::blockToGctJetPreCluster},
0428 {0x98a, &GctFormatTranslateV35::blockToGctJetPreCluster},
0429 {0x98b, &GctFormatTranslateV35::blockToGctInternEtSumsAndJetCluster},
0430 {0x98c, &GctFormatTranslateV35::blockToFibres},
0431 {0xa00, &GctFormatTranslateV35::blockToRctCaloRegions},
0432 {0xa01, &GctFormatTranslateV35::blockToGctJetPreCluster},
0433 {0xa02, &GctFormatTranslateV35::blockToGctJetPreCluster},
0434 {0xa03, &GctFormatTranslateV35::blockToGctInternEtSumsAndJetCluster},
0435 {0xa04, &GctFormatTranslateV35::blockToFibres},
0436 {0xa08, &GctFormatTranslateV35::blockToRctCaloRegions},
0437 {0xa09, &GctFormatTranslateV35::blockToGctJetPreCluster},
0438 {0xa0a, &GctFormatTranslateV35::blockToGctJetPreCluster},
0439 {0xa0b, &GctFormatTranslateV35::blockToGctInternEtSumsAndJetCluster},
0440 {0xa0c, &GctFormatTranslateV35::blockToFibres},
0441 {0xa80, &GctFormatTranslateV35::blockDoNothing},
0442 {0xa84, &GctFormatTranslateV35::blockToFibres},
0443 {0xa88, &GctFormatTranslateV35::blockToRctCaloRegions},
0444 {0xa89, &GctFormatTranslateV35::blockToGctJetPreCluster},
0445 {0xa8a, &GctFormatTranslateV35::blockToGctJetPreCluster},
0446 {0xa8b, &GctFormatTranslateV35::blockToGctInternEtSumsAndJetCluster},
0447 {0xa8c, &GctFormatTranslateV35::blockToFibres},
0448 {0xb00, &GctFormatTranslateV35::blockToRctCaloRegions},
0449 {0xb01, &GctFormatTranslateV35::blockToGctJetPreCluster},
0450 {0xb02, &GctFormatTranslateV35::blockToGctJetPreCluster},
0451 {0xb03, &GctFormatTranslateV35::blockToGctInternEtSumsAndJetCluster},
0452 {0xb04, &GctFormatTranslateV35::blockToFibres},
0453 {0xb08, &GctFormatTranslateV35::blockToRctCaloRegions},
0454 {0xb09, &GctFormatTranslateV35::blockToGctJetPreCluster},
0455 {0xb0a, &GctFormatTranslateV35::blockToGctJetPreCluster},
0456 {0xb0b, &GctFormatTranslateV35::blockToGctInternEtSumsAndJetCluster},
0457 {0xb0c, &GctFormatTranslateV35::blockToFibres},
0458 {0xb80, &GctFormatTranslateV35::blockDoNothing},
0459 {0xb84, &GctFormatTranslateV35::blockToFibres},
0460 {0xb88, &GctFormatTranslateV35::blockToRctCaloRegions},
0461 {0xb89, &GctFormatTranslateV35::blockToGctJetPreCluster},
0462 {0xb8a, &GctFormatTranslateV35::blockToGctJetPreCluster},
0463 {0xb8b, &GctFormatTranslateV35::blockToGctInternEtSumsAndJetCluster},
0464 {0xb8c, &GctFormatTranslateV35::blockToFibres},
0465
0466 {0xd00, &GctFormatTranslateV35::blockToRctCaloRegions},
0467 {0xd01, &GctFormatTranslateV35::blockToGctJetPreCluster},
0468 {0xd02, &GctFormatTranslateV35::blockToGctJetPreCluster},
0469 {0xd03, &GctFormatTranslateV35::blockToGctInternEtSumsAndJetCluster},
0470 {0xd04, &GctFormatTranslateV35::blockToFibres},
0471 {0xd08, &GctFormatTranslateV35::blockToRctCaloRegions},
0472 {0xd09, &GctFormatTranslateV35::blockToGctJetPreCluster},
0473 {0xd0a, &GctFormatTranslateV35::blockToGctJetPreCluster},
0474 {0xd0b, &GctFormatTranslateV35::blockToGctInternEtSumsAndJetCluster},
0475 {0xd0c, &GctFormatTranslateV35::blockToFibres},
0476 {0xd80, &GctFormatTranslateV35::blockDoNothing},
0477 {0xd84, &GctFormatTranslateV35::blockToFibres},
0478 {0xd88, &GctFormatTranslateV35::blockToRctCaloRegions},
0479 {0xd89, &GctFormatTranslateV35::blockToGctJetPreCluster},
0480 {0xd8a, &GctFormatTranslateV35::blockToGctJetPreCluster},
0481 {0xd8b, &GctFormatTranslateV35::blockToGctInternEtSumsAndJetCluster},
0482 {0xd8c, &GctFormatTranslateV35::blockToFibres},
0483 {0xe00, &GctFormatTranslateV35::blockToRctCaloRegions},
0484 {0xe01, &GctFormatTranslateV35::blockToGctJetPreCluster},
0485 {0xe02, &GctFormatTranslateV35::blockToGctJetPreCluster},
0486 {0xe03, &GctFormatTranslateV35::blockToGctInternEtSumsAndJetCluster},
0487 {0xe04, &GctFormatTranslateV35::blockToFibres},
0488 {0xe08, &GctFormatTranslateV35::blockToRctCaloRegions},
0489 {0xe09, &GctFormatTranslateV35::blockToGctJetPreCluster},
0490 {0xe0a, &GctFormatTranslateV35::blockToGctJetPreCluster},
0491 {0xe0b, &GctFormatTranslateV35::blockToGctInternEtSumsAndJetCluster},
0492 {0xe0c, &GctFormatTranslateV35::blockToFibres},
0493 {0xe80, &GctFormatTranslateV35::blockDoNothing},
0494 {0xe84, &GctFormatTranslateV35::blockToFibres},
0495 {0xe88, &GctFormatTranslateV35::blockToRctCaloRegions},
0496 {0xe89, &GctFormatTranslateV35::blockToGctJetPreCluster},
0497 {0xe8a, &GctFormatTranslateV35::blockToGctJetPreCluster},
0498 {0xe8b, &GctFormatTranslateV35::blockToGctInternEtSumsAndJetCluster},
0499 {0xe8c, &GctFormatTranslateV35::blockToFibres},
0500 {0xf00, &GctFormatTranslateV35::blockToRctCaloRegions},
0501 {0xf01, &GctFormatTranslateV35::blockToGctJetPreCluster},
0502 {0xf02, &GctFormatTranslateV35::blockToGctJetPreCluster},
0503 {0xf03, &GctFormatTranslateV35::blockToGctInternEtSumsAndJetCluster},
0504 {0xf04, &GctFormatTranslateV35::blockToFibres},
0505 {0xf08, &GctFormatTranslateV35::blockToRctCaloRegions},
0506 {0xf09, &GctFormatTranslateV35::blockToGctJetPreCluster},
0507 {0xf0a, &GctFormatTranslateV35::blockToGctJetPreCluster},
0508 {0xf0b, &GctFormatTranslateV35::blockToGctInternEtSumsAndJetCluster},
0509 {0xf0c, &GctFormatTranslateV35::blockToFibres},
0510 {0xf80, &GctFormatTranslateV35::blockDoNothing},
0511 {0xf84, &GctFormatTranslateV35::blockToFibres},
0512 {0xf88, &GctFormatTranslateV35::blockToRctCaloRegions},
0513 {0xf89, &GctFormatTranslateV35::blockToGctJetPreCluster},
0514 {0xf8a, &GctFormatTranslateV35::blockToGctJetPreCluster},
0515 {0xf8b, &GctFormatTranslateV35::blockToGctInternEtSumsAndJetCluster},
0516 {0xf8c, &GctFormatTranslateV35::blockToFibres}
0517 };
0518
0519
0520 const GctFormatTranslateV35::BlkToRctCrateMap GctFormatTranslateV35::m_rctEmCrate = {
0521 {0x804, 13}, {0x884, 9}, {0xc04, 4}, {0xc84, 0}};
0522
0523
0524 const GctFormatTranslateV35::BlkToRctCrateMap GctFormatTranslateV35::m_rctJetCrate = {
0525 {0x900, 9},
0526 {0x908, 10},
0527 {0x988, 17},
0528 {0xa00, 12},
0529 {0xa08, 13},
0530 {0xa88, 11},
0531 {0xb00, 15},
0532 {0xb08, 16},
0533 {0xb88, 14},
0534 {0xd00, 0},
0535 {0xd08, 1},
0536 {0xd88, 8},
0537 {0xe00, 3},
0538 {0xe08, 4},
0539 {0xe88, 2},
0540 {0xf00, 6},
0541 {0xf08, 7},
0542 {0xf88, 5}
0543 };
0544
0545
0546 const GctFormatTranslateV35::BlockIdToEmCandIsoBoundMap GctFormatTranslateV35::m_internEmIsoBounds = {
0547 {0x680, IsoBoundaryPair(8, 15)},
0548 {0x800, IsoBoundaryPair(0, 9)},
0549 {0x803, IsoBoundaryPair(0, 1)},
0550 {0x880, IsoBoundaryPair(0, 7)},
0551 {0x883, IsoBoundaryPair(0, 1)},
0552 {0xc00, IsoBoundaryPair(0, 9)},
0553 {0xc03, IsoBoundaryPair(0, 1)},
0554 {0xc80, IsoBoundaryPair(0, 7)},
0555 {0xc83, IsoBoundaryPair(0, 1)}};
0556
0557
0558
0559 GctFormatTranslateV35::GctFormatTranslateV35(bool hltMode, bool unpackSharedRegions)
0560 : GctFormatTranslateBase(hltMode, unpackSharedRegions) {}
0561
0562 GctFormatTranslateV35::~GctFormatTranslateV35() {}
0563
0564 GctBlockHeader GctFormatTranslateV35::generateBlockHeader(const unsigned char* data) const {
0565
0566 uint32_t hdr = data[0] + (data[1] << 8) + (data[2] << 16) + (data[3] << 24);
0567
0568
0569
0570
0571
0572
0573
0574
0575
0576
0577
0578 unsigned blockId = hdr & 0xfff;
0579 unsigned blockLength = 0;
0580 unsigned nSamples = (hdr >> 16) & 0xf;
0581 unsigned bxId = (hdr >> 20) & 0xfff;
0582 unsigned eventId = (hdr >> 12) & 0xf;
0583 bool valid = (blockLengthMap().find(blockId) != blockLengthMap().end());
0584
0585 if (valid) {
0586 blockLength = blockLengthMap().find(blockId)->second;
0587 }
0588
0589 return GctBlockHeader(blockId, blockLength, nSamples, bxId, eventId, valid);
0590 }
0591
0592
0593 bool GctFormatTranslateV35::convertBlock(const unsigned char* data, const GctBlockHeader& hdr) {
0594
0595 if (hdr.nSamples() < 1) {
0596 return true;
0597 }
0598
0599 if (!checkBlock(hdr)) {
0600 return false;
0601 }
0602
0603
0604
0605
0606 (this->*m_blockUnpackFn.find(hdr.blockId())->second)(data,
0607 hdr);
0608
0609 return true;
0610 }
0611
0612
0613
0614 uint32_t GctFormatTranslateV35::generateRawHeader(const uint32_t blockId,
0615 const uint32_t nSamples,
0616 const uint32_t bxId,
0617 const uint32_t eventId) const {
0618
0619
0620
0621
0622
0623
0624
0625
0626
0627
0628 return ((bxId & 0xfff) << 20) | ((nSamples & 0xf) << 16) | ((eventId & 0xf) << 12) | (blockId & 0xfff);
0629 }
0630
0631
0632
0633
0634 void GctFormatTranslateV35::blockToGctEmCandsAndEnergySums(const unsigned char* d, const GctBlockHeader& hdr) {
0635 const unsigned int id = hdr.blockId();
0636 const unsigned int nSamples = hdr.nSamples();
0637
0638
0639
0640 const uint16_t* p16 = reinterpret_cast<const uint16_t*>(d);
0641
0642
0643
0644 const unsigned int emCandCategoryOffset =
0645 nSamples * 4;
0646 const unsigned int timeSampleOffset = nSamples * 2;
0647
0648 unsigned int samplesToUnpack = 1;
0649 if (!hltMode()) {
0650 samplesToUnpack = nSamples;
0651 }
0652
0653 for (unsigned int iso = 0; iso < 2; ++iso)
0654 {
0655 bool isoFlag = (iso == 1);
0656
0657
0658 L1GctEmCandCollection* em;
0659 if (isoFlag) {
0660 em = colls()->gctIsoEm();
0661 } else {
0662 em = colls()->gctNonIsoEm();
0663 }
0664
0665 for (unsigned int bx = 0; bx < samplesToUnpack; ++bx)
0666 {
0667
0668
0669 const unsigned int cand0Offset = iso * emCandCategoryOffset + bx * 2;
0670
0671 em->push_back(L1GctEmCand(p16[cand0Offset], isoFlag, id, 0, bx));
0672 em->push_back(L1GctEmCand(p16[cand0Offset + timeSampleOffset], isoFlag, id, 1, bx));
0673 em->push_back(L1GctEmCand(p16[cand0Offset + 1], isoFlag, id, 2, bx));
0674 em->push_back(L1GctEmCand(p16[cand0Offset + timeSampleOffset + 1], isoFlag, id, 3, bx));
0675 }
0676 }
0677
0678 p16 += emCandCategoryOffset * 2;
0679
0680
0681
0682
0683 colls()->gctEtTot()->push_back(L1GctEtTotal(p16[0]));
0684 colls()->gctEtHad()->push_back(L1GctEtHad(p16[1]));
0685
0686
0687 const uint32_t* p32 = reinterpret_cast<const uint32_t*>(p16);
0688
0689 colls()->gctEtMiss()->push_back(L1GctEtMiss(p32[nSamples]));
0690 }
0691
0692 void GctFormatTranslateV35::blockToGctJetCandsAndCounts(const unsigned char* d, const GctBlockHeader& hdr) {
0693 const unsigned int id = hdr.blockId();
0694 const unsigned int nSamples = hdr.nSamples();
0695
0696
0697
0698 const uint16_t* p16 = reinterpret_cast<const uint16_t*>(d);
0699
0700
0701
0702 const unsigned int jetCandCategoryOffset = nSamples * 4;
0703 const unsigned int timeSampleOffset = nSamples * 2;
0704
0705 unsigned int samplesToUnpack = 1;
0706 if (!hltMode()) {
0707 samplesToUnpack = nSamples;
0708 }
0709
0710
0711 for (unsigned int iCat = 0; iCat < NUM_JET_CATEGORIES; ++iCat) {
0712 L1GctJetCandCollection* const jets = gctJets(iCat);
0713 assert(jets->empty());
0714
0715 bool tauflag = (iCat == TAU_JETS);
0716 bool forwardFlag = (iCat == FORWARD_JETS);
0717
0718
0719 for (unsigned int bx = 0; bx < samplesToUnpack; ++bx) {
0720
0721 const unsigned int cand0Offset = iCat * jetCandCategoryOffset + bx * 2;
0722
0723
0724 jets->push_back(L1GctJetCand(p16[cand0Offset], tauflag, forwardFlag, id, 0, bx));
0725
0726 jets->push_back(L1GctJetCand(p16[cand0Offset + timeSampleOffset], tauflag, forwardFlag, id, 1, bx));
0727
0728 jets->push_back(L1GctJetCand(p16[cand0Offset + 1], tauflag, forwardFlag, id, 2, bx));
0729
0730 jets->push_back(L1GctJetCand(p16[cand0Offset + timeSampleOffset + 1], tauflag, forwardFlag, id, 3, bx));
0731 }
0732 }
0733
0734 p16 += NUM_JET_CATEGORIES * jetCandCategoryOffset;
0735
0736
0737
0738
0739
0740 const uint32_t* p32 = reinterpret_cast<const uint32_t*>(p16);
0741
0742
0743 colls()->gctHfBitCounts()->push_back(L1GctHFBitCounts::fromConcHFBitCounts(id, 6, 0, p32[0]));
0744 colls()->gctHfRingEtSums()->push_back(L1GctHFRingEtSums::fromConcRingSums(id, 6, 0, p32[0]));
0745
0746 }
0747
0748
0749 void GctFormatTranslateV35::blockToGctInternEmCand(const unsigned char* d, const GctBlockHeader& hdr) {
0750
0751 if (hltMode()) {
0752 LogDebug("GCT") << "HLT mode - skipping unpack of internal EM Cands";
0753 return;
0754 }
0755
0756 unsigned int id = hdr.blockId();
0757 unsigned int nSamples = hdr.nSamples();
0758 unsigned int numCandPairs = hdr.blockLength();
0759
0760
0761 auto found = internEmIsoBounds().find(id);
0762 assert(internEmIsoBounds().find(id) != internEmIsoBounds().end());
0763
0764 unsigned int lowerIsoPairBound = found->second.first;
0765 unsigned int upperIsoPairBound = found->second.second;
0766
0767
0768 const uint16_t* p = reinterpret_cast<const uint16_t*>(d);
0769
0770
0771 for (unsigned int bx = 0; bx < nSamples; ++bx) {
0772
0773 for (unsigned int candPair = 0; candPair < numCandPairs; ++candPair) {
0774
0775 bool iso = ((candPair >= lowerIsoPairBound) && (candPair <= upperIsoPairBound));
0776
0777
0778 for (unsigned int i = 0; i < 2; ++i) {
0779 unsigned offset = 2 * (bx + candPair * nSamples) + i;
0780 uint16_t candRaw = p[offset];
0781 colls()->gctInternEm()->push_back(L1GctInternEmCand(candRaw, iso, id, candPair * 2 + i, bx));
0782 }
0783 }
0784 }
0785 }
0786
0787
0788
0789 void GctFormatTranslateV35::blockToRctEmCand(const unsigned char* d, const GctBlockHeader& hdr) {
0790
0791 if (hltMode()) {
0792 LogDebug("GCT") << "HLT mode - skipping unpack of RCT EM Cands";
0793 return;
0794 }
0795
0796 unsigned int id = hdr.blockId();
0797 unsigned int nSamples = hdr.nSamples();
0798 unsigned int length = hdr.blockLength();
0799
0800
0801 const uint16_t* p = reinterpret_cast<const uint16_t*>(d);
0802
0803
0804 uint16_t sfp[2][4];
0805 uint16_t eIsoRank[4];
0806 uint16_t eIsoCard[4];
0807 uint16_t eIsoRgn[4];
0808 uint16_t eNonIsoRank[4];
0809 uint16_t eNonIsoCard[4];
0810 uint16_t eNonIsoRgn[4];
0811 uint16_t MIPbits[7][2];
0812 uint16_t QBits[7][2];
0813
0814 unsigned int bx = 0;
0815
0816
0817 auto found = rctEmCrateMap().find(id);
0818 assert(found != rctEmCrateMap().end());
0819 for (unsigned int crate = found->second; crate < found->second + length / 3; ++crate) {
0820
0821 for (unsigned short iSfp = 0; iSfp < 4; ++iSfp) {
0822 for (unsigned short cyc = 0; cyc < 2; ++cyc) {
0823 if (iSfp == 0) {
0824 sfp[cyc][iSfp] = 0;
0825 }
0826 else {
0827 sfp[cyc][iSfp] = *p;
0828 ++p;
0829 }
0830 }
0831 p = p + 2 * (nSamples - 1);
0832 }
0833
0834
0835 srcCardRouting().SFPtoEMU(eIsoRank, eIsoCard, eIsoRgn, eNonIsoRank, eNonIsoCard, eNonIsoRgn, MIPbits, QBits, sfp);
0836
0837
0838 for (unsigned short int i = 0; i < 4; ++i) {
0839 colls()->rctEm()->push_back(L1CaloEmCand(eIsoRank[i], eIsoRgn[i], eIsoCard[i], crate, true, i, bx));
0840 }
0841 for (unsigned short int i = 0; i < 4; ++i) {
0842 colls()->rctEm()->push_back(L1CaloEmCand(eNonIsoRank[i], eNonIsoRgn[i], eNonIsoCard[i], crate, false, i, bx));
0843 }
0844 }
0845 }
0846
0847
0848 void GctFormatTranslateV35::blockToRctCaloRegions(const unsigned char* d, const GctBlockHeader& hdr) {
0849
0850 if (hltMode()) {
0851 LogDebug("GCT") << "HLT mode - skipping unpack of RCT Regions";
0852 return;
0853 }
0854
0855 unsigned int id = hdr.blockId();
0856 unsigned int nSamples = hdr.nSamples();
0857 unsigned int length = hdr.blockLength();
0858
0859
0860 auto found = rctJetCrateMap().find(id);
0861 assert(found != rctJetCrateMap().end());
0862
0863
0864 unsigned int crate = found->second;
0865
0866
0867 const uint16_t* p = reinterpret_cast<const uint16_t*>(d);
0868
0869
0870 unsigned int ieta;
0871 unsigned int iphi;
0872
0873 for (unsigned int i = 0; i < length; ++i) {
0874 for (uint16_t bx = 0; bx < nSamples; ++bx) {
0875 if (i > 0) {
0876 if (crate < 9) {
0877 ieta = 11 - i;
0878 iphi = 2 * ((11 - crate) % 9);
0879 } else {
0880 ieta = 10 + i;
0881 iphi = 2 * ((20 - crate) % 9);
0882 }
0883
0884 colls()->rctCalo()->push_back(L1CaloRegion::makeRegionFromUnpacker(*p, ieta, iphi, id, i, bx));
0885 ++p;
0886
0887 if (iphi > 0) {
0888 iphi -= 1;
0889 } else {
0890 iphi = 17;
0891 }
0892 colls()->rctCalo()->push_back(L1CaloRegion::makeRegionFromUnpacker(*p, ieta, iphi, id, i, bx));
0893 ++p;
0894 } else {
0895 ++p;
0896 ++p;
0897 }
0898 }
0899 }
0900 }
0901
0902
0903 void GctFormatTranslateV35::blockToFibres(const unsigned char* d, const GctBlockHeader& hdr) {
0904
0905 if (hltMode()) {
0906 LogDebug("GCT") << "HLT mode - skipping unpack of GCT Fibres";
0907 return;
0908 }
0909
0910 unsigned int id = hdr.blockId();
0911 unsigned int nSamples = hdr.nSamples();
0912 unsigned int length = hdr.blockLength();
0913
0914
0915 const uint32_t* p = reinterpret_cast<const uint32_t*>(d);
0916
0917 for (unsigned int i = 0; i < length; ++i) {
0918 for (unsigned int bx = 0; bx < nSamples; ++bx) {
0919 colls()->gctFibres()->push_back(L1GctFibreWord(*p, id, i, bx));
0920 ++p;
0921 }
0922 }
0923 }
0924
0925 void GctFormatTranslateV35::blockToFibresAndToRctEmCand(const unsigned char* d, const GctBlockHeader& hdr) {
0926 this->blockToRctEmCand(d, hdr);
0927 this->blockToFibres(d, hdr);
0928 }
0929
0930 void GctFormatTranslateV35::blockToGctInternEtSums(const unsigned char* d, const GctBlockHeader& hdr) {
0931
0932
0933 if (hltMode()) {
0934 LogDebug("GCT") << "HLT mode - skipping unpack of internal Et Sums";
0935 return;
0936 }
0937
0938 unsigned int id = hdr.blockId();
0939 unsigned int nSamples = hdr.nSamples();
0940 unsigned int length = hdr.blockLength();
0941
0942
0943 const uint32_t* p = reinterpret_cast<const uint32_t*>(d);
0944
0945 for (unsigned int i = 0; i < length; ++i) {
0946
0947 for (unsigned int bx = 0; bx < nSamples; ++bx) {
0948 colls()->gctInternEtSums()->push_back(L1GctInternEtSum::fromTotalEtOrHt(id, i, bx, *p));
0949 ++p;
0950 }
0951 }
0952 }
0953
0954 void GctFormatTranslateV35::blockToGctInternEtSumsAndJetCluster(const unsigned char* d, const GctBlockHeader& hdr) {
0955
0956 if (hltMode()) {
0957 LogDebug("GCT") << "HLT mode - skipping unpack of internal Jet Cands";
0958 return;
0959 }
0960
0961 unsigned int id = hdr.blockId();
0962 unsigned int nSamples = hdr.nSamples();
0963 unsigned int length = hdr.blockLength();
0964
0965
0966 const uint32_t* p = reinterpret_cast<const uint32_t*>(d);
0967
0968 for (unsigned int i = 0; i < length; ++i) {
0969
0970 for (unsigned int bx = 0; bx < nSamples; ++bx) {
0971 if (i < 2)
0972 colls()->gctInternEtSums()->push_back(L1GctInternEtSum::fromJetMissEt(id, i, bx, *p));
0973 if (i == 3) {
0974 colls()->gctInternEtSums()->push_back(L1GctInternEtSum::fromJetTotEt(id, i, bx, *p));
0975 colls()->gctInternEtSums()->push_back(L1GctInternEtSum::fromJetTotHt(id, i, bx, *p));
0976 }
0977 if (i > 4)
0978 colls()->gctInternJets()->push_back(L1GctInternJetData::fromJetCluster(L1CaloRegionDetId(0, 0), id, i, bx, *p));
0979 ++p;
0980 }
0981 }
0982 }
0983
0984 void GctFormatTranslateV35::blockToGctTrigObjects(const unsigned char* d, const GctBlockHeader& hdr) {
0985
0986 if (hltMode()) {
0987 LogDebug("GCT") << "HLT mode - skipping unpack of internal Jet Cands";
0988 return;
0989 }
0990
0991 unsigned int id = hdr.blockId();
0992 unsigned int nSamples = hdr.nSamples();
0993 unsigned int length = hdr.blockLength();
0994
0995
0996 const uint16_t* p = reinterpret_cast<const uint16_t*>(d);
0997
0998 for (unsigned int i = 0; i < length; ++i) {
0999
1000 for (unsigned int bx = 0; bx < nSamples; ++bx) {
1001 colls()->gctInternJets()->push_back(
1002 L1GctInternJetData::fromGctTrigObject(L1CaloRegionDetId(0, 0), id, i, bx, *p));
1003 ++p;
1004 colls()->gctInternJets()->push_back(
1005 L1GctInternJetData::fromGctTrigObject(L1CaloRegionDetId(0, 0), id, i, bx, *p));
1006 ++p;
1007 }
1008 }
1009 }
1010
1011 void GctFormatTranslateV35::blockToGctJetClusterMinimal(const unsigned char* d, const GctBlockHeader& hdr) {
1012
1013 if (hltMode()) {
1014 LogDebug("GCT") << "HLT mode - skipping unpack of internal Jet Cands";
1015 return;
1016 }
1017
1018 unsigned int id = hdr.blockId();
1019 unsigned int nSamples = hdr.nSamples();
1020 unsigned int length = hdr.blockLength();
1021
1022
1023 const uint16_t* p = reinterpret_cast<const uint16_t*>(d);
1024
1025 for (unsigned int i = 0; i < length; ++i) {
1026
1027 for (unsigned int bx = 0; bx < nSamples; ++bx) {
1028 colls()->gctInternJets()->push_back(
1029 L1GctInternJetData::fromJetClusterMinimal(L1CaloRegionDetId(0, 0), id, i, bx, *p));
1030 ++p;
1031 colls()->gctInternJets()->push_back(
1032 L1GctInternJetData::fromJetClusterMinimal(L1CaloRegionDetId(0, 0), id, i, bx, *p));
1033 ++p;
1034 }
1035 }
1036 }
1037
1038 void GctFormatTranslateV35::blockToGctJetPreCluster(const unsigned char* d, const GctBlockHeader& hdr) {
1039
1040 if (hltMode()) {
1041 LogDebug("GCT") << "HLT mode - skipping unpack of internal Jet Cands";
1042 return;
1043 }
1044
1045 unsigned int id = hdr.blockId();
1046 unsigned int nSamples = hdr.nSamples();
1047 unsigned int length = hdr.blockLength();
1048
1049
1050 const uint16_t* p = reinterpret_cast<const uint16_t*>(d);
1051
1052 for (unsigned int i = 0; i < length; ++i) {
1053
1054 for (unsigned int bx = 0; bx < nSamples; ++bx) {
1055 colls()->gctInternJets()->push_back(
1056 L1GctInternJetData::fromJetPreCluster(L1CaloRegionDetId(0, 0), id, i, bx, *p));
1057 ++p;
1058 colls()->gctInternJets()->push_back(
1059 L1GctInternJetData::fromJetPreCluster(L1CaloRegionDetId(0, 0), id, i, bx, *p));
1060 ++p;
1061 }
1062 }
1063 }
1064
1065 void GctFormatTranslateV35::blockToGctInternRingSums(const unsigned char* d, const GctBlockHeader& hdr) {
1066
1067 if (hltMode()) {
1068 LogDebug("GCT") << "HLT mode - skipping unpack of internal HF ring data";
1069 return;
1070 }
1071
1072 unsigned int id = hdr.blockId();
1073 unsigned int nSamples = hdr.nSamples();
1074 unsigned int length = hdr.blockLength();
1075
1076
1077 const uint32_t* p = reinterpret_cast<const uint32_t*>(d);
1078
1079 for (unsigned int i = 0; i < length / 2; ++i) {
1080
1081 for (unsigned int bx = 0; bx < nSamples; ++bx) {
1082 colls()->gctInternHFData()->push_back(L1GctInternHFData::fromConcRingSums(id, i, bx, *p));
1083 ++p;
1084 }
1085 for (unsigned int bx = 0; bx < nSamples; ++bx) {
1086 colls()->gctInternHFData()->push_back(L1GctInternHFData::fromConcBitCounts(id, i, bx, *p));
1087 ++p;
1088 }
1089 }
1090 }
1091
1092 void GctFormatTranslateV35::blockToGctWheelInputInternEtAndRingSums(const unsigned char* d, const GctBlockHeader& hdr) {
1093
1094 if (hltMode()) {
1095 LogDebug("GCT") << "HLT mode - skipping unpack of wheel input internal Et sums and HF ring data";
1096 return;
1097 }
1098
1099 unsigned int id = hdr.blockId();
1100 unsigned int nSamples = hdr.nSamples();
1101 unsigned int length = hdr.blockLength();
1102
1103
1104 const uint32_t* p = reinterpret_cast<const uint32_t*>(d);
1105
1106 for (unsigned int i = 0; i < length; ++i) {
1107
1108 for (unsigned int bx = 0; bx < nSamples; ++bx) {
1109 if (i < 3) {
1110 colls()->gctInternEtSums()->push_back(L1GctInternEtSum::fromTotalEtOrHt(id, i, bx, *p));
1111 } else if (i > 2 && i < 9) {
1112 colls()->gctInternEtSums()->push_back(L1GctInternEtSum::fromMissEtxOrEty(id, i, bx, *p));
1113 } else if (i > 8 && i < 15) {
1114 colls()->gctInternHFData()->push_back(L1GctInternHFData::fromWheelRingSums(id, i, bx, *p));
1115 } else if (i > 14) {
1116 colls()->gctInternHFData()->push_back(L1GctInternHFData::fromWheelBitCounts(id, i, bx, *p));
1117 }
1118 ++p;
1119 }
1120 }
1121 }
1122
1123 void GctFormatTranslateV35::blockToGctWheelOutputInternEtAndRingSums(const unsigned char* d,
1124 const GctBlockHeader& hdr) {
1125
1126 if (hltMode()) {
1127 LogDebug("GCT") << "HLT mode - skipping unpack of wheel output internal Et sums and HF ring data";
1128 return;
1129 }
1130
1131 unsigned int id = hdr.blockId();
1132 unsigned int nSamples = hdr.nSamples();
1133 unsigned int length = hdr.blockLength();
1134
1135
1136 const uint32_t* p = reinterpret_cast<const uint32_t*>(d);
1137
1138 for (unsigned int i = 0; i < length; ++i) {
1139
1140 for (unsigned int bx = 0; bx < nSamples; ++bx) {
1141 if (i < 1) {
1142 colls()->gctInternEtSums()->push_back(L1GctInternEtSum::fromTotalEtOrHt(id, i, bx, *p));
1143 } else if (i > 0 && i < 3) {
1144 colls()->gctInternEtSums()->push_back(L1GctInternEtSum::fromMissEtxOrEty(id, i, bx, *p));
1145 } else if (i > 2 && i < 5) {
1146 colls()->gctInternHFData()->push_back(L1GctInternHFData::fromWheelRingSums(id, i, bx, *p));
1147 } else if (i > 4) {
1148 colls()->gctInternHFData()->push_back(L1GctInternHFData::fromWheelBitCounts(id, i, bx, *p));
1149 }
1150 ++p;
1151 }
1152 }
1153 }