Skip to content

Commit

Permalink
Merge pull request cms-sw#76 from yulunmiao/hgcal-condformat-HGCalNAN…
Browse files Browse the repository at this point in the history
…O-13_2_0_pre3

[Dense Map] first version of the DenseMapTool class
  • Loading branch information
pfs authored Oct 7, 2023
2 parents ed176c4 + b3f25ad commit 6e61707
Show file tree
Hide file tree
Showing 4 changed files with 467 additions and 243 deletions.
41 changes: 24 additions & 17 deletions EventFilter/HGCalRawToDigi/interface/HGCalUnpacker.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,18 @@
#include <vector>

struct HGCalUnpackerConfig {
uint32_t sLinkBOE{0x2a}; ///< S-Link BOE pattern
uint32_t cbHeaderMarker{0x5f}; ///< Capture block reserved pattern for a new event
uint32_t econdHeaderMarker{0x154}; ///< ECON-D header Marker pattern for a new event
uint32_t sLinkCaptureBlockMax{10}; ///< maximum number of capture blocks in one S-Link
uint32_t captureBlockECONDMax{12}; ///< maximum number of ECON-Ds in one capture block
uint32_t econdERXMax{12}; ///< maximum number of eRxs in one ECON-D
uint32_t erxChannelMax{37}; ///< maximum number of channels in one eRx
uint32_t payloadLengthMax{469}; ///< maximum length of payload length
uint32_t channelMax{7000000}; ///< maximum number of channels unpacked
uint32_t commonModeMax{4000000}; ///< maximum number of common modes unpacked
bool applyFWworkaround{false}; ///this flag is used to deal with some firmware features
uint32_t sLinkBOE{0x2a}; ///< S-Link BOE pattern
uint32_t cbHeaderMarker{0x5f}; ///< Capture block reserved pattern for a new event
uint32_t econdHeaderMarker{0x154}; ///< ECON-D header Marker pattern for a new event
uint32_t maxFEDsPerEndcap{512}; ///< maximum number of FEDs on one side
uint32_t sLinkCaptureBlockMax{10}; ///< maximum number of capture blocks in one S-Link
uint32_t captureBlockECONDMax{12}; ///< maximum number of ECON-Ds in one capture block
uint32_t econdERXMax{12}; ///< maximum number of eRxs in one ECON-D
uint32_t erxChannelMax{37}; ///< maximum number of channels in one eRx
uint32_t payloadLengthMax{469}; ///< maximum length of payload length
uint32_t channelMax{7000000}; ///< maximum number of channels unpacked
uint32_t commonModeMax{4000000}; ///< maximum number of common modes unpacked
bool applyFWworkaround{false}; ///this flag is used to deal with some firmware features
};

/// This class is designed to unpack raw data from HGCal, formatted as S-Links, capture blocks, and ECON-Ds, to HGCROC channel data.
Expand Down Expand Up @@ -90,6 +91,13 @@ class HGCalUnpacker {
const std::function<uint16_t(uint16_t sLink, uint8_t captureBlock, uint8_t econd)>& enabledERXMapping,
const std::function<uint16_t(uint16_t fedid)>& fed2slink);

/// parse input in S-Link format, only parsing ECON-D header and get flagged ECON-Ds
/// \param[in] inputArray input as 32-bits words vector.
/// \param[in] enabledERXMapping map from S-Link indices to enabled eRx in this ECON-D
/// \param[in] fed2slink mapping of fed ids to S-link indices
void parseSLinkHeaderOnly(const std::vector<uint32_t>& inputArray,
const std::function<uint16_t(uint16_t fedid)>& fed2slink);

/// we should think of removing this method
/// parse input in capture block format
/// \param[in] inputArray input as 32-bits words vector.
Expand All @@ -108,7 +116,7 @@ class HGCalUnpacker {
/// \return vector of HGCROCChannelDataFrame<ElecID>(ID, value) for digis
const std::vector<HGCROCChannelDataFrame<HGCalElectronicsId> >& channelData() const { return channelData_; }
/// \return vector of sum of two common modes on the half roc of the channel
const std::vector<uint16_t>& commonModeSum() const{ return commonModeSum_; }
const std::vector<uint16_t>& commonModeSum() const { return commonModeSum_; }
/// \return vector of HGCROCChannelDataFrame<ElecID>(ID, value) for common modes
const std::vector<HGCROCChannelDataFrame<HGCalElectronicsId> >& commonModeData() const { return commonModeData_; }
/// \return vector of flagged ECOND information
Expand All @@ -135,13 +143,12 @@ class HGCalUnpacker {
0b11111111111111111111111111111111};
const uint32_t erxBodyBits_[16] = {24, 16, 24, 24, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32};
HGCalUnpackerConfig config_;
size_t channelDataSize_{0}; ///< Size of unpacked channels
size_t commonModeDataSize_{0}; ///< Size of unpacked common modes
size_t channelDataSize_{0}; ///< Size of unpacked channels
size_t commonModeDataSize_{0}; ///< Size of unpacked common modes
std::vector<HGCROCChannelDataFrame<HGCalElectronicsId> > channelData_; ///< Array for unpacked channels
std::vector<uint16_t> commonModeSum_;
std::vector<HGCROCChannelDataFrame<HGCalElectronicsId> > commonModeData_; ///< Array for unpacked common modes
HGCalFlaggedECONDInfoCollection flaggedECOND_; ///< Array with flagged ECON-D information

std::vector<HGCROCChannelDataFrame<HGCalElectronicsId> > commonModeData_; ///< Array for unpacked common modes
HGCalFlaggedECONDInfoCollection flaggedECOND_; ///< Array with flagged ECON-D information
};

#endif
Loading

0 comments on commit 6e61707

Please sign in to comment.