File indexing completed on 2025-03-10 00:36:59
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef EventFilter_HGCalRawToDigi_HGCalUnpacker_h
0012 #define EventFilter_HGCalRawToDigi_HGCalUnpacker_h
0013
0014 #include "DataFormats/HGCalDigi/interface/HGCalRawDataDefinitions.h"
0015 #include "DataFormats/FEDRawData/interface/FEDRawData.h"
0016 #include "DataFormats/HGCalDigi/interface/HGCalDigiHost.h"
0017 #include "DataFormats/HGCalDigi/interface/HGCalECONDPacketInfoHost.h"
0018 #include "CondFormats/HGCalObjects/interface/HGCalMappingModuleIndexer.h"
0019 #include "CondFormats/HGCalObjects/interface/HGCalConfiguration.h"
0020 #include "FWCore/Utilities/interface/Exception.h"
0021 #include "EventFilter/HGCalRawToDigi/interface/UnpackerTools.h"
0022
0023 #include <cstdint>
0024 #include <functional>
0025 #include <vector>
0026
0027 class HGCalUnpacker {
0028 public:
0029 HGCalUnpacker() = default;
0030
0031
0032
0033
0034
0035 uint16_t parseFEDData(unsigned fedId,
0036 const FEDRawData& fed_data,
0037 const HGCalMappingModuleIndexer& moduleIndexer,
0038 const HGCalConfiguration& config,
0039 hgcaldigi::HGCalDigiHost& digis,
0040 hgcaldigi::HGCalECONDPacketInfoHost& econdPacketInfo,
0041 bool headerOnlyMode = false);
0042
0043 private:
0044 constexpr static uint8_t tctp_[16] = {
0045 0b00, 0b00, 0b01, 0b00, 0b00, 0b00, 0b00, 0b00, 0b10, 0b10, 0b10, 0b10, 0b11, 0b11, 0b11, 0b11};
0046
0047 constexpr static uint32_t adcm1Mask_[16] = {0b1111111111,
0048 0b0000000000,
0049 0b1111111111,
0050 0b0000000000,
0051 0b1111111111,
0052 0b1111111111,
0053 0b1111111111,
0054 0b1111111111,
0055 0b1111111111,
0056 0b1111111111,
0057 0b1111111111,
0058 0b1111111111,
0059 0b1111111111,
0060 0b1111111111,
0061 0b1111111111,
0062 0b1111111111};
0063 constexpr static uint32_t adcm1Shift_[16] = {
0064 18,
0065 28,
0066 18,
0067 0,
0068 20,
0069 20,
0070 20,
0071 20,
0072 20,
0073 20,
0074 20,
0075 20,
0076 20,
0077 20,
0078 20,
0079 20,
0080 };
0081
0082 constexpr static uint32_t adcShift_[16] = {8, 18, 8, 18, 10, 10, 10, 10, 10, 10, 10, 10, 0, 0, 0, 0};
0083 constexpr static uint32_t adcMask_[16] = {0b1111111111,
0084 0b1111111111,
0085 0b1111111111,
0086 0b1111111111,
0087 0b1111111111,
0088 0b1111111111,
0089 0b1111111111,
0090 0b1111111111,
0091 0b1111111111,
0092 0b1111111111,
0093 0b1111111111,
0094 0b1111111111,
0095 0b0000000000,
0096 0b0000000000,
0097 0b0000000000,
0098 0b0000000000};
0099
0100 constexpr static uint32_t totShift_[16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 10, 10, 10};
0101 constexpr static uint32_t totMask_[16] = {0b0000000000,
0102 0b0000000000,
0103 0b0000000000,
0104 0b0000000000,
0105 0b0000000000,
0106 0b0000000000,
0107 0b0000000000,
0108 0b0000000000,
0109 0b0000000000,
0110 0b0000000000,
0111 0b0000000000,
0112 0b0000000000,
0113 0b1111111111,
0114 0b1111111111,
0115 0b1111111111,
0116 0b1111111111};
0117
0118 constexpr static uint32_t toaShift_[16] = {0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
0119 constexpr static uint32_t toaMask_[16] = {0b0000000000,
0120 0b0000000000,
0121 0b0000000000,
0122 0b1111111111,
0123 0b1111111111,
0124 0b1111111111,
0125 0b1111111111,
0126 0b1111111111,
0127 0b1111111111,
0128 0b1111111111,
0129 0b1111111111,
0130 0b1111111111,
0131 0b1111111111,
0132 0b1111111111,
0133 0b1111111111,
0134 0b1111111111};
0135 constexpr static uint16_t flags_[16] = {hgcal::DIGI_FLAG::ZS_ToA,
0136 hgcal::DIGI_FLAG::ZS_ToA_ADCm1,
0137 hgcal::DIGI_FLAG::ZS_ToA,
0138 hgcal::DIGI_FLAG::ZS_ADCm1,
0139 hgcal::DIGI_FLAG::FULL_READOUT,
0140 hgcal::DIGI_FLAG::FULL_READOUT,
0141 hgcal::DIGI_FLAG::FULL_READOUT,
0142 hgcal::DIGI_FLAG::FULL_READOUT,
0143 hgcal::DIGI_FLAG::Invalid,
0144 hgcal::DIGI_FLAG::Invalid,
0145 hgcal::DIGI_FLAG::Invalid,
0146 hgcal::DIGI_FLAG::Invalid,
0147 hgcal::DIGI_FLAG::FULL_READOUT,
0148 hgcal::DIGI_FLAG::FULL_READOUT,
0149 hgcal::DIGI_FLAG::FULL_READOUT,
0150 hgcal::DIGI_FLAG::FULL_READOUT};
0151 constexpr static uint32_t erxBodyBits_[16] = {24, 16, 24, 24, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32};
0152 };
0153
0154 #endif