CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Phase2TrackerFEDRawChannelUnpacker.h
Go to the documentation of this file.
1 #ifndef EventFilter_Phase2TrackerRawToDigi_Phase2TrackerPhase2TrackerFEDRawChannelUnpacker_H // {
2 #define EventFilter_Phase2TrackerRawToDigi_Phase2TrackerPhase2TrackerFEDRawChannelUnpacker_H
3 
7 #include <stdint.h>
8 
9 namespace Phase2Tracker {
10 
11  // unpacker for RAW CBC data
12  // each bit of the channel is related to one strip
14  {
15  public:
17  uint8_t stripIndex() const { return currentStrip_; }
18  bool stripOn() const { return bool((currentWord_>>bitInWord_)&0x1); }
19  bool hasData() const { return valuesLeft_; }
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  {
39  }
40 
42  {
43  bitInWord_++;
44  currentStrip_++;
45  if (bitInWord_ > 7) {
46  bitInWord_ = 0;
49  }
50  valuesLeft_--;
51  return (*this);
52  }
53 
55  {
56  ++(*this); return *this;
57  }
58 
59 } // end of Phase2Tracker namespace
60 
61 #endif // } end def EventFilter_Phase2TrackerRawToDigi_Phase2TrackerPhase2TrackerFEDRawChannelUnpacker_H
62 
Phase2TrackerFEDRawChannelUnpacker(const Phase2TrackerFEDChannel &channel)
static const int STRIPS_PADDING
Definition: utils.h:27