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