Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:15:00

0001 #include "EventFilter/GctRawToDigi/src/GctFormatTranslateV35.h"
0002 
0003 // C++ headers
0004 #include <iostream>
0005 #include <cassert>
0006 
0007 // Framework headers
0008 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0009 
0010 // Namespace resolution
0011 using std::cout;
0012 using std::endl;
0013 using std::make_pair;
0014 using std::pair;
0015 
0016 // INITIALISE STATIC VARIABLES
0017 /*** Setup BlockID to BlockLength Map ***/
0018 const GctFormatTranslateV35::BlockLengthMap GctFormatTranslateV35::m_blockLength = {
0019     // Miscellaneous Blocks
0020     {0x000, 0},  // NULL
0021     // ConcJet FPGA
0022     {0x580, 12},  // ConcJet: Input TrigPathA (Jet Cands)
0023     {0x581, 2},   // ConcJet: Input TrigPathB (HF Rings)
0024     {0x583, 8},   // ConcJet: Jet Cands and Counts Output to GT
0025     {0x587, 4},   // ConcJet: BX & Orbit Info
0026     // ConcElec FPGA
0027     {0x680, 16},  // ConcElec: Input TrigPathA (EM Cands)
0028     {0x681, 6},   // ConcElec: Input TrigPathB (Et Sums)
0029     {0x682, 2},   // ConcElec: Input TrigPathC (Ht Sums)
0030     {0x683, 6},   // ConcElec: EM Cands and Energy Sums Output to GT
0031     {0x686, 2},   // ConcElec: Test (GT Serdes Loopback)
0032     {0x687, 4},   // ConcElec: BX & Orbit Info
0033     // Electron Leaf FPGAs
0034     {0x800, 20},  // Leaf0ElecPosEtaU1: Sort Input
0035     {0x803, 4},   // Leaf0ElecPosEtaU1: Sort Output
0036     {0x804, 15},  // Leaf0ElecPosEtaU1: Raw Input
0037     {0x880, 16},  // Leaf0ElecPosEtaU2: Sort Input
0038     {0x883, 4},   // Leaf0ElecPosEtaU2: Sort Output
0039     {0x884, 12},  // Leaf0ElecPosEtaU2: Raw Input
0040     {0xc00, 20},  // Leaf0ElecNegEtaU1: Sort Input
0041     {0xc03, 4},   // Leaf0ElecNegEtaU1: Sort Output
0042     {0xc04, 15},  // Leaf0ElecNegEtaU1: Raw Input
0043     {0xc80, 16},  // Leaf0ElecNegEtaU2: Sort Input
0044     {0xc83, 4},   // Leaf0ElecNegEtaU2: Sort Output
0045     {0xc84, 12},  // Leaf0ElecNegEtaU2: Raw Input
0046     // Wheel Pos-eta Jet FPGA
0047     {0x300, 27},  // WheelPosEtaJet: Input TrigPathA (Jet Sort)
0048     {0x303, 6},   // WheelPosEtaJet: Output TrigPathA (Jet Sort)
0049     {0x306,
0050      32},  // WheelPosEtaJet: Test (deprecated)  (Doesn't exist in V27.1 format, but does in V24 & V25, so keep for CRUZET2 data compatibility reasons)
0051     {0x307,
0052      4},  // WheelPosEtaJet: Info (deprecated)  (Doesn't exist in V27.1 format, but does in V24 & V25, so keep for CRUZET2 data compatibility reasons)
0053     // Wheel Pos-eta Energy FPGA
0054     {0x380, 21},  // WheelPosEtaEnergy: Input TrigPathA (Et)
0055     {0x381, 3},   // WheelPosEtaEnergy: Input TrigPathB (Ht)
0056     {0x383, 7},   // WheelPosEtaEnergy: Output TrigPathA (Et)
0057     {0x385, 2},   // WheelPosEtaEnergy: Output TrigPathB (Ht)
0058     {0x386, 32},  // WheelPosEtaEnergy: Test
0059     {0x387,
0060      6},  // WheelPosEtaEnergy: BX & Orbit Info   (Potential data incompatibility between V24/V25 where block length=4, and V27.1 where block length=6)
0061     // Wheel Neg-eta Jet FPGA
0062     {0x700, 27},  // WheelNegEtaJet: Input TrigPathA (Jet Sort)
0063     {0x703, 6},   // WheelNegEtaJet: Output TrigPathA (Jet Sort)
0064     {0x706,
0065      32},  // WheelNegEtaJet: Test (deprecated)  (Doesn't exist in V27.1 format, but does in V24 & V25, so keep for CRUZET2 data compatibility reasons)
0066     {0x707,
0067      4},  // WheelNegEtaJet: Info (deprecated)  (Doesn't exist in V27.1 format, but does in V24 & V25, so keep for CRUZET2 data compatibility reasons)
0068     // Wheel Neg-eta Energy FPGA
0069     {0x780, 21},  // WheelNegEtaEnergy: Input TrigPathA (Et)
0070     {0x781, 3},   // WheelNegEtaEnergy: Input TrigPathB (Ht)
0071     {0x783, 7},   // WheelNegEtaEnergy: Output TrigPathA (Et)
0072     {0x785, 2},   // WheelNegEtaEnergy: Output TrigPathB (Ht)
0073     {0x786, 32},  // WheelNegEtaEnergy: Test
0074     {0x787,
0075      6},  // WheelNegEtaEnergy: BX & Orbit Info   (Potential data incompatibility between V24/V25 where block length=4, and V27.1 where block length=6)
0076     // Jet Leaf FPGAs - Positive Eta
0077     {0x900, 12},  // Leaf1JetPosEtaU1: JF2 Input
0078     {0x901, 3},   // Leaf1JetPosEtaU1: JF2 Shared Received
0079     {0x902, 3},   // Leaf1JetPosEtaU1: JF2 Shared Sent
0080     {0x903, 10},  // Leaf1JetPosEtaU1: JF2 Output
0081     {0x904, 8},   // Leaf1JetPosEtaU1: JF2 Raw Input
0082     {0x908, 12},  // Leaf1JetPosEtaU1: JF3 Input
0083     {0x909, 3},   // Leaf1JetPosEtaU1: JF3 Shared Received
0084     {0x90a, 3},   // Leaf1JetPosEtaU1: JF3 Shared Sent
0085     {0x90b, 10},  // Leaf1JetPosEtaU1: JF3 Output
0086     {0x90c, 8},   // Leaf1JetPosEtaU1: JF3 Raw Input
0087     {0x980, 3},   // Leaf1JetPosEtaU2: Eta0 Input
0088     {0x984, 6},   // Leaf1JetPosEtaU2: Eta0 Raw Input
0089     {0x988, 12},  // Leaf1JetPosEtaU2: JF1 Input
0090     {0x989, 3},   // Leaf1JetPosEtaU2: JF1 Shared Received
0091     {0x98a, 3},   // Leaf1JetPosEtaU2: JF1 Shared Sent
0092     {0x98b, 10},  // Leaf1JetPosEtaU2: JF1 Output
0093     {0x98c, 8},   // Leaf1JetPosEtaU2: JF1 Raw Input
0094     {0xa00, 12},  // Leaf2JetPosEtaU1: JF2 Input
0095     {0xa01, 3},   // Leaf2JetPosEtaU1: JF2 Shared Received
0096     {0xa02, 3},   // Leaf2JetPosEtaU1: JF2 Shared Sent
0097     {0xa03, 10},  // Leaf2JetPosEtaU1: JF2 Output
0098     {0xa04, 8},   // Leaf2JetPosEtaU1: JF2 Raw Input
0099     {0xa08, 12},  // Leaf2JetPosEtaU1: JF3 Input
0100     {0xa09, 3},   // Leaf2JetPosEtaU1: JF3 Shared Received
0101     {0xa0a, 3},   // Leaf2JetPosEtaU1: JF3 Shared Sent
0102     {0xa0b, 10},  // Leaf2JetPosEtaU1: JF3 Output
0103     {0xa0c, 8},   // Leaf2JetPosEtaU1: JF3 Raw Input
0104     {0xa80, 3},   // Leaf2JetPosEtaU2: Eta0 Input
0105     {0xa84, 6},   // Leaf2JetPosEtaU2: Eta0 Raw Input
0106     {0xa88, 12},  // Leaf2JetPosEtaU2: JF1 Input
0107     {0xa89, 3},   // Leaf2JetPosEtaU2: JF1 Shared Received
0108     {0xa8a, 3},   // Leaf2JetPosEtaU2: JF1 Shared Sent
0109     {0xa8b, 10},  // Leaf2JetPosEtaU2: JF1 Output
0110     {0xa8c, 8},   // Leaf2JetPosEtaU2: JF1 Raw Input
0111     {0xb00, 12},  // Leaf3JetPosEtaU1: JF2 Input
0112     {0xb01, 3},   // Leaf3JetPosEtaU1: JF2 Shared Received
0113     {0xb02, 3},   // Leaf3JetPosEtaU1: JF2 Shared Sent
0114     {0xb03, 10},  // Leaf3JetPosEtaU1: JF2 Output
0115     {0xb04, 8},   // Leaf3JetPosEtaU1: JF2 Raw Input
0116     {0xb08, 12},  // Leaf3JetPosEtaU1: JF3 Input
0117     {0xb09, 3},   // Leaf3JetPosEtaU1: JF3 Shared Received
0118     {0xb0a, 3},   // Leaf3JetPosEtaU1: JF3 Shared Sent
0119     {0xb0b, 10},  // Leaf3JetPosEtaU1: JF3 Output
0120     {0xb0c, 8},   // Leaf3JetPosEtaU1: JF3 Raw Input
0121     {0xb80, 3},   // Leaf3JetPosEtaU2: Eta0 Input
0122     {0xb84, 6},   // Leaf3JetPosEtaU2: Eta0 Raw Input
0123     {0xb88, 12},  // Leaf3JetPosEtaU2: JF1 Input
0124     {0xb89, 3},   // Leaf3JetPosEtaU2: JF1 Shared Received
0125     {0xb8a, 3},   // Leaf3JetPosEtaU2: JF1 Shared Sent
0126     {0xb8b, 10},  // Leaf3JetPosEtaU2: JF1 Output
0127     {0xb8c, 8},   // Leaf3JetPosEtaU2: JF1 Raw Input
0128     // Jet Leaf FPGAs - Negative Eta
0129     {0xd00, 12},  // Leaf1JetNegEtaU1: JF2 Input
0130     {0xd01, 3},   // Leaf1JetNegEtaU1: JF2 Shared Received
0131     {0xd02, 3},   // Leaf1JetNegEtaU1: JF2 Shared Sent
0132     {0xd03, 10},  // Leaf1JetNegEtaU1: JF2 Output
0133     {0xd04, 8},   // Leaf1JetNegEtaU1: JF2 Raw Input
0134     {0xd08, 12},  // Leaf1JetNegEtaU1: JF3 Input
0135     {0xd09, 3},   // Leaf1JetNegEtaU1: JF3 Shared Received
0136     {0xd0a, 3},   // Leaf1JetNegEtaU1: JF3 Shared Sent
0137     {0xd0b, 10},  // Leaf1JetNegEtaU1: JF3 Output
0138     {0xd0c, 8},   // Leaf1JetNegEtaU1: JF3 Raw Input
0139     {0xd80, 3},   // Leaf1JetNegEtaU2: Eta0 Input
0140     {0xd84, 6},   // Leaf1JetNegEtaU2: Eta0 Raw Input
0141     {0xd88, 12},  // Leaf1JetNegEtaU2: JF1 Input
0142     {0xd89, 3},   // Leaf1JetNegEtaU2: JF1 Shared Received
0143     {0xd8a, 3},   // Leaf1JetNegEtaU2: JF1 Shared Sent
0144     {0xd8b, 10},  // Leaf1JetNegEtaU2: JF1 Output
0145     {0xd8c, 8},   // Leaf1JetNegEtaU2: JF1 Raw Input
0146     {0xe00, 12},  // Leaf2JetNegEtaU1: JF2 Input
0147     {0xe01, 3},   // Leaf2JetNegEtaU1: JF2 Shared Received
0148     {0xe02, 3},   // Leaf2JetNegEtaU1: JF2 Shared Sent
0149     {0xe03, 10},  // Leaf2JetNegEtaU1: JF2 Output
0150     {0xe04, 8},   // Leaf2JetNegEtaU1: JF2 Raw Input
0151     {0xe08, 12},  // Leaf2JetNegEtaU1: JF3 Input
0152     {0xe09, 3},   // Leaf2JetNegEtaU1: JF3 Shared Received
0153     {0xe0a, 3},   // Leaf2JetNegEtaU1: JF3 Shared Sent
0154     {0xe0b, 10},  // Leaf2JetNegEtaU1: JF3 Output
0155     {0xe0c, 8},   // Leaf2JetNegEtaU1: JF3 Raw Input
0156     {0xe80, 3},   // Leaf2JetNegEtaU2: Eta0 Input
0157     {0xe84, 6},   // Leaf2JetNegEtaU2: Eta0 Raw Input
0158     {0xe88, 12},  // Leaf2JetNegEtaU2: JF1 Input
0159     {0xe89, 3},   // Leaf2JetNegEtaU2: JF1 Shared Received
0160     {0xe8a, 3},   // Leaf2JetNegEtaU2: JF1 Shared Sent
0161     {0xe8b, 10},  // Leaf2JetNegEtaU2: JF1 Output
0162     {0xe8c, 8},   // Leaf2JetNegEtaU2: JF1 Raw Input
0163     {0xf00, 12},  // Leaf3JetNegEtaU1: JF2 Input
0164     {0xf01, 3},   // Leaf3JetNegEtaU1: JF2 Shared Received
0165     {0xf02, 3},   // Leaf3JetNegEtaU1: JF2 Shared Sent
0166     {0xf03, 10},  // Leaf3JetNegEtaU1: JF2 Output
0167     {0xf04, 8},   // Leaf3JetNegEtaU1: JF2 Raw Input
0168     {0xf08, 12},  // Leaf3JetNegEtaU1: JF3 Input
0169     {0xf09, 3},   // Leaf3JetNegEtaU1: JF3 Shared Received
0170     {0xf0a, 3},   // Leaf3JetNegEtaU1: JF3 Shared Sent
0171     {0xf0b, 10},  // Leaf3JetNegEtaU1: JF3 Output
0172     {0xf0c, 8},   // Leaf3JetNegEtaU1: JF3 Raw Input
0173     {0xf80, 3},   // Leaf3JetNegEtaU2: Eta0 Input
0174     {0xf84, 6},   // Leaf3JetNegEtaU2: Eta0 Raw Input
0175     {0xf88, 12},  // Leaf3JetNegEtaU2: JF1 Input
0176     {0xf89, 3},   // Leaf3JetNegEtaU2: JF1 Shared Received
0177     {0xf8a, 3},   // Leaf3JetNegEtaU2: JF1 Shared Sent
0178     {0xf8b, 10},  // Leaf3JetNegEtaU2: JF1 Output
0179     {0xf8c, 8}    // Leaf3JetNegEtaU2: JF1 Raw Input
0180 };
0181 
0182 /*** Setup BlockID to BlockName Map ***/
0183 const GctFormatTranslateV35::BlockNameMap GctFormatTranslateV35::m_blockName = {
0184     // Miscellaneous Blocks
0185     {0x000, "NULL"},
0186     // ConcJet FPGA
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     // ConcElec FPGA
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     // Electron Leaf FPGAs
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     // Wheel Pos-eta Jet FPGA
0212     {0x300, "WheelPosEtaJet: Input TrigPathA (Jet Sort)"},
0213     {0x303, "WheelPosEtaJet: Output TrigPathA (Jet Sort)"},
0214     {0x306,
0215      "WheelPosEtaJet: Test (deprecated)"},  // (Doesn't exist in V27.1 format, but does in V24 & V25, so keep for CRUZET2 data compatibility reasons)
0216     {0x307,
0217      "WheelPosEtaJet: Info (deprecated)"},  // (Doesn't exist in V27.1 format, but does in V24 & V25, so keep for CRUZET2 data compatibility reasons)
0218     // Wheel Pos-eta Energy FPGA
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     // Wheel Neg-eta Jet FPGA
0226     {0x700, "WheelNegEtaJet: Input TrigPathA (Jet Sort)"},
0227     {0x703, "WheelNegEtaJet: Output TrigPathA (Jet Sort)"},
0228     {0x706,
0229      "WheelNegEtaJet: Test (deprecated)"},  // (Doesn't exist in V27.1 format, but does in V24 & V25, so keep for CRUZET2 data compatibility reasons)
0230     {0x707,
0231      "WheelNegEtaJet: Info (deprecated)"},  // (Doesn't exist in V27.1 format, but does in V24 & V25, so keep for CRUZET2 data compatibility reasons)
0232     // Wheel Neg-eta Energy FPGA
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     // Jet Leaf FPGAs - Positive Eta
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"},  // Next Leaf Start
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"},  // Next Leaf Start
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"},  // Next Leaf Start
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"},  // Next Leaf Start
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"},  // Next Leaf Start
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     // Jet Leaf FPGAs - Negative Eta
0292     {0xd00, "Leaf1JetNegEtaU1: JF2 Input"},  // START OF NEG ETA JET LEAVES
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"},  // Next Leaf Start
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"},  // Next Leaf Start
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"},  // Next Leaf Start
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"},  // Next Leaf Start
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"},  // Next Leaf Start
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 /*** Setup BlockID to Unpack-Function Map ***/
0345 const GctFormatTranslateV35::BlockIdToUnpackFnMap GctFormatTranslateV35::m_blockUnpackFn = {
0346     // Miscellaneous Blocks
0347     {0x000, &GctFormatTranslateV35::blockDoNothing},  // NULL
0348     // ConcJet FPGA
0349     {0x580, &GctFormatTranslateV35::blockToGctTrigObjects},        // ConcJet: Input TrigPathA (Jet Cands)
0350     {0x581, &GctFormatTranslateV35::blockToGctInternRingSums},     // ConcJet: Input TrigPathB (HF Rings)
0351     {0x583, &GctFormatTranslateV35::blockToGctJetCandsAndCounts},  // ConcJet: Jet Cands and Counts Output to GT
0352     {0x587, &GctFormatTranslateV35::blockDoNothing},               // ConcJet: BX & Orbit Info
0353     // ConcElec FPGA
0354     {0x680, &GctFormatTranslateV35::blockToGctInternEmCand},          // ConcElec: Input TrigPathA (EM Cands)
0355     {0x681, &GctFormatTranslateV35::blockToGctInternEtSums},          // ConcElec: Input TrigPathB (Et Sums)
0356     {0x682, &GctFormatTranslateV35::blockToGctInternEtSums},          // ConcElec: Input TrigPathC (Ht Sums)
0357     {0x683, &GctFormatTranslateV35::blockToGctEmCandsAndEnergySums},  // ConcElec: EM Cands and Energy Sums Output to GT
0358     {0x686, &GctFormatTranslateV35::blockDoNothing},                  // ConcElec: Test (GT Serdes Loopback)
0359     {0x687, &GctFormatTranslateV35::blockDoNothing},                  // ConcElec: BX & Orbit Info
0360     // Electron Leaf FPGAs
0361     {0x800, &GctFormatTranslateV35::blockToGctInternEmCand},       // Leaf0ElecPosEtaU1: Sort Input
0362     {0x803, &GctFormatTranslateV35::blockToGctInternEmCand},       // Leaf0ElecPosEtaU1: Sort Output
0363     {0x804, &GctFormatTranslateV35::blockToFibresAndToRctEmCand},  // Leaf0ElecPosEtaU1: Raw Input
0364     {0x880, &GctFormatTranslateV35::blockToGctInternEmCand},       // Leaf0ElecPosEtaU2: Sort Input
0365     {0x883, &GctFormatTranslateV35::blockToGctInternEmCand},       // Leaf0ElecPosEtaU2: Sort Output
0366     {0x884, &GctFormatTranslateV35::blockToFibresAndToRctEmCand},  // Leaf0ElecPosEtaU2: Raw Input
0367     {0xc00, &GctFormatTranslateV35::blockToGctInternEmCand},       // Leaf0ElecNegEtaU1: Sort Input
0368     {0xc03, &GctFormatTranslateV35::blockToGctInternEmCand},       // Leaf0ElecNegEtaU1: Sort Output
0369     {0xc04, &GctFormatTranslateV35::blockToFibresAndToRctEmCand},  // Leaf0ElecNegEtaU1: Raw Input
0370     {0xc80, &GctFormatTranslateV35::blockToGctInternEmCand},       // Leaf0ElecNegEtaU2: Sort Input
0371     {0xc83, &GctFormatTranslateV35::blockToGctInternEmCand},       // Leaf0ElecNegEtaU2: Sort Output
0372     {0xc84, &GctFormatTranslateV35::blockToFibresAndToRctEmCand},  // Leaf0ElecNegEtaU2: Raw Input
0373     // Wheel Pos-eta Jet FPGA
0374     {0x300, &GctFormatTranslateV35::blockToGctJetClusterMinimal},  // WheelPosEtaJet: Input TrigPathA (Jet Sort)
0375     {0x303, &GctFormatTranslateV35::blockToGctTrigObjects},        // WheelPosEtaJet: Output TrigPathA (Jet Sort)
0376     {0x306,
0377      &GctFormatTranslateV35::
0378          blockDoNothing},  // WheelPosEtaJet: Test (deprecated)  (Doesn't exist in V27.1 format, but does in V24 & V25, so keep for CRUZET2 data compatibility reasons)
0379     {0x307,
0380      &GctFormatTranslateV35::
0381          blockDoNothing},  // WheelPosEtaJet: Info (deprecated)  (Doesn't exist in V27.1 format, but does in V24 & V25, so keep for CRUZET2 data compatibility reasons)
0382     // Wheel Pos-eta Energy FPGA
0383     {0x380,
0384      &GctFormatTranslateV35::blockToGctWheelInputInternEtAndRingSums},  // WheelPosEtaEnergy: Input TrigPathA (Et)
0385     {0x381, &GctFormatTranslateV35::blockToGctInternEtSums},            // WheelPosEtaEnergy: Input TrigPathB (Ht)
0386     {0x383,
0387      &GctFormatTranslateV35::blockToGctWheelOutputInternEtAndRingSums},  // WheelPosEtaEnergy: Output TrigPathA (Et)
0388     {0x385, &GctFormatTranslateV35::blockToGctInternEtSums},             // WheelPosEtaEnergy: Output TrigPathB (Ht)
0389     {0x386, &GctFormatTranslateV35::blockDoNothing},                     // WheelPosEtaEnergy: Test
0390     {0x387,
0391      &GctFormatTranslateV35::
0392          blockDoNothing},  // WheelPosEtaEnergy: BX & Orbit Info   (Potential data incompatibility between V24/V25 where block length=4, and V27.1 where block length=6)
0393     // Wheel Neg-eta Jet FPGA
0394     {0x700, &GctFormatTranslateV35::blockToGctJetClusterMinimal},  // WheelNegEtaJet: Input TrigPathA (Jet Sort)
0395     {0x703, &GctFormatTranslateV35::blockToGctTrigObjects},        // WheelNegEtaJet: Output TrigPathA (Jet Sort)
0396     {0x706,
0397      &GctFormatTranslateV35::
0398          blockDoNothing},  // WheelNegEtaJet: Test (deprecated)  (Doesn't exist in V27.1 format, but does in V24 & V25, so keep for CRUZET2 data compatibility reasons)
0399     {0x707,
0400      &GctFormatTranslateV35::
0401          blockDoNothing},  // WheelNegEtaJet: Info (deprecated)  (Doesn't exist in V27.1 format, but does in V24 & V25, so keep for CRUZET2 data compatibility reasons)
0402     // Wheel Neg-eta Energy FPGA
0403     {0x780,
0404      &GctFormatTranslateV35::blockToGctWheelInputInternEtAndRingSums},  // WheelNegEtaEnergy: Input TrigPathA (Et)
0405     {0x781, &GctFormatTranslateV35::blockToGctInternEtSums},            // WheelNegEtaEnergy: Input TrigPathB (Ht)
0406     {0x783,
0407      &GctFormatTranslateV35::blockToGctWheelOutputInternEtAndRingSums},  // WheelNegEtaEnergy: Output TrigPathA (Et)
0408     {0x785, &GctFormatTranslateV35::blockToGctInternEtSums},             // WheelNegEtaEnergy: Output TrigPathB (Ht)
0409     {0x786, &GctFormatTranslateV35::blockDoNothing},                     // WheelNegEtaEnergy: Test
0410     {0x787,
0411      &GctFormatTranslateV35::
0412          blockDoNothing},  // WheelNegEtaEnergy: BX & Orbit Info   (Potential data incompatibility between V24/V25 where block length=4, and V27.1 where block length=6)
0413     // Jet Leaf FPGAs - Positive Eta
0414     {0x900, &GctFormatTranslateV35::blockToRctCaloRegions},                // Leaf1JetPosEtaU1: JF2 Input
0415     {0x901, &GctFormatTranslateV35::blockToGctJetPreCluster},              // Leaf1JetPosEtaU1: JF2 Shared Received
0416     {0x902, &GctFormatTranslateV35::blockToGctJetPreCluster},              // Leaf1JetPosEtaU1: JF2 Shared Sent
0417     {0x903, &GctFormatTranslateV35::blockToGctInternEtSumsAndJetCluster},  // Leaf1JetPosEtaU1: JF2 Output
0418     {0x904, &GctFormatTranslateV35::blockToFibres},                        // Leaf1JetPosEtaU1: JF2 Raw Input
0419     {0x908, &GctFormatTranslateV35::blockToRctCaloRegions},                // Leaf1JetPosEtaU1: JF3 Input
0420     {0x909, &GctFormatTranslateV35::blockToGctJetPreCluster},              // Leaf1JetPosEtaU1: JF3 Shared Received
0421     {0x90a, &GctFormatTranslateV35::blockToGctJetPreCluster},              // Leaf1JetPosEtaU1: JF3 Shared Sent
0422     {0x90b, &GctFormatTranslateV35::blockToGctInternEtSumsAndJetCluster},  // Leaf1JetPosEtaU1: JF3 Output
0423     {0x90c, &GctFormatTranslateV35::blockToFibres},                        // Leaf1JetPosEtaU1: JF3 Raw Input
0424     {0x980, &GctFormatTranslateV35::blockDoNothing},                       // Leaf1JetPosEtaU2: Eta0 Input
0425     {0x984, &GctFormatTranslateV35::blockToFibres},                        // Leaf1JetPosEtaU2: Eta0 Raw Input
0426     {0x988, &GctFormatTranslateV35::blockToRctCaloRegions},                // Leaf1JetPosEtaU2: JF1 Input
0427     {0x989, &GctFormatTranslateV35::blockToGctJetPreCluster},              // Leaf1JetPosEtaU2: JF1 Shared Received
0428     {0x98a, &GctFormatTranslateV35::blockToGctJetPreCluster},              // Leaf1JetPosEtaU2: JF1 Shared Sent
0429     {0x98b, &GctFormatTranslateV35::blockToGctInternEtSumsAndJetCluster},  // Leaf1JetPosEtaU2: JF1 Output
0430     {0x98c, &GctFormatTranslateV35::blockToFibres},                        // Leaf1JetPosEtaU2: JF1 Raw Input
0431     {0xa00, &GctFormatTranslateV35::blockToRctCaloRegions},                // Leaf2JetPosEtaU1: JF2 Input
0432     {0xa01, &GctFormatTranslateV35::blockToGctJetPreCluster},              // Leaf2JetPosEtaU1: JF2 Shared Received
0433     {0xa02, &GctFormatTranslateV35::blockToGctJetPreCluster},              // Leaf2JetPosEtaU1: JF2 Shared Sent
0434     {0xa03, &GctFormatTranslateV35::blockToGctInternEtSumsAndJetCluster},  // Leaf2JetPosEtaU1: JF2 Output
0435     {0xa04, &GctFormatTranslateV35::blockToFibres},                        // Leaf2JetPosEtaU1: JF2 Raw Input
0436     {0xa08, &GctFormatTranslateV35::blockToRctCaloRegions},                // Leaf2JetPosEtaU1: JF3 Input
0437     {0xa09, &GctFormatTranslateV35::blockToGctJetPreCluster},              // Leaf2JetPosEtaU1: JF3 Shared Received
0438     {0xa0a, &GctFormatTranslateV35::blockToGctJetPreCluster},              // Leaf2JetPosEtaU1: JF3 Shared Sent
0439     {0xa0b, &GctFormatTranslateV35::blockToGctInternEtSumsAndJetCluster},  // Leaf2JetPosEtaU1: JF3 Output
0440     {0xa0c, &GctFormatTranslateV35::blockToFibres},                        // Leaf2JetPosEtaU1: JF3 Raw Input
0441     {0xa80, &GctFormatTranslateV35::blockDoNothing},                       // Leaf2JetPosEtaU2: Eta0 Input
0442     {0xa84, &GctFormatTranslateV35::blockToFibres},                        // Leaf2JetPosEtaU2: Eta0 Raw Input
0443     {0xa88, &GctFormatTranslateV35::blockToRctCaloRegions},                // Leaf2JetPosEtaU2: JF1 Input
0444     {0xa89, &GctFormatTranslateV35::blockToGctJetPreCluster},              // Leaf2JetPosEtaU2: JF1 Shared Received
0445     {0xa8a, &GctFormatTranslateV35::blockToGctJetPreCluster},              // Leaf2JetPosEtaU2: JF1 Shared Sent
0446     {0xa8b, &GctFormatTranslateV35::blockToGctInternEtSumsAndJetCluster},  // Leaf2JetPosEtaU2: JF1 Output
0447     {0xa8c, &GctFormatTranslateV35::blockToFibres},                        // Leaf2JetPosEtaU2: JF1 Raw Input
0448     {0xb00, &GctFormatTranslateV35::blockToRctCaloRegions},                // Leaf3JetPosEtaU1: JF2 Input
0449     {0xb01, &GctFormatTranslateV35::blockToGctJetPreCluster},              // Leaf3JetPosEtaU1: JF2 Shared Received
0450     {0xb02, &GctFormatTranslateV35::blockToGctJetPreCluster},              // Leaf3JetPosEtaU1: JF2 Shared Sent
0451     {0xb03, &GctFormatTranslateV35::blockToGctInternEtSumsAndJetCluster},  // Leaf3JetPosEtaU1: JF2 Output
0452     {0xb04, &GctFormatTranslateV35::blockToFibres},                        // Leaf3JetPosEtaU1: JF2 Raw Input
0453     {0xb08, &GctFormatTranslateV35::blockToRctCaloRegions},                // Leaf3JetPosEtaU1: JF3 Input
0454     {0xb09, &GctFormatTranslateV35::blockToGctJetPreCluster},              // Leaf3JetPosEtaU1: JF3 Shared Received
0455     {0xb0a, &GctFormatTranslateV35::blockToGctJetPreCluster},              // Leaf3JetPosEtaU1: JF3 Shared Sent
0456     {0xb0b, &GctFormatTranslateV35::blockToGctInternEtSumsAndJetCluster},  // Leaf3JetPosEtaU1: JF3 Output
0457     {0xb0c, &GctFormatTranslateV35::blockToFibres},                        // Leaf3JetPosEtaU1: JF3 Raw Input
0458     {0xb80, &GctFormatTranslateV35::blockDoNothing},                       // Leaf3JetPosEtaU2: Eta0 Input
0459     {0xb84, &GctFormatTranslateV35::blockToFibres},                        // Leaf3JetPosEtaU2: Eta0 Raw Input
0460     {0xb88, &GctFormatTranslateV35::blockToRctCaloRegions},                // Leaf3JetPosEtaU2: JF1 Input
0461     {0xb89, &GctFormatTranslateV35::blockToGctJetPreCluster},              // Leaf3JetPosEtaU2: JF1 Shared Received
0462     {0xb8a, &GctFormatTranslateV35::blockToGctJetPreCluster},              // Leaf3JetPosEtaU2: JF1 Shared Sent
0463     {0xb8b, &GctFormatTranslateV35::blockToGctInternEtSumsAndJetCluster},  // Leaf3JetPosEtaU2: JF1 Output
0464     {0xb8c, &GctFormatTranslateV35::blockToFibres},                        // Leaf3JetPosEtaU2: JF1 Raw Input
0465     // Jet Leaf FPGAs - Negative Eta
0466     {0xd00, &GctFormatTranslateV35::blockToRctCaloRegions},                // Leaf1JetNegEtaU1: JF2 Input
0467     {0xd01, &GctFormatTranslateV35::blockToGctJetPreCluster},              // Leaf1JetNegEtaU1: JF2 Shared Received
0468     {0xd02, &GctFormatTranslateV35::blockToGctJetPreCluster},              // Leaf1JetNegEtaU1: JF2 Shared Sent
0469     {0xd03, &GctFormatTranslateV35::blockToGctInternEtSumsAndJetCluster},  // Leaf1JetNegEtaU1: JF2 Output
0470     {0xd04, &GctFormatTranslateV35::blockToFibres},                        // Leaf1JetNegEtaU1: JF2 Raw Input
0471     {0xd08, &GctFormatTranslateV35::blockToRctCaloRegions},                // Leaf1JetNegEtaU1: JF3 Input
0472     {0xd09, &GctFormatTranslateV35::blockToGctJetPreCluster},              // Leaf1JetNegEtaU1: JF3 Shared Received
0473     {0xd0a, &GctFormatTranslateV35::blockToGctJetPreCluster},              // Leaf1JetNegEtaU1: JF3 Shared Sent
0474     {0xd0b, &GctFormatTranslateV35::blockToGctInternEtSumsAndJetCluster},  // Leaf1JetNegEtaU1: JF3 Output
0475     {0xd0c, &GctFormatTranslateV35::blockToFibres},                        // Leaf1JetNegEtaU1: JF3 Raw Input
0476     {0xd80, &GctFormatTranslateV35::blockDoNothing},                       // Leaf1JetNegEtaU2: Eta0 Input
0477     {0xd84, &GctFormatTranslateV35::blockToFibres},                        // Leaf1JetNegEtaU2: Eta0 Raw Input
0478     {0xd88, &GctFormatTranslateV35::blockToRctCaloRegions},                // Leaf1JetNegEtaU2: JF1 Input
0479     {0xd89, &GctFormatTranslateV35::blockToGctJetPreCluster},              // Leaf1JetNegEtaU2: JF1 Shared Received
0480     {0xd8a, &GctFormatTranslateV35::blockToGctJetPreCluster},              // Leaf1JetNegEtaU2: JF1 Shared Sent
0481     {0xd8b, &GctFormatTranslateV35::blockToGctInternEtSumsAndJetCluster},  // Leaf1JetNegEtaU2: JF1 Output
0482     {0xd8c, &GctFormatTranslateV35::blockToFibres},                        // Leaf1JetNegEtaU2: JF1 Raw Input
0483     {0xe00, &GctFormatTranslateV35::blockToRctCaloRegions},                // Leaf2JetNegEtaU1: JF2 Input
0484     {0xe01, &GctFormatTranslateV35::blockToGctJetPreCluster},              // Leaf2JetNegEtaU1: JF2 Shared Received
0485     {0xe02, &GctFormatTranslateV35::blockToGctJetPreCluster},              // Leaf2JetNegEtaU1: JF2 Shared Sent
0486     {0xe03, &GctFormatTranslateV35::blockToGctInternEtSumsAndJetCluster},  // Leaf2JetNegEtaU1: JF2 Output
0487     {0xe04, &GctFormatTranslateV35::blockToFibres},                        // Leaf2JetNegEtaU1: JF2 Raw Input
0488     {0xe08, &GctFormatTranslateV35::blockToRctCaloRegions},                // Leaf2JetNegEtaU1: JF3 Input
0489     {0xe09, &GctFormatTranslateV35::blockToGctJetPreCluster},              // Leaf2JetNegEtaU1: JF3 Shared Received
0490     {0xe0a, &GctFormatTranslateV35::blockToGctJetPreCluster},              // Leaf2JetNegEtaU1: JF3 Shared Sent
0491     {0xe0b, &GctFormatTranslateV35::blockToGctInternEtSumsAndJetCluster},  // Leaf2JetNegEtaU1: JF3 Output
0492     {0xe0c, &GctFormatTranslateV35::blockToFibres},                        // Leaf2JetNegEtaU1: JF3 Raw Input
0493     {0xe80, &GctFormatTranslateV35::blockDoNothing},                       // Leaf2JetNegEtaU2: Eta0 Input
0494     {0xe84, &GctFormatTranslateV35::blockToFibres},                        // Leaf2JetNegEtaU2: Eta0 Raw Input
0495     {0xe88, &GctFormatTranslateV35::blockToRctCaloRegions},                // Leaf2JetNegEtaU2: JF1 Input
0496     {0xe89, &GctFormatTranslateV35::blockToGctJetPreCluster},              // Leaf2JetNegEtaU2: JF1 Shared Received
0497     {0xe8a, &GctFormatTranslateV35::blockToGctJetPreCluster},              // Leaf2JetNegEtaU2: JF1 Shared Sent
0498     {0xe8b, &GctFormatTranslateV35::blockToGctInternEtSumsAndJetCluster},  // Leaf2JetNegEtaU2: JF1 Output
0499     {0xe8c, &GctFormatTranslateV35::blockToFibres},                        // Leaf2JetNegEtaU2: JF1 Raw Input
0500     {0xf00, &GctFormatTranslateV35::blockToRctCaloRegions},                // Leaf3JetNegEtaU1: JF2 Input
0501     {0xf01, &GctFormatTranslateV35::blockToGctJetPreCluster},              // Leaf3JetNegEtaU1: JF2 Shared Received
0502     {0xf02, &GctFormatTranslateV35::blockToGctJetPreCluster},              // Leaf3JetNegEtaU1: JF2 Shared Sent
0503     {0xf03, &GctFormatTranslateV35::blockToGctInternEtSumsAndJetCluster},  // Leaf3JetNegEtaU1: JF2 Output
0504     {0xf04, &GctFormatTranslateV35::blockToFibres},                        // Leaf3JetNegEtaU1: JF2 Raw Input
0505     {0xf08, &GctFormatTranslateV35::blockToRctCaloRegions},                // Leaf3JetNegEtaU1: JF3 Input
0506     {0xf09, &GctFormatTranslateV35::blockToGctJetPreCluster},              // Leaf3JetNegEtaU1: JF3 Shared Received
0507     {0xf0a, &GctFormatTranslateV35::blockToGctJetPreCluster},              // Leaf3JetNegEtaU1: JF3 Shared Sent
0508     {0xf0b, &GctFormatTranslateV35::blockToGctInternEtSumsAndJetCluster},  // Leaf3JetNegEtaU1: JF3 Output
0509     {0xf0c, &GctFormatTranslateV35::blockToFibres},                        // Leaf3JetNegEtaU1: JF3 Raw Input
0510     {0xf80, &GctFormatTranslateV35::blockDoNothing},                       // Leaf3JetNegEtaU2: Eta0 Input
0511     {0xf84, &GctFormatTranslateV35::blockToFibres},                        // Leaf3JetNegEtaU2: Eta0 Raw Input
0512     {0xf88, &GctFormatTranslateV35::blockToRctCaloRegions},                // Leaf3JetNegEtaU2: JF1 Input
0513     {0xf89, &GctFormatTranslateV35::blockToGctJetPreCluster},              // Leaf3JetNegEtaU2: JF1 Shared Received
0514     {0xf8a, &GctFormatTranslateV35::blockToGctJetPreCluster},              // Leaf3JetNegEtaU2: JF1 Shared Sent
0515     {0xf8b, &GctFormatTranslateV35::blockToGctInternEtSumsAndJetCluster},  // Leaf3JetNegEtaU2: JF1 Output
0516     {0xf8c, &GctFormatTranslateV35::blockToFibres}                         // Leaf3JetNegEtaU2: JF1 Raw Input
0517 };
0518 
0519 /*** Setup RCT Em Crate Map ***/
0520 const GctFormatTranslateV35::BlkToRctCrateMap GctFormatTranslateV35::m_rctEmCrate = {
0521     {0x804, 13}, {0x884, 9}, {0xc04, 4}, {0xc84, 0}};
0522 
0523 /*** Setup RCT jet crate map. ***/
0524 const GctFormatTranslateV35::BlkToRctCrateMap GctFormatTranslateV35::m_rctJetCrate = {
0525     {0x900, 9},   // PosEta Leaf 1 JF2
0526     {0x908, 10},  // PosEta Leaf 1 JF3
0527     {0x988, 17},  // PosEta Leaf 1 JF1
0528     {0xa00, 12},  // PosEta Leaf 2 JF2
0529     {0xa08, 13},  // PosEta Leaf 2 JF3
0530     {0xa88, 11},  // PosEta Leaf 2 JF1
0531     {0xb00, 15},  // PosEta Leaf 3 JF2
0532     {0xb08, 16},  // PosEta Leaf 3 JF3
0533     {0xb88, 14},  // PosEta Leaf 3 JF1
0534     {0xd00, 0},   // NegEta Leaf 1 JF2
0535     {0xd08, 1},   // NegEta Leaf 1 JF3
0536     {0xd88, 8},   // NegEta Leaf 1 JF1
0537     {0xe00, 3},   // NegEta Leaf 2 JF2
0538     {0xe08, 4},   // NegEta Leaf 2 JF3
0539     {0xe88, 2},   // NegEta Leaf 2 JF1
0540     {0xf00, 6},   // NegEta Leaf 3 JF2
0541     {0xf08, 7},   // NegEta Leaf 3 JF3
0542     {0xf88, 5}    // NegEta Leaf 3 JF1
0543 };
0544 
0545 /*** Setup Block ID map for pipeline payload positions of isolated Internal EM Cands. ***/
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 // PUBLIC METHODS
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   // Turn the four 8-bit header words into the full 32-bit header.
0566   uint32_t hdr = data[0] + (data[1] << 8) + (data[2] << 16) + (data[3] << 24);
0567 
0568   //  Bit mapping of V35 header:
0569   //  --------------------------
0570   //  11:0   => block_id  Unique pipeline identifier.
0571   //   - 3:0    =>> pipe_id There can be up to 16 different pipelines per FPGA.
0572   //   - 6:4    =>> reserved  Do not use yet. Set to zero.
0573   //   - 11:7   =>> fpga geograpical add  The VME geographical address of the FPGA.
0574   //  15:12  => event_id  Determined locally.  Not reset by Resync.
0575   //  19:16  => number_of_time_samples  If time samples 15 or more then value = 15.
0576   //  31:20  => event_bcid  The bunch crossing the data was recorded.
0577 
0578   unsigned blockId = hdr & 0xfff;
0579   unsigned blockLength = 0;  // Set to zero until we know it's a valid block
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 // conversion
0593 bool GctFormatTranslateV35::convertBlock(const unsigned char* data, const GctBlockHeader& hdr) {
0594   // if the block has no time samples, don't bother with it.
0595   if (hdr.nSamples() < 1) {
0596     return true;
0597   }
0598 
0599   if (!checkBlock(hdr)) {
0600     return false;
0601   }  // Check the block to see if it's possible to unpack.
0602 
0603   // The header validity check above will protect against
0604   // the map::find() method returning the end of the map,
0605   // assuming the block header definitions are up-to-date.
0606   (this->*m_blockUnpackFn.find(hdr.blockId())->second)(data,
0607                                                        hdr);  // Calls the correct unpack function, based on block ID.
0608 
0609   return true;
0610 }
0611 
0612 // PROTECTED METHODS
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   //  Bit mapping of V35 header:
0619   //  --------------------------
0620   //  11:0   => block_id  Unique pipeline identifier.
0621   //   - 3:0    =>> pipe_id There can be up to 16 different pipelines per FPGA.
0622   //   - 6:4    =>> reserved  Do not use yet. Set to zero.
0623   //   - 11:7   =>> fpga geograpical add  The VME geographical address of the FPGA.
0624   //  15:12  => event_id  Determined locally.  Not reset by Resync.
0625   //  19:16  => number_of_time_samples  If time samples 15 or more then value = 15.
0626   //  31:20  => event_bxId  The bunch crossing the data was recorded.
0627 
0628   return ((bxId & 0xfff) << 20) | ((nSamples & 0xf) << 16) | ((eventId & 0xf) << 12) | (blockId & 0xfff);
0629 }
0630 
0631 // PRIVATE METHODS
0632 
0633 // Output EM Candidates unpacking
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   // Re-interpret pointer.  p16 will be pointing at the 16 bit word that
0639   // contains the rank0 non-isolated electron of the zeroth time-sample.
0640   const uint16_t* p16 = reinterpret_cast<const uint16_t*>(d);
0641 
0642   // UNPACK EM CANDS
0643 
0644   const unsigned int emCandCategoryOffset =
0645       nSamples * 4;  // Offset to jump from the non-iso electrons to the isolated ones.
0646   const unsigned int timeSampleOffset = nSamples * 2;  // Offset to jump to next candidate pair in the same time-sample.
0647 
0648   unsigned int samplesToUnpack = 1;
0649   if (!hltMode()) {
0650     samplesToUnpack = nSamples;
0651   }  // Only if not running in HLT mode do we want more than 1 timesample.
0652 
0653   for (unsigned int iso = 0; iso < 2; ++iso)  // loop over non-iso/iso candidate pairs
0654   {
0655     bool isoFlag = (iso == 1);
0656 
0657     // Get the correct collection to put them in.
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)  // loop over time samples
0666     {
0667       // cand0Offset will give the offset on p16 to get the rank 0 candidate
0668       // of the correct category and timesample.
0669       const unsigned int cand0Offset = iso * emCandCategoryOffset + bx * 2;
0670 
0671       em->push_back(L1GctEmCand(p16[cand0Offset], isoFlag, id, 0, bx));                         // rank0 electron
0672       em->push_back(L1GctEmCand(p16[cand0Offset + timeSampleOffset], isoFlag, id, 1, bx));      // rank1 electron
0673       em->push_back(L1GctEmCand(p16[cand0Offset + 1], isoFlag, id, 2, bx));                     // rank2 electron
0674       em->push_back(L1GctEmCand(p16[cand0Offset + timeSampleOffset + 1], isoFlag, id, 3, bx));  // rank3 electron
0675     }
0676   }
0677 
0678   p16 += emCandCategoryOffset * 2;  // Move the pointer over the data we've already unpacked.
0679 
0680   // UNPACK ENERGY SUMS
0681   // NOTE: we are only unpacking one timesample of these currently!
0682 
0683   colls()->gctEtTot()->push_back(L1GctEtTotal(p16[0]));  // Et total (timesample 0).
0684   colls()->gctEtHad()->push_back(L1GctEtHad(p16[1]));    // Et hadronic (timesample 0).
0685 
0686   // 32-bit pointer for getting Missing Et.
0687   const uint32_t* p32 = reinterpret_cast<const uint32_t*>(p16);
0688 
0689   colls()->gctEtMiss()->push_back(L1GctEtMiss(p32[nSamples]));  // Et Miss (timesample 0).
0690 }
0691 
0692 void GctFormatTranslateV35::blockToGctJetCandsAndCounts(const unsigned char* d, const GctBlockHeader& hdr) {
0693   const unsigned int id = hdr.blockId();         // Capture block ID.
0694   const unsigned int nSamples = hdr.nSamples();  // Number of time-samples.
0695 
0696   // Re-interpret block payload pointer to 16 bits so it sees one candidate at a time.
0697   // p16 points to the start of the block payload, at the rank0 tau jet candidate.
0698   const uint16_t* p16 = reinterpret_cast<const uint16_t*>(d);
0699 
0700   // UNPACK JET CANDS
0701 
0702   const unsigned int jetCandCategoryOffset = nSamples * 4;  // Offset to jump from one jet category to the next.
0703   const unsigned int timeSampleOffset = nSamples * 2;  // Offset to jump to next candidate pair in the same time-sample.
0704 
0705   unsigned int samplesToUnpack = 1;
0706   if (!hltMode()) {
0707     samplesToUnpack = nSamples;
0708   }  // Only if not running in HLT mode do we want more than 1 timesample.
0709 
0710   // Loop over the different catagories of jets
0711   for (unsigned int iCat = 0; iCat < NUM_JET_CATEGORIES; ++iCat) {
0712     L1GctJetCandCollection* const jets = gctJets(iCat);
0713     assert(jets->empty());  // The supplied vector should be empty.
0714 
0715     bool tauflag = (iCat == TAU_JETS);
0716     bool forwardFlag = (iCat == FORWARD_JETS);
0717 
0718     // Loop over the different timesamples (bunch crossings).
0719     for (unsigned int bx = 0; bx < samplesToUnpack; ++bx) {
0720       // cand0Offset will give the offset on p16 to get the rank 0 Jet Cand of the correct category and timesample.
0721       const unsigned int cand0Offset = iCat * jetCandCategoryOffset + bx * 2;
0722 
0723       // Rank 0 Jet.
0724       jets->push_back(L1GctJetCand(p16[cand0Offset], tauflag, forwardFlag, id, 0, bx));
0725       // Rank 1 Jet.
0726       jets->push_back(L1GctJetCand(p16[cand0Offset + timeSampleOffset], tauflag, forwardFlag, id, 1, bx));
0727       // Rank 2 Jet.
0728       jets->push_back(L1GctJetCand(p16[cand0Offset + 1], tauflag, forwardFlag, id, 2, bx));
0729       // Rank 3 Jet.
0730       jets->push_back(L1GctJetCand(p16[cand0Offset + timeSampleOffset + 1], tauflag, forwardFlag, id, 3, bx));
0731     }
0732   }
0733 
0734   p16 += NUM_JET_CATEGORIES * jetCandCategoryOffset;  // Move the pointer over the data we've already unpacked.
0735 
0736   // NOW UNPACK: HFBitCounts, HFRingEtSums (no Missing Ht yet)
0737   // NOTE: we are only unpacking one timesample of these currently!
0738 
0739   // Re-interpret block payload pointer to 32 bits so it sees six jet counts at a time.
0740   const uint32_t* p32 = reinterpret_cast<const uint32_t*>(p16);
0741 
0742   // Channel 0 carries both HF counts and sums
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   // Skip channel 1 for now. Later this may carry MHT would be accessed as p32[nSamples]
0746 }
0747 
0748 // Internal EM Candidates unpacking
0749 void GctFormatTranslateV35::blockToGctInternEmCand(const unsigned char* d, const GctBlockHeader& hdr) {
0750   // Don't want to do this in HLT optimisation mode!
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   // Debug assertion to prevent problems if definitions not up to date.
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   // Re-interpret pointer to 16 bits so it sees one candidate at a time.
0768   const uint16_t* p = reinterpret_cast<const uint16_t*>(d);
0769 
0770   // Loop over timesamples (i.e. bunch crossings)
0771   for (unsigned int bx = 0; bx < nSamples; ++bx) {
0772     // Loop over candidate pairs (i.e. each iteration unpacks a pair of candidates)
0773     for (unsigned int candPair = 0; candPair < numCandPairs; ++candPair) {
0774       // Is the candidate electron pair an isolated pair or not?
0775       bool iso = ((candPair >= lowerIsoPairBound) && (candPair <= upperIsoPairBound));
0776 
0777       // Loop over the two electron candidates in each pair
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 // Input EM Candidates unpacking
0788 // this is the last time I deal the RCT bit assignment travesty!!!
0789 void GctFormatTranslateV35::blockToRctEmCand(const unsigned char* d, const GctBlockHeader& hdr) {
0790   // Don't want to do this in HLT optimisation mode!
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   // re-interpret pointer
0801   const uint16_t* p = reinterpret_cast<const uint16_t*>(d);
0802 
0803   // arrays of source card data
0804   uint16_t sfp[2][4];  // [ cycle ] [ SFP ]
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   // loop over crates
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     // read SC SFP words
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         }       // muon bits
0826         else {  // EM candidate
0827           sfp[cyc][iSfp] = *p;
0828           ++p;
0829         }
0830       }
0831       p = p + 2 * (nSamples - 1);
0832     }
0833 
0834     // fill SC arrays
0835     srcCardRouting().SFPtoEMU(eIsoRank, eIsoCard, eIsoRgn, eNonIsoRank, eNonIsoCard, eNonIsoRgn, MIPbits, QBits, sfp);
0836 
0837     // create EM cands
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 // Input RCT region unpacking
0848 void GctFormatTranslateV35::blockToRctCaloRegions(const unsigned char* d, const GctBlockHeader& hdr) {
0849   // Don't want to do this in HLT optimisation mode!
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   // Debug assertion to prevent problems if definitions not up to date.
0860   auto found = rctJetCrateMap().find(id);
0861   assert(found != rctJetCrateMap().end());
0862 
0863   // get crate (need this to get ieta and iphi)
0864   unsigned int crate = found->second;
0865 
0866   // re-interpret pointer
0867   const uint16_t* p = reinterpret_cast<const uint16_t*>(d);
0868 
0869   // eta and phi
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) {  // negative eta
0877           ieta = 11 - i;
0878           iphi = 2 * ((11 - crate) % 9);
0879         } else {  // positive eta
0880           ieta = 10 + i;
0881           iphi = 2 * ((20 - crate) % 9);
0882         }
0883         // First region is phi=0
0884         colls()->rctCalo()->push_back(L1CaloRegion::makeRegionFromUnpacker(*p, ieta, iphi, id, i, bx));
0885         ++p;
0886         // Second region is phi=1
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 {  // Skip the first two regions which are duplicates.
0895         ++p;
0896         ++p;
0897       }
0898     }
0899   }
0900 }
0901 
0902 // Fibre unpacking
0903 void GctFormatTranslateV35::blockToFibres(const unsigned char* d, const GctBlockHeader& hdr) {
0904   // Don't want to do this in HLT optimisation mode!
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   // re-interpret pointer
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   // Don't want to do this in HLT optimisation mode!
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   // Re-interpret pointer to 32 bits
0943   const uint32_t* p = reinterpret_cast<const uint32_t*>(d);
0944 
0945   for (unsigned int i = 0; i < length; ++i) {
0946     // Loop over timesamples (i.e. bunch crossings)
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   // Don't want to do this in HLT optimisation mode!
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   // Re-interpret pointer to 32 bits
0966   const uint32_t* p = reinterpret_cast<const uint32_t*>(d);
0967 
0968   for (unsigned int i = 0; i < length; ++i) {
0969     // Loop over timesamples (i.e. bunch crossings)
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   // Don't want to do this in HLT optimisation mode!
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   // Re-interpret pointer to 16 bits so it sees one candidate at a time.
0996   const uint16_t* p = reinterpret_cast<const uint16_t*>(d);
0997 
0998   for (unsigned int i = 0; i < length; ++i) {
0999     // Loop over timesamples (i.e. bunch crossings)
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   // Don't want to do this in HLT optimisation mode!
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   // Re-interpret pointer to 16 bits so it sees one candidate at a time.
1023   const uint16_t* p = reinterpret_cast<const uint16_t*>(d);
1024 
1025   for (unsigned int i = 0; i < length; ++i) {
1026     // Loop over timesamples (i.e. bunch crossings)
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   // Don't want to do this in HLT optimisation mode!
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   // Re-interpret pointer to 16 bits so it sees one candidate at a time.
1050   const uint16_t* p = reinterpret_cast<const uint16_t*>(d);
1051 
1052   for (unsigned int i = 0; i < length; ++i) {
1053     // Loop over timesamples (i.e. bunch crossings)
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   // Don't want to do this in HLT optimisation mode!
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   // Re-interpret pointer to 32 bits
1077   const uint32_t* p = reinterpret_cast<const uint32_t*>(d);
1078 
1079   for (unsigned int i = 0; i < length / 2; ++i) {
1080     // Loop over timesamples (i.e. bunch crossings)
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   // Don't want to do this in HLT optimisation mode!
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   // Re-interpret pointer to 32 bits
1104   const uint32_t* p = reinterpret_cast<const uint32_t*>(d);
1105 
1106   for (unsigned int i = 0; i < length; ++i) {
1107     // Loop over timesamples (i.e. bunch crossings)
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   // Don't want to do this in HLT optimisation mode!
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   // Re-interpret pointer to 32 bits
1136   const uint32_t* p = reinterpret_cast<const uint32_t*>(d);
1137 
1138   for (unsigned int i = 0; i < length; ++i) {
1139     // Loop over timesamples (i.e. bunch crossings)
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 }