CMS 3D CMS Logo

HGCalUnpacker.h
Go to the documentation of this file.
1 /****************************************************************************
2  *
3  * This is a part of HGCAL offline software.
4  * Authors:
5  * Yulun Miao, Northwestern University
6  * Huilin Qu, CERN
7  * Laurent Forthomme, CERN
8  *
9  ****************************************************************************/
10 
11 #ifndef EventFilter_HGCalRawToDigi_HGCalUnpacker_h
12 #define EventFilter_HGCalRawToDigi_HGCalUnpacker_h
13 
16 
17 #include <cstdint>
18 #include <functional>
19 #include <vector>
20 
22  uint32_t sLinkBOE{0x0};
23  uint32_t captureBlockReserved{0x3f};
24  uint32_t econdHeaderMarker{0x154};
25  uint32_t sLinkCaptureBlockMax{10};
26  uint32_t captureBlockECONDMax{12};
27  uint32_t econdERXMax{12};
28  uint32_t erxChannelMax{37};
29  uint32_t payloadLengthMax{469};
30  uint32_t channelMax{7000000};
31  uint32_t commonModeMax{4000000};
32 };
33 
35 template <class D>
37 public:
40  };
42  kSLinkBOEMask = 0b11111111,
43  };
46  };
50  };
55  kHTShift = 10,
56  kEBOShift = 8,
59  };
61  kHeaderMask = 0b111111111,
62  kPayloadLengthMask = 0b111111111,
64  kHTMask = 0b11,
65  kEBOMask = 0b11,
68  };
73  };
76  kCommonmode0Mask = 0b1111111111,
77  kCommonmode1Mask = 0b1111111111,
78  };
79 
81 
86  void parseSLink(const std::vector<uint32_t>& inputArray,
87  const std::function<uint16_t(uint16_t sLink, uint8_t captureBlock, uint8_t econd)>& enabledERXMapping,
88  const std::function<D(HGCalElectronicsId elecID)>& logicalMapping);
93  void parseCaptureBlock(
94  const std::vector<uint32_t>& inputArray,
95  const std::function<uint16_t(uint16_t sLink, uint8_t captureBlock, uint8_t econd)>& enabledERXMapping,
96  const std::function<D(HGCalElectronicsId elecID)>& logicalMapping);
101  void parseECOND(const std::vector<uint32_t>& inputArray,
102  const std::function<uint16_t(uint16_t sLink, uint8_t captureBlock, uint8_t econd)>& enabledERXMapping,
103  const std::function<D(HGCalElectronicsId elecID)>& logicalMapping);
104 
106  const std::vector<HGCROCChannelDataFrame<D> >& channelData() const { return channelData_; }
108  const std::vector<uint32_t>& commonModeIndex() const { return commonModeIndex_; }
110  const std::vector<uint16_t>& commonModeData() const { return commonModeData_; }
111  const std::vector<uint32_t>& badECOND() const { return badECOND_; }
112 
113 private:
114  const uint32_t erxBodyLeftShift_[16] = {2, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
115  const uint32_t erxBodyRightShift_[16] = {0, 8, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
116  const uint32_t erxBodyMask_[16] = {0b00111111111111111111110000000000,
117  0b00000000000011111111110000000000,
118  0b00111111111111111111110000000000,
119  0b00000000000011111111111111111111,
120  0b00111111111111111111111111111111,
121  0b00111111111111111111111111111111,
122  0b00111111111111111111111111111111,
123  0b00111111111111111111111111111111,
124  0b11111111111111111111111111111111,
125  0b11111111111111111111111111111111,
126  0b11111111111111111111111111111111,
127  0b11111111111111111111111111111111,
128  0b11111111111111111111111111111111,
129  0b11111111111111111111111111111111,
130  0b11111111111111111111111111111111,
131  0b11111111111111111111111111111111};
132  const uint32_t erxBodyBits_[16] = {24, 16, 24, 24, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32};
134  size_t channelDataSize_{0};
136  std::vector<HGCROCChannelDataFrame<D> > channelData_;
137  std::vector<uint32_t> commonModeIndex_;
138  std::vector<uint16_t> commonModeData_;
139  std::vector<uint32_t> badECOND_;
140 };
141 
142 #endif
const uint32_t erxBodyLeftShift_[16]
weight_default_t b1[25]
Definition: b1.h:9
const std::vector< HGCROCChannelDataFrame< D > > & channelData() const
uint32_t channelMax
maximum number of channels unpacked
Definition: HGCalUnpacker.h:30
void parseSLink(const std::vector< uint32_t > &inputArray, const std::function< uint16_t(uint16_t sLink, uint8_t captureBlock, uint8_t econd)> &enabledERXMapping, const std::function< D(HGCalElectronicsId elecID)> &logicalMapping)
const uint32_t erxBodyMask_[16]
std::vector< uint32_t > commonModeIndex_
Array for logicalMapping between unpacked channels to first common mode.
const uint32_t erxBodyRightShift_[16]
Definition: config.py:1
uint32_t sLinkCaptureBlockMax
maximum number of capture blocks in one S-Link
Definition: HGCalUnpacker.h:25
size_t channelDataSize_
Size of unpacked channels.
This class is designed to unpack raw data from HGCal, formatted as S-Links, capture blocks...
Definition: HGCalUnpacker.h:36
uint32_t erxChannelMax
maximum number of channels in one eRx
Definition: HGCalUnpacker.h:28
uint32_t payloadLengthMax
maximum length of payload length
Definition: HGCalUnpacker.h:29
uint32_t captureBlockECONDMax
maximum number of ECON-Ds in one capture block
Definition: HGCalUnpacker.h:26
uint32_t econdHeaderMarker
ECON-D header Marker pattern.
Definition: HGCalUnpacker.h:24
std::vector< HGCROCChannelDataFrame< D > > channelData_
Array for unpacked channels.
void parseECOND(const std::vector< uint32_t > &inputArray, const std::function< uint16_t(uint16_t sLink, uint8_t captureBlock, uint8_t econd)> &enabledERXMapping, const std::function< D(HGCalElectronicsId elecID)> &logicalMapping)
size_t commonModeDataSize_
Size of unpacked common modes.
wrapper for a 32b data word identifying a readout channel in the raw data The format is the following...
uint32_t econdERXMax
maximum number of eRxs in one ECON-D
Definition: HGCalUnpacker.h:27
const std::vector< uint16_t > & commonModeData() const
const std::vector< uint32_t > & badECOND() const
const std::vector< uint32_t > & commonModeIndex() const
DecomposeProduct< arg, typename Div::arg > D
Definition: Factorize.h:141
uint32_t commonModeMax
maximum number of common modes unpacked
Definition: HGCalUnpacker.h:31
uint32_t captureBlockReserved
Capture block reserved pattern.
Definition: HGCalUnpacker.h:23
HGCalUnpackerConfig config_
uint32_t sLinkBOE
S-Link BOE pattern.
Definition: HGCalUnpacker.h:22
HGCalUnpacker(HGCalUnpackerConfig config)
std::vector< uint32_t > badECOND_
Array of indices of bad ECON-Ds.
void parseCaptureBlock(const std::vector< uint32_t > &inputArray, const std::function< uint16_t(uint16_t sLink, uint8_t captureBlock, uint8_t econd)> &enabledERXMapping, const std::function< D(HGCalElectronicsId elecID)> &logicalMapping)
static const int elecID
Definition: TopGenEvent.h:18
const uint32_t erxBodyBits_[16]
std::vector< uint16_t > commonModeData_
Array for unpacked common modes.