CMS 3D CMS Logo

Phase2TrackerFEDBuffer.h
Go to the documentation of this file.
1 #ifndef EventFilter_Phase2TrackerRawToDigi_Phase2TrackerPhase2TrackerFEDBuffer_H // {
2 #define EventFilter_Phase2TrackerRawToDigi_Phase2TrackerPhase2TrackerFEDBuffer_H
3 
8 #include <cstdint>
9 #include <vector>
10 #include <map>
11 
12 namespace Phase2Tracker {
13 
15  public:
16  // gets data of one tracker FED to check, analyze and sort it
17  Phase2TrackerFEDBuffer(const uint8_t* fedBuffer, const size_t fedBufferSize);
19 
20  //dump buffer to stream
21  void dump(std::ostream& os) const { printHex(buffer_, bufferSize_, os); }
22 
23  //methods to get parts of the buffer
24  FEDDAQHeader daqHeader() const { return daqHeader_; }
25  FEDDAQTrailer daqTrailer() const { return daqTrailer_; }
26  size_t bufferSize() const { return bufferSize_; }
28  const Phase2TrackerFEDChannel& channel(const uint8_t internalPhase2TrackerFEDChannelNum) const {
29  return channels_[internalPhase2TrackerFEDChannelNum];
30  }
31  std::map<uint32_t, uint32_t> conditionData() const;
32 
33  //methods to get info from DAQ header from FEDDAQHeader class
35  uint32_t daqLvl1ID() const { return daqHeader_.l1ID(); }
36  uint16_t daqBXID() const { return daqHeader_.bxID(); }
37  uint16_t daqSourceID() const { return daqHeader_.sourceID(); }
38 
39  //methods to get info from DAQ trailer from FEDDAQTrailer class
41  uint32_t daqEventLengthInBytes() const { return daqTrailer_.eventLengthInBytes(); }
42  uint16_t daqCRC() const { return daqTrailer_.crc(); }
43  FEDTTSBits daqTTSState() const { return daqTrailer_.ttsBits(); }
44 
45  //methods to get info from the tracker header using Phase2TrackerFEDHeader class
47  inline const uint8_t* getPointerToPayload() const { return trackerHeader_.getPointerToData(); }
48  inline const uint8_t* getPointerToCondData() const { return condDataPointer_; }
49  inline const uint8_t* getPointerToTriggerData() const { return triggerPointer_; }
50 
51  private:
52  const uint8_t* buffer_;
53  const size_t bufferSize_;
54  std::vector<Phase2TrackerFEDChannel> channels_;
58  const uint8_t* payloadPointer_;
59  const uint8_t* condDataPointer_;
60  const uint8_t* triggerPointer_;
61  void findChannels();
62 
64  public:
65  // check methods
66  inline bool doChecks() const { return true; } // FEDBuffer
67  inline bool checkNoFEOverflows() const { return true; } // FEDBufferBase
68  inline bool doCorruptBufferChecks() const { return true; } // FEDBuffer
69 
70  }; // end of FEDBuffer class
71 
72 } // namespace Phase2Tracker
73 
74 #endif // } end def EventFilter_Phase2TrackerRawToDigi_Phase2TrackerPhase2TrackerFEDBuffer_H
FEDReadoutMode
Definition: utils.h:96
std::vector< Phase2TrackerFEDChannel > channels_
const Phase2TrackerFEDChannel & channel(const uint8_t internalPhase2TrackerFEDChannelNum) const
Phase2TrackerFEDHeader trackerHeader() const
Phase2TrackerFEDBuffer(const uint8_t *fedBuffer, const size_t fedBufferSize)
void printHex(const void *pointer, const size_t lengthInBytes, std::ostream &os)
Definition: utils.h:59
std::map< uint32_t, uint32_t > conditionData() const