CMS 3D CMS Logo

Phase2TrackerFEDRawChannelUnpacker.h
Go to the documentation of this file.
1 #ifndef EventFilter_Phase2TrackerRawToDigi_Phase2TrackerPhase2TrackerFEDRawChannelUnpacker_H // {
2 #define EventFilter_Phase2TrackerRawToDigi_Phase2TrackerPhase2TrackerFEDRawChannelUnpacker_H
3 
7 #include <cstdint>
8 
9 namespace Phase2Tracker {
10 
11  // unpacker for RAW CBC data
12  // each bit of the channel is related to one strip
14  public:
16  uint8_t stripIndex() const { return currentStrip_; }
17  bool stripOn() const { return bool((currentWord_ >> bitInWord_) & 0x1); }
18  bool hasData() const { return valuesLeft_; }
21 
22  private:
23  const uint8_t* data_;
24  uint8_t currentOffset_;
25  uint8_t currentStrip_;
26  uint16_t valuesLeft_;
27  uint8_t currentWord_;
28  uint8_t bitInWord_;
29  }; // end of Phase2TrackerFEDRawChannelUnpacker
30 
32  : data_(channel.data()),
33  currentOffset_(channel.offset()),
34  currentStrip_(0),
35  valuesLeft_((channel.length()) * 8 - STRIPS_PADDING),
36  currentWord_(channel.data()[currentOffset_ ^ 7]),
37  bitInWord_(0) {}
38 
40  bitInWord_++;
41  currentStrip_++;
42  if (bitInWord_ > 7) {
43  bitInWord_ = 0;
46  }
47  valuesLeft_--;
48  return (*this);
49  }
50 
52  ++(*this);
53  return *this;
54  }
55 
56 } // namespace Phase2Tracker
57 
58 #endif // } end def EventFilter_Phase2TrackerRawToDigi_Phase2TrackerPhase2TrackerFEDRawChannelUnpacker_H
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
Phase2TrackerFEDRawChannelUnpacker(const Phase2TrackerFEDChannel &channel)
static const int STRIPS_PADDING
Definition: utils.h:27